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.
23 #include "object-curse.h"
24 #include "player-damage.h"
25 #include "player-effects.h"
26 #include "player-race.h"
27 #include "player-class.h"
30 #include "monster-status.h"
31 #include "monster-spell.h"
33 #include "spells-status.h"
34 #include "spells-diceroll.h"
35 #include "spells-summon.h"
36 #include "monsterrace-hook.h"
44 #include "player-status.h"
45 #include "player-move.h"
46 #include "realm-hex.h"
47 #include "realm-song.h"
48 #include "object-hook.h"
49 #include "object-broken.h"
50 #include "object-flavor.h"
55 #include "view-mainwindow.h"
59 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
60 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
63 int project_length = 0; /*!< 投射の射程距離 */
69 STR_OFFSET cap_nickname;
72 * @brief 歌、剣術、呪術領域情報テーブル
74 const magic_type technic_info[NUM_TECHNIC][32] =
197 * @brief 配置した鏡リストの次を取得する /
198 * Get another mirror. for SEEKER
199 * @param next_y 次の鏡のy座標を返す参照ポインタ
200 * @param next_x 次の鏡のx座標を返す参照ポインタ
201 * @param cury 現在の鏡のy座標
202 * @param curx 現在の鏡のx座標
204 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
206 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
207 int mirror_num = 0; /* 鏡の数 */
211 for (x = 0; x < current_floor_ptr->width; x++)
213 for (y = 0; y < current_floor_ptr->height; y++)
215 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
216 mirror_y[mirror_num] = y;
217 mirror_x[mirror_num] = x;
224 num = randint0(mirror_num);
225 *next_y = mirror_y[num];
226 *next_x = mirror_x[num];
229 *next_y = cury + randint0(5) - 2;
230 *next_x = curx + randint0(5) - 2;
236 * Mega-Hack -- track "affected" monsters (see "project()" comments)
238 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
239 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
240 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
241 /* Mega-Hack -- monsters target */
242 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
243 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
247 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
248 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
249 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
250 * @param y 目標Y座標 / Target y location (or location to travel "towards")
251 * @param x 目標X座標 / Target x location (or location to travel "towards")
252 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
253 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
254 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
257 * We are called both for "beam" effects and "ball" effects.
259 * The "r" parameter is the "distance from ground zero".
261 * Note that we determine if the player can "see" anything that happens
262 * by taking into account: blindness, line-of-sight, and illumination.
264 * We return "TRUE" if the effect of the projection is "obvious".
266 * We also "see" grids which are "memorized", probably a hack
268 * Perhaps we should affect doors?
271 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
273 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
274 feature_type *f_ptr = &f_info[g_ptr->feat];
276 bool obvious = FALSE;
277 bool known = player_has_los_bold(y, x);
282 /* Reduce damage by distance */
283 dam = (dam + r) / (r + 1);
286 if (have_flag(f_ptr->flags, FF_TREE))
294 message = _("枯れた", "was blasted."); break;
296 message = _("縮んだ", "shrank."); break;
298 message = _("溶けた", "melted."); break;
301 message = _("凍り、砕け散った", "was frozen and smashed."); break;
305 message = _("燃えた", "burns up!"); break;
317 message = _("粉砕された", "was crushed."); break;
319 message = NULL; break;
323 msg_format(_("木は%s。", "A tree %s"), message);
324 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
327 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
331 /* Analyze the type */
334 /* Ignore most effects */
369 /* Destroy Traps (and Locks) */
372 /* Reveal secret doors */
373 if (is_hidden_door(g_ptr))
378 /* Check line of sight */
386 if (is_trap(g_ptr->feat))
388 /* Check line of sight */
391 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
395 /* Destroy the trap */
396 cave_alter_feat(y, x, FF_DISARM);
399 /* Locked doors are unlocked */
400 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
402 FEAT_IDX old_feat = g_ptr->feat;
404 /* Unlock the door */
405 cave_alter_feat(y, x, FF_DISARM);
407 /* Check line of sound */
408 if (known && (old_feat != g_ptr->feat))
410 msg_print(_("カチッと音がした!", "Click!"));
415 /* Remove "unsafe" flag if player is not blind */
416 if (!p_ptr->blind && player_has_los_bold(y, x))
418 g_ptr->info &= ~(CAVE_UNSAFE);
426 /* Destroy Doors (and traps) */
429 /* Destroy all doors and traps */
430 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
432 /* Check line of sight */
435 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
439 /* Destroy the feature */
440 cave_alter_feat(y, x, FF_TUNNEL);
443 /* Remove "unsafe" flag if player is not blind */
444 if (!p_ptr->blind && player_has_los_bold(y, x))
446 g_ptr->info &= ~(CAVE_UNSAFE);
454 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
456 if (have_flag(f_ptr->flags, FF_SPIKE))
458 s16b old_mimic = g_ptr->mimic;
459 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
461 cave_alter_feat(y, x, FF_SPIKE);
462 g_ptr->mimic = old_mimic;
467 /* Check line of sight */
468 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
470 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
477 /* Destroy walls (and doors) */
480 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
482 if (known && (g_ptr->info & (CAVE_MARK)))
484 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
488 /* Destroy the wall */
489 cave_alter_feat(y, x, FF_HURT_ROCK);
490 p_ptr->update |= (PU_FLOW);
498 if (!cave_naked_bold(y, x)) break;
499 if (player_bold(y, x)) break;
500 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
501 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
513 if (!cave_naked_bold(y, x)) break;
514 if (player_bold(y, x)) break;
515 cave_set_feat(y, x, feat_tree);
516 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
522 if (!cave_naked_bold(y, x)) break;
523 g_ptr->info |= CAVE_OBJECT;
524 g_ptr->mimic = feat_glyph;
532 if (!cave_naked_bold(y, x)) break;
533 if (player_bold(y, x)) break;
534 cave_set_feat(y, x, feat_granite);
540 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
543 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
544 cave_set_feat(y, x, feat_shallow_lava);
548 cave_set_feat(y, x, feat_deep_lava);
555 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
558 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
559 cave_set_feat(y, x, feat_shallow_water);
563 cave_set_feat(y, x, feat_deep_water);
568 /* Lite up the grid */
572 /* Turn on the light */
573 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
575 g_ptr->info |= (CAVE_GLOW);
578 update_local_illumination(p_ptr, y, x);
581 if (player_can_see_bold(y, x)) obvious = TRUE;
583 /* Mega-Hack -- Update the monster in the affected grid */
584 /* This allows "spear of light" (etc) to work "correctly" */
585 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
587 if (p_ptr->special_defense & NINJA_S_STEALTH)
589 if (player_bold(y, x)) set_superstealth(p_ptr, FALSE);
596 /* Darken the grid */
600 bool do_dark = !p_ptr->phase_out && !is_mirror_grid(g_ptr);
603 /* Turn off the light. */
606 if (current_floor_ptr->dun_level || !is_daytime())
608 for (j = 0; j < 9; j++)
610 int by = y + ddy_ddd[j];
611 int bx = x + ddx_ddd[j];
613 if (in_bounds2(by, bx))
615 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
617 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
628 g_ptr->info &= ~(CAVE_GLOW);
630 /* Hack -- Forget "boring" grids */
631 if (!have_flag(f_ptr->flags, FF_REMEMBER))
634 g_ptr->info &= ~(CAVE_MARK);
641 update_local_illumination(p_ptr, y, x);
643 if (player_can_see_bold(y, x)) obvious = TRUE;
645 /* Mega-Hack -- Update the monster in the affected grid */
646 /* This allows "spear of light" (etc) to work "correctly" */
647 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
657 if (is_mirror_grid(g_ptr))
659 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
662 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
665 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
667 if (known && (g_ptr->info & CAVE_MARK))
669 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
673 /* Destroy the wall */
674 cave_alter_feat(y, x, FF_HURT_ROCK);
675 p_ptr->update |= (PU_FLOW);
682 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
684 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
687 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
690 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
692 if (known && (g_ptr->info & CAVE_MARK))
694 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
698 /* Destroy the wall */
699 cave_alter_feat(y, x, FF_HURT_ROCK);
700 p_ptr->update |= (PU_FLOW);
705 case GF_DISINTEGRATE:
707 /* Destroy mirror/glyph */
708 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
711 /* Permanent features don't get effect */
712 /* But not protect monsters and other objects */
713 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
715 cave_alter_feat(y, x, FF_HURT_DISI);
717 /* Update some things -- similar to GF_KILL_WALL */
718 p_ptr->update |= (PU_FLOW);
725 /* Return "Anything seen?" */
732 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
733 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
734 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
735 * @param y 目標Y座標 / Target y location (or location to travel "towards")
736 * @param x 目標X座標 / Target x location (or location to travel "towards")
737 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
738 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
739 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
742 * We are called from "project()" to "damage" objects
744 * We are called both for "beam" effects and "ball" effects.
746 * Perhaps we should only SOMETIMES damage things on the ground.
748 * The "r" parameter is the "distance from ground zero".
750 * Note that we determine if the player can "see" anything that happens
751 * by taking into account: blindness, line-of-sight, and illumination.
753 * We also "see" grids which are "memorized", probably a hack
755 * We return "TRUE" if the effect of the projection is "obvious".
758 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
760 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
762 OBJECT_IDX this_o_idx, next_o_idx = 0;
764 bool obvious = FALSE;
765 bool known = player_has_los_bold(y, x);
767 BIT_FLAGS flgs[TR_FLAG_SIZE];
769 GAME_TEXT o_name[MAX_NLEN];
771 KIND_OBJECT_IDX k_idx = 0;
772 bool is_potion = FALSE;
777 /* Reduce damage by distance */
778 dam = (dam + r) / (r + 1);
781 /* Scan all objects in the grid */
782 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
784 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
788 bool do_kill = FALSE;
790 concptr note_kill = NULL;
793 /* Get the "plural"-ness */
794 bool plural = (o_ptr->number > 1);
796 next_o_idx = o_ptr->next_o_idx;
797 object_flags(o_ptr, flgs);
799 /* Check for artifact */
800 if (object_is_artifact(o_ptr)) is_art = TRUE;
802 /* Analyze the type */
805 /* Acid -- Lots of things */
808 if (hates_acid(o_ptr))
811 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
812 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
817 /* Elec -- Rings and Wands */
820 if (hates_elec(o_ptr))
823 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
824 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
829 /* Fire -- Flammable objects */
832 if (hates_fire(o_ptr))
835 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
836 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
841 /* Cold -- potions and flasks */
844 if (hates_cold(o_ptr))
846 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
848 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
856 if (hates_fire(o_ptr))
859 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
860 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
862 if (hates_elec(o_ptr))
866 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
867 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
875 if (hates_fire(o_ptr))
878 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
879 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
881 if (hates_cold(o_ptr))
885 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
886 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
891 /* Hack -- break potions and such */
897 if (hates_cold(o_ptr))
899 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
905 /* Mana and Chaos -- destroy everything */
911 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
915 case GF_DISINTEGRATE:
918 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
925 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
926 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
927 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
931 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
935 if (object_is_cursed(o_ptr))
938 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
945 identify_item(o_ptr);
947 /* Auto-inscription */
948 autopick_alter_item((-this_o_idx), FALSE);
956 /* Chests are noticed only if trapped or locked */
957 if (o_ptr->tval == TV_CHEST)
959 /* Disarm/Unlock traps */
962 /* Disarm or Unlock */
963 o_ptr->pval = (0 - o_ptr->pval);
968 if (known && (o_ptr->marked & OM_FOUND))
970 msg_print(_("カチッと音がした!", "Click!"));
980 if (o_ptr->tval == TV_CORPSE)
985 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
986 mode |= PM_FORCE_PET;
988 for (i = 0; i < o_ptr->number ; i++)
990 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
991 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
995 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
999 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1001 note_kill = _("生き返った。", " revived.");
1003 else if (!note_kill)
1005 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1016 /* Attempt to destroy the object */
1019 /* Effect "observed" */
1020 if (known && (o_ptr->marked & OM_FOUND))
1023 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1026 /* Artifacts, and other objects, get to resist */
1027 if (is_art || ignore)
1029 /* Observe the resist */
1030 if (known && (o_ptr->marked & OM_FOUND))
1032 msg_format(_("%sは影響を受けない!",
1033 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1040 /* Describe if needed */
1041 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1043 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1046 k_idx = o_ptr->k_idx;
1047 is_potion = object_is_potion(o_ptr);
1048 delete_object_idx(this_o_idx);
1050 /* Potions produce effects when 'shattered' */
1053 (void)potion_smash_effect(who, y, x, k_idx);
1061 /* Return "Anything seen?" */
1067 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1068 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1069 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1070 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1071 * @param x 目標X座標 / Target x location (or location to travel "towards")
1072 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1073 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1075 * @param see_s_msg TRUEならばメッセージを表示する
1076 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1079 * This routine takes a "source monster" (by index) which is mostly used to
1080 * determine if the player is causing the damage, and a "radius" (see below),
1081 * which is used to decrease the power of explosions with distance, and a
1082 * location, via integers which are modified by certain types of attacks
1083 * (polymorph and teleport being the obvious ones), a default damage, which
1084 * is modified as needed based on various properties, and finally a "damage
1085 * type" (see below).
1088 * Note that this routine can handle "no damage" attacks (like teleport) by
1089 * taking a "zero" damage, and can even take "parameters" to attacks (like
1090 * confuse) by accepting a "damage", using it to calculate the effect, and
1091 * then setting the damage to zero. Note that the "damage" parameter is
1092 * divided by the radius, so monsters not at the "epicenter" will not take
1093 * as much damage (or whatever)...
1096 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1097 * may result in a dereference of an invalid pointer.
1100 * Various messages are produced, and damage is applied.
1103 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1104 * actually be "made" of that substance, or "breathe" big balls of it.
1105 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1107 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1108 * and hurts evil less. If can breath nether, then it resists it as well.
1111 * Damage reductions use the following formulas:
1112 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1113 * gives avg damage of .655, ranging from .858 to .500
1114 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1115 * gives avg damage of .544, ranging from .714 to .417
1116 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1117 * gives avg damage of .444, ranging from .556 to .333
1118 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1119 * gives avg damage of .327, ranging from .427 to .250
1120 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1121 * gives something simple.
1124 * In this function, "result" messages are postponed until the end, where
1125 * the "note" string is appended to the monster name, if not NULL. So,
1126 * to make a spell have "no effect" just set "note" to NULL. You should
1127 * also set "notice" to FALSE, or the player will learn what the spell does.
1130 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1134 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1138 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1140 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1141 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
1143 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1147 /* Is the monster "seen"? */
1148 bool seen = m_ptr->ml;
1149 bool seen_msg = is_seen(m_ptr);
1151 bool slept = (bool)MON_CSLEEP(m_ptr);
1153 /* Were the effects "obvious" (if seen)? */
1154 bool obvious = FALSE;
1156 /* Can the player know about this effect? */
1157 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->phase_out);
1159 /* Were the effects "irrelevant"? */
1160 bool skipped = FALSE;
1162 /* Gets the monster angry at the source of the effect? */
1163 bool get_angry = FALSE;
1165 /* Polymorph setting (true or false) */
1166 bool do_poly = FALSE;
1168 /* Teleport setting (max distance) */
1171 /* Confusion setting (amount to confuse) */
1174 /* Stunning setting (amount to stun) */
1177 /* Sleep amount (amount to sleep) */
1180 /* Fear amount (amount to fear) */
1183 /* Time amount (amount to time) */
1186 bool heal_leper = FALSE;
1188 /* Hold the monster name */
1189 GAME_TEXT m_name[MAX_NLEN];
1192 PARAMETER_VALUE photo = 0;
1194 /* Assume no note */
1195 concptr note = NULL;
1197 /* Assume a default death */
1198 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1200 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1203 if (!g_ptr->m_idx) return (FALSE);
1205 /* Never affect projector */
1206 if (who && (g_ptr->m_idx == who)) return (FALSE);
1207 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1208 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1210 /* Don't affect already death monsters */
1211 /* Prevents problems with chain reactions of exploding monsters */
1212 if (m_ptr->hp < 0) return (FALSE);
1214 /* Reduce damage by distance */
1215 dam = (dam + r) / (r + 1);
1218 /* Get the monster name (BEFORE polymorphing) */
1219 monster_desc(m_name, m_ptr, 0);
1221 /* Get the monster possessive ("his"/"her"/"its") */
1222 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1224 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(p_ptr, TRUE, TRUE);
1226 if (r_ptr->flagsr & RFR_RES_ALL &&
1227 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1228 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1230 note = _("には完全な耐性がある!", " is immune.");
1232 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1233 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1237 /* Analyze the damage type */
1240 /* Magic Missile -- pure damage */
1243 if (seen) obvious = TRUE;
1250 if (seen) obvious = TRUE;
1251 if (r_ptr->flagsr & RFR_IM_ACID)
1253 note = _("にはかなり耐性がある!", " resists a lot.");
1255 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1263 if (seen) obvious = TRUE;
1264 if (r_ptr->flagsr & RFR_IM_ELEC)
1266 note = _("にはかなり耐性がある!", " resists a lot.");
1268 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1276 if (seen) obvious = TRUE;
1277 if (r_ptr->flagsr & RFR_IM_FIRE)
1279 note = _("にはかなり耐性がある!", " resists a lot.");
1281 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1283 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1285 note = _("はひどい痛手をうけた。", " is hit hard.");
1287 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1295 if (seen) obvious = TRUE;
1296 if (r_ptr->flagsr & RFR_IM_COLD)
1298 note = _("にはかなり耐性がある!", " resists a lot.");
1300 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1302 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1304 note = _("はひどい痛手をうけた。", " is hit hard.");
1306 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1314 if (seen) obvious = TRUE;
1315 if (r_ptr->flagsr & RFR_IM_POIS)
1317 note = _("にはかなり耐性がある!", " resists a lot.");
1319 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1327 if (seen) obvious = TRUE;
1328 if (r_ptr->flagsr & RFR_IM_POIS)
1330 note = _("には耐性がある。", " resists.");
1331 dam *= 3; dam /= randint1(6) + 6;
1332 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1334 else if (one_in_(3)) do_poly = TRUE;
1338 /* Hellfire -- hurts Evil */
1341 if (seen) obvious = TRUE;
1342 if (r_ptr->flags3 & RF3_GOOD)
1344 note = _("はひどい痛手をうけた。", " is hit hard.");
1346 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1351 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1354 if (seen) obvious = TRUE;
1355 if (r_ptr->flags3 & RF3_EVIL)
1358 note = _("はひどい痛手をうけた。", " is hit hard.");
1359 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1363 note = _("には耐性がある。", " resists.");
1364 dam *= 3; dam /= randint1(6) + 6;
1369 /* Arrow -- XXX no defense */
1372 if (seen) obvious = TRUE;
1376 /* Plasma -- XXX perhaps check ELEC or FIRE */
1379 if (seen) obvious = TRUE;
1380 if (r_ptr->flagsr & RFR_RES_PLAS)
1382 note = _("には耐性がある。", " resists.");
1383 dam *= 3; dam /= randint1(6) + 6;
1384 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1389 /* Nether -- see above */
1392 if (seen) obvious = TRUE;
1393 if (r_ptr->flagsr & RFR_RES_NETH)
1395 if (r_ptr->flags3 & RF3_UNDEAD)
1397 note = _("には完全な耐性がある!", " is immune.");
1399 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1403 note = _("には耐性がある。", " resists.");
1404 dam *= 3; dam /= randint1(6) + 6;
1406 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1408 else if (r_ptr->flags3 & RF3_EVIL)
1410 note = _("はいくらか耐性を示した。", " resists somewhat.");
1412 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1417 /* Water (acid) damage -- Water spirits/elementals are immune */
1420 if (seen) obvious = TRUE;
1421 if (r_ptr->flagsr & RFR_RES_WATE)
1423 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1425 note = _("には完全な耐性がある!", " is immune.");
1430 note = _("には耐性がある。", " resists.");
1431 dam *= 3; dam /= randint1(6) + 6;
1433 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1438 /* Chaos -- Chaos breathers resist */
1441 if (seen) obvious = TRUE;
1442 if (r_ptr->flagsr & RFR_RES_CHAO)
1444 note = _("には耐性がある。", " resists.");
1445 dam *= 3; dam /= randint1(6) + 6;
1446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1448 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1450 note = _("はいくらか耐性を示した。", " resists somewhat.");
1451 dam *= 3; dam /= randint1(6) + 6;
1452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1457 do_conf = (5 + randint1(11) + r) / (r + 1);
1462 /* Shards -- Shard breathers resist */
1465 if (seen) obvious = TRUE;
1466 if (r_ptr->flagsr & RFR_RES_SHAR)
1468 note = _("には耐性がある。", " resists.");
1469 dam *= 3; dam /= randint1(6) + 6;
1470 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1475 /* Rocket: Shard resistance helps */
1478 if (seen) obvious = TRUE;
1479 if (r_ptr->flagsr & RFR_RES_SHAR)
1481 note = _("はいくらか耐性を示した。", " resists somewhat.");
1483 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1489 /* Sound -- Sound breathers resist */
1492 if (seen) obvious = TRUE;
1493 if (r_ptr->flagsr & RFR_RES_SOUN)
1495 note = _("には耐性がある。", " resists.");
1496 dam *= 2; dam /= randint1(6) + 6;
1497 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1499 else do_stun = (10 + randint1(15) + r) / (r + 1);
1506 if (seen) obvious = TRUE;
1507 if (r_ptr->flags3 & RF3_NO_CONF)
1509 note = _("には耐性がある。", " resists.");
1510 dam *= 3; dam /= randint1(6) + 6;
1511 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1513 else do_conf = (10 + randint1(15) + r) / (r + 1);
1517 /* Disenchantment -- Breathers and Disenchanters resist */
1520 if (seen) obvious = TRUE;
1521 if (r_ptr->flagsr & RFR_RES_DISE)
1523 note = _("には耐性がある。", " resists.");
1524 dam *= 3; dam /= randint1(6) + 6;
1525 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1530 /* Nexus -- Breathers and Existers resist */
1533 if (seen) obvious = TRUE;
1534 if (r_ptr->flagsr & RFR_RES_NEXU)
1536 note = _("には耐性がある。", " resists.");
1537 dam *= 3; dam /= randint1(6) + 6;
1538 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1546 if (seen) obvious = TRUE;
1547 if (r_ptr->flagsr & RFR_RES_WALL)
1549 note = _("には耐性がある。", " resists.");
1550 dam *= 3; dam /= randint1(6) + 6;
1551 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1553 else do_stun = (randint1(15) + r) / (r + 1);
1557 /* Inertia -- breathers resist */
1560 if (seen) obvious = TRUE;
1561 if (r_ptr->flagsr & RFR_RES_INER)
1563 note = _("には耐性がある。", " resists.");
1564 dam *= 3; dam /= randint1(6) + 6;
1565 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1569 /* Powerful monsters can resist */
1570 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1571 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1575 /* Normal monsters slow down */
1578 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1580 note = _("の動きが遅くなった。", " starts moving slower.");
1587 /* Time -- breathers resist */
1590 if (seen) obvious = TRUE;
1591 if (r_ptr->flagsr & RFR_RES_TIME)
1593 note = _("には耐性がある。", " resists.");
1594 dam *= 3; dam /= randint1(6) + 6;
1595 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1597 else do_time = (dam + 1) / 2;
1601 /* Gravity -- breathers resist */
1604 bool resist_tele = FALSE;
1606 if (seen) obvious = TRUE;
1607 if (r_ptr->flagsr & RFR_RES_TELE)
1609 if (r_ptr->flags1 & (RF1_UNIQUE))
1611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1612 note = _("には効果がなかった。", " is unaffected!");
1615 else if (r_ptr->level > randint1(100))
1617 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1618 note = _("には耐性がある!", " resists!");
1623 if (!resist_tele) do_dist = 10;
1625 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1627 if (r_ptr->flagsr & RFR_RES_GRAV)
1629 note = _("には耐性がある!", " resists!");
1630 dam *= 3; dam /= randint1(6) + 6;
1632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1637 /* Powerful monsters can resist */
1638 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1639 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1643 /* Normal monsters slow down */
1646 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1648 note = _("の動きが遅くなった。", " starts moving slower.");
1653 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1655 /* Attempt a saving throw */
1656 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1657 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1661 /* No obvious effect */
1662 note = _("には効果がなかった。", " is unaffected!");
1674 if (seen) obvious = TRUE;
1680 case GF_DISINTEGRATE:
1682 if (seen) obvious = TRUE;
1683 if (r_ptr->flags3 & RF3_HURT_ROCK)
1685 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1686 note = _("の皮膚がただれた!", " loses some skin!");
1687 note_dies = _("は蒸発した!", " evaporates!");
1695 if (seen) obvious = TRUE;
1697 /* PSI only works if the monster can see you! -- RG */
1698 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1701 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1705 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1708 note = _("には完全な耐性がある!", " is immune.");
1709 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1712 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1713 (r_ptr->flags3 & RF3_ANIMAL) ||
1714 (r_ptr->level > randint1(3 * dam)))
1716 note = _("には耐性がある!", " resists!");
1720 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1721 * attacks back on them
1723 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1724 (r_ptr->level > p_ptr->lev / 2) &&
1728 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1729 (seen ? "%^s's corrupted mind backlashes your attack!" :
1730 "%^ss corrupted mind backlashes your attack!")), m_name);
1733 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
1735 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1739 /* Injure +/- confusion */
1740 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1741 take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1742 if (one_in_(4) && !CHECK_MULTISHADOW(p_ptr))
1744 switch (randint1(4))
1747 set_confused(p_ptr, p_ptr->confused + 3 + randint1(dam));
1750 set_stun(p_ptr, p_ptr->stun + randint1(dam));
1754 if (r_ptr->flags3 & RF3_NO_FEAR)
1755 note = _("には効果がなかった。", " is unaffected.");
1757 set_afraid(p_ptr, p_ptr->afraid + 3 + randint1(dam));
1761 if (!p_ptr->free_act)
1762 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(dam));
1771 if ((dam > 0) && one_in_(4))
1773 switch (randint1(4))
1776 do_conf = 3 + randint1(dam);
1779 do_stun = 3 + randint1(dam);
1782 do_fear = 3 + randint1(dam);
1785 note = _("は眠り込んでしまった!", " falls asleep!");
1786 do_sleep = 3 + randint1(dam);
1791 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1797 if (seen) obvious = TRUE;
1798 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1801 note = _("には完全な耐性がある!", " is immune.");
1803 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1804 (r_ptr->flags3 & RF3_ANIMAL) ||
1805 (r_ptr->level > randint1(3 * dam)))
1807 note = _("には耐性がある!", " resists!");
1811 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1812 * attacks back on them
1814 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1815 (r_ptr->level > p_ptr->lev / 2) &&
1819 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1820 (seen ? "%^s's corrupted mind backlashes your attack!" :
1821 "%^ss corrupted mind backlashes your attack!")), m_name);
1823 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
1825 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1829 /* Injure + mana drain */
1830 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1831 if (!CHECK_MULTISHADOW(p_ptr))
1833 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1834 p_ptr->csp -= damroll(5, dam) / 2;
1835 if (p_ptr->csp < 0) p_ptr->csp = 0;
1836 p_ptr->redraw |= PR_MANA;
1837 p_ptr->window |= (PW_SPELL);
1839 take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1846 int b = damroll(5, dam) / 4;
1847 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1848 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1849 (seen ? "You convert %s's pain into %s!" :
1850 "You convert %ss pain into %s!"));
1851 msg_format(msg, m_name, str);
1853 b = MIN(p_ptr->msp, p_ptr->csp + b);
1855 p_ptr->redraw |= PR_MANA;
1856 p_ptr->window |= (PW_SPELL);
1858 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1862 case GF_TELEKINESIS:
1864 if (seen) obvious = TRUE;
1867 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1872 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1874 /* Attempt a saving throw */
1875 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1876 (r_ptr->level > 5 + randint1(dam)))
1880 /* No obvious effect */
1886 /* Psycho-spear -- powerful magic missile */
1889 if (seen) obvious = TRUE;
1893 /* Meteor -- powerful magic missile */
1896 if (seen) obvious = TRUE;
1902 if (!is_hostile(m_ptr)) break;
1903 if (seen) obvious = TRUE;
1904 /* Attempt a saving throw */
1905 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1906 (r_ptr->flags3 & RF3_NO_CONF) ||
1907 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1909 /* Memorize a flag */
1910 if (r_ptr->flags3 & RF3_NO_CONF)
1912 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1919 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1920 * attacks back on them
1922 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1923 (r_ptr->level > p_ptr->lev / 2) &&
1927 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1928 (seen ? "%^s's corrupted mind backlashes your attack!" :
1929 "%^ss corrupted mind backlashes your attack!")), m_name);
1932 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1934 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1938 /* Confuse, stun, terrify */
1939 switch (randint1(4))
1942 set_stun(p_ptr, p_ptr->stun + dam / 2);
1945 set_confused(p_ptr, p_ptr->confused + dam / 2);
1949 if (r_ptr->flags3 & RF3_NO_FEAR)
1950 note = _("には効果がなかった。", " is unaffected.");
1952 set_afraid(p_ptr, p_ptr->afraid + dam);
1959 /* No obvious effect */
1960 note = _("には効果がなかった。", " is unaffected.");
1966 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1968 note = _("があなたに隷属した。", " is in your thrall!");
1973 switch (randint1(4))
1987 /* No "real" damage */
1992 /* Ice -- Cold + Cuts + Stun */
1995 if (seen) obvious = TRUE;
1996 do_stun = (randint1(15) + 1) / (r + 1);
1997 if (r_ptr->flagsr & RFR_IM_COLD)
1999 note = _("にはかなり耐性がある!", " resists a lot.");
2001 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2003 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2005 note = _("はひどい痛手をうけた。", " is hit hard.");
2007 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2014 case GF_HYPODYNAMIA:
2016 if (seen) obvious = TRUE;
2017 if (!monster_living(m_ptr->r_idx))
2019 if (is_original_ap_and_seen(m_ptr))
2021 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2022 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2023 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2025 note = _("には効果がなかった。", " is unaffected.");
2029 else do_time = (dam+7)/8;
2037 if (seen) obvious = TRUE;
2038 if (!monster_living(m_ptr->r_idx))
2040 if (is_original_ap_and_seen(m_ptr))
2042 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2043 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2044 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2046 note = _("には完全な耐性がある!", " is immune.");
2050 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2051 (randint1(888) != 666)) ||
2052 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2053 randint1(100) != 66))
2055 note = _("には耐性がある!", " resists!");
2063 /* Polymorph monster (Use "dam" as "power") */
2066 if (seen) obvious = TRUE;
2067 /* Attempt to polymorph (see below) */
2070 /* Powerful monsters can resist */
2071 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2072 (r_ptr->flags1 & RF1_QUESTOR) ||
2073 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2075 note = _("には効果がなかった。", " is unaffected.");
2080 /* No "real" damage */
2087 /* Clone monsters (Ignore "dam") */
2090 if (seen) obvious = TRUE;
2092 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2094 note = _("には効果がなかった。", " is unaffected.");
2099 m_ptr->hp = m_ptr->maxhp;
2101 /* Attempt to clone. */
2102 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2104 note = _("が分裂した!", " spawns!");
2108 /* No "real" damage */
2115 /* Heal Monster (use "dam" as amount of healing) */
2118 if (seen) obvious = TRUE;
2121 (void)set_monster_csleep(g_ptr->m_idx, 0);
2123 if (m_ptr->maxhp < m_ptr->max_maxhp)
2125 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2126 m_ptr->maxhp = m_ptr->max_maxhp;
2131 /* Redraw (later) if needed */
2132 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2133 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2141 if (seen) obvious = TRUE;
2144 (void)set_monster_csleep(g_ptr->m_idx, 0);
2145 if (MON_STUNNED(m_ptr))
2147 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2148 (void)set_monster_stunned(g_ptr->m_idx, 0);
2150 if (MON_CONFUSED(m_ptr))
2152 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2153 (void)set_monster_confused(g_ptr->m_idx, 0);
2155 if (MON_MONFEAR(m_ptr))
2157 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2158 (void)set_monster_monfear(g_ptr->m_idx, 0);
2162 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2165 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2169 chg_virtue(p_ptr, V_VITALITY, 1);
2171 if (r_ptr->flags1 & RF1_UNIQUE)
2172 chg_virtue(p_ptr, V_INDIVIDUALISM, 1);
2174 if (is_friendly(m_ptr))
2175 chg_virtue(p_ptr, V_HONOUR, 1);
2176 else if (!(r_ptr->flags3 & RF3_EVIL))
2178 if (r_ptr->flags3 & RF3_GOOD)
2179 chg_virtue(p_ptr, V_COMPASSION, 2);
2181 chg_virtue(p_ptr, V_COMPASSION, 1);
2184 if (r_ptr->flags3 & RF3_ANIMAL)
2185 chg_virtue(p_ptr, V_NATURE, 1);
2188 if (m_ptr->r_idx == MON_LEPER)
2191 if (!who) chg_virtue(p_ptr, V_COMPASSION, 5);
2194 /* Redraw (later) if needed */
2195 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2196 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2198 note = _("は体力を回復したようだ。", " looks healthier.");
2200 /* No "real" damage */
2206 /* Speed Monster (Ignore "dam") */
2209 if (seen) obvious = TRUE;
2212 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2214 note = _("の動きが速くなった。", " starts moving faster.");
2219 if (r_ptr->flags1 & RF1_UNIQUE)
2220 chg_virtue(p_ptr, V_INDIVIDUALISM, 1);
2221 if (is_friendly(m_ptr))
2222 chg_virtue(p_ptr, V_HONOUR, 1);
2225 /* No "real" damage */
2231 /* Slow Monster (Use "dam" as "power") */
2234 if (seen) obvious = TRUE;
2236 /* Powerful monsters can resist */
2237 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2238 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2240 note = _("には効果がなかった。", " is unaffected.");
2244 /* Normal monsters slow down */
2247 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2249 note = _("の動きが遅くなった。", " starts moving slower.");
2253 /* No "real" damage */
2259 /* Sleep (Use "dam" as "power") */
2262 if (seen) obvious = TRUE;
2264 /* Attempt a saving throw */
2265 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2266 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2267 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2269 /* Memorize a flag */
2270 if (r_ptr->flags3 & RF3_NO_SLEEP)
2272 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2274 /* No obvious effect */
2275 note = _("には効果がなかった。", " is unaffected.");
2280 /* Go to sleep (much) later */
2281 note = _("は眠り込んでしまった!", " falls asleep!");
2285 /* No "real" damage */
2291 /* Sleep (Use "dam" as "power") */
2292 case GF_STASIS_EVIL:
2294 if (seen) obvious = TRUE;
2296 /* Attempt a saving throw */
2297 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2298 !(r_ptr->flags3 & RF3_EVIL) ||
2299 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2301 note = _("には効果がなかった。", " is unaffected.");
2306 /* Go to sleep (much) later */
2307 note = _("は動けなくなった!", " is suspended!");
2311 /* No "real" damage */
2316 /* Sleep (Use "dam" as "power") */
2319 if (seen) obvious = TRUE;
2321 /* Attempt a saving throw */
2322 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2323 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2325 note = _("には効果がなかった。", " is unaffected.");
2330 /* Go to sleep (much) later */
2331 note = _("は動けなくなった!", " is suspended!");
2335 /* No "real" damage */
2344 vir = virtue_number(p_ptr, V_HARMONY);
2347 dam += p_ptr->virtues[vir-1]/10;
2350 vir = virtue_number(p_ptr, V_INDIVIDUALISM);
2353 dam -= p_ptr->virtues[vir-1]/20;
2356 if (seen) obvious = TRUE;
2358 /* Attempt a saving throw */
2359 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2363 /* No obvious effect */
2364 note = _("には効果がなかった。", " is unaffected.");
2367 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2369 else if (p_ptr->cursed & TRC_AGGRAVATE)
2371 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2372 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2376 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2379 chg_virtue(p_ptr, V_INDIVIDUALISM, -1);
2380 if (r_ptr->flags3 & RF3_ANIMAL)
2381 chg_virtue(p_ptr, V_NATURE, 1);
2384 /* No "real" damage */
2389 /* Control undead */
2390 case GF_CONTROL_UNDEAD:
2393 if (seen) obvious = TRUE;
2395 vir = virtue_number(p_ptr, V_UNLIFE);
2398 dam += p_ptr->virtues[vir-1]/10;
2401 vir = virtue_number(p_ptr, V_INDIVIDUALISM);
2404 dam -= p_ptr->virtues[vir-1]/20;
2407 /* Attempt a saving throw */
2408 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2409 !(r_ptr->flags3 & RF3_UNDEAD))
2411 /* No obvious effect */
2412 note = _("には効果がなかった。", " is unaffected.");
2414 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2416 else if (p_ptr->cursed & TRC_AGGRAVATE)
2418 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2419 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2423 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2427 /* No "real" damage */
2433 case GF_CONTROL_DEMON:
2436 if (seen) obvious = TRUE;
2438 vir = virtue_number(p_ptr, V_UNLIFE);
2441 dam += p_ptr->virtues[vir-1]/10;
2444 vir = virtue_number(p_ptr, V_INDIVIDUALISM);
2447 dam -= p_ptr->virtues[vir-1]/20;
2450 /* Attempt a saving throw */
2451 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2452 !(r_ptr->flags3 & RF3_DEMON))
2454 /* No obvious effect */
2455 note = _("には効果がなかった。", " is unaffected.");
2457 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2459 else if (p_ptr->cursed & TRC_AGGRAVATE)
2461 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2462 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2466 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2470 /* No "real" damage */
2476 case GF_CONTROL_ANIMAL:
2479 if (seen) obvious = TRUE;
2481 vir = virtue_number(p_ptr, V_NATURE);
2484 dam += p_ptr->virtues[vir-1]/10;
2487 vir = virtue_number(p_ptr, V_INDIVIDUALISM);
2490 dam -= p_ptr->virtues[vir-1]/20;
2493 /* Attempt a saving throw */
2494 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2495 !(r_ptr->flags3 & RF3_ANIMAL))
2498 /* No obvious effect */
2499 note = _("には効果がなかった。", " is unaffected.");
2501 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2503 else if (p_ptr->cursed & TRC_AGGRAVATE)
2505 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2506 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2510 note = _("はなついた。", " is tamed!");
2512 if (r_ptr->flags3 & RF3_ANIMAL)
2513 chg_virtue(p_ptr, V_NATURE, 1);
2516 /* No "real" damage */
2522 case GF_CHARM_LIVING:
2526 vir = virtue_number(p_ptr, V_UNLIFE);
2527 if (seen) obvious = TRUE;
2529 vir = virtue_number(p_ptr, V_UNLIFE);
2532 dam -= p_ptr->virtues[vir-1]/10;
2535 vir = virtue_number(p_ptr, V_INDIVIDUALISM);
2538 dam -= p_ptr->virtues[vir-1]/20;
2541 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2543 /* Attempt a saving throw */
2544 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2545 !monster_living(m_ptr->r_idx))
2548 /* No obvious effect */
2549 note = _("には効果がなかった。", " is unaffected.");
2551 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2553 else if (p_ptr->cursed & TRC_AGGRAVATE)
2555 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2556 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2560 note = _("を支配した。", " is tamed!");
2562 if (r_ptr->flags3 & RF3_ANIMAL)
2563 chg_virtue(p_ptr, V_NATURE, 1);
2566 /* No "real" damage */
2571 /* Confusion (Use "dam" as "power") */
2574 if (seen) obvious = TRUE;
2576 /* Get confused later */
2577 do_conf = damroll(3, (dam / 2)) + 1;
2579 /* Attempt a saving throw */
2580 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2581 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2582 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2584 /* Memorize a flag */
2585 if (r_ptr->flags3 & (RF3_NO_CONF))
2587 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2593 /* No obvious effect */
2594 note = _("には効果がなかった。", " is unaffected.");
2598 /* No "real" damage */
2605 if (seen) obvious = TRUE;
2607 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2609 /* Attempt a saving throw */
2610 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2611 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2616 /* No obvious effect */
2617 note = _("には効果がなかった。", " is unaffected.");
2621 /* No "real" damage */
2626 /* Lite, but only hurts susceptible creatures */
2635 if (r_ptr->flags3 & (RF3_HURT_LITE))
2637 /* Obvious effect */
2638 if (seen) obvious = TRUE;
2640 /* Memorize the effects */
2641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2643 /* Special effect */
2644 note = _("は光に身をすくめた!", " cringes from the light!");
2645 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2648 /* Normally no damage */
2660 /* Lite -- opposite of Dark */
2663 if (seen) obvious = TRUE;
2665 if (r_ptr->flagsr & RFR_RES_LITE)
2667 note = _("には耐性がある!", " resists!");
2668 dam *= 2; dam /= (randint1(6)+6);
2669 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2671 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2673 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2674 note = _("は光に身をすくめた!", " cringes from the light!");
2675 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2682 /* Dark -- opposite of Lite */
2685 if (seen) obvious = TRUE;
2687 if (r_ptr->flagsr & RFR_RES_DARK)
2689 note = _("には耐性がある!", " resists!");
2690 dam *= 2; dam /= (randint1(6)+6);
2691 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2700 /* Hurt by rock remover */
2701 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2704 if (seen) obvious = TRUE;
2706 /* Memorize the effects */
2707 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2709 /* Cute little message */
2710 note = _("の皮膚がただれた!", " loses some skin!");
2711 note_dies = _("はドロドロに溶けた!", " dissolves!");
2714 /* Usually, ignore the effects */
2725 /* Teleport undead (Use "dam" as "power") */
2726 case GF_AWAY_UNDEAD:
2728 /* Only affect undead */
2729 if (r_ptr->flags3 & (RF3_UNDEAD))
2731 bool resists_tele = FALSE;
2733 if (r_ptr->flagsr & RFR_RES_TELE)
2735 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2737 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2738 note = _("には効果がなかった。", " is unaffected.");
2739 resists_tele = TRUE;
2741 else if (r_ptr->level > randint1(100))
2743 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2744 note = _("には耐性がある!", " resists!");
2745 resists_tele = TRUE;
2751 if (seen) obvious = TRUE;
2752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2764 /* No "real" damage */
2770 /* Teleport evil (Use "dam" as "power") */
2773 /* Only affect evil */
2774 if (r_ptr->flags3 & (RF3_EVIL))
2776 bool resists_tele = FALSE;
2778 if (r_ptr->flagsr & RFR_RES_TELE)
2780 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2782 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2783 note = _("には効果がなかった。", " is unaffected.");
2784 resists_tele = TRUE;
2786 else if (r_ptr->level > randint1(100))
2788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2789 note = _("には耐性がある!", " resists!");
2790 resists_tele = TRUE;
2796 if (seen) obvious = TRUE;
2797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2809 /* No "real" damage */
2815 /* Teleport monster (Use "dam" as "power") */
2818 bool resists_tele = FALSE;
2819 if (r_ptr->flagsr & RFR_RES_TELE)
2821 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2823 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2824 note = _("には効果がなかった。", " is unaffected.");
2825 resists_tele = TRUE;
2827 else if (r_ptr->level > randint1(100))
2829 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2830 note = _("には耐性がある!", " resists!");
2831 resists_tele = TRUE;
2837 if (seen) obvious = TRUE;
2839 /* Prepare to teleport */
2843 /* No "real" damage */
2849 /* Turn undead (Use "dam" as "power") */
2850 case GF_TURN_UNDEAD:
2852 /* Only affect undead */
2853 if (r_ptr->flags3 & (RF3_UNDEAD))
2855 if (seen) obvious = TRUE;
2857 /* Learn about type */
2858 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2860 /* Apply some fear */
2861 do_fear = damroll(3, (dam / 2)) + 1;
2863 /* Attempt a saving throw */
2864 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2866 /* No obvious effect */
2867 note = _("には効果がなかった。", " is unaffected.");
2880 /* No "real" damage */
2886 /* Turn evil (Use "dam" as "power") */
2889 /* Only affect evil */
2890 if (r_ptr->flags3 & (RF3_EVIL))
2892 if (seen) obvious = TRUE;
2894 /* Learn about type */
2895 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2897 /* Apply some fear */
2898 do_fear = damroll(3, (dam / 2)) + 1;
2900 /* Attempt a saving throw */
2901 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2903 /* No obvious effect */
2904 note = _("には効果がなかった。", " is unaffected.");
2917 /* No "real" damage */
2923 /* Turn monster (Use "dam" as "power") */
2926 if (seen) obvious = TRUE;
2928 /* Apply some fear */
2929 do_fear = damroll(3, (dam / 2)) + 1;
2931 /* Attempt a saving throw */
2932 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2933 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2934 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2936 /* No obvious effect */
2937 note = _("には効果がなかった。", " is unaffected.");
2942 /* No "real" damage */
2949 case GF_DISP_UNDEAD:
2951 /* Only affect undead */
2952 if (r_ptr->flags3 & (RF3_UNDEAD))
2954 if (seen) obvious = TRUE;
2956 /* Learn about type */
2957 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2959 note = _("は身震いした。", " shudders.");
2960 note_dies = _("はドロドロに溶けた!", " dissolves!");
2980 /* Only affect evil */
2981 if (r_ptr->flags3 & (RF3_EVIL))
2983 if (seen) obvious = TRUE;
2985 /* Learn about type */
2986 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2988 note = _("は身震いした。", " shudders.");
2989 note_dies = _("はドロドロに溶けた!", " dissolves!");
3008 /* Only affect good */
3009 if (r_ptr->flags3 & (RF3_GOOD))
3011 if (seen) obvious = TRUE;
3013 /* Learn about type */
3014 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3016 note = _("は身震いした。", " shudders.");
3017 note_dies = _("はドロドロに溶けた!", " dissolves!");
3034 case GF_DISP_LIVING:
3036 /* Only affect non-undead */
3037 if (monster_living(m_ptr->r_idx))
3039 if (seen) obvious = TRUE;
3041 note = _("は身震いした。", " shudders.");
3042 note_dies = _("はドロドロに溶けた!", " dissolves!");
3061 /* Only affect demons */
3062 if (r_ptr->flags3 & (RF3_DEMON))
3064 if (seen) obvious = TRUE;
3066 /* Learn about type */
3067 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3069 note = _("は身震いした。", " shudders.");
3070 note_dies = _("はドロドロに溶けた!", " dissolves!");
3086 /* Dispel monster */
3089 if (seen) obvious = TRUE;
3090 note = _("は身震いした。", " shudders.");
3091 note_dies = _("はドロドロに溶けた!", " dissolves!");
3098 if (seen) obvious = TRUE;
3099 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3103 /* Heal the monster */
3104 if (caster_ptr->hp < caster_ptr->maxhp)
3107 caster_ptr->hp += dam;
3108 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3110 /* Redraw (later) if needed */
3111 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3112 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3114 /* Special message */
3117 monster_desc(killer, caster_ptr, 0);
3118 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3124 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3125 (void)hp_player(p_ptr, dam);
3130 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3139 if (seen) obvious = TRUE;
3140 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3141 /* Attempt a saving throw */
3142 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3143 (r_ptr->flags3 & RF3_NO_CONF) ||
3144 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3146 /* Memorize a flag */
3147 if (r_ptr->flags3 & (RF3_NO_CONF))
3149 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3151 note = _("には効果がなかった。", " is unaffected.");
3154 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3156 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3157 note = _("には完全な耐性がある!", " is immune.");
3160 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3162 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3163 note = _("には耐性がある。", " resists.");
3168 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3169 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3171 if (who > 0) do_conf = randint0(4) + 4;
3172 else do_conf = randint0(8) + 8;
3178 case GF_BRAIN_SMASH:
3180 if (seen) obvious = TRUE;
3181 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3183 /* Attempt a saving throw */
3184 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3185 (r_ptr->flags3 & RF3_NO_CONF) ||
3186 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3188 /* Memorize a flag */
3189 if (r_ptr->flags3 & (RF3_NO_CONF))
3191 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3193 note = _("には効果がなかった。", " is unaffected.");
3196 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3198 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3199 note = _("には完全な耐性がある!", " is immune.");
3202 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3204 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3205 note = _("には耐性がある!", " resists!");
3210 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3211 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3215 do_conf = randint0(4) + 4;
3216 do_stun = randint0(4) + 4;
3220 do_conf = randint0(8) + 8;
3221 do_stun = randint0(8) + 8;
3223 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3231 if (seen) obvious = TRUE;
3232 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3233 /* Attempt a saving throw */
3234 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3236 note = _("には効果がなかった。", " is unaffected.");
3245 if (seen) obvious = TRUE;
3246 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3247 /* Attempt a saving throw */
3248 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3250 note = _("には効果がなかった。", " is unaffected.");
3259 if (seen) obvious = TRUE;
3260 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3261 /* Attempt a saving throw */
3262 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3264 note = _("には効果がなかった。", " is unaffected.");
3273 if (seen) obvious = TRUE;
3275 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3276 "You point at %s, screaming the word, 'DIE!'."), m_name);
3277 /* Attempt a saving throw */
3278 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3280 note = _("には効果がなかった。", " is unaffected.");
3289 if (seen) obvious = TRUE;
3290 if (r_ptr->flags1 & RF1_UNIQUE)
3292 note = _("には効果がなかった。", " is unaffected.");
3297 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3298 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3300 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3302 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3306 note = _("は耐性を持っている!", "resists!");
3313 /* Capture monster */
3317 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3318 (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)
3320 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3325 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3326 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3327 nokori_hp = m_ptr->maxhp * 3 / 10;
3329 nokori_hp = m_ptr->maxhp * 3 / 20;
3331 if (m_ptr->hp >= nokori_hp)
3333 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3336 else if (m_ptr->hp < randint0(nokori_hp))
3338 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3339 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3340 cap_mon = m_ptr->r_idx;
3341 cap_mspeed = m_ptr->mspeed;
3343 cap_maxhp = m_ptr->max_maxhp;
3344 cap_nickname = m_ptr->nickname; /* Quark transfer */
3345 if (g_ptr->m_idx == p_ptr->riding)
3347 if (rakuba(p_ptr, -1, FALSE))
3349 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3353 delete_monster_idx(g_ptr->m_idx);
3359 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3365 /* Attack (Use "dam" as attack type) */
3368 /* Return this monster's death */
3369 return py_attack(p_ptr, y, x, dam);
3372 /* Sleep (Use "dam" as "power") */
3378 if (seen) obvious = TRUE;
3379 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3381 note = _("には効果がなかった。", " is unaffected.");
3384 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3387 if (MON_CSLEEP(m_ptr))
3389 note = _("には効果がなかった。", " is unaffected.");
3395 if (one_in_(5)) effect = 1;
3396 else if (one_in_(4)) effect = 2;
3397 else if (one_in_(3)) effect = 3;
3402 /* Powerful monsters can resist */
3403 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3404 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3406 note = _("には効果がなかった。", " is unaffected.");
3410 /* Normal monsters slow down */
3413 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3415 note = _("の動きが遅くなった。", " starts moving slower.");
3420 else if (effect == 2)
3422 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3424 /* Attempt a saving throw */
3425 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3426 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3431 /* No obvious effect */
3432 note = _("には効果がなかった。", " is unaffected.");
3437 else if (effect == 3)
3439 /* Attempt a saving throw */
3440 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3441 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3442 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3444 /* Memorize a flag */
3445 if (r_ptr->flags3 & RF3_NO_SLEEP)
3447 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3450 /* No obvious effect */
3451 note = _("には効果がなかった。", " is unaffected.");
3456 /* Go to sleep (much) later */
3457 note = _("は眠り込んでしまった!", " falls asleep!");
3464 note = _("には効果がなかった。", " is unaffected.");
3467 /* No "real" damage */
3475 if (seen) obvious = TRUE;
3476 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3478 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3479 chg_virtue(p_ptr, V_VITALITY, -1);
3489 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3491 if (r_ptr->flags3 & (RF3_HURT_LITE))
3493 /* Obvious effect */
3494 if (seen) obvious = TRUE;
3496 /* Memorize the effects */
3497 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3499 /* Special effect */
3500 note = _("は光に身をすくめた!", " cringes from the light!");
3501 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3504 /* Normally no damage */
3511 photo = m_ptr->r_idx;
3518 case GF_BLOOD_CURSE:
3520 if (seen) obvious = TRUE;
3526 bool success = FALSE;
3527 if (seen) obvious = TRUE;
3529 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3531 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3532 if (dam < 1) dam = 1;
3534 /* No need to tame your pet */
3537 note = _("の動きが速くなった。", " starts moving faster.");
3538 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3542 /* Attempt a saving throw */
3543 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3544 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3545 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3546 (p_ptr->cursed & TRC_AGGRAVATE) ||
3547 ((r_ptr->level+10) > randint1(dam)))
3550 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3554 note = _("を支配した。", " is tamed!");
3556 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3558 /* Learn about type */
3559 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3566 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3568 do_fear = randint1(90)+10;
3570 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3573 /* No "real" damage */
3580 if (seen) obvious = TRUE;
3581 /* Attempt a saving throw */
3582 if (randint0(100 + dam) < (r_ptr->level + 50))
3584 note = _("には効果がなかった。", " is unaffected.");
3604 /* Absolutely no effect */
3605 if (skipped) return (FALSE);
3607 /* "Unique" monsters cannot be polymorphed */
3608 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3610 /* Quest monsters cannot be polymorphed */
3611 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3613 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3615 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3616 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->phase_out)
3618 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3623 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(p_ptr, V_COMPASSION, -1);
3624 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(p_ptr, V_HONOUR, -1);
3627 /* Modify the damage */
3629 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3630 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3632 /* Check for death */
3633 if (dam > m_ptr->hp)
3635 /* Extract method of death */
3640 /* Sound and Impact resisters never stun */
3642 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3643 !(r_ptr->flags3 & RF3_NO_STUN))
3645 if (seen) obvious = TRUE;
3648 if (MON_STUNNED(m_ptr))
3650 note = _("はひどくもうろうとした。", " is more dazed.");
3651 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3655 note = _("はもうろうとした。", " is dazed.");
3660 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3666 /* Confusion and Chaos resisters (and sleepers) never confuse */
3668 !(r_ptr->flags3 & RF3_NO_CONF) &&
3669 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3671 if (seen) obvious = TRUE;
3673 /* Already partially confused */
3674 if (MON_CONFUSED(m_ptr))
3676 note = _("はさらに混乱したようだ。", " looks more confused.");
3677 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3680 /* Was not confused */
3683 note = _("は混乱したようだ。", " looks confused.");
3687 /* Apply confusion */
3688 (void)set_monster_confused(g_ptr->m_idx, tmp);
3696 if (seen) obvious = TRUE;
3698 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3702 note = _("は弱くなったようだ。", " seems weakened.");
3703 m_ptr->maxhp -= do_time;
3704 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3709 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3710 if (do_poly && (randint1(90) > r_ptr->level))
3712 if (polymorph_monster(y, x))
3714 if (seen) obvious = TRUE;
3716 /* Monster polymorphs */
3717 note = _("が変身した!", " changes!");
3719 /* Turn off the damage */
3725 note = _("には効果がなかった。", " is unaffected.");
3728 /* Hack -- Get new monster */
3729 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3731 /* Hack -- Get new race */
3732 r_ptr = &r_info[m_ptr->r_idx];
3735 /* Handle "teleport" */
3738 if (seen) obvious = TRUE;
3740 note = _("が消え去った!", " disappears!");
3742 if (!who) chg_virtue(p_ptr, V_VALOUR, -1);
3745 teleport_away(g_ptr->m_idx, do_dist,
3746 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3748 /* Hack -- get new location */
3752 /* Hack -- get new grid */
3753 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3760 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3767 if (typ == GF_DRAIN_MANA)
3769 /* Drain mana does nothing */
3772 /* If another monster did the damage, hurt the monster by hand */
3775 /* Redraw (later) if needed */
3776 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3777 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3779 /* Wake the monster up */
3780 (void)set_monster_csleep(g_ptr->m_idx, 0);
3782 /* Hurt the monster */
3790 if (is_pet(m_ptr) && !(m_ptr->ml))
3793 /* Give detailed messages if destroyed */
3796 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3799 msg_format("%^s%s", m_name, note);
3803 current_floor_ptr->monster_noise = TRUE;
3807 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3809 /* Generate treasure, etc */
3810 monster_death(g_ptr->m_idx, FALSE);
3813 delete_monster_idx(g_ptr->m_idx);
3817 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3821 /* Damaged monster */
3824 /* Give detailed messages if visible or destroyed */
3825 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3827 /* Hack -- Pain message */
3830 message_pain(g_ptr->m_idx, dam);
3834 current_floor_ptr->monster_noise = TRUE;
3837 /* Hack -- handle sleep */
3838 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3842 else if (heal_leper)
3844 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3846 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3848 char m2_name[MAX_NLEN];
3850 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3851 exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3854 delete_monster_idx(g_ptr->m_idx);
3857 /* If the player did it, give him experience, check fear */
3862 /* Hurt the monster, check for fear and death */
3863 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3868 /* Damaged monster */
3871 /* HACK - anger the monster before showing the sleep message */
3872 if (do_sleep) anger_monster(m_ptr);
3874 /* Give detailed messages if visible or destroyed */
3875 if (note && seen_msg)
3876 msg_format(_("%s%s", "%^s%s"), m_name, note);
3878 /* Hack -- Pain message */
3879 else if (known && (dam || !do_fear))
3881 message_pain(g_ptr->m_idx, dam);
3884 /* Anger monsters */
3885 if (((dam > 0) || get_angry) && !do_sleep)
3886 anger_monster(m_ptr);
3888 if ((fear || do_fear) && seen)
3891 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3894 /* Hack -- handle sleep */
3895 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3899 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3901 blood_curse_to_enemy(who);
3904 if (p_ptr->phase_out)
3906 p_ptr->health_who = g_ptr->m_idx;
3907 p_ptr->redraw |= (PR_HEALTH);
3911 /* Verify this code */
3912 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3914 /* Redraw the monster grid */
3917 /* Update monster recall window */
3918 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3920 p_ptr->window |= (PW_MONSTER);
3923 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3927 if (!(flg & PROJECT_NO_HANGEKI))
3929 set_target(m_ptr, monster_target_y, monster_target_x);
3932 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3934 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3938 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3940 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3941 rakubadam_m = (dam > 200) ? 200 : dam;
3951 /* Prepare to make a Blade of Chaos */
3952 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3954 q_ptr->pval = photo;
3956 /* Mark the item as fully known */
3957 q_ptr->ident |= (IDENT_MENTAL);
3958 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3966 /* Return "Anything seen?" */
3971 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3972 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3973 * @param who_name 効果を起こしたモンスターの名前
3974 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3975 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3976 * @param x 目標X座標 / Target x location (or location to travel "towards")
3977 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3978 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3980 * @param monspell 効果元のモンスター魔法ID
3981 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3983 * Handle a beam/bolt/ball causing damage to the player.
3984 * This routine takes a "source monster" (by index), a "distance", a default
3985 * "damage", and a "damage type". See "project_m()" above.
3986 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3987 * is reduced (see "project_m()" above). This can happen if a monster breathes
3988 * at the player and hits a wall instead.
3989 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3990 * to know if this is actually a ball or a bolt spell
3991 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3992 * we just assume that the effects were obvious, for historical reasons.
3994 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
3999 /* Hack -- assume obvious */
4000 bool obvious = TRUE;
4002 /* Player blind-ness */
4003 bool blind = (p_ptr->blind ? TRUE : FALSE);
4005 /* Player needs a "description" (he is blind) */
4008 /* Source monster */
4009 monster_type *m_ptr = NULL;
4011 /* Monster name (for attacks) */
4012 GAME_TEXT m_name[MAX_NLEN];
4014 /* Monster name (for damage) */
4017 /* Hack -- messages */
4023 /* Player is not here */
4024 if (!player_bold(y, x)) return (FALSE);
4026 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4028 if (kawarimi(TRUE)) return FALSE;
4031 /* Player cannot hurt himself */
4032 if (!who) return (FALSE);
4033 if (who == p_ptr->riding) return (FALSE);
4035 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4038 int max_attempts = 10;
4039 sound(SOUND_REFLECT);
4042 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4043 else if (p_ptr->special_defense & KATA_FUUJIN)
4044 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4046 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4049 /* Choose 'new' target */
4054 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
4055 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
4058 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4060 if (max_attempts < 1)
4062 t_y = current_floor_ptr->m_list[who].fy;
4063 t_x = current_floor_ptr->m_list[who].fx;
4068 t_y = p_ptr->y - 1 + randint1(3);
4069 t_x = p_ptr->x - 1 + randint1(3);
4072 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4074 disturb(p_ptr, TRUE, TRUE);
4078 /* Limit maximum damage */
4079 if (dam > 1600) dam = 1600;
4081 /* Reduce damage by distance */
4082 dam = (dam + r) / (r + 1);
4085 /* If the player is blind, be more descriptive */
4086 if (blind) fuzzy = TRUE;
4091 m_ptr = ¤t_floor_ptr->m_list[who];
4092 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4093 monster_desc(m_name, m_ptr, 0);
4095 /* Get the monster's real name (gotten before polymorph!) */
4096 strcpy(killer, who_name);
4102 case PROJECT_WHO_UNCTRL_POWER:
4103 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4106 case PROJECT_WHO_GLASS_SHARDS:
4107 strcpy(killer, _("ガラスの破片", "shards of glass"));
4111 strcpy(killer, _("罠", "a trap"));
4114 strcpy(m_name, killer);
4117 /* Analyze the damage */
4120 /* Standard damage -- hurts p_ptr->inventory_list too */
4123 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4124 get_damage = acid_dam(dam, killer, monspell, FALSE);
4128 /* Standard damage -- hurts p_ptr->inventory_list too */
4131 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4132 get_damage = fire_dam(dam, killer, monspell, FALSE);
4136 /* Standard damage -- hurts p_ptr->inventory_list too */
4139 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4140 get_damage = cold_dam(dam, killer, monspell, FALSE);
4144 /* Standard damage -- hurts p_ptr->inventory_list too */
4147 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4148 get_damage = elec_dam(dam, killer, monspell, FALSE);
4152 /* Standard damage -- also poisons player */
4155 bool double_resist = IS_OPPOSE_POIS();
4156 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4158 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4159 if (double_resist) dam = (dam + 2) / 3;
4161 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(p_ptr))
4163 do_dec_stat(p_ptr, A_CON);
4166 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4168 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW(p_ptr))
4170 set_poisoned(p_ptr, p_ptr->poisoned + randint0(dam) + 10);
4175 /* Standard damage -- also poisons / mutates player */
4178 bool double_resist = IS_OPPOSE_POIS();
4179 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4181 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4182 if (double_resist) dam = (2 * dam + 2) / 5;
4183 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4184 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW(p_ptr))
4186 set_poisoned(p_ptr, p_ptr->poisoned + randint0(dam) + 10);
4188 if (one_in_(5)) /* 6 */
4190 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4191 if (one_in_(4)) /* 4 */
4192 do_poly_self(p_ptr);
4194 status_shuffle(p_ptr);
4199 inven_damage(set_acid_destroy, 2);
4205 /* Standard damage */
4208 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4209 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4213 /* Holy Orb -- Player only takes partial damage */
4216 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4217 if (p_ptr->align > 10)
4219 else if (p_ptr->align < -10)
4221 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4227 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4228 if (p_ptr->align > 10)
4230 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4234 /* Arrow -- XXX no dodging */
4239 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4241 else if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (p_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
4243 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4246 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4250 /* Plasma -- XXX No resist */
4253 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4254 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4256 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW(p_ptr))
4258 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4259 (void)set_stun(p_ptr, p_ptr->stun + plus_stun);
4262 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4264 inven_damage(set_acid_destroy, 3);
4270 /* Nether -- drain experience */
4273 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4274 if (p_ptr->resist_neth)
4276 if (!PRACE_IS_(p_ptr, RACE_SPECTRE))
4278 dam *= 6; dam /= (randint1(4) + 7);
4281 else if (!CHECK_MULTISHADOW(p_ptr)) drain_exp(p_ptr, 200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4283 if (PRACE_IS_(p_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW(p_ptr))
4285 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4286 hp_player(p_ptr, dam / 4);
4287 learn_spell(monspell);
4291 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4297 /* Water -- stun/confuse */
4300 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4301 if (!CHECK_MULTISHADOW(p_ptr))
4303 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4305 set_stun(p_ptr, p_ptr->stun + randint1(40));
4307 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4309 set_confused(p_ptr, p_ptr->confused + randint1(5) + 5);
4312 if (one_in_(5) && !p_ptr->resist_water)
4314 inven_damage(set_cold_destroy, 3);
4317 if (p_ptr->resist_water) get_damage /= 4;
4320 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4324 /* Chaos -- many effects */
4327 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4328 if (p_ptr->resist_chaos)
4330 dam *= 6; dam /= (randint1(4) + 7);
4333 if (!CHECK_MULTISHADOW(p_ptr))
4335 if (!p_ptr->resist_conf)
4337 (void)set_confused(p_ptr, p_ptr->confused + randint0(20) + 10);
4339 if (!p_ptr->resist_chaos)
4341 (void)set_image(p_ptr, p_ptr->image + randint1(10));
4344 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4345 (void)gain_mutation(p_ptr, 0);
4348 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4350 drain_exp(p_ptr, 5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4353 if (!p_ptr->resist_chaos || one_in_(9))
4355 inven_damage(set_elec_destroy, 2);
4356 inven_damage(set_fire_destroy, 2);
4360 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4364 /* Shards -- mostly cutting */
4367 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4368 if (p_ptr->resist_shard)
4370 dam *= 6; dam /= (randint1(4) + 7);
4372 else if (!CHECK_MULTISHADOW(p_ptr))
4374 (void)set_cut(p_ptr,p_ptr->cut + dam);
4377 if (!p_ptr->resist_shard || one_in_(13))
4379 inven_damage(set_cold_destroy, 2);
4382 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4386 /* Sound -- mostly stunning */
4389 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4390 if (p_ptr->resist_sound)
4392 dam *= 5; dam /= (randint1(4) + 7);
4394 else if (!CHECK_MULTISHADOW(p_ptr))
4396 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4397 (void)set_stun(p_ptr, p_ptr->stun + plus_stun);
4400 if (!p_ptr->resist_sound || one_in_(13))
4402 inven_damage(set_cold_destroy, 2);
4405 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4409 /* Pure confusion */
4412 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4413 if (p_ptr->resist_conf)
4415 dam *= 5; dam /= (randint1(4) + 7);
4417 else if (!CHECK_MULTISHADOW(p_ptr))
4419 (void)set_confused(p_ptr, p_ptr->confused + randint1(20) + 10);
4421 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4425 /* Disenchantment -- see above */
4428 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4429 if (p_ptr->resist_disen)
4431 dam *= 6; dam /= (randint1(4) + 7);
4433 else if (!CHECK_MULTISHADOW(p_ptr))
4435 (void)apply_disenchant(0);
4437 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4441 /* Nexus -- see above */
4444 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4445 if (p_ptr->resist_nexus)
4447 dam *= 6; dam /= (randint1(4) + 7);
4449 else if (!CHECK_MULTISHADOW(p_ptr))
4453 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4457 /* Force -- mostly stun */
4460 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4461 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW(p_ptr))
4463 (void)set_stun(p_ptr, p_ptr->stun + randint1(20));
4465 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4470 /* Rocket -- stun, cut */
4473 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4474 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW(p_ptr))
4476 (void)set_stun(p_ptr, p_ptr->stun + randint1(20));
4479 if (p_ptr->resist_shard)
4483 else if (!CHECK_MULTISHADOW(p_ptr))
4485 (void)set_cut(p_ptr,p_ptr->cut + (dam / 2));
4488 if (!p_ptr->resist_shard || one_in_(12))
4490 inven_damage(set_cold_destroy, 3);
4493 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4497 /* Inertia -- slowness */
4500 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4501 if (!CHECK_MULTISHADOW(p_ptr)) (void)set_slow(p_ptr, p_ptr->slow + randint0(4) + 4, FALSE);
4502 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4506 /* Lite -- blinding */
4509 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4510 if (p_ptr->resist_lite)
4512 dam *= 4; dam /= (randint1(4) + 7);
4514 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW(p_ptr))
4516 (void)set_blind(p_ptr, p_ptr->blind + randint1(5) + 2);
4519 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4521 if (!CHECK_MULTISHADOW(p_ptr)) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4524 else if (PRACE_IS_(p_ptr, RACE_S_FAIRY))
4529 if (p_ptr->wraith_form) dam *= 2;
4530 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4532 if (p_ptr->wraith_form && !CHECK_MULTISHADOW(p_ptr))
4534 p_ptr->wraith_form = 0;
4535 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4536 "The light forces you out of your incorporeal shadow form."));
4538 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4539 p_ptr->update |= (PU_MONSTERS);
4540 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4546 /* Dark -- blinding */
4549 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4550 if (p_ptr->resist_dark)
4552 dam *= 4; dam /= (randint1(4) + 7);
4554 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4556 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW(p_ptr))
4558 (void)set_blind(p_ptr, p_ptr->blind + randint1(5) + 2);
4560 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4564 /* Time -- bolt fewer effects XXX */
4567 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4568 if (p_ptr->resist_time)
4571 dam /= (randint1(4) + 7);
4572 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4574 else if (!CHECK_MULTISHADOW(p_ptr))
4576 switch (randint1(10))
4578 case 1: case 2: case 3: case 4: case 5:
4580 if (p_ptr->prace == RACE_ANDROID) break;
4581 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4582 lose_exp(p_ptr, 100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4586 case 6: case 7: case 8: case 9:
4588 switch (randint1(6))
4590 case 1: k = A_STR; act = _("強く", "strong"); break;
4591 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4592 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4593 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4594 case 5: k = A_CON; act = _("健康で", "hale"); break;
4595 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4598 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4599 "You're not as %s as you used to be..."), act);
4601 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4602 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4603 p_ptr->update |= (PU_BONUS);
4609 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4610 "You're not as powerful as you used to be..."));
4612 for (k = 0; k < A_MAX; k++)
4614 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4615 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4617 p_ptr->update |= (PU_BONUS);
4623 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4627 /* Gravity -- stun plus slowness plus teleport */
4630 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4631 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4633 if (!CHECK_MULTISHADOW(p_ptr))
4635 teleport_player(5, TELEPORT_PASSIVE);
4636 if (!p_ptr->levitation)
4637 (void)set_slow(p_ptr, p_ptr->slow + randint0(4) + 4, FALSE);
4638 if (!(p_ptr->resist_sound || p_ptr->levitation))
4640 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4641 (void)set_stun(p_ptr, p_ptr->stun + plus_stun);
4644 if (p_ptr->levitation)
4646 dam = (dam * 2) / 3;
4649 if (!p_ptr->levitation || one_in_(13))
4651 inven_damage(set_cold_destroy, 2);
4654 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4658 /* Standard damage */
4659 case GF_DISINTEGRATE:
4661 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4663 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4669 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4671 (void)hp_player(p_ptr, dam);
4678 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4679 (void)set_fast(p_ptr, p_ptr->fast + randint1(5), FALSE);
4686 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4687 (void)set_slow(p_ptr, p_ptr->slow + randint0(4) + 4, FALSE);
4693 if (p_ptr->free_act) break;
4694 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4696 if (ironman_nightmare)
4698 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4699 /* Have some nightmares */
4700 sanity_blast(p_ptr, NULL, FALSE);
4703 set_paralyzed(p_ptr, p_ptr->paralyzed + dam);
4713 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4714 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4721 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4722 get_damage = take_hit(p_ptr, DAMAGE_FORCE, dam, killer, monspell);
4729 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4731 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4732 if (!p_ptr->resist_shard || one_in_(13))
4734 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4735 inven_damage(set_cold_destroy, 2);
4741 /* Ice -- cold plus stun plus cuts */
4744 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4745 get_damage = cold_dam(dam, killer, monspell, FALSE);
4746 if (!CHECK_MULTISHADOW(p_ptr))
4748 if (!p_ptr->resist_shard)
4750 (void)set_cut(p_ptr,p_ptr->cut + damroll(5, 8));
4752 if (!p_ptr->resist_sound)
4754 (void)set_stun(p_ptr, p_ptr->stun + randint1(15));
4757 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4759 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4769 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4771 if (p_ptr->mimic_form)
4773 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4774 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4779 switch (p_ptr->prace)
4781 /* Some races are immune */
4795 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4807 if (CHECK_MULTISHADOW(p_ptr))
4809 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4811 else if (p_ptr->csp)
4815 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4817 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4820 if (dam >= p_ptr->csp)
4824 p_ptr->csp_frac = 0;
4833 learn_spell(monspell);
4834 p_ptr->redraw |= (PR_MANA);
4835 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4839 /* Heal the monster */
4840 if (m_ptr->hp < m_ptr->maxhp)
4844 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4846 /* Redraw (later) if needed */
4847 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4848 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4850 /* Special message */
4853 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4866 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW(p_ptr))
4868 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4869 learn_spell(monspell);
4873 if (!CHECK_MULTISHADOW(p_ptr))
4875 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4877 if (!p_ptr->resist_conf)
4879 (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
4882 if (!p_ptr->resist_chaos && one_in_(3))
4884 (void)set_image(p_ptr, p_ptr->image + randint0(250) + 150);
4891 p_ptr->csp_frac = 0;
4893 p_ptr->redraw |= PR_MANA;
4896 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4902 case GF_BRAIN_SMASH:
4904 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW(p_ptr))
4906 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4907 learn_spell(monspell);
4911 if (!CHECK_MULTISHADOW(p_ptr))
4913 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4919 p_ptr->csp_frac = 0;
4921 p_ptr->redraw |= PR_MANA;
4924 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4925 if (!CHECK_MULTISHADOW(p_ptr))
4927 if (!p_ptr->resist_blind)
4929 (void)set_blind(p_ptr, p_ptr->blind + 8 + randint0(8));
4931 if (!p_ptr->resist_conf)
4933 (void)set_confused(p_ptr, p_ptr->confused + randint0(4) + 4);
4935 if (!p_ptr->free_act)
4937 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + randint0(4) + 4);
4939 (void)set_slow(p_ptr, p_ptr->slow + randint0(4) + 4, FALSE);
4941 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4942 (void)do_dec_stat(p_ptr, A_INT);
4943 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4944 (void)do_dec_stat(p_ptr, A_WIS);
4946 if (!p_ptr->resist_chaos)
4948 (void)set_image(p_ptr, p_ptr->image + randint0(250) + 150);
4958 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
4960 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4961 learn_spell(monspell);
4965 if (!CHECK_MULTISHADOW(p_ptr)) curse_equipment(15, 0);
4966 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4974 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
4976 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4977 learn_spell(monspell);
4981 if (!CHECK_MULTISHADOW(p_ptr)) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4982 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4990 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
4992 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4993 learn_spell(monspell);
4997 if (!CHECK_MULTISHADOW(p_ptr)) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4998 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
5006 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(p_ptr))
5008 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5009 learn_spell(monspell);
5013 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, killer, monspell);
5014 if (!CHECK_MULTISHADOW(p_ptr)) (void)set_cut(p_ptr,p_ptr->cut + damroll(10, 10));
5022 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW(p_ptr))
5024 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5025 learn_spell(monspell);
5029 if (!CHECK_MULTISHADOW(p_ptr))
5031 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5032 curse_equipment(40, 20);
5035 get_damage = take_hit(p_ptr, DAMAGE_ATTACK, dam, m_name, monspell);
5037 if (p_ptr->chp < 1) p_ptr->chp = 1;
5052 /* Hex - revenge damage stored */
5053 revenge_store(get_damage);
5055 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5056 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5058 GAME_TEXT m_name_self[80];
5061 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5063 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5064 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5065 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr, p_ptr->tim_eyeeye-5, TRUE);
5068 if (p_ptr->riding && dam > 0)
5070 rakubadam_p = (dam > 200) ? 200 : dam;
5074 disturb(p_ptr, TRUE, TRUE);
5077 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5079 (void)kawarimi(FALSE);
5082 /* Return "Anything seen?" */
5088 * Find the distance from (x, y) to a line.
5090 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5092 /* Vector from (x, y) to (x1, y1) */
5093 POSITION py = y1 - y;
5094 POSITION px = x1 - x;
5097 POSITION ny = x2 - x1;
5098 POSITION nx = y1 - y2;
5101 POSITION pd = distance(y1, x1, y, x);
5102 POSITION nd = distance(y1, x1, y2, x2);
5104 if (pd > nd) return distance(y, x, y2, x2);
5106 /* Component of P on N */
5107 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5109 /* Absolute value */
5110 return((nd >= 0) ? nd : 0 - nd);
5117 * Modified version of los() for calculation of disintegration balls.
5118 * Disintegration effects are stopped by permanent walls.
5120 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5122 POSITION dx, dy; /* Delta */
5123 POSITION ax, ay; /* Absolute */
5124 POSITION sx, sy; /* Signs */
5125 POSITION qx, qy; /* Fractions */
5126 POSITION tx, ty; /* Scanners */
5127 POSITION f1, f2; /* Scale factors */
5128 POSITION m; /* Slope, or 1/Slope, of LOS */
5130 /* Extract the offset */
5134 /* Extract the absolute offset */
5138 /* Handle adjacent (or identical) grids */
5139 if ((ax < 2) && (ay < 2)) return (TRUE);
5141 /* Paranoia -- require "safe" origin */
5142 /* if (!in_bounds(y1, x1)) return (FALSE); */
5144 /* Directly South/North */
5147 /* South -- check for walls */
5150 for (ty = y1 + 1; ty < y2; ty++)
5152 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5156 /* North -- check for walls */
5159 for (ty = y1 - 1; ty > y2; ty--)
5161 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5169 /* Directly East/West */
5172 /* East -- check for walls */
5175 for (tx = x1 + 1; tx < x2; tx++)
5177 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5181 /* West -- check for walls */
5184 for (tx = x1 - 1; tx > x2; tx--)
5186 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5194 /* Extract some signs */
5195 sx = (dx < 0) ? -1 : 1;
5196 sy = (dy < 0) ? -1 : 1;
5198 /* Vertical "knights" */
5203 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5207 /* Horizontal "knights" */
5212 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5216 /* Calculate scale factor div 2 */
5219 /* Calculate scale factor */
5223 /* Travel horizontally */
5226 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5232 /* Consider the special case where slope == 1. */
5243 /* Note (below) the case (qy == f2), where */
5244 /* the LOS exactly meets the corner of a tile. */
5247 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5258 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5271 /* Travel vertically */
5274 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5290 /* Note (below) the case (qx == f2), where */
5291 /* the LOS exactly meets the corner of a tile. */
5294 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5305 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5326 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
5331 int brev = rad * rad / dist;
5335 int mdis = distance(y1, x1, y2, x2) + rad;
5337 while (bdis <= mdis)
5341 if ((0 < dist) && (path_n < dist))
5343 POSITION ny = GRID_Y(path_g[path_n]);
5344 POSITION nx = GRID_X(path_g[path_n]);
5345 POSITION nd = distance(ny, nx, y1, x1);
5347 /* Get next base point */
5356 /* Travel from center outward */
5357 for (cdis = 0; cdis <= brad; cdis++)
5359 /* Scan the maximal blast area of radius "cdis" */
5360 for (y = by - cdis; y <= by + cdis; y++)
5362 for (x = bx - cdis; x <= bx + cdis; x++)
5364 /* Ignore "illegal" locations */
5365 if (!in_bounds(y, x)) continue;
5367 /* Enforce a circular "ripple" */
5368 if (distance(y1, x1, y, x) != bdis) continue;
5370 /* Enforce an arc */
5371 if (distance(by, bx, y, x) != cdis) continue;
5377 /* Lights are stopped by opaque terrains */
5378 if (!los(by, bx, y, x)) continue;
5380 case GF_DISINTEGRATE:
5381 /* Disintegration are stopped only by perma-walls */
5382 if (!in_disintegration_range(by, bx, y, x)) continue;
5385 /* Ball explosions are stopped by walls */
5386 if (!projectable(by, bx, y, x)) continue;
5390 /* Save this grid */
5398 /* Encode some more "radius" info */
5399 gm[bdis + 1] = *pgrids;
5401 /* Increase the size */
5402 brad = rad * (path_n + brev) / (dist + brev);
5404 /* Find the next ripple */
5408 /* Store the effect size */
5414 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5415 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5416 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5417 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5418 * @param x 目標X座標 / Target x location (or location to travel "towards")
5419 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5420 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5421 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx)
5422 * @param monspell 効果元のモンスター魔法ID
5423 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5426 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5427 * towards a given location (optionally passing over the heads of interposing
5428 * monsters), and have it do a given amount of damage to the monsters (and
5429 * optionally objects) within the given radius of the final location.
5431 * A "bolt" travels from source to target and affects only the target grid.
5432 * A "beam" travels from source to target, affecting all grids passed through.
5433 * A "ball" travels from source to the target, exploding at the target, and
5434 * affecting everything within the given radius of the target location.
5436 * Traditionally, a "bolt" does not affect anything on the ground, and does
5437 * not pass over the heads of interposing monsters, much like a traditional
5438 * missile, and will "stop" abruptly at the "target" even if no monster is
5439 * positioned there, while a "ball", on the other hand, passes over the heads
5440 * of monsters between the source and target, and affects everything except
5441 * the source monster which lies within the final radius, while a "beam"
5442 * affects every monster between the source and target, except for the casting
5443 * monster (or player), and rarely affects things on the ground.
5445 * Two special flags allow us to use this function in special ways, the
5446 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5447 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5448 * actually projecting from the source monster (or player).
5450 * The player will only get "experience" for monsters killed by himself
5451 * Unique monsters can only be destroyed by attacks from the player
5453 * Only 256 grids can be affected per projection, limiting the effective
5454 * "radius" of standard ball attacks to nine units (diameter nineteen).
5456 * One can project in a given "direction" by combining PROJECT_THRU with small
5457 * offsets to the initial location (see "line_spell()"), or by calculating
5458 * "virtual targets" far away from the player.
5460 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5461 * continuing until it actually hits somethings (useful for "stone to mud").
5463 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5465 * Balls must explode BEFORE hitting walls, or they would affect monsters
5466 * on both sides of a wall. Some bug reports indicate that this is still
5467 * happening in 2.7.8 for Windows, though it appears to be impossible.
5469 * We "pre-calculate" the blast area only in part for efficiency.
5470 * More importantly, this lets us do "explosions" from the "inside" out.
5471 * This results in a more logical distribution of "blast" treasure.
5472 * It also produces a better (in my opinion) animation of the explosion.
5473 * It could be (but is not) used to have the treasure dropped by monsters
5474 * in the middle of the explosion fall "outwards", and then be damaged by
5475 * the blast as it spreads outwards towards the treasure drop location.
5477 * Walls and doors are included in the blast area, so that they can be
5478 * "burned" or "melted" in later versions.
5480 * This algorithm is intended to maximize simplicity, not necessarily
5481 * efficiency, since this function is not a bottleneck in the code.
5483 * We apply the blast effect from ground zero outwards, in several passes,
5484 * first affecting features, then objects, then monsters, then the player.
5485 * This allows walls to be removed before checking the object or monster
5486 * in the wall, and protects objects which are dropped by monsters killed
5487 * in the blast, and allows the player to see all affects before he is
5488 * killed or teleported away. The semantics of this method are open to
5489 * various interpretations, but they seem to work well in practice.
5491 * We process the blast area from ground-zero outwards to allow for better
5492 * distribution of treasure dropped by monsters, and because it provides a
5493 * pleasing visual effect at low cost.
5495 * Note that the damage done by "ball" explosions decreases with distance.
5496 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5498 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5499 * the target, and then the damage "flows" along this beam of destruction.
5500 * The damage at every grid is the same as at the "center" of a "ball"
5501 * explosion, since the "beam" grids are treated as if they ARE at the
5502 * center of a "ball" explosion.
5504 * Currently, specifying "beam" plus "ball" means that locations which are
5505 * covered by the initial "beam", and also covered by the final "ball", except
5506 * for the final grid (the epicenter of the ball), will be "hit twice", once
5507 * by the initial beam, and once by the exploding ball. For the grid right
5508 * next to the epicenter, this results in 150% damage being done. The center
5509 * does not have this problem, for the same reason the final grid in a "beam"
5510 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5511 * grids which are covered by the "ball" will NOT work, as then they will
5512 * receive LESS damage than they should. Do not combine "beam" with "ball".
5514 * The array "gy[],gx[]" with current size "grids" is used to hold the
5515 * collected locations of all grids in the "blast area" plus "beam path".
5517 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5518 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5519 * first blast grid (see above) with radius "N" from the blast center. Note
5520 * that only the first gm[1] grids in the blast area thus take full damage.
5521 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5522 * number of blast grids.
5524 * Note that once the projection is complete, (y2,x2) holds the final location
5525 * of bolts/beams, and the "epicenter" of balls.
5527 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5528 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5529 * implementation of the "distance" function. Also, a bolt can be properly
5530 * viewed as a "ball" with a "rad" of "zero".
5532 * Note that if no "target" is reached before the beam/bolt/ball travels the
5533 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5534 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5536 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5537 * to move from point A to point B, even if the player cannot see part of the
5538 * projection path. Note that in general, the player will *always* see part
5539 * of the path, since it either starts at the player or ends on the player.
5541 * Hack -- we assume that every "projection" is "self-illuminating".
5543 * Hack -- when only a single monster is affected, we automatically track
5544 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5546 * Note that all projections now "explode" at their final destination, even
5547 * if they were being projected at a more distant destination. This means
5548 * that "ball" spells will *always* explode.
5550 * Note that we must call "handle_stuff()" after affecting terrain features
5551 * in the blast radius, in case the "illumination" of the grid was changed,
5552 * and "update_view()" and "update_monsters()" need to be called.
5555 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5565 POSITION y_saver, x_saver; /* For reflecting monsters */
5567 int msec = delay_factor * delay_factor * delay_factor;
5569 /* Assume the player sees nothing */
5570 bool notice = FALSE;
5572 /* Assume the player has seen nothing */
5573 bool visual = FALSE;
5575 /* Assume the player has seen no blast grids */
5578 /* Assume to be a normal ball spell */
5579 bool breath = FALSE;
5581 /* Is the player blind? */
5582 bool blind = (p_ptr->blind ? TRUE : FALSE);
5584 bool old_hide = FALSE;
5586 /* Number of grids in the "path" */
5589 /* Actual grids in the "path" */
5592 /* Number of grids in the "blast area" (including the "beam" path) */
5595 /* Coordinates of the affected grids */
5596 POSITION gx[1024], gy[1024];
5598 /* Encoded "radius" info (see above) */
5601 /* Actual radius encoded in gm[] */
5602 POSITION gm_rad = rad;
5606 /* Attacker's name (prepared before polymorph)*/
5607 GAME_TEXT who_name[MAX_NLEN];
5609 /* Can the player see the source of this effect? */
5610 bool see_s_msg = TRUE;
5612 /* Initialize by null string */
5618 /* Default target of monsterspell is player */
5619 monster_target_y = p_ptr->y;
5620 monster_target_x = p_ptr->x;
5622 /* Hack -- Jump to target */
5623 if (flg & (PROJECT_JUMP))
5628 /* Clear the flag */
5629 flg &= ~(PROJECT_JUMP);
5634 /* Start at player */
5641 /* Start at monster */
5644 x1 = current_floor_ptr->m_list[who].fx;
5645 y1 = current_floor_ptr->m_list[who].fy;
5646 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_WRONGDOER_NAME);
5658 /* Default "destination" */
5663 /* Hack -- verify stuff */
5664 if (flg & (PROJECT_THRU))
5666 if ((x1 == x2) && (y1 == y2))
5668 flg &= ~(PROJECT_THRU);
5672 /* Handle a breath attack */
5677 if (flg & PROJECT_HIDE) old_hide = TRUE;
5678 flg |= PROJECT_HIDE;
5682 /* Hack -- Assume there will be no blast (max radius 32) */
5683 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5691 /* Collect beam grids */
5692 if (flg & (PROJECT_BEAM))
5703 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5705 case GF_DISINTEGRATE:
5706 flg |= (PROJECT_GRID);
5707 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5711 /* Calculate the projection path */
5713 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5716 /* Giga-Hack SEEKER & SUPER_RAY */
5718 if( typ == GF_SEEKER )
5728 for (i = 0; i < path_n; ++i)
5733 POSITION ny = GRID_Y(path_g[i]);
5734 POSITION nx = GRID_X(path_g[i]);
5745 /* Only do visuals if requested */
5746 if (!blind && !(flg & (PROJECT_HIDE)))
5748 /* Only do visuals if the player can "see" the bolt */
5749 if (panel_contains(y, x) && player_has_los_bold(y, x))
5756 /* Obtain the bolt pict */
5757 p = bolt_pict(oy, ox, y, x, typ);
5759 /* Extract attr/char */
5763 /* Visual effects */
5764 print_rel(c, a, y, x);
5765 move_cursor_relative(y, x);
5766 /*if (fresh_before)*/ Term_fresh();
5767 Term_xtra(TERM_XTRA_DELAY, msec);
5769 /*if (fresh_before)*/ Term_fresh();
5771 /* Display "beam" grids */
5772 if (flg & (PROJECT_BEAM))
5774 /* Obtain the explosion pict */
5775 p = bolt_pict(y, x, y, x, typ);
5777 /* Extract attr/char */
5781 /* Visual effects */
5782 print_rel(c, a, y, x);
5785 /* Hack -- Activate delay */
5789 /* Hack -- delay anyway for consistency */
5792 /* Delay for consistency */
5793 Term_xtra(TERM_XTRA_DELAY, msec);
5796 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5797 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5799 /* The target of monsterspell becomes tha mirror(broken) */
5800 monster_target_y = y;
5801 monster_target_x = x;
5803 remove_mirror(y, x);
5804 next_mirror(&oy, &ox, y, x);
5806 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5807 for (j = last_i; j <= i; j++)
5809 y = GRID_Y(path_g[j]);
5810 x = GRID_X(path_g[j]);
5811 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5812 if (!who && (project_m_n == 1) && !jump) {
5813 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5814 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5818 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5819 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5823 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5828 for(i = last_i ; i < path_n ; i++)
5831 py = GRID_Y(path_g[i]);
5832 px = GRID_X(path_g[i]);
5833 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5835 if (!who && (project_m_n == 1) && !jump) {
5836 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5838 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5842 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5843 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5847 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5851 else if(typ == GF_SUPER_RAY){
5853 int second_step = 0;
5860 for (i = 0; i < path_n; ++i)
5865 POSITION ny = GRID_Y(path_g[i]);
5866 POSITION nx = GRID_X(path_g[i]);
5877 /* Only do visuals if requested */
5878 if (!blind && !(flg & (PROJECT_HIDE)))
5880 /* Only do visuals if the player can "see" the bolt */
5881 if (panel_contains(y, x) && player_has_los_bold(y, x))
5888 /* Obtain the bolt pict */
5889 p = bolt_pict(oy, ox, y, x, typ);
5891 /* Extract attr/char */
5895 /* Visual effects */
5896 print_rel(c, a, y, x);
5897 move_cursor_relative(y, x);
5898 /*if (fresh_before)*/ Term_fresh();
5899 Term_xtra(TERM_XTRA_DELAY, msec);
5901 /*if (fresh_before)*/ Term_fresh();
5903 /* Display "beam" grids */
5904 if (flg & (PROJECT_BEAM))
5906 /* Obtain the explosion pict */
5907 p = bolt_pict(y, x, y, x, typ);
5909 /* Extract attr/char */
5913 /* Visual effects */
5914 print_rel(c, a, y, x);
5917 /* Hack -- Activate delay */
5921 /* Hack -- delay anyway for consistency */
5924 /* Delay for consistency */
5925 Term_xtra(TERM_XTRA_DELAY, msec);
5928 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5929 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5931 if( second_step )continue;
5934 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5936 /* The target of monsterspell becomes tha mirror(broken) */
5937 monster_target_y = y;
5938 monster_target_x = x;
5941 for( j = 0; j <=i ; j++ )
5943 y = GRID_Y(path_g[j]);
5944 x = GRID_X(path_g[j]);
5945 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5949 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5950 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5951 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5952 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5953 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5954 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
5955 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5956 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5959 for( i = 0; i < path_n ; i++ )
5962 py = GRID_Y(path_g[i]);
5963 px = GRID_X(path_g[i]);
5964 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5965 if(!who && (project_m_n == 1) && !jump){
5966 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5967 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5971 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5972 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5976 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5981 /* Project along the path */
5982 for (i = 0; i < path_n; ++i)
5987 POSITION ny = GRID_Y(path_g[i]);
5988 POSITION nx = GRID_X(path_g[i]);
5990 if (flg & PROJECT_DISI)
5992 /* Hack -- Balls explode before reaching walls */
5993 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5995 else if (flg & PROJECT_LOS)
5997 /* Hack -- Balls explode before reaching walls */
5998 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6002 /* Hack -- Balls explode before reaching walls */
6003 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6010 /* Collect beam grids */
6011 if (flg & (PROJECT_BEAM))
6018 /* Only do visuals if requested */
6019 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6021 /* Only do visuals if the player can "see" the bolt */
6022 if (panel_contains(y, x) && player_has_los_bold(y, x))
6029 /* Obtain the bolt pict */
6030 p = bolt_pict(oy, ox, y, x, typ);
6032 /* Extract attr/char */
6036 /* Visual effects */
6037 print_rel(c, a, y, x);
6038 move_cursor_relative(y, x);
6039 /*if (fresh_before)*/ Term_fresh();
6040 Term_xtra(TERM_XTRA_DELAY, msec);
6042 /*if (fresh_before)*/ Term_fresh();
6044 /* Display "beam" grids */
6045 if (flg & (PROJECT_BEAM))
6047 /* Obtain the explosion pict */
6048 p = bolt_pict(y, x, y, x, typ);
6050 /* Extract attr/char */
6054 /* Visual effects */
6055 print_rel(c, a, y, x);
6058 /* Hack -- Activate delay */
6062 /* Hack -- delay anyway for consistency */
6065 /* Delay for consistency */
6066 Term_xtra(TERM_XTRA_DELAY, msec);
6073 /* Save the "blast epicenter" */
6077 if (breath && !path_n)
6083 flg &= ~(PROJECT_HIDE);
6087 /* Start the "explosion" */
6090 /* Hack -- make sure beams get to "explode" */
6098 /* If we found a "target", explode there */
6099 if (dist <= MAX_RANGE)
6101 /* Mega-Hack -- remove the final "beam" grid */
6102 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6105 * Create a conical breath attack
6116 flg &= ~(PROJECT_HIDE);
6118 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6122 /* Determine the blast area, work from the inside out */
6123 for (dist = 0; dist <= rad; dist++)
6125 /* Scan the maximal blast area of radius "dist" */
6126 for (y = by - dist; y <= by + dist; y++)
6128 for (x = bx - dist; x <= bx + dist; x++)
6130 /* Ignore "illegal" locations */
6131 if (!in_bounds2(y, x)) continue;
6133 /* Enforce a "circular" explosion */
6134 if (distance(by, bx, y, x) != dist) continue;
6140 /* Lights are stopped by opaque terrains */
6141 if (!los(by, bx, y, x)) continue;
6143 case GF_DISINTEGRATE:
6144 /* Disintegration are stopped only by perma-walls */
6145 if (!in_disintegration_range(by, bx, y, x)) continue;
6148 /* Ball explosions are stopped by walls */
6149 if (!projectable(by, bx, y, x)) continue;
6153 /* Save this grid */
6160 /* Encode some more "radius" info */
6166 /* Speed -- ignore "non-explosions" */
6167 if (!grids) return (FALSE);
6170 /* Display the "blast area" if requested */
6171 if (!blind && !(flg & (PROJECT_HIDE)))
6173 /* Then do the "blast", from inside out */
6174 for (t = 0; t <= gm_rad; t++)
6176 /* Dump everything with this radius */
6177 for (i = gm[t]; i < gm[t+1]; i++)
6182 /* Only do visuals if the player can "see" the blast */
6183 if (panel_contains(y, x) && player_has_los_bold(y, x))
6192 /* Obtain the explosion pict */
6193 p = bolt_pict(y, x, y, x, typ);
6195 /* Extract attr/char */
6199 /* Visual effects -- Display */
6200 print_rel(c, a, y, x);
6204 /* Hack -- center the cursor */
6205 move_cursor_relative(by, bx);
6207 /* Flush each "radius" seperately */
6208 /*if (fresh_before)*/ Term_fresh();
6210 /* Delay (efficiently) */
6211 if (visual || drawn)
6213 Term_xtra(TERM_XTRA_DELAY, msec);
6217 /* Flush the erasing */
6220 /* Erase the explosion drawn above */
6221 for (i = 0; i < grids; i++)
6226 /* Hack -- Erase if needed */
6227 if (panel_contains(y, x) && player_has_los_bold(y, x))
6233 /* Hack -- center the cursor */
6234 move_cursor_relative(by, bx);
6236 /* Flush the explosion */
6237 /*if (fresh_before)*/ Term_fresh();
6241 update_creature(p_ptr);
6243 if (flg & PROJECT_KILL)
6245 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6246 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6250 /* Check features */
6251 if (flg & (PROJECT_GRID))
6253 /* Start with "dist" of zero */
6256 /* Scan for features */
6257 for (i = 0; i < grids; i++)
6259 /* Hack -- Notice new "dist" values */
6260 if (gm[dist+1] == i) dist++;
6262 /* Get the grid location */
6266 /* Find the closest point in the blast */
6269 int d = dist_to_line(y, x, y1, x1, by, bx);
6271 /* Affect the grid */
6272 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6276 /* Affect the grid */
6277 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6282 update_creature(p_ptr);
6285 if (flg & (PROJECT_ITEM))
6287 /* Start with "dist" of zero */
6290 /* Scan for objects */
6291 for (i = 0; i < grids; i++)
6293 /* Hack -- Notice new "dist" values */
6294 if (gm[dist+1] == i) dist++;
6296 /* Get the grid location */
6300 /* Find the closest point in the blast */
6303 int d = dist_to_line(y, x, y1, x1, by, bx);
6305 /* Affect the object in the grid */
6306 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6310 /* Affect the object in the grid */
6311 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6317 /* Check monsters */
6318 if (flg & (PROJECT_KILL))
6325 /* Start with "dist" of zero */
6328 /* Scan for monsters */
6329 for (i = 0; i < grids; i++)
6333 /* Hack -- Notice new "dist" values */
6334 if (gm[dist + 1] == i) dist++;
6336 /* Get the grid location */
6340 /* A single bolt may be reflected */
6343 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6344 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6346 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6347 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6348 (!who || dist_hack > 1) && !one_in_(10))
6351 int max_attempts = 10;
6353 /* Choose 'new' target */
6356 t_y = y_saver - 1 + randint1(3);
6357 t_x = x_saver - 1 + randint1(3);
6360 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6362 if (max_attempts < 1)
6368 sound(SOUND_REFLECT);
6371 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6372 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6373 else if (m_ptr->r_idx == MON_DIO)
6374 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6376 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6378 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6380 /* Reflected bolts randomly target either one */
6381 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6382 else flg |= PROJECT_PLAYER;
6384 /* The bolt is reflected */
6385 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6387 /* Don't affect the monster any longer */
6393 /* Find the closest point in the blast */
6396 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6400 effective_dist = dist;
6404 /* There is the riding player on this monster */
6405 if (p_ptr->riding && player_bold(y, x))
6407 /* Aimed on the player */
6408 if (flg & PROJECT_PLAYER)
6410 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6413 * A beam or bolt is well aimed
6415 * So don't affects the mount.
6422 * The spell is not well aimed,
6423 * So partly affect the mount too.
6430 * This grid is the original target.
6431 * Or aimed on your horse.
6433 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6435 /* Hit the mount with full damage */
6439 * Otherwise this grid is not the
6440 * original target, it means that line
6441 * of fire is obstructed by this
6445 * A beam or bolt will hit either
6446 * player or mount. Choose randomly.
6448 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6452 /* Hit the mount with full damage */
6456 /* Hit the player later */
6457 flg |= PROJECT_PLAYER;
6459 /* Don't affect the mount */
6465 * The spell is not well aimed, so
6466 * partly affect both player and
6475 /* Affect the monster in the grid */
6476 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6480 /* Player affected one monster (without "jumping") */
6481 if (!who && (project_m_n == 1) && !jump)
6486 /* Track if possible */
6487 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6489 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6493 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6494 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6502 if (flg & (PROJECT_KILL))
6504 /* Start with "dist" of zero */
6507 /* Scan for player */
6508 for (i = 0; i < grids; i++)
6512 /* Hack -- Notice new "dist" values */
6513 if (gm[dist+1] == i) dist++;
6515 /* Get the grid location */
6519 /* Affect the player? */
6520 if (!player_bold(y, x)) continue;
6522 /* Find the closest point in the blast */
6525 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6529 effective_dist = dist;
6532 /* Target may be your horse */
6535 /* Aimed on the player */
6536 if (flg & PROJECT_PLAYER)
6538 /* Hit the player with full damage */
6542 * Hack -- When this grid was not the
6543 * original target, a beam or bolt
6544 * would hit either player or mount,
6545 * and should be choosen randomly.
6547 * But already choosen to hit the
6548 * mount at this point.
6550 * Or aimed on your horse.
6552 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6555 * A beam or bolt is well aimed
6557 * So don't affects the player.
6564 * The spell is not well aimed,
6565 * So partly affect the player too.
6571 /* Affect the player */
6572 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6578 GAME_TEXT m_name[MAX_NLEN];
6580 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6582 if (rakubadam_m > 0)
6584 if (rakuba(p_ptr, rakubadam_m, FALSE))
6586 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6589 if (p_ptr->riding && rakubadam_p > 0)
6591 if(rakuba(p_ptr, rakubadam_p, FALSE))
6593 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6598 /* Return "something was noticed" */
6603 * @brief 鏡魔法「封魔結界」の効果処理
6605 * @return 効果があったらTRUEを返す
6607 bool binding_field(HIT_POINT dam)
6609 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6610 int mirror_num = 0; /* 鏡の数 */
6612 POSITION centersign;
6613 POSITION x1, x2, y1, y2;
6615 int msec = delay_factor*delay_factor*delay_factor;
6618 POSITION point_x[3];
6619 POSITION point_y[3];
6621 /* Default target of monsterspell is player */
6622 monster_target_y = p_ptr->y;
6623 monster_target_x = p_ptr->x;
6625 for (x = 0; x < current_floor_ptr->width; x++)
6627 for (y = 0; y < current_floor_ptr->height; y++)
6629 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6630 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6631 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6632 player_has_los_bold(y, x) &&
6633 projectable(p_ptr->y, p_ptr->x, y, x)
6635 mirror_y[mirror_num] = y;
6636 mirror_x[mirror_num] = x;
6642 if (mirror_num < 2)return FALSE;
6644 point_x[0] = randint0(mirror_num);
6646 point_x[1] = randint0(mirror_num);
6647 } while (point_x[0] == point_x[1]);
6649 point_y[0] = mirror_y[point_x[0]];
6650 point_x[0] = mirror_x[point_x[0]];
6651 point_y[1] = mirror_y[point_x[1]];
6652 point_x[1] = mirror_x[point_x[1]];
6653 point_y[2] = p_ptr->y;
6654 point_x[2] = p_ptr->x;
6656 x = point_x[0] + point_x[1] + point_x[2];
6657 y = point_y[0] + point_y[1] + point_y[2];
6659 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6660 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6661 if (centersign == 0)return FALSE;
6663 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6664 x1 = x1 < point_x[2] ? x1 : point_x[2];
6665 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6666 y1 = y1 < point_y[2] ? y1 : point_y[2];
6668 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6669 x2 = x2 > point_x[2] ? x2 : point_x[2];
6670 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6671 y2 = y2 > point_y[2] ? y2 : point_y[2];
6673 for (y = y1; y <= y2; y++) {
6674 for (x = x1; x <= x2; x++) {
6675 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6676 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6677 centersign*((point_x[1] - x)*(point_y[2] - y)
6678 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6679 centersign*((point_x[2] - x)*(point_y[0] - y)
6680 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6682 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6683 /* Visual effects */
6685 && panel_contains(y, x)) {
6686 p = bolt_pict(y, x, y, x, GF_MANA);
6687 print_rel(PICT_C(p), PICT_A(p), y, x);
6688 move_cursor_relative(y, x);
6689 /*if (fresh_before)*/ Term_fresh();
6690 Term_xtra(TERM_XTRA_DELAY, msec);
6696 for (y = y1; y <= y2; y++) {
6697 for (x = x1; x <= x2; x++) {
6698 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6699 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6700 centersign*((point_x[1] - x)*(point_y[2] - y)
6701 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6702 centersign*((point_x[2] - x)*(point_y[0] - y)
6703 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6705 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6706 (void)project_f(0, 0, y, x, dam, GF_MANA);
6711 for (y = y1; y <= y2; y++) {
6712 for (x = x1; x <= x2; x++) {
6713 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6714 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6715 centersign*((point_x[1] - x)*(point_y[2] - y)
6716 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6717 centersign*((point_x[2] - x)*(point_y[0] - y)
6718 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6720 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6721 (void)project_o(0, 0, y, x, dam, GF_MANA);
6726 for (y = y1; y <= y2; y++) {
6727 for (x = x1; x <= x2; x++) {
6728 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6729 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6730 centersign*((point_x[1] - x)*(point_y[2] - y)
6731 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6732 centersign*((point_x[2] - x)*(point_y[0] - y)
6733 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6735 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6736 (void)project_m(0, 0, y, x, dam, GF_MANA,
6737 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6743 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6744 remove_mirror(point_y[0], point_x[0]);
6751 * @brief 鏡魔法「鏡の封印」の効果処理
6753 * @return 効果があったらTRUEを返す
6755 void seal_of_mirror(HIT_POINT dam)
6759 for (x = 0; x < current_floor_ptr->width; x++)
6761 for (y = 0; y < current_floor_ptr->height; y++)
6763 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6765 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6766 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6768 if (!current_floor_ptr->grid_array[y][x].m_idx)
6770 remove_mirror(y, x);
6782 * @brief 領域魔法に応じて技能の名称を返す。
6783 * @param tval 魔法書のtval
6784 * @return 領域魔法の技能名称を保管した文字列ポインタ
6786 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6790 case TV_HISSATSU_BOOK:
6791 return _("必殺技", "art");
6793 return _("祈り", "prayer");
6795 return _("歌", "song");
6797 return _("呪文", "spell");