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.
22 #include "object-curse.h"
23 #include "player-damage.h"
24 #include "player-effects.h"
25 #include "player-race.h"
28 #include "monster-status.h"
29 #include "monster-spell.h"
31 #include "spells-status.h"
32 #include "spells-diceroll.h"
33 #include "spells-summon.h"
34 #include "monsterrace-hook.h"
42 #include "player-status.h"
43 #include "player-move.h"
44 #include "realm-hex.h"
45 #include "object-hook.h"
46 #include "object-broken.h"
47 #include "object-flavor.h"
52 #include "view-mainwindow.h"
56 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
57 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
59 int project_length = 0; /*!< 投射の射程距離 */
63 * @brief 歌、剣術、呪術領域情報テーブル
65 const magic_type technic_info[NUM_TECHNIC][32] =
188 * @brief 配置した鏡リストの次を取得する /
189 * Get another mirror. for SEEKER
190 * @param next_y 次の鏡のy座標を返す参照ポインタ
191 * @param next_x 次の鏡のx座標を返す参照ポインタ
192 * @param cury 現在の鏡のy座標
193 * @param curx 現在の鏡のx座標
195 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
197 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
198 int mirror_num = 0; /* 鏡の数 */
202 for (x = 0; x < current_floor_ptr->width; x++)
204 for (y = 0; y < current_floor_ptr->height; y++)
206 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
207 mirror_y[mirror_num] = y;
208 mirror_x[mirror_num] = x;
215 num = randint0(mirror_num);
216 *next_y = mirror_y[num];
217 *next_x = mirror_x[num];
220 *next_y = cury + randint0(5) - 2;
221 *next_x = curx + randint0(5) - 2;
227 * Mega-Hack -- track "affected" monsters (see "project()" comments)
229 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
230 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
231 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
232 /* Mega-Hack -- monsters target */
233 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
234 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
238 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
239 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
240 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
241 * @param y 目標Y座標 / Target y location (or location to travel "towards")
242 * @param x 目標X座標 / Target x location (or location to travel "towards")
243 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
244 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
245 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
248 * We are called both for "beam" effects and "ball" effects.
250 * The "r" parameter is the "distance from ground zero".
252 * Note that we determine if the player can "see" anything that happens
253 * by taking into account: blindness, line-of-sight, and illumination.
255 * We return "TRUE" if the effect of the projection is "obvious".
257 * We also "see" grids which are "memorized", probably a hack
259 * Perhaps we should affect doors?
262 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
264 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
265 feature_type *f_ptr = &f_info[g_ptr->feat];
267 bool obvious = FALSE;
268 bool known = player_has_los_bold(y, x);
273 /* Reduce damage by distance */
274 dam = (dam + r) / (r + 1);
277 if (have_flag(f_ptr->flags, FF_TREE))
285 message = _("枯れた", "was blasted."); break;
287 message = _("縮んだ", "shrank."); break;
289 message = _("溶けた", "melted."); break;
292 message = _("凍り、砕け散った", "was frozen and smashed."); break;
296 message = _("燃えた", "burns up!"); break;
308 message = _("粉砕された", "was crushed."); break;
310 message = NULL; break;
314 msg_format(_("木は%s。", "A tree %s"), message);
315 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
318 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
322 /* Analyze the type */
325 /* Ignore most effects */
360 /* Destroy Traps (and Locks) */
363 /* Reveal secret doors */
364 if (is_hidden_door(g_ptr))
369 /* Check line of sight */
377 if (is_trap(g_ptr->feat))
379 /* Check line of sight */
382 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
386 /* Destroy the trap */
387 cave_alter_feat(y, x, FF_DISARM);
390 /* Locked doors are unlocked */
391 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
393 FEAT_IDX old_feat = g_ptr->feat;
395 /* Unlock the door */
396 cave_alter_feat(y, x, FF_DISARM);
398 /* Check line of sound */
399 if (known && (old_feat != g_ptr->feat))
401 msg_print(_("カチッと音がした!", "Click!"));
406 /* Remove "unsafe" flag if player is not blind */
407 if (!p_ptr->blind && player_has_los_bold(y, x))
409 g_ptr->info &= ~(CAVE_UNSAFE);
417 /* Destroy Doors (and traps) */
420 /* Destroy all doors and traps */
421 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
423 /* Check line of sight */
426 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
430 /* Destroy the feature */
431 cave_alter_feat(y, x, FF_TUNNEL);
434 /* Remove "unsafe" flag if player is not blind */
435 if (!p_ptr->blind && player_has_los_bold(y, x))
437 g_ptr->info &= ~(CAVE_UNSAFE);
445 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
447 if (have_flag(f_ptr->flags, FF_SPIKE))
449 s16b old_mimic = g_ptr->mimic;
450 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
452 cave_alter_feat(y, x, FF_SPIKE);
453 g_ptr->mimic = old_mimic;
458 /* Check line of sight */
459 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
461 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
468 /* Destroy walls (and doors) */
471 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
473 if (known && (g_ptr->info & (CAVE_MARK)))
475 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
479 /* Destroy the wall */
480 cave_alter_feat(y, x, FF_HURT_ROCK);
481 p_ptr->update |= (PU_FLOW);
489 if (!cave_naked_bold(y, x)) break;
490 if (player_bold(y, x)) break;
491 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
492 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
504 if (!cave_naked_bold(y, x)) break;
505 if (player_bold(y, x)) break;
506 cave_set_feat(y, x, feat_tree);
507 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
513 if (!cave_naked_bold(y, x)) break;
514 g_ptr->info |= CAVE_OBJECT;
515 g_ptr->mimic = feat_glyph;
523 if (!cave_naked_bold(y, x)) break;
524 if (player_bold(y, x)) break;
525 cave_set_feat(y, x, feat_granite);
531 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
534 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
535 cave_set_feat(y, x, feat_shallow_lava);
539 cave_set_feat(y, x, feat_deep_lava);
546 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
549 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
550 cave_set_feat(y, x, feat_shallow_water);
554 cave_set_feat(y, x, feat_deep_water);
559 /* Lite up the grid */
563 /* Turn on the light */
564 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
566 g_ptr->info |= (CAVE_GLOW);
569 update_local_illumination(y, x);
572 if (player_can_see_bold(y, x)) obvious = TRUE;
574 /* Mega-Hack -- Update the monster in the affected grid */
575 /* This allows "spear of light" (etc) to work "correctly" */
576 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
578 if (p_ptr->special_defense & NINJA_S_STEALTH)
580 if (player_bold(y, x)) set_superstealth(FALSE);
587 /* Darken the grid */
591 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
594 /* Turn off the light. */
597 if (current_floor_ptr->dun_level || !is_daytime())
599 for (j = 0; j < 9; j++)
601 int by = y + ddy_ddd[j];
602 int bx = x + ddx_ddd[j];
604 if (in_bounds2(by, bx))
606 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
608 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
619 g_ptr->info &= ~(CAVE_GLOW);
621 /* Hack -- Forget "boring" grids */
622 if (!have_flag(f_ptr->flags, FF_REMEMBER))
625 g_ptr->info &= ~(CAVE_MARK);
632 update_local_illumination(y, x);
634 if (player_can_see_bold(y, x)) obvious = TRUE;
636 /* Mega-Hack -- Update the monster in the affected grid */
637 /* This allows "spear of light" (etc) to work "correctly" */
638 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
648 if (is_mirror_grid(g_ptr))
650 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
653 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
656 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
658 if (known && (g_ptr->info & CAVE_MARK))
660 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
664 /* Destroy the wall */
665 cave_alter_feat(y, x, FF_HURT_ROCK);
666 p_ptr->update |= (PU_FLOW);
673 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
675 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
678 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
681 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
683 if (known && (g_ptr->info & CAVE_MARK))
685 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
689 /* Destroy the wall */
690 cave_alter_feat(y, x, FF_HURT_ROCK);
691 p_ptr->update |= (PU_FLOW);
696 case GF_DISINTEGRATE:
698 /* Destroy mirror/glyph */
699 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
702 /* Permanent features don't get effect */
703 /* But not protect monsters and other objects */
704 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
706 cave_alter_feat(y, x, FF_HURT_DISI);
708 /* Update some things -- similar to GF_KILL_WALL */
709 p_ptr->update |= (PU_FLOW);
716 /* Return "Anything seen?" */
723 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
724 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
725 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
726 * @param y 目標Y座標 / Target y location (or location to travel "towards")
727 * @param x 目標X座標 / Target x location (or location to travel "towards")
728 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
729 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
730 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
733 * We are called from "project()" to "damage" objects
735 * We are called both for "beam" effects and "ball" effects.
737 * Perhaps we should only SOMETIMES damage things on the ground.
739 * The "r" parameter is the "distance from ground zero".
741 * Note that we determine if the player can "see" anything that happens
742 * by taking into account: blindness, line-of-sight, and illumination.
744 * We also "see" grids which are "memorized", probably a hack
746 * We return "TRUE" if the effect of the projection is "obvious".
749 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
751 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
753 OBJECT_IDX this_o_idx, next_o_idx = 0;
755 bool obvious = FALSE;
756 bool known = player_has_los_bold(y, x);
758 BIT_FLAGS flgs[TR_FLAG_SIZE];
760 GAME_TEXT o_name[MAX_NLEN];
762 KIND_OBJECT_IDX k_idx = 0;
763 bool is_potion = FALSE;
768 /* Reduce damage by distance */
769 dam = (dam + r) / (r + 1);
772 /* Scan all objects in the grid */
773 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
775 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
779 bool do_kill = FALSE;
781 concptr note_kill = NULL;
784 /* Get the "plural"-ness */
785 bool plural = (o_ptr->number > 1);
787 next_o_idx = o_ptr->next_o_idx;
788 object_flags(o_ptr, flgs);
790 /* Check for artifact */
791 if (object_is_artifact(o_ptr)) is_art = TRUE;
793 /* Analyze the type */
796 /* Acid -- Lots of things */
799 if (hates_acid(o_ptr))
802 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
803 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
808 /* Elec -- Rings and Wands */
811 if (hates_elec(o_ptr))
814 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
815 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
820 /* Fire -- Flammable objects */
823 if (hates_fire(o_ptr))
826 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
827 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
832 /* Cold -- potions and flasks */
835 if (hates_cold(o_ptr))
837 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
839 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
847 if (hates_fire(o_ptr))
850 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
851 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
853 if (hates_elec(o_ptr))
857 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
858 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
866 if (hates_fire(o_ptr))
869 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
870 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
872 if (hates_cold(o_ptr))
876 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
877 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
882 /* Hack -- break potions and such */
888 if (hates_cold(o_ptr))
890 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
896 /* Mana and Chaos -- destroy everything */
902 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
906 case GF_DISINTEGRATE:
909 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
916 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
917 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
918 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
922 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
926 if (object_is_cursed(o_ptr))
929 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
936 identify_item(o_ptr);
938 /* Auto-inscription */
939 autopick_alter_item((-this_o_idx), FALSE);
947 /* Chests are noticed only if trapped or locked */
948 if (o_ptr->tval == TV_CHEST)
950 /* Disarm/Unlock traps */
953 /* Disarm or Unlock */
954 o_ptr->pval = (0 - o_ptr->pval);
959 if (known && (o_ptr->marked & OM_FOUND))
961 msg_print(_("カチッと音がした!", "Click!"));
971 if (o_ptr->tval == TV_CORPSE)
976 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
977 mode |= PM_FORCE_PET;
979 for (i = 0; i < o_ptr->number ; i++)
981 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
982 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
986 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
990 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
992 note_kill = _("生き返った。", " revived.");
996 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1007 /* Attempt to destroy the object */
1010 /* Effect "observed" */
1011 if (known && (o_ptr->marked & OM_FOUND))
1014 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1017 /* Artifacts, and other objects, get to resist */
1018 if (is_art || ignore)
1020 /* Observe the resist */
1021 if (known && (o_ptr->marked & OM_FOUND))
1023 msg_format(_("%sは影響を受けない!",
1024 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1031 /* Describe if needed */
1032 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1034 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1037 k_idx = o_ptr->k_idx;
1038 is_potion = object_is_potion(o_ptr);
1039 delete_object_idx(this_o_idx);
1041 /* Potions produce effects when 'shattered' */
1044 (void)potion_smash_effect(who, y, x, k_idx);
1052 /* Return "Anything seen?" */
1058 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1059 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1060 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1061 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1062 * @param x 目標X座標 / Target x location (or location to travel "towards")
1063 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1064 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1066 * @param see_s_msg TRUEならばメッセージを表示する
1067 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1070 * This routine takes a "source monster" (by index) which is mostly used to
1071 * determine if the player is causing the damage, and a "radius" (see below),
1072 * which is used to decrease the power of explosions with distance, and a
1073 * location, via integers which are modified by certain types of attacks
1074 * (polymorph and teleport being the obvious ones), a default damage, which
1075 * is modified as needed based on various properties, and finally a "damage
1076 * type" (see below).
1079 * Note that this routine can handle "no damage" attacks (like teleport) by
1080 * taking a "zero" damage, and can even take "parameters" to attacks (like
1081 * confuse) by accepting a "damage", using it to calculate the effect, and
1082 * then setting the damage to zero. Note that the "damage" parameter is
1083 * divided by the radius, so monsters not at the "epicenter" will not take
1084 * as much damage (or whatever)...
1087 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1088 * may result in a dereference of an invalid pointer.
1091 * Various messages are produced, and damage is applied.
1094 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1095 * actually be "made" of that substance, or "breathe" big balls of it.
1096 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1098 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1099 * and hurts evil less. If can breath nether, then it resists it as well.
1102 * Damage reductions use the following formulas:
1103 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1104 * gives avg damage of .655, ranging from .858 to .500
1105 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1106 * gives avg damage of .544, ranging from .714 to .417
1107 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1108 * gives avg damage of .444, ranging from .556 to .333
1109 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1110 * gives avg damage of .327, ranging from .427 to .250
1111 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1112 * gives something simple.
1115 * In this function, "result" messages are postponed until the end, where
1116 * the "note" string is appended to the monster name, if not NULL. So,
1117 * to make a spell have "no effect" just set "note" to NULL. You should
1118 * also set "notice" to FALSE, or the player will learn what the spell does.
1121 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1125 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)
1129 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1131 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1132 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
1134 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1138 /* Is the monster "seen"? */
1139 bool seen = m_ptr->ml;
1140 bool seen_msg = is_seen(m_ptr);
1142 bool slept = (bool)MON_CSLEEP(m_ptr);
1144 /* Were the effects "obvious" (if seen)? */
1145 bool obvious = FALSE;
1147 /* Can the player know about this effect? */
1148 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1150 /* Were the effects "irrelevant"? */
1151 bool skipped = FALSE;
1153 /* Gets the monster angry at the source of the effect? */
1154 bool get_angry = FALSE;
1156 /* Polymorph setting (true or false) */
1157 bool do_poly = FALSE;
1159 /* Teleport setting (max distance) */
1162 /* Confusion setting (amount to confuse) */
1165 /* Stunning setting (amount to stun) */
1168 /* Sleep amount (amount to sleep) */
1171 /* Fear amount (amount to fear) */
1174 /* Time amount (amount to time) */
1177 bool heal_leper = FALSE;
1179 /* Hold the monster name */
1180 GAME_TEXT m_name[MAX_NLEN];
1183 PARAMETER_VALUE photo = 0;
1185 /* Assume no note */
1186 concptr note = NULL;
1188 /* Assume a default death */
1189 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1191 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1194 if (!g_ptr->m_idx) return (FALSE);
1196 /* Never affect projector */
1197 if (who && (g_ptr->m_idx == who)) return (FALSE);
1198 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1199 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1201 /* Don't affect already death monsters */
1202 /* Prevents problems with chain reactions of exploding monsters */
1203 if (m_ptr->hp < 0) return (FALSE);
1205 /* Reduce damage by distance */
1206 dam = (dam + r) / (r + 1);
1209 /* Get the monster name (BEFORE polymorphing) */
1210 monster_desc(m_name, m_ptr, 0);
1212 /* Get the monster possessive ("his"/"her"/"its") */
1213 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1215 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1217 if (r_ptr->flagsr & RFR_RES_ALL &&
1218 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1219 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1221 note = _("には完全な耐性がある!", " is immune.");
1223 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1224 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1228 /* Analyze the damage type */
1231 /* Magic Missile -- pure damage */
1234 if (seen) obvious = TRUE;
1241 if (seen) obvious = TRUE;
1242 if (r_ptr->flagsr & RFR_IM_ACID)
1244 note = _("にはかなり耐性がある!", " resists a lot.");
1246 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1254 if (seen) obvious = TRUE;
1255 if (r_ptr->flagsr & RFR_IM_ELEC)
1257 note = _("にはかなり耐性がある!", " resists a lot.");
1259 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1267 if (seen) obvious = TRUE;
1268 if (r_ptr->flagsr & RFR_IM_FIRE)
1270 note = _("にはかなり耐性がある!", " resists a lot.");
1272 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1274 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1276 note = _("はひどい痛手をうけた。", " is hit hard.");
1278 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1286 if (seen) obvious = TRUE;
1287 if (r_ptr->flagsr & RFR_IM_COLD)
1289 note = _("にはかなり耐性がある!", " resists a lot.");
1291 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1293 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1295 note = _("はひどい痛手をうけた。", " is hit hard.");
1297 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1305 if (seen) obvious = TRUE;
1306 if (r_ptr->flagsr & RFR_IM_POIS)
1308 note = _("にはかなり耐性がある!", " resists a lot.");
1310 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1318 if (seen) obvious = TRUE;
1319 if (r_ptr->flagsr & RFR_IM_POIS)
1321 note = _("には耐性がある。", " resists.");
1322 dam *= 3; dam /= randint1(6) + 6;
1323 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1325 else if (one_in_(3)) do_poly = TRUE;
1329 /* Hellfire -- hurts Evil */
1332 if (seen) obvious = TRUE;
1333 if (r_ptr->flags3 & RF3_GOOD)
1335 note = _("はひどい痛手をうけた。", " is hit hard.");
1337 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1342 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1345 if (seen) obvious = TRUE;
1346 if (r_ptr->flags3 & RF3_EVIL)
1349 note = _("はひどい痛手をうけた。", " is hit hard.");
1350 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1354 note = _("には耐性がある。", " resists.");
1355 dam *= 3; dam /= randint1(6) + 6;
1360 /* Arrow -- XXX no defense */
1363 if (seen) obvious = TRUE;
1367 /* Plasma -- XXX perhaps check ELEC or FIRE */
1370 if (seen) obvious = TRUE;
1371 if (r_ptr->flagsr & RFR_RES_PLAS)
1373 note = _("には耐性がある。", " resists.");
1374 dam *= 3; dam /= randint1(6) + 6;
1375 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1380 /* Nether -- see above */
1383 if (seen) obvious = TRUE;
1384 if (r_ptr->flagsr & RFR_RES_NETH)
1386 if (r_ptr->flags3 & RF3_UNDEAD)
1388 note = _("には完全な耐性がある!", " is immune.");
1390 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1394 note = _("には耐性がある。", " resists.");
1395 dam *= 3; dam /= randint1(6) + 6;
1397 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1399 else if (r_ptr->flags3 & RF3_EVIL)
1401 note = _("はいくらか耐性を示した。", " resists somewhat.");
1403 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1408 /* Water (acid) damage -- Water spirits/elementals are immune */
1411 if (seen) obvious = TRUE;
1412 if (r_ptr->flagsr & RFR_RES_WATE)
1414 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1416 note = _("には完全な耐性がある!", " is immune.");
1421 note = _("には耐性がある。", " resists.");
1422 dam *= 3; dam /= randint1(6) + 6;
1424 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1429 /* Chaos -- Chaos breathers resist */
1432 if (seen) obvious = TRUE;
1433 if (r_ptr->flagsr & RFR_RES_CHAO)
1435 note = _("には耐性がある。", " resists.");
1436 dam *= 3; dam /= randint1(6) + 6;
1437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1439 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1441 note = _("はいくらか耐性を示した。", " resists somewhat.");
1442 dam *= 3; dam /= randint1(6) + 6;
1443 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1448 do_conf = (5 + randint1(11) + r) / (r + 1);
1453 /* Shards -- Shard breathers resist */
1456 if (seen) obvious = TRUE;
1457 if (r_ptr->flagsr & RFR_RES_SHAR)
1459 note = _("には耐性がある。", " resists.");
1460 dam *= 3; dam /= randint1(6) + 6;
1461 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1466 /* Rocket: Shard resistance helps */
1469 if (seen) obvious = TRUE;
1470 if (r_ptr->flagsr & RFR_RES_SHAR)
1472 note = _("はいくらか耐性を示した。", " resists somewhat.");
1474 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1480 /* Sound -- Sound breathers resist */
1483 if (seen) obvious = TRUE;
1484 if (r_ptr->flagsr & RFR_RES_SOUN)
1486 note = _("には耐性がある。", " resists.");
1487 dam *= 2; dam /= randint1(6) + 6;
1488 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1490 else do_stun = (10 + randint1(15) + r) / (r + 1);
1497 if (seen) obvious = TRUE;
1498 if (r_ptr->flags3 & RF3_NO_CONF)
1500 note = _("には耐性がある。", " resists.");
1501 dam *= 3; dam /= randint1(6) + 6;
1502 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1504 else do_conf = (10 + randint1(15) + r) / (r + 1);
1508 /* Disenchantment -- Breathers and Disenchanters resist */
1511 if (seen) obvious = TRUE;
1512 if (r_ptr->flagsr & RFR_RES_DISE)
1514 note = _("には耐性がある。", " resists.");
1515 dam *= 3; dam /= randint1(6) + 6;
1516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1521 /* Nexus -- Breathers and Existers resist */
1524 if (seen) obvious = TRUE;
1525 if (r_ptr->flagsr & RFR_RES_NEXU)
1527 note = _("には耐性がある。", " resists.");
1528 dam *= 3; dam /= randint1(6) + 6;
1529 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1537 if (seen) obvious = TRUE;
1538 if (r_ptr->flagsr & RFR_RES_WALL)
1540 note = _("には耐性がある。", " resists.");
1541 dam *= 3; dam /= randint1(6) + 6;
1542 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1544 else do_stun = (randint1(15) + r) / (r + 1);
1548 /* Inertia -- breathers resist */
1551 if (seen) obvious = TRUE;
1552 if (r_ptr->flagsr & RFR_RES_INER)
1554 note = _("には耐性がある。", " resists.");
1555 dam *= 3; dam /= randint1(6) + 6;
1556 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1560 /* Powerful monsters can resist */
1561 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1562 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1566 /* Normal monsters slow down */
1569 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1571 note = _("の動きが遅くなった。", " starts moving slower.");
1578 /* Time -- breathers resist */
1581 if (seen) obvious = TRUE;
1582 if (r_ptr->flagsr & RFR_RES_TIME)
1584 note = _("には耐性がある。", " resists.");
1585 dam *= 3; dam /= randint1(6) + 6;
1586 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1588 else do_time = (dam + 1) / 2;
1592 /* Gravity -- breathers resist */
1595 bool resist_tele = FALSE;
1597 if (seen) obvious = TRUE;
1598 if (r_ptr->flagsr & RFR_RES_TELE)
1600 if (r_ptr->flags1 & (RF1_UNIQUE))
1602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1603 note = _("には効果がなかった。", " is unaffected!");
1606 else if (r_ptr->level > randint1(100))
1608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1609 note = _("には耐性がある!", " resists!");
1614 if (!resist_tele) do_dist = 10;
1616 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1618 if (r_ptr->flagsr & RFR_RES_GRAV)
1620 note = _("には耐性がある!", " resists!");
1621 dam *= 3; dam /= randint1(6) + 6;
1623 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1628 /* Powerful monsters can resist */
1629 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1630 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1634 /* Normal monsters slow down */
1637 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1639 note = _("の動きが遅くなった。", " starts moving slower.");
1644 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1646 /* Attempt a saving throw */
1647 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1648 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1652 /* No obvious effect */
1653 note = _("には効果がなかった。", " is unaffected!");
1665 if (seen) obvious = TRUE;
1671 case GF_DISINTEGRATE:
1673 if (seen) obvious = TRUE;
1674 if (r_ptr->flags3 & RF3_HURT_ROCK)
1676 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1677 note = _("の皮膚がただれた!", " loses some skin!");
1678 note_dies = _("は蒸発した!", " evaporates!");
1686 if (seen) obvious = TRUE;
1688 /* PSI only works if the monster can see you! -- RG */
1689 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1692 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1696 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1699 note = _("には完全な耐性がある!", " is immune.");
1700 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1703 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1704 (r_ptr->flags3 & RF3_ANIMAL) ||
1705 (r_ptr->level > randint1(3 * dam)))
1707 note = _("には耐性がある!", " resists!");
1711 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1712 * attacks back on them
1714 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1715 (r_ptr->level > p_ptr->lev / 2) &&
1719 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1720 (seen ? "%^s's corrupted mind backlashes your attack!" :
1721 "%^ss corrupted mind backlashes your attack!")), m_name);
1724 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1726 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1730 /* Injure +/- confusion */
1731 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1732 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1733 if (one_in_(4) && !CHECK_MULTISHADOW())
1735 switch (randint1(4))
1738 set_confused(p_ptr->confused + 3 + randint1(dam));
1741 set_stun(p_ptr->stun + randint1(dam));
1745 if (r_ptr->flags3 & RF3_NO_FEAR)
1746 note = _("には効果がなかった。", " is unaffected.");
1748 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1752 if (!p_ptr->free_act)
1753 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1762 if ((dam > 0) && one_in_(4))
1764 switch (randint1(4))
1767 do_conf = 3 + randint1(dam);
1770 do_stun = 3 + randint1(dam);
1773 do_fear = 3 + randint1(dam);
1776 note = _("は眠り込んでしまった!", " falls asleep!");
1777 do_sleep = 3 + randint1(dam);
1782 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1788 if (seen) obvious = TRUE;
1789 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1792 note = _("には完全な耐性がある!", " is immune.");
1794 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1795 (r_ptr->flags3 & RF3_ANIMAL) ||
1796 (r_ptr->level > randint1(3 * dam)))
1798 note = _("には耐性がある!", " resists!");
1802 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1803 * attacks back on them
1805 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1806 (r_ptr->level > p_ptr->lev / 2) &&
1810 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1811 (seen ? "%^s's corrupted mind backlashes your attack!" :
1812 "%^ss corrupted mind backlashes your attack!")), m_name);
1814 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1816 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1820 /* Injure + mana drain */
1821 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1822 if (!CHECK_MULTISHADOW())
1824 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1825 p_ptr->csp -= damroll(5, dam) / 2;
1826 if (p_ptr->csp < 0) p_ptr->csp = 0;
1827 p_ptr->redraw |= PR_MANA;
1828 p_ptr->window |= (PW_SPELL);
1830 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1837 int b = damroll(5, dam) / 4;
1838 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1839 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1840 (seen ? "You convert %s's pain into %s!" :
1841 "You convert %ss pain into %s!"));
1842 msg_format(msg, m_name, str);
1844 b = MIN(p_ptr->msp, p_ptr->csp + b);
1846 p_ptr->redraw |= PR_MANA;
1847 p_ptr->window |= (PW_SPELL);
1849 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1853 case GF_TELEKINESIS:
1855 if (seen) obvious = TRUE;
1858 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1863 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1865 /* Attempt a saving throw */
1866 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1867 (r_ptr->level > 5 + randint1(dam)))
1871 /* No obvious effect */
1877 /* Psycho-spear -- powerful magic missile */
1880 if (seen) obvious = TRUE;
1884 /* Meteor -- powerful magic missile */
1887 if (seen) obvious = TRUE;
1893 if (!is_hostile(m_ptr)) break;
1894 if (seen) obvious = TRUE;
1895 /* Attempt a saving throw */
1896 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1897 (r_ptr->flags3 & RF3_NO_CONF) ||
1898 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1900 /* Memorize a flag */
1901 if (r_ptr->flags3 & RF3_NO_CONF)
1903 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1910 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1911 * attacks back on them
1913 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1914 (r_ptr->level > p_ptr->lev / 2) &&
1918 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1919 (seen ? "%^s's corrupted mind backlashes your attack!" :
1920 "%^ss corrupted mind backlashes your attack!")), m_name);
1923 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1925 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1929 /* Confuse, stun, terrify */
1930 switch (randint1(4))
1933 set_stun(p_ptr->stun + dam / 2);
1936 set_confused(p_ptr->confused + dam / 2);
1940 if (r_ptr->flags3 & RF3_NO_FEAR)
1941 note = _("には効果がなかった。", " is unaffected.");
1943 set_afraid(p_ptr->afraid + dam);
1950 /* No obvious effect */
1951 note = _("には効果がなかった。", " is unaffected.");
1957 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1959 note = _("があなたに隷属した。", " is in your thrall!");
1964 switch (randint1(4))
1978 /* No "real" damage */
1983 /* Ice -- Cold + Cuts + Stun */
1986 if (seen) obvious = TRUE;
1987 do_stun = (randint1(15) + 1) / (r + 1);
1988 if (r_ptr->flagsr & RFR_IM_COLD)
1990 note = _("にはかなり耐性がある!", " resists a lot.");
1992 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1994 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1996 note = _("はひどい痛手をうけた。", " is hit hard.");
1998 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2005 case GF_HYPODYNAMIA:
2007 if (seen) obvious = TRUE;
2008 if (!monster_living(m_ptr->r_idx))
2010 if (is_original_ap_and_seen(m_ptr))
2012 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2013 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2014 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2016 note = _("には効果がなかった。", " is unaffected.");
2020 else do_time = (dam+7)/8;
2028 if (seen) obvious = TRUE;
2029 if (!monster_living(m_ptr->r_idx))
2031 if (is_original_ap_and_seen(m_ptr))
2033 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2034 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2035 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2037 note = _("には完全な耐性がある!", " is immune.");
2041 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2042 (randint1(888) != 666)) ||
2043 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2044 randint1(100) != 66))
2046 note = _("には耐性がある!", " resists!");
2054 /* Polymorph monster (Use "dam" as "power") */
2057 if (seen) obvious = TRUE;
2058 /* Attempt to polymorph (see below) */
2061 /* Powerful monsters can resist */
2062 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2063 (r_ptr->flags1 & RF1_QUESTOR) ||
2064 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2066 note = _("には効果がなかった。", " is unaffected.");
2071 /* No "real" damage */
2078 /* Clone monsters (Ignore "dam") */
2081 if (seen) obvious = TRUE;
2083 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2085 note = _("には効果がなかった。", " is unaffected.");
2090 m_ptr->hp = m_ptr->maxhp;
2092 /* Attempt to clone. */
2093 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2095 note = _("が分裂した!", " spawns!");
2099 /* No "real" damage */
2106 /* Heal Monster (use "dam" as amount of healing) */
2109 if (seen) obvious = TRUE;
2112 (void)set_monster_csleep(g_ptr->m_idx, 0);
2114 if (m_ptr->maxhp < m_ptr->max_maxhp)
2116 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2117 m_ptr->maxhp = m_ptr->max_maxhp;
2122 /* Redraw (later) if needed */
2123 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2124 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2132 if (seen) obvious = TRUE;
2135 (void)set_monster_csleep(g_ptr->m_idx, 0);
2136 if (MON_STUNNED(m_ptr))
2138 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2139 (void)set_monster_stunned(g_ptr->m_idx, 0);
2141 if (MON_CONFUSED(m_ptr))
2143 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2144 (void)set_monster_confused(g_ptr->m_idx, 0);
2146 if (MON_MONFEAR(m_ptr))
2148 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2149 (void)set_monster_monfear(g_ptr->m_idx, 0);
2153 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2156 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2160 chg_virtue(V_VITALITY, 1);
2162 if (r_ptr->flags1 & RF1_UNIQUE)
2163 chg_virtue(V_INDIVIDUALISM, 1);
2165 if (is_friendly(m_ptr))
2166 chg_virtue(V_HONOUR, 1);
2167 else if (!(r_ptr->flags3 & RF3_EVIL))
2169 if (r_ptr->flags3 & RF3_GOOD)
2170 chg_virtue(V_COMPASSION, 2);
2172 chg_virtue(V_COMPASSION, 1);
2175 if (r_ptr->flags3 & RF3_ANIMAL)
2176 chg_virtue(V_NATURE, 1);
2179 if (m_ptr->r_idx == MON_LEPER)
2182 if (!who) chg_virtue(V_COMPASSION, 5);
2185 /* Redraw (later) if needed */
2186 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2187 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2189 note = _("は体力を回復したようだ。", " looks healthier.");
2191 /* No "real" damage */
2197 /* Speed Monster (Ignore "dam") */
2200 if (seen) obvious = TRUE;
2203 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2205 note = _("の動きが速くなった。", " starts moving faster.");
2210 if (r_ptr->flags1 & RF1_UNIQUE)
2211 chg_virtue(V_INDIVIDUALISM, 1);
2212 if (is_friendly(m_ptr))
2213 chg_virtue(V_HONOUR, 1);
2216 /* No "real" damage */
2222 /* Slow Monster (Use "dam" as "power") */
2225 if (seen) obvious = TRUE;
2227 /* Powerful monsters can resist */
2228 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2229 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2231 note = _("には効果がなかった。", " is unaffected.");
2235 /* Normal monsters slow down */
2238 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2240 note = _("の動きが遅くなった。", " starts moving slower.");
2244 /* No "real" damage */
2250 /* Sleep (Use "dam" as "power") */
2253 if (seen) obvious = TRUE;
2255 /* Attempt a saving throw */
2256 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2257 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2258 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2260 /* Memorize a flag */
2261 if (r_ptr->flags3 & RF3_NO_SLEEP)
2263 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2265 /* No obvious effect */
2266 note = _("には効果がなかった。", " is unaffected.");
2271 /* Go to sleep (much) later */
2272 note = _("は眠り込んでしまった!", " falls asleep!");
2276 /* No "real" damage */
2282 /* Sleep (Use "dam" as "power") */
2283 case GF_STASIS_EVIL:
2285 if (seen) obvious = TRUE;
2287 /* Attempt a saving throw */
2288 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2289 !(r_ptr->flags3 & RF3_EVIL) ||
2290 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2292 note = _("には効果がなかった。", " is unaffected.");
2297 /* Go to sleep (much) later */
2298 note = _("は動けなくなった!", " is suspended!");
2302 /* No "real" damage */
2307 /* Sleep (Use "dam" as "power") */
2310 if (seen) obvious = TRUE;
2312 /* Attempt a saving throw */
2313 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2314 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2316 note = _("には効果がなかった。", " is unaffected.");
2321 /* Go to sleep (much) later */
2322 note = _("は動けなくなった!", " is suspended!");
2326 /* No "real" damage */
2335 vir = virtue_number(V_HARMONY);
2338 dam += p_ptr->virtues[vir-1]/10;
2341 vir = virtue_number(V_INDIVIDUALISM);
2344 dam -= p_ptr->virtues[vir-1]/20;
2347 if (seen) obvious = TRUE;
2349 /* Attempt a saving throw */
2350 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2354 /* No obvious effect */
2355 note = _("には効果がなかった。", " is unaffected.");
2358 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2360 else if (p_ptr->cursed & TRC_AGGRAVATE)
2362 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2363 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2367 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2370 chg_virtue(V_INDIVIDUALISM, -1);
2371 if (r_ptr->flags3 & RF3_ANIMAL)
2372 chg_virtue(V_NATURE, 1);
2375 /* No "real" damage */
2380 /* Control undead */
2381 case GF_CONTROL_UNDEAD:
2384 if (seen) obvious = TRUE;
2386 vir = virtue_number(V_UNLIFE);
2389 dam += p_ptr->virtues[vir-1]/10;
2392 vir = virtue_number(V_INDIVIDUALISM);
2395 dam -= p_ptr->virtues[vir-1]/20;
2398 /* Attempt a saving throw */
2399 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2400 !(r_ptr->flags3 & RF3_UNDEAD))
2402 /* No obvious effect */
2403 note = _("には効果がなかった。", " is unaffected.");
2405 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2407 else if (p_ptr->cursed & TRC_AGGRAVATE)
2409 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2410 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2414 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2418 /* No "real" damage */
2424 case GF_CONTROL_DEMON:
2427 if (seen) obvious = TRUE;
2429 vir = virtue_number(V_UNLIFE);
2432 dam += p_ptr->virtues[vir-1]/10;
2435 vir = virtue_number(V_INDIVIDUALISM);
2438 dam -= p_ptr->virtues[vir-1]/20;
2441 /* Attempt a saving throw */
2442 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2443 !(r_ptr->flags3 & RF3_DEMON))
2445 /* No obvious effect */
2446 note = _("には効果がなかった。", " is unaffected.");
2448 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2450 else if (p_ptr->cursed & TRC_AGGRAVATE)
2452 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2453 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2457 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2461 /* No "real" damage */
2467 case GF_CONTROL_ANIMAL:
2470 if (seen) obvious = TRUE;
2472 vir = virtue_number(V_NATURE);
2475 dam += p_ptr->virtues[vir-1]/10;
2478 vir = virtue_number(V_INDIVIDUALISM);
2481 dam -= p_ptr->virtues[vir-1]/20;
2484 /* Attempt a saving throw */
2485 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2486 !(r_ptr->flags3 & RF3_ANIMAL))
2489 /* No obvious effect */
2490 note = _("には効果がなかった。", " is unaffected.");
2492 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2494 else if (p_ptr->cursed & TRC_AGGRAVATE)
2496 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2497 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2501 note = _("はなついた。", " is tamed!");
2503 if (r_ptr->flags3 & RF3_ANIMAL)
2504 chg_virtue(V_NATURE, 1);
2507 /* No "real" damage */
2513 case GF_CHARM_LIVING:
2517 vir = virtue_number(V_UNLIFE);
2518 if (seen) obvious = TRUE;
2520 vir = virtue_number(V_UNLIFE);
2523 dam -= p_ptr->virtues[vir-1]/10;
2526 vir = virtue_number(V_INDIVIDUALISM);
2529 dam -= p_ptr->virtues[vir-1]/20;
2532 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2534 /* Attempt a saving throw */
2535 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2536 !monster_living(m_ptr->r_idx))
2539 /* No obvious effect */
2540 note = _("には効果がなかった。", " is unaffected.");
2542 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2544 else if (p_ptr->cursed & TRC_AGGRAVATE)
2546 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2547 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2551 note = _("を支配した。", " is tamed!");
2553 if (r_ptr->flags3 & RF3_ANIMAL)
2554 chg_virtue(V_NATURE, 1);
2557 /* No "real" damage */
2562 /* Confusion (Use "dam" as "power") */
2565 if (seen) obvious = TRUE;
2567 /* Get confused later */
2568 do_conf = damroll(3, (dam / 2)) + 1;
2570 /* Attempt a saving throw */
2571 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2572 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2573 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2575 /* Memorize a flag */
2576 if (r_ptr->flags3 & (RF3_NO_CONF))
2578 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2584 /* No obvious effect */
2585 note = _("には効果がなかった。", " is unaffected.");
2589 /* No "real" damage */
2596 if (seen) obvious = TRUE;
2598 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2600 /* Attempt a saving throw */
2601 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2602 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2607 /* No obvious effect */
2608 note = _("には効果がなかった。", " is unaffected.");
2612 /* No "real" damage */
2617 /* Lite, but only hurts susceptible creatures */
2626 if (r_ptr->flags3 & (RF3_HURT_LITE))
2628 /* Obvious effect */
2629 if (seen) obvious = TRUE;
2631 /* Memorize the effects */
2632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2634 /* Special effect */
2635 note = _("は光に身をすくめた!", " cringes from the light!");
2636 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2639 /* Normally no damage */
2651 /* Lite -- opposite of Dark */
2654 if (seen) obvious = TRUE;
2656 if (r_ptr->flagsr & RFR_RES_LITE)
2658 note = _("には耐性がある!", " resists!");
2659 dam *= 2; dam /= (randint1(6)+6);
2660 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2662 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2664 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2665 note = _("は光に身をすくめた!", " cringes from the light!");
2666 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2673 /* Dark -- opposite of Lite */
2676 if (seen) obvious = TRUE;
2678 if (r_ptr->flagsr & RFR_RES_DARK)
2680 note = _("には耐性がある!", " resists!");
2681 dam *= 2; dam /= (randint1(6)+6);
2682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2691 /* Hurt by rock remover */
2692 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2695 if (seen) obvious = TRUE;
2697 /* Memorize the effects */
2698 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2700 /* Cute little message */
2701 note = _("の皮膚がただれた!", " loses some skin!");
2702 note_dies = _("はドロドロに溶けた!", " dissolves!");
2705 /* Usually, ignore the effects */
2716 /* Teleport undead (Use "dam" as "power") */
2717 case GF_AWAY_UNDEAD:
2719 /* Only affect undead */
2720 if (r_ptr->flags3 & (RF3_UNDEAD))
2722 bool resists_tele = FALSE;
2724 if (r_ptr->flagsr & RFR_RES_TELE)
2726 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2728 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2729 note = _("には効果がなかった。", " is unaffected.");
2730 resists_tele = TRUE;
2732 else if (r_ptr->level > randint1(100))
2734 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2735 note = _("には耐性がある!", " resists!");
2736 resists_tele = TRUE;
2742 if (seen) obvious = TRUE;
2743 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2755 /* No "real" damage */
2761 /* Teleport evil (Use "dam" as "power") */
2764 /* Only affect evil */
2765 if (r_ptr->flags3 & (RF3_EVIL))
2767 bool resists_tele = FALSE;
2769 if (r_ptr->flagsr & RFR_RES_TELE)
2771 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2773 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2774 note = _("には効果がなかった。", " is unaffected.");
2775 resists_tele = TRUE;
2777 else if (r_ptr->level > randint1(100))
2779 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2780 note = _("には耐性がある!", " resists!");
2781 resists_tele = TRUE;
2787 if (seen) obvious = TRUE;
2788 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2800 /* No "real" damage */
2806 /* Teleport monster (Use "dam" as "power") */
2809 bool resists_tele = FALSE;
2810 if (r_ptr->flagsr & RFR_RES_TELE)
2812 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2814 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2815 note = _("には効果がなかった。", " is unaffected.");
2816 resists_tele = TRUE;
2818 else if (r_ptr->level > randint1(100))
2820 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2821 note = _("には耐性がある!", " resists!");
2822 resists_tele = TRUE;
2828 if (seen) obvious = TRUE;
2830 /* Prepare to teleport */
2834 /* No "real" damage */
2840 /* Turn undead (Use "dam" as "power") */
2841 case GF_TURN_UNDEAD:
2843 /* Only affect undead */
2844 if (r_ptr->flags3 & (RF3_UNDEAD))
2846 if (seen) obvious = TRUE;
2848 /* Learn about type */
2849 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2851 /* Apply some fear */
2852 do_fear = damroll(3, (dam / 2)) + 1;
2854 /* Attempt a saving throw */
2855 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2857 /* No obvious effect */
2858 note = _("には効果がなかった。", " is unaffected.");
2871 /* No "real" damage */
2877 /* Turn evil (Use "dam" as "power") */
2880 /* Only affect evil */
2881 if (r_ptr->flags3 & (RF3_EVIL))
2883 if (seen) obvious = TRUE;
2885 /* Learn about type */
2886 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2888 /* Apply some fear */
2889 do_fear = damroll(3, (dam / 2)) + 1;
2891 /* Attempt a saving throw */
2892 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2894 /* No obvious effect */
2895 note = _("には効果がなかった。", " is unaffected.");
2908 /* No "real" damage */
2914 /* Turn monster (Use "dam" as "power") */
2917 if (seen) obvious = TRUE;
2919 /* Apply some fear */
2920 do_fear = damroll(3, (dam / 2)) + 1;
2922 /* Attempt a saving throw */
2923 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2924 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2925 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2927 /* No obvious effect */
2928 note = _("には効果がなかった。", " is unaffected.");
2933 /* No "real" damage */
2940 case GF_DISP_UNDEAD:
2942 /* Only affect undead */
2943 if (r_ptr->flags3 & (RF3_UNDEAD))
2945 if (seen) obvious = TRUE;
2947 /* Learn about type */
2948 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2950 note = _("は身震いした。", " shudders.");
2951 note_dies = _("はドロドロに溶けた!", " dissolves!");
2971 /* Only affect evil */
2972 if (r_ptr->flags3 & (RF3_EVIL))
2974 if (seen) obvious = TRUE;
2976 /* Learn about type */
2977 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2979 note = _("は身震いした。", " shudders.");
2980 note_dies = _("はドロドロに溶けた!", " dissolves!");
2999 /* Only affect good */
3000 if (r_ptr->flags3 & (RF3_GOOD))
3002 if (seen) obvious = TRUE;
3004 /* Learn about type */
3005 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3007 note = _("は身震いした。", " shudders.");
3008 note_dies = _("はドロドロに溶けた!", " dissolves!");
3025 case GF_DISP_LIVING:
3027 /* Only affect non-undead */
3028 if (monster_living(m_ptr->r_idx))
3030 if (seen) obvious = TRUE;
3032 note = _("は身震いした。", " shudders.");
3033 note_dies = _("はドロドロに溶けた!", " dissolves!");
3052 /* Only affect demons */
3053 if (r_ptr->flags3 & (RF3_DEMON))
3055 if (seen) obvious = TRUE;
3057 /* Learn about type */
3058 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3060 note = _("は身震いした。", " shudders.");
3061 note_dies = _("はドロドロに溶けた!", " dissolves!");
3077 /* Dispel monster */
3080 if (seen) obvious = TRUE;
3081 note = _("は身震いした。", " shudders.");
3082 note_dies = _("はドロドロに溶けた!", " dissolves!");
3089 if (seen) obvious = TRUE;
3090 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3094 /* Heal the monster */
3095 if (caster_ptr->hp < caster_ptr->maxhp)
3098 caster_ptr->hp += dam;
3099 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3101 /* Redraw (later) if needed */
3102 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3103 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3105 /* Special message */
3108 monster_desc(killer, caster_ptr, 0);
3109 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3115 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3116 (void)hp_player(dam);
3121 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3130 if (seen) obvious = TRUE;
3131 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3132 /* Attempt a saving throw */
3133 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3134 (r_ptr->flags3 & RF3_NO_CONF) ||
3135 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3137 /* Memorize a flag */
3138 if (r_ptr->flags3 & (RF3_NO_CONF))
3140 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3142 note = _("には効果がなかった。", " is unaffected.");
3145 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3147 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3148 note = _("には完全な耐性がある!", " is immune.");
3151 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3153 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3154 note = _("には耐性がある。", " resists.");
3159 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3160 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3162 if (who > 0) do_conf = randint0(4) + 4;
3163 else do_conf = randint0(8) + 8;
3169 case GF_BRAIN_SMASH:
3171 if (seen) obvious = TRUE;
3172 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3174 /* Attempt a saving throw */
3175 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3176 (r_ptr->flags3 & RF3_NO_CONF) ||
3177 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3179 /* Memorize a flag */
3180 if (r_ptr->flags3 & (RF3_NO_CONF))
3182 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3184 note = _("には効果がなかった。", " is unaffected.");
3187 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3189 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3190 note = _("には完全な耐性がある!", " is immune.");
3193 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3195 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3196 note = _("には耐性がある!", " resists!");
3201 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3202 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3206 do_conf = randint0(4) + 4;
3207 do_stun = randint0(4) + 4;
3211 do_conf = randint0(8) + 8;
3212 do_stun = randint0(8) + 8;
3214 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3222 if (seen) obvious = TRUE;
3223 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3224 /* Attempt a saving throw */
3225 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3227 note = _("には効果がなかった。", " is unaffected.");
3236 if (seen) obvious = TRUE;
3237 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3238 /* Attempt a saving throw */
3239 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3241 note = _("には効果がなかった。", " is unaffected.");
3250 if (seen) obvious = TRUE;
3251 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3252 /* Attempt a saving throw */
3253 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3255 note = _("には効果がなかった。", " is unaffected.");
3264 if (seen) obvious = TRUE;
3266 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3267 "You point at %s, screaming the word, 'DIE!'."), m_name);
3268 /* Attempt a saving throw */
3269 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3271 note = _("には効果がなかった。", " is unaffected.");
3280 if (seen) obvious = TRUE;
3281 if (r_ptr->flags1 & RF1_UNIQUE)
3283 note = _("には効果がなかった。", " is unaffected.");
3288 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3289 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3291 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3293 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3297 note = _("は耐性を持っている!", "resists!");
3304 /* Capture monster */
3308 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3309 (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)
3311 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3316 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3317 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3318 nokori_hp = m_ptr->maxhp * 3 / 10;
3320 nokori_hp = m_ptr->maxhp * 3 / 20;
3322 if (m_ptr->hp >= nokori_hp)
3324 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3327 else if (m_ptr->hp < randint0(nokori_hp))
3329 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3330 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3331 cap_mon = m_ptr->r_idx;
3332 cap_mspeed = m_ptr->mspeed;
3334 cap_maxhp = m_ptr->max_maxhp;
3335 cap_nickname = m_ptr->nickname; /* Quark transfer */
3336 if (g_ptr->m_idx == p_ptr->riding)
3338 if (rakuba(-1, FALSE))
3340 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3344 delete_monster_idx(g_ptr->m_idx);
3350 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3356 /* Attack (Use "dam" as attack type) */
3359 /* Return this monster's death */
3360 return py_attack(y, x, dam);
3363 /* Sleep (Use "dam" as "power") */
3369 if (seen) obvious = TRUE;
3370 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3372 note = _("には効果がなかった。", " is unaffected.");
3375 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3378 if (MON_CSLEEP(m_ptr))
3380 note = _("には効果がなかった。", " is unaffected.");
3386 if (one_in_(5)) effect = 1;
3387 else if (one_in_(4)) effect = 2;
3388 else if (one_in_(3)) effect = 3;
3393 /* Powerful monsters can resist */
3394 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3395 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3397 note = _("には効果がなかった。", " is unaffected.");
3401 /* Normal monsters slow down */
3404 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3406 note = _("の動きが遅くなった。", " starts moving slower.");
3411 else if (effect == 2)
3413 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3415 /* Attempt a saving throw */
3416 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3417 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3422 /* No obvious effect */
3423 note = _("には効果がなかった。", " is unaffected.");
3428 else if (effect == 3)
3430 /* Attempt a saving throw */
3431 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3432 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3433 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3435 /* Memorize a flag */
3436 if (r_ptr->flags3 & RF3_NO_SLEEP)
3438 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3441 /* No obvious effect */
3442 note = _("には効果がなかった。", " is unaffected.");
3447 /* Go to sleep (much) later */
3448 note = _("は眠り込んでしまった!", " falls asleep!");
3455 note = _("には効果がなかった。", " is unaffected.");
3458 /* No "real" damage */
3466 if (seen) obvious = TRUE;
3467 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3469 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3470 chg_virtue(V_VITALITY, -1);
3480 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3482 if (r_ptr->flags3 & (RF3_HURT_LITE))
3484 /* Obvious effect */
3485 if (seen) obvious = TRUE;
3487 /* Memorize the effects */
3488 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3490 /* Special effect */
3491 note = _("は光に身をすくめた!", " cringes from the light!");
3492 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3495 /* Normally no damage */
3502 photo = m_ptr->r_idx;
3509 case GF_BLOOD_CURSE:
3511 if (seen) obvious = TRUE;
3517 bool success = FALSE;
3518 if (seen) obvious = TRUE;
3520 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3522 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3523 if (dam < 1) dam = 1;
3525 /* No need to tame your pet */
3528 note = _("の動きが速くなった。", " starts moving faster.");
3529 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3533 /* Attempt a saving throw */
3534 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3535 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3536 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3537 (p_ptr->cursed & TRC_AGGRAVATE) ||
3538 ((r_ptr->level+10) > randint1(dam)))
3541 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3545 note = _("を支配した。", " is tamed!");
3547 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3549 /* Learn about type */
3550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3557 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3559 do_fear = randint1(90)+10;
3561 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3564 /* No "real" damage */
3571 if (seen) obvious = TRUE;
3572 /* Attempt a saving throw */
3573 if (randint0(100 + dam) < (r_ptr->level + 50))
3575 note = _("には効果がなかった。", " is unaffected.");
3595 /* Absolutely no effect */
3596 if (skipped) return (FALSE);
3598 /* "Unique" monsters cannot be polymorphed */
3599 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3601 /* Quest monsters cannot be polymorphed */
3602 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3604 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3606 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3607 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3609 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3614 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3615 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3618 /* Modify the damage */
3620 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3621 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3623 /* Check for death */
3624 if (dam > m_ptr->hp)
3626 /* Extract method of death */
3631 /* Sound and Impact resisters never stun */
3633 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3634 !(r_ptr->flags3 & RF3_NO_STUN))
3636 if (seen) obvious = TRUE;
3639 if (MON_STUNNED(m_ptr))
3641 note = _("はひどくもうろうとした。", " is more dazed.");
3642 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3646 note = _("はもうろうとした。", " is dazed.");
3651 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3657 /* Confusion and Chaos resisters (and sleepers) never confuse */
3659 !(r_ptr->flags3 & RF3_NO_CONF) &&
3660 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3662 if (seen) obvious = TRUE;
3664 /* Already partially confused */
3665 if (MON_CONFUSED(m_ptr))
3667 note = _("はさらに混乱したようだ。", " looks more confused.");
3668 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3671 /* Was not confused */
3674 note = _("は混乱したようだ。", " looks confused.");
3678 /* Apply confusion */
3679 (void)set_monster_confused(g_ptr->m_idx, tmp);
3687 if (seen) obvious = TRUE;
3689 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3693 note = _("は弱くなったようだ。", " seems weakened.");
3694 m_ptr->maxhp -= do_time;
3695 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3700 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3701 if (do_poly && (randint1(90) > r_ptr->level))
3703 if (polymorph_monster(y, x))
3705 if (seen) obvious = TRUE;
3707 /* Monster polymorphs */
3708 note = _("が変身した!", " changes!");
3710 /* Turn off the damage */
3716 note = _("には効果がなかった。", " is unaffected.");
3719 /* Hack -- Get new monster */
3720 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3722 /* Hack -- Get new race */
3723 r_ptr = &r_info[m_ptr->r_idx];
3726 /* Handle "teleport" */
3729 if (seen) obvious = TRUE;
3731 note = _("が消え去った!", " disappears!");
3733 if (!who) chg_virtue(V_VALOUR, -1);
3736 teleport_away(g_ptr->m_idx, do_dist,
3737 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3739 /* Hack -- get new location */
3743 /* Hack -- get new grid */
3744 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3751 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3758 if (typ == GF_DRAIN_MANA)
3760 /* Drain mana does nothing */
3763 /* If another monster did the damage, hurt the monster by hand */
3766 /* Redraw (later) if needed */
3767 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3768 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3770 /* Wake the monster up */
3771 (void)set_monster_csleep(g_ptr->m_idx, 0);
3773 /* Hurt the monster */
3781 if (is_pet(m_ptr) && !(m_ptr->ml))
3784 /* Give detailed messages if destroyed */
3787 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3790 msg_format("%^s%s", m_name, note);
3798 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3800 /* Generate treasure, etc */
3801 monster_death(g_ptr->m_idx, FALSE);
3804 delete_monster_idx(g_ptr->m_idx);
3808 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3812 /* Damaged monster */
3815 /* Give detailed messages if visible or destroyed */
3816 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3818 /* Hack -- Pain message */
3821 message_pain(g_ptr->m_idx, dam);
3828 /* Hack -- handle sleep */
3829 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3833 else if (heal_leper)
3835 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3837 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3839 char m2_name[MAX_NLEN];
3841 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3842 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3845 delete_monster_idx(g_ptr->m_idx);
3848 /* If the player did it, give him experience, check fear */
3853 /* Hurt the monster, check for fear and death */
3854 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3859 /* Damaged monster */
3862 /* HACK - anger the monster before showing the sleep message */
3863 if (do_sleep) anger_monster(m_ptr);
3865 /* Give detailed messages if visible or destroyed */
3866 if (note && seen_msg)
3867 msg_format(_("%s%s", "%^s%s"), m_name, note);
3869 /* Hack -- Pain message */
3870 else if (known && (dam || !do_fear))
3872 message_pain(g_ptr->m_idx, dam);
3875 /* Anger monsters */
3876 if (((dam > 0) || get_angry) && !do_sleep)
3877 anger_monster(m_ptr);
3879 if ((fear || do_fear) && seen)
3882 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3885 /* Hack -- handle sleep */
3886 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3890 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3892 blood_curse_to_enemy(who);
3895 if (p_ptr->inside_battle)
3897 p_ptr->health_who = g_ptr->m_idx;
3898 p_ptr->redraw |= (PR_HEALTH);
3902 /* Verify this code */
3903 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3905 /* Redraw the monster grid */
3908 /* Update monster recall window */
3909 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3911 p_ptr->window |= (PW_MONSTER);
3914 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3918 if (!(flg & PROJECT_NO_HANGEKI))
3920 set_target(m_ptr, monster_target_y, monster_target_x);
3923 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3925 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3929 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3931 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3932 rakubadam_m = (dam > 200) ? 200 : dam;
3942 /* Prepare to make a Blade of Chaos */
3943 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3945 q_ptr->pval = photo;
3947 /* Mark the item as fully known */
3948 q_ptr->ident |= (IDENT_MENTAL);
3949 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3957 /* Return "Anything seen?" */
3962 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3963 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3964 * @param who_name 効果を起こしたモンスターの名前
3965 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3966 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3967 * @param x 目標X座標 / Target x location (or location to travel "towards")
3968 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3969 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3971 * @param monspell 効果元のモンスター魔法ID
3972 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3974 * Handle a beam/bolt/ball causing damage to the player.
3975 * This routine takes a "source monster" (by index), a "distance", a default
3976 * "damage", and a "damage type". See "project_m()" above.
3977 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3978 * is reduced (see "project_m()" above). This can happen if a monster breathes
3979 * at the player and hits a wall instead.
3980 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3981 * to know if this is actually a ball or a bolt spell
3982 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3983 * we just assume that the effects were obvious, for historical reasons.
3985 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)
3990 /* Hack -- assume obvious */
3991 bool obvious = TRUE;
3993 /* Player blind-ness */
3994 bool blind = (p_ptr->blind ? TRUE : FALSE);
3996 /* Player needs a "description" (he is blind) */
3999 /* Source monster */
4000 monster_type *m_ptr = NULL;
4002 /* Monster name (for attacks) */
4003 GAME_TEXT m_name[MAX_NLEN];
4005 /* Monster name (for damage) */
4008 /* Hack -- messages */
4014 /* Player is not here */
4015 if (!player_bold(y, x)) return (FALSE);
4017 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4019 if (kawarimi(TRUE)) return FALSE;
4022 /* Player cannot hurt himself */
4023 if (!who) return (FALSE);
4024 if (who == p_ptr->riding) return (FALSE);
4026 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4029 int max_attempts = 10;
4030 sound(SOUND_REFLECT);
4033 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4034 else if (p_ptr->special_defense & KATA_FUUJIN)
4035 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4037 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4040 /* Choose 'new' target */
4045 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
4046 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
4049 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4051 if (max_attempts < 1)
4053 t_y = current_floor_ptr->m_list[who].fy;
4054 t_x = current_floor_ptr->m_list[who].fx;
4059 t_y = p_ptr->y - 1 + randint1(3);
4060 t_x = p_ptr->x - 1 + randint1(3);
4063 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4065 disturb(TRUE, TRUE);
4069 /* Limit maximum damage */
4070 if (dam > 1600) dam = 1600;
4072 /* Reduce damage by distance */
4073 dam = (dam + r) / (r + 1);
4076 /* If the player is blind, be more descriptive */
4077 if (blind) fuzzy = TRUE;
4082 m_ptr = ¤t_floor_ptr->m_list[who];
4083 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4084 monster_desc(m_name, m_ptr, 0);
4086 /* Get the monster's real name (gotten before polymorph!) */
4087 strcpy(killer, who_name);
4093 case PROJECT_WHO_UNCTRL_POWER:
4094 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4097 case PROJECT_WHO_GLASS_SHARDS:
4098 strcpy(killer, _("ガラスの破片", "shards of glass"));
4102 strcpy(killer, _("罠", "a trap"));
4105 strcpy(m_name, killer);
4108 /* Analyze the damage */
4111 /* Standard damage -- hurts p_ptr->inventory_list too */
4114 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4115 get_damage = acid_dam(dam, killer, monspell, FALSE);
4119 /* Standard damage -- hurts p_ptr->inventory_list too */
4122 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4123 get_damage = fire_dam(dam, killer, monspell, FALSE);
4127 /* Standard damage -- hurts p_ptr->inventory_list too */
4130 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4131 get_damage = cold_dam(dam, killer, monspell, FALSE);
4135 /* Standard damage -- hurts p_ptr->inventory_list too */
4138 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4139 get_damage = elec_dam(dam, killer, monspell, FALSE);
4143 /* Standard damage -- also poisons player */
4146 bool double_resist = IS_OPPOSE_POIS();
4147 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4149 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4150 if (double_resist) dam = (dam + 2) / 3;
4152 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4157 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4159 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4161 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4166 /* Standard damage -- also poisons / mutates player */
4169 bool double_resist = IS_OPPOSE_POIS();
4170 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4172 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4173 if (double_resist) dam = (2 * dam + 2) / 5;
4174 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4175 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4177 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4179 if (one_in_(5)) /* 6 */
4181 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4182 if (one_in_(4)) /* 4 */
4190 inven_damage(set_acid_destroy, 2);
4196 /* Standard damage */
4199 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4200 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4204 /* Holy Orb -- Player only takes partial damage */
4207 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4208 if (p_ptr->align > 10)
4210 else if (p_ptr->align < -10)
4212 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4218 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4219 if (p_ptr->align > 10)
4221 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4225 /* Arrow -- XXX no dodging */
4230 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4232 else if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (p_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
4234 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4237 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4241 /* Plasma -- XXX No resist */
4244 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4245 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4247 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4249 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4250 (void)set_stun(p_ptr->stun + plus_stun);
4253 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4255 inven_damage(set_acid_destroy, 3);
4261 /* Nether -- drain experience */
4264 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4265 if (p_ptr->resist_neth)
4267 if (!prace_is_(RACE_SPECTRE))
4269 dam *= 6; dam /= (randint1(4) + 7);
4272 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4274 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4276 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4278 learn_spell(monspell);
4282 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4288 /* Water -- stun/confuse */
4291 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4292 if (!CHECK_MULTISHADOW())
4294 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4296 set_stun(p_ptr->stun + randint1(40));
4298 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4300 set_confused(p_ptr->confused + randint1(5) + 5);
4303 if (one_in_(5) && !p_ptr->resist_water)
4305 inven_damage(set_cold_destroy, 3);
4308 if (p_ptr->resist_water) get_damage /= 4;
4311 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4315 /* Chaos -- many effects */
4318 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4319 if (p_ptr->resist_chaos)
4321 dam *= 6; dam /= (randint1(4) + 7);
4324 if (!CHECK_MULTISHADOW())
4326 if (!p_ptr->resist_conf)
4328 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4330 if (!p_ptr->resist_chaos)
4332 (void)set_image(p_ptr->image + randint1(10));
4335 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4336 (void)gain_mutation(p_ptr, 0);
4339 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4341 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4344 if (!p_ptr->resist_chaos || one_in_(9))
4346 inven_damage(set_elec_destroy, 2);
4347 inven_damage(set_fire_destroy, 2);
4351 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4355 /* Shards -- mostly cutting */
4358 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4359 if (p_ptr->resist_shard)
4361 dam *= 6; dam /= (randint1(4) + 7);
4363 else if (!CHECK_MULTISHADOW())
4365 (void)set_cut(p_ptr->cut + dam);
4368 if (!p_ptr->resist_shard || one_in_(13))
4370 inven_damage(set_cold_destroy, 2);
4373 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4377 /* Sound -- mostly stunning */
4380 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4381 if (p_ptr->resist_sound)
4383 dam *= 5; dam /= (randint1(4) + 7);
4385 else if (!CHECK_MULTISHADOW())
4387 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4388 (void)set_stun(p_ptr->stun + plus_stun);
4391 if (!p_ptr->resist_sound || one_in_(13))
4393 inven_damage(set_cold_destroy, 2);
4396 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4400 /* Pure confusion */
4403 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4404 if (p_ptr->resist_conf)
4406 dam *= 5; dam /= (randint1(4) + 7);
4408 else if (!CHECK_MULTISHADOW())
4410 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4412 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4416 /* Disenchantment -- see above */
4419 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4420 if (p_ptr->resist_disen)
4422 dam *= 6; dam /= (randint1(4) + 7);
4424 else if (!CHECK_MULTISHADOW())
4426 (void)apply_disenchant(0);
4428 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4432 /* Nexus -- see above */
4435 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4436 if (p_ptr->resist_nexus)
4438 dam *= 6; dam /= (randint1(4) + 7);
4440 else if (!CHECK_MULTISHADOW())
4444 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4448 /* Force -- mostly stun */
4451 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4452 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4454 (void)set_stun(p_ptr->stun + randint1(20));
4456 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4461 /* Rocket -- stun, cut */
4464 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4465 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4467 (void)set_stun(p_ptr->stun + randint1(20));
4470 if (p_ptr->resist_shard)
4474 else if (!CHECK_MULTISHADOW())
4476 (void)set_cut(p_ptr->cut + (dam / 2));
4479 if (!p_ptr->resist_shard || one_in_(12))
4481 inven_damage(set_cold_destroy, 3);
4484 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4488 /* Inertia -- slowness */
4491 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4492 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4493 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4497 /* Lite -- blinding */
4500 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4501 if (p_ptr->resist_lite)
4503 dam *= 4; dam /= (randint1(4) + 7);
4505 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4507 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4510 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4512 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4515 else if (prace_is_(RACE_S_FAIRY))
4520 if (p_ptr->wraith_form) dam *= 2;
4521 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4523 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4525 p_ptr->wraith_form = 0;
4526 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4527 "The light forces you out of your incorporeal shadow form."));
4529 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4530 p_ptr->update |= (PU_MONSTERS);
4531 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4537 /* Dark -- blinding */
4540 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4541 if (p_ptr->resist_dark)
4543 dam *= 4; dam /= (randint1(4) + 7);
4545 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4547 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4549 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4551 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4555 /* Time -- bolt fewer effects XXX */
4558 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4559 if (p_ptr->resist_time)
4562 dam /= (randint1(4) + 7);
4563 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4565 else if (!CHECK_MULTISHADOW())
4567 switch (randint1(10))
4569 case 1: case 2: case 3: case 4: case 5:
4571 if (p_ptr->prace == RACE_ANDROID) break;
4572 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4573 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4577 case 6: case 7: case 8: case 9:
4579 switch (randint1(6))
4581 case 1: k = A_STR; act = _("強く", "strong"); break;
4582 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4583 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4584 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4585 case 5: k = A_CON; act = _("健康で", "hale"); break;
4586 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4589 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4590 "You're not as %s as you used to be..."), act);
4592 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4593 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4594 p_ptr->update |= (PU_BONUS);
4600 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4601 "You're not as powerful as you used to be..."));
4603 for (k = 0; k < A_MAX; k++)
4605 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4606 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4608 p_ptr->update |= (PU_BONUS);
4614 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4618 /* Gravity -- stun plus slowness plus teleport */
4621 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4622 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4624 if (!CHECK_MULTISHADOW())
4626 teleport_player(5, TELEPORT_PASSIVE);
4627 if (!p_ptr->levitation)
4628 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4629 if (!(p_ptr->resist_sound || p_ptr->levitation))
4631 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4632 (void)set_stun(p_ptr->stun + plus_stun);
4635 if (p_ptr->levitation)
4637 dam = (dam * 2) / 3;
4640 if (!p_ptr->levitation || one_in_(13))
4642 inven_damage(set_cold_destroy, 2);
4645 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4649 /* Standard damage */
4650 case GF_DISINTEGRATE:
4652 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4654 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4660 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4662 (void)hp_player(dam);
4669 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4670 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4677 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4678 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4684 if (p_ptr->free_act) break;
4685 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4687 if (ironman_nightmare)
4689 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4690 /* Have some nightmares */
4691 sanity_blast(NULL, FALSE);
4694 set_paralyzed(p_ptr->paralyzed + dam);
4704 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4705 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4712 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4713 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4720 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4722 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4723 if (!p_ptr->resist_shard || one_in_(13))
4725 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4726 inven_damage(set_cold_destroy, 2);
4732 /* Ice -- cold plus stun plus cuts */
4735 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4736 get_damage = cold_dam(dam, killer, monspell, FALSE);
4737 if (!CHECK_MULTISHADOW())
4739 if (!p_ptr->resist_shard)
4741 (void)set_cut(p_ptr->cut + damroll(5, 8));
4743 if (!p_ptr->resist_sound)
4745 (void)set_stun(p_ptr->stun + randint1(15));
4748 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4750 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4760 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4762 if (p_ptr->mimic_form)
4764 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4765 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4770 switch (p_ptr->prace)
4772 /* Some races are immune */
4786 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4798 if (CHECK_MULTISHADOW())
4800 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4802 else if (p_ptr->csp)
4806 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4808 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4811 if (dam >= p_ptr->csp)
4815 p_ptr->csp_frac = 0;
4824 learn_spell(monspell);
4825 p_ptr->redraw |= (PR_MANA);
4826 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4830 /* Heal the monster */
4831 if (m_ptr->hp < m_ptr->maxhp)
4835 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4837 /* Redraw (later) if needed */
4838 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4839 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4841 /* Special message */
4844 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4857 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4859 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4860 learn_spell(monspell);
4864 if (!CHECK_MULTISHADOW())
4866 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4868 if (!p_ptr->resist_conf)
4870 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4873 if (!p_ptr->resist_chaos && one_in_(3))
4875 (void)set_image(p_ptr->image + randint0(250) + 150);
4882 p_ptr->csp_frac = 0;
4884 p_ptr->redraw |= PR_MANA;
4887 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4893 case GF_BRAIN_SMASH:
4895 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4897 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4898 learn_spell(monspell);
4902 if (!CHECK_MULTISHADOW())
4904 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4910 p_ptr->csp_frac = 0;
4912 p_ptr->redraw |= PR_MANA;
4915 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4916 if (!CHECK_MULTISHADOW())
4918 if (!p_ptr->resist_blind)
4920 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4922 if (!p_ptr->resist_conf)
4924 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4926 if (!p_ptr->free_act)
4928 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4930 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4932 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4933 (void)do_dec_stat(A_INT);
4934 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4935 (void)do_dec_stat(A_WIS);
4937 if (!p_ptr->resist_chaos)
4939 (void)set_image(p_ptr->image + randint0(250) + 150);
4949 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4951 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4952 learn_spell(monspell);
4956 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
4957 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4965 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4967 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4968 learn_spell(monspell);
4972 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4973 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4981 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4983 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4984 learn_spell(monspell);
4988 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4989 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4997 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
4999 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5000 learn_spell(monspell);
5004 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5005 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5013 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5015 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5016 learn_spell(monspell);
5020 if (!CHECK_MULTISHADOW())
5022 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5023 curse_equipment(40, 20);
5026 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5028 if (p_ptr->chp < 1) p_ptr->chp = 1;
5043 /* Hex - revenge damage stored */
5044 revenge_store(get_damage);
5046 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5047 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5049 GAME_TEXT m_name_self[80];
5052 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5054 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5055 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5056 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5059 if (p_ptr->riding && dam > 0)
5061 rakubadam_p = (dam > 200) ? 200 : dam;
5065 disturb(TRUE, TRUE);
5068 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5070 (void)kawarimi(FALSE);
5073 /* Return "Anything seen?" */
5079 * Find the distance from (x, y) to a line.
5081 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5083 /* Vector from (x, y) to (x1, y1) */
5084 POSITION py = y1 - y;
5085 POSITION px = x1 - x;
5088 POSITION ny = x2 - x1;
5089 POSITION nx = y1 - y2;
5092 POSITION pd = distance(y1, x1, y, x);
5093 POSITION nd = distance(y1, x1, y2, x2);
5095 if (pd > nd) return distance(y, x, y2, x2);
5097 /* Component of P on N */
5098 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5100 /* Absolute value */
5101 return((nd >= 0) ? nd : 0 - nd);
5108 * Modified version of los() for calculation of disintegration balls.
5109 * Disintegration effects are stopped by permanent walls.
5111 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5113 POSITION dx, dy; /* Delta */
5114 POSITION ax, ay; /* Absolute */
5115 POSITION sx, sy; /* Signs */
5116 POSITION qx, qy; /* Fractions */
5117 POSITION tx, ty; /* Scanners */
5118 POSITION f1, f2; /* Scale factors */
5119 POSITION m; /* Slope, or 1/Slope, of LOS */
5121 /* Extract the offset */
5125 /* Extract the absolute offset */
5129 /* Handle adjacent (or identical) grids */
5130 if ((ax < 2) && (ay < 2)) return (TRUE);
5132 /* Paranoia -- require "safe" origin */
5133 /* if (!in_bounds(y1, x1)) return (FALSE); */
5135 /* Directly South/North */
5138 /* South -- check for walls */
5141 for (ty = y1 + 1; ty < y2; ty++)
5143 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5147 /* North -- check for walls */
5150 for (ty = y1 - 1; ty > y2; ty--)
5152 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5160 /* Directly East/West */
5163 /* East -- check for walls */
5166 for (tx = x1 + 1; tx < x2; tx++)
5168 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5172 /* West -- check for walls */
5175 for (tx = x1 - 1; tx > x2; tx--)
5177 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5185 /* Extract some signs */
5186 sx = (dx < 0) ? -1 : 1;
5187 sy = (dy < 0) ? -1 : 1;
5189 /* Vertical "knights" */
5194 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5198 /* Horizontal "knights" */
5203 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5207 /* Calculate scale factor div 2 */
5210 /* Calculate scale factor */
5214 /* Travel horizontally */
5217 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5223 /* Consider the special case where slope == 1. */
5234 /* Note (below) the case (qy == f2), where */
5235 /* the LOS exactly meets the corner of a tile. */
5238 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5249 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5262 /* Travel vertically */
5265 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5281 /* Note (below) the case (qx == f2), where */
5282 /* the LOS exactly meets the corner of a tile. */
5285 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5296 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5317 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)
5322 int brev = rad * rad / dist;
5326 int mdis = distance(y1, x1, y2, x2) + rad;
5328 while (bdis <= mdis)
5332 if ((0 < dist) && (path_n < dist))
5334 POSITION ny = GRID_Y(path_g[path_n]);
5335 POSITION nx = GRID_X(path_g[path_n]);
5336 POSITION nd = distance(ny, nx, y1, x1);
5338 /* Get next base point */
5347 /* Travel from center outward */
5348 for (cdis = 0; cdis <= brad; cdis++)
5350 /* Scan the maximal blast area of radius "cdis" */
5351 for (y = by - cdis; y <= by + cdis; y++)
5353 for (x = bx - cdis; x <= bx + cdis; x++)
5355 /* Ignore "illegal" locations */
5356 if (!in_bounds(y, x)) continue;
5358 /* Enforce a circular "ripple" */
5359 if (distance(y1, x1, y, x) != bdis) continue;
5361 /* Enforce an arc */
5362 if (distance(by, bx, y, x) != cdis) continue;
5368 /* Lights are stopped by opaque terrains */
5369 if (!los(by, bx, y, x)) continue;
5371 case GF_DISINTEGRATE:
5372 /* Disintegration are stopped only by perma-walls */
5373 if (!in_disintegration_range(by, bx, y, x)) continue;
5376 /* Ball explosions are stopped by walls */
5377 if (!projectable(by, bx, y, x)) continue;
5381 /* Save this grid */
5389 /* Encode some more "radius" info */
5390 gm[bdis + 1] = *pgrids;
5392 /* Increase the size */
5393 brad = rad * (path_n + brev) / (dist + brev);
5395 /* Find the next ripple */
5399 /* Store the effect size */
5405 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5406 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5407 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5408 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5409 * @param x 目標X座標 / Target x location (or location to travel "towards")
5410 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5411 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5412 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5413 * @param monspell 効果元のモンスター魔法ID
5414 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5417 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5418 * towards a given location (optionally passing over the heads of interposing
5419 * monsters), and have it do a given amount of damage to the monsters (and
5420 * optionally objects) within the given radius of the final location.
5422 * A "bolt" travels from source to target and affects only the target grid.
5423 * A "beam" travels from source to target, affecting all grids passed through.
5424 * A "ball" travels from source to the target, exploding at the target, and
5425 * affecting everything within the given radius of the target location.
5427 * Traditionally, a "bolt" does not affect anything on the ground, and does
5428 * not pass over the heads of interposing monsters, much like a traditional
5429 * missile, and will "stop" abruptly at the "target" even if no monster is
5430 * positioned there, while a "ball", on the other hand, passes over the heads
5431 * of monsters between the source and target, and affects everything except
5432 * the source monster which lies within the final radius, while a "beam"
5433 * affects every monster between the source and target, except for the casting
5434 * monster (or player), and rarely affects things on the ground.
5436 * Two special flags allow us to use this function in special ways, the
5437 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5438 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5439 * actually projecting from the source monster (or player).
5441 * The player will only get "experience" for monsters killed by himself
5442 * Unique monsters can only be destroyed by attacks from the player
5444 * Only 256 grids can be affected per projection, limiting the effective
5445 * "radius" of standard ball attacks to nine units (diameter nineteen).
5447 * One can project in a given "direction" by combining PROJECT_THRU with small
5448 * offsets to the initial location (see "line_spell()"), or by calculating
5449 * "virtual targets" far away from the player.
5451 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5452 * continuing until it actually hits somethings (useful for "stone to mud").
5454 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5456 * Balls must explode BEFORE hitting walls, or they would affect monsters
5457 * on both sides of a wall. Some bug reports indicate that this is still
5458 * happening in 2.7.8 for Windows, though it appears to be impossible.
5460 * We "pre-calculate" the blast area only in part for efficiency.
5461 * More importantly, this lets us do "explosions" from the "inside" out.
5462 * This results in a more logical distribution of "blast" treasure.
5463 * It also produces a better (in my opinion) animation of the explosion.
5464 * It could be (but is not) used to have the treasure dropped by monsters
5465 * in the middle of the explosion fall "outwards", and then be damaged by
5466 * the blast as it spreads outwards towards the treasure drop location.
5468 * Walls and doors are included in the blast area, so that they can be
5469 * "burned" or "melted" in later versions.
5471 * This algorithm is intended to maximize simplicity, not necessarily
5472 * efficiency, since this function is not a bottleneck in the code.
5474 * We apply the blast effect from ground zero outwards, in several passes,
5475 * first affecting features, then objects, then monsters, then the player.
5476 * This allows walls to be removed before checking the object or monster
5477 * in the wall, and protects objects which are dropped by monsters killed
5478 * in the blast, and allows the player to see all affects before he is
5479 * killed or teleported away. The semantics of this method are open to
5480 * various interpretations, but they seem to work well in practice.
5482 * We process the blast area from ground-zero outwards to allow for better
5483 * distribution of treasure dropped by monsters, and because it provides a
5484 * pleasing visual effect at low cost.
5486 * Note that the damage done by "ball" explosions decreases with distance.
5487 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5489 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5490 * the target, and then the damage "flows" along this beam of destruction.
5491 * The damage at every grid is the same as at the "center" of a "ball"
5492 * explosion, since the "beam" grids are treated as if they ARE at the
5493 * center of a "ball" explosion.
5495 * Currently, specifying "beam" plus "ball" means that locations which are
5496 * covered by the initial "beam", and also covered by the final "ball", except
5497 * for the final grid (the epicenter of the ball), will be "hit twice", once
5498 * by the initial beam, and once by the exploding ball. For the grid right
5499 * next to the epicenter, this results in 150% damage being done. The center
5500 * does not have this problem, for the same reason the final grid in a "beam"
5501 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5502 * grids which are covered by the "ball" will NOT work, as then they will
5503 * receive LESS damage than they should. Do not combine "beam" with "ball".
5505 * The array "gy[],gx[]" with current size "grids" is used to hold the
5506 * collected locations of all grids in the "blast area" plus "beam path".
5508 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5509 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5510 * first blast grid (see above) with radius "N" from the blast center. Note
5511 * that only the first gm[1] grids in the blast area thus take full damage.
5512 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5513 * number of blast grids.
5515 * Note that once the projection is complete, (y2,x2) holds the final location
5516 * of bolts/beams, and the "epicenter" of balls.
5518 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5519 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5520 * implementation of the "distance" function. Also, a bolt can be properly
5521 * viewed as a "ball" with a "rad" of "zero".
5523 * Note that if no "target" is reached before the beam/bolt/ball travels the
5524 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5525 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5527 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5528 * to move from point A to point B, even if the player cannot see part of the
5529 * projection path. Note that in general, the player will *always* see part
5530 * of the path, since it either starts at the player or ends on the player.
5532 * Hack -- we assume that every "projection" is "self-illuminating".
5534 * Hack -- when only a single monster is affected, we automatically track
5535 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5537 * Note that all projections now "explode" at their final destination, even
5538 * if they were being projected at a more distant destination. This means
5539 * that "ball" spells will *always* explode.
5541 * Note that we must call "handle_stuff()" after affecting terrain features
5542 * in the blast radius, in case the "illumination" of the grid was changed,
5543 * and "update_view()" and "update_monsters()" need to be called.
5546 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5556 POSITION y_saver, x_saver; /* For reflecting monsters */
5558 int msec = delay_factor * delay_factor * delay_factor;
5560 /* Assume the player sees nothing */
5561 bool notice = FALSE;
5563 /* Assume the player has seen nothing */
5564 bool visual = FALSE;
5566 /* Assume the player has seen no blast grids */
5569 /* Assume to be a normal ball spell */
5570 bool breath = FALSE;
5572 /* Is the player blind? */
5573 bool blind = (p_ptr->blind ? TRUE : FALSE);
5575 bool old_hide = FALSE;
5577 /* Number of grids in the "path" */
5580 /* Actual grids in the "path" */
5583 /* Number of grids in the "blast area" (including the "beam" path) */
5586 /* Coordinates of the affected grids */
5587 POSITION gx[1024], gy[1024];
5589 /* Encoded "radius" info (see above) */
5592 /* Actual radius encoded in gm[] */
5593 POSITION gm_rad = rad;
5597 /* Attacker's name (prepared before polymorph)*/
5598 GAME_TEXT who_name[MAX_NLEN];
5600 /* Can the player see the source of this effect? */
5601 bool see_s_msg = TRUE;
5603 /* Initialize by null string */
5609 /* Default target of monsterspell is player */
5610 monster_target_y = p_ptr->y;
5611 monster_target_x = p_ptr->x;
5613 /* Hack -- Jump to target */
5614 if (flg & (PROJECT_JUMP))
5619 /* Clear the flag */
5620 flg &= ~(PROJECT_JUMP);
5625 /* Start at player */
5632 /* Start at monster */
5635 x1 = current_floor_ptr->m_list[who].fx;
5636 y1 = current_floor_ptr->m_list[who].fy;
5637 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_WRONGDOER_NAME);
5649 /* Default "destination" */
5654 /* Hack -- verify stuff */
5655 if (flg & (PROJECT_THRU))
5657 if ((x1 == x2) && (y1 == y2))
5659 flg &= ~(PROJECT_THRU);
5663 /* Handle a breath attack */
5668 if (flg & PROJECT_HIDE) old_hide = TRUE;
5669 flg |= PROJECT_HIDE;
5673 /* Hack -- Assume there will be no blast (max radius 32) */
5674 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5682 /* Collect beam grids */
5683 if (flg & (PROJECT_BEAM))
5694 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5696 case GF_DISINTEGRATE:
5697 flg |= (PROJECT_GRID);
5698 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5702 /* Calculate the projection path */
5704 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5707 /* Giga-Hack SEEKER & SUPER_RAY */
5709 if( typ == GF_SEEKER )
5719 for (i = 0; i < path_n; ++i)
5724 POSITION ny = GRID_Y(path_g[i]);
5725 POSITION nx = GRID_X(path_g[i]);
5736 /* Only do visuals if requested */
5737 if (!blind && !(flg & (PROJECT_HIDE)))
5739 /* Only do visuals if the player can "see" the bolt */
5740 if (panel_contains(y, x) && player_has_los_bold(y, x))
5747 /* Obtain the bolt pict */
5748 p = bolt_pict(oy, ox, y, x, typ);
5750 /* Extract attr/char */
5754 /* Visual effects */
5755 print_rel(c, a, y, x);
5756 move_cursor_relative(y, x);
5757 /*if (fresh_before)*/ Term_fresh();
5758 Term_xtra(TERM_XTRA_DELAY, msec);
5760 /*if (fresh_before)*/ Term_fresh();
5762 /* Display "beam" grids */
5763 if (flg & (PROJECT_BEAM))
5765 /* Obtain the explosion pict */
5766 p = bolt_pict(y, x, y, x, typ);
5768 /* Extract attr/char */
5772 /* Visual effects */
5773 print_rel(c, a, y, x);
5776 /* Hack -- Activate delay */
5780 /* Hack -- delay anyway for consistency */
5783 /* Delay for consistency */
5784 Term_xtra(TERM_XTRA_DELAY, msec);
5787 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5788 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5790 /* The target of monsterspell becomes tha mirror(broken) */
5791 monster_target_y = y;
5792 monster_target_x = x;
5794 remove_mirror(y, x);
5795 next_mirror(&oy, &ox, y, x);
5797 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5798 for (j = last_i; j <= i; j++)
5800 y = GRID_Y(path_g[j]);
5801 x = GRID_X(path_g[j]);
5802 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5803 if (!who && (project_m_n == 1) && !jump) {
5804 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5805 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5809 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5810 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5814 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5819 for(i = last_i ; i < path_n ; i++)
5822 py = GRID_Y(path_g[i]);
5823 px = GRID_X(path_g[i]);
5824 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5826 if (!who && (project_m_n == 1) && !jump) {
5827 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5829 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5833 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5834 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5838 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5842 else if(typ == GF_SUPER_RAY){
5844 int second_step = 0;
5851 for (i = 0; i < path_n; ++i)
5856 POSITION ny = GRID_Y(path_g[i]);
5857 POSITION nx = GRID_X(path_g[i]);
5868 /* Only do visuals if requested */
5869 if (!blind && !(flg & (PROJECT_HIDE)))
5871 /* Only do visuals if the player can "see" the bolt */
5872 if (panel_contains(y, x) && player_has_los_bold(y, x))
5879 /* Obtain the bolt pict */
5880 p = bolt_pict(oy, ox, y, x, typ);
5882 /* Extract attr/char */
5886 /* Visual effects */
5887 print_rel(c, a, y, x);
5888 move_cursor_relative(y, x);
5889 /*if (fresh_before)*/ Term_fresh();
5890 Term_xtra(TERM_XTRA_DELAY, msec);
5892 /*if (fresh_before)*/ Term_fresh();
5894 /* Display "beam" grids */
5895 if (flg & (PROJECT_BEAM))
5897 /* Obtain the explosion pict */
5898 p = bolt_pict(y, x, y, x, typ);
5900 /* Extract attr/char */
5904 /* Visual effects */
5905 print_rel(c, a, y, x);
5908 /* Hack -- Activate delay */
5912 /* Hack -- delay anyway for consistency */
5915 /* Delay for consistency */
5916 Term_xtra(TERM_XTRA_DELAY, msec);
5919 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5920 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5922 if( second_step )continue;
5925 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5927 /* The target of monsterspell becomes tha mirror(broken) */
5928 monster_target_y = y;
5929 monster_target_x = x;
5932 for( j = 0; j <=i ; j++ )
5934 y = GRID_Y(path_g[j]);
5935 x = GRID_X(path_g[j]);
5936 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5940 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5941 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5942 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5943 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5944 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5945 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
5946 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5947 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5950 for( i = 0; i < path_n ; i++ )
5953 py = GRID_Y(path_g[i]);
5954 px = GRID_X(path_g[i]);
5955 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5956 if(!who && (project_m_n == 1) && !jump){
5957 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5958 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5962 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5963 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5967 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5972 /* Project along the path */
5973 for (i = 0; i < path_n; ++i)
5978 POSITION ny = GRID_Y(path_g[i]);
5979 POSITION nx = GRID_X(path_g[i]);
5981 if (flg & PROJECT_DISI)
5983 /* Hack -- Balls explode before reaching walls */
5984 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5986 else if (flg & PROJECT_LOS)
5988 /* Hack -- Balls explode before reaching walls */
5989 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
5993 /* Hack -- Balls explode before reaching walls */
5994 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6001 /* Collect beam grids */
6002 if (flg & (PROJECT_BEAM))
6009 /* Only do visuals if requested */
6010 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6012 /* Only do visuals if the player can "see" the bolt */
6013 if (panel_contains(y, x) && player_has_los_bold(y, x))
6020 /* Obtain the bolt pict */
6021 p = bolt_pict(oy, ox, y, x, typ);
6023 /* Extract attr/char */
6027 /* Visual effects */
6028 print_rel(c, a, y, x);
6029 move_cursor_relative(y, x);
6030 /*if (fresh_before)*/ Term_fresh();
6031 Term_xtra(TERM_XTRA_DELAY, msec);
6033 /*if (fresh_before)*/ Term_fresh();
6035 /* Display "beam" grids */
6036 if (flg & (PROJECT_BEAM))
6038 /* Obtain the explosion pict */
6039 p = bolt_pict(y, x, y, x, typ);
6041 /* Extract attr/char */
6045 /* Visual effects */
6046 print_rel(c, a, y, x);
6049 /* Hack -- Activate delay */
6053 /* Hack -- delay anyway for consistency */
6056 /* Delay for consistency */
6057 Term_xtra(TERM_XTRA_DELAY, msec);
6064 /* Save the "blast epicenter" */
6068 if (breath && !path_n)
6074 flg &= ~(PROJECT_HIDE);
6078 /* Start the "explosion" */
6081 /* Hack -- make sure beams get to "explode" */
6089 /* If we found a "target", explode there */
6090 if (dist <= MAX_RANGE)
6092 /* Mega-Hack -- remove the final "beam" grid */
6093 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6096 * Create a conical breath attack
6107 flg &= ~(PROJECT_HIDE);
6109 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6113 /* Determine the blast area, work from the inside out */
6114 for (dist = 0; dist <= rad; dist++)
6116 /* Scan the maximal blast area of radius "dist" */
6117 for (y = by - dist; y <= by + dist; y++)
6119 for (x = bx - dist; x <= bx + dist; x++)
6121 /* Ignore "illegal" locations */
6122 if (!in_bounds2(y, x)) continue;
6124 /* Enforce a "circular" explosion */
6125 if (distance(by, bx, y, x) != dist) continue;
6131 /* Lights are stopped by opaque terrains */
6132 if (!los(by, bx, y, x)) continue;
6134 case GF_DISINTEGRATE:
6135 /* Disintegration are stopped only by perma-walls */
6136 if (!in_disintegration_range(by, bx, y, x)) continue;
6139 /* Ball explosions are stopped by walls */
6140 if (!projectable(by, bx, y, x)) continue;
6144 /* Save this grid */
6151 /* Encode some more "radius" info */
6157 /* Speed -- ignore "non-explosions" */
6158 if (!grids) return (FALSE);
6161 /* Display the "blast area" if requested */
6162 if (!blind && !(flg & (PROJECT_HIDE)))
6164 /* Then do the "blast", from inside out */
6165 for (t = 0; t <= gm_rad; t++)
6167 /* Dump everything with this radius */
6168 for (i = gm[t]; i < gm[t+1]; i++)
6170 /* Extract the location */
6174 /* Only do visuals if the player can "see" the blast */
6175 if (panel_contains(y, x) && player_has_los_bold(y, x))
6184 /* Obtain the explosion pict */
6185 p = bolt_pict(y, x, y, x, typ);
6187 /* Extract attr/char */
6191 /* Visual effects -- Display */
6192 print_rel(c, a, y, x);
6196 /* Hack -- center the cursor */
6197 move_cursor_relative(by, bx);
6199 /* Flush each "radius" seperately */
6200 /*if (fresh_before)*/ Term_fresh();
6202 /* Delay (efficiently) */
6203 if (visual || drawn)
6205 Term_xtra(TERM_XTRA_DELAY, msec);
6209 /* Flush the erasing */
6212 /* Erase the explosion drawn above */
6213 for (i = 0; i < grids; i++)
6215 /* Extract the location */
6219 /* Hack -- Erase if needed */
6220 if (panel_contains(y, x) && player_has_los_bold(y, x))
6226 /* Hack -- center the cursor */
6227 move_cursor_relative(by, bx);
6229 /* Flush the explosion */
6230 /*if (fresh_before)*/ Term_fresh();
6234 update_creature(p_ptr);
6236 if (flg & PROJECT_KILL)
6238 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6239 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6243 /* Check features */
6244 if (flg & (PROJECT_GRID))
6246 /* Start with "dist" of zero */
6249 /* Scan for features */
6250 for (i = 0; i < grids; i++)
6252 /* Hack -- Notice new "dist" values */
6253 if (gm[dist+1] == i) dist++;
6255 /* Get the grid location */
6259 /* Find the closest point in the blast */
6262 int d = dist_to_line(y, x, y1, x1, by, bx);
6264 /* Affect the grid */
6265 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6269 /* Affect the grid */
6270 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6275 update_creature(p_ptr);
6278 if (flg & (PROJECT_ITEM))
6280 /* Start with "dist" of zero */
6283 /* Scan for objects */
6284 for (i = 0; i < grids; i++)
6286 /* Hack -- Notice new "dist" values */
6287 if (gm[dist+1] == i) dist++;
6289 /* Get the grid location */
6293 /* Find the closest point in the blast */
6296 int d = dist_to_line(y, x, y1, x1, by, bx);
6298 /* Affect the object in the grid */
6299 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6303 /* Affect the object in the grid */
6304 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6310 /* Check monsters */
6311 if (flg & (PROJECT_KILL))
6318 /* Start with "dist" of zero */
6321 /* Scan for monsters */
6322 for (i = 0; i < grids; i++)
6326 /* Hack -- Notice new "dist" values */
6327 if (gm[dist + 1] == i) dist++;
6329 /* Get the grid location */
6333 /* A single bolt may be reflected */
6336 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6337 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6339 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6340 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6341 (!who || dist_hack > 1) && !one_in_(10))
6344 int max_attempts = 10;
6346 /* Choose 'new' target */
6349 t_y = y_saver - 1 + randint1(3);
6350 t_x = x_saver - 1 + randint1(3);
6353 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6355 if (max_attempts < 1)
6361 sound(SOUND_REFLECT);
6364 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6365 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6366 else if (m_ptr->r_idx == MON_DIO)
6367 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6369 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6371 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6373 /* Reflected bolts randomly target either one */
6374 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6375 else flg |= PROJECT_PLAYER;
6377 /* The bolt is reflected */
6378 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6380 /* Don't affect the monster any longer */
6386 /* Find the closest point in the blast */
6389 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6393 effective_dist = dist;
6397 /* There is the riding player on this monster */
6398 if (p_ptr->riding && player_bold(y, x))
6400 /* Aimed on the player */
6401 if (flg & PROJECT_PLAYER)
6403 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6406 * A beam or bolt is well aimed
6408 * So don't affects the mount.
6415 * The spell is not well aimed,
6416 * So partly affect the mount too.
6423 * This grid is the original target.
6424 * Or aimed on your horse.
6426 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6428 /* Hit the mount with full damage */
6432 * Otherwise this grid is not the
6433 * original target, it means that line
6434 * of fire is obstructed by this
6438 * A beam or bolt will hit either
6439 * player or mount. Choose randomly.
6441 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6445 /* Hit the mount with full damage */
6449 /* Hit the player later */
6450 flg |= PROJECT_PLAYER;
6452 /* Don't affect the mount */
6458 * The spell is not well aimed, so
6459 * partly affect both player and
6468 /* Affect the monster in the grid */
6469 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6473 /* Player affected one monster (without "jumping") */
6474 if (!who && (project_m_n == 1) && !jump)
6479 /* Track if possible */
6480 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6482 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6486 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6487 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6495 if (flg & (PROJECT_KILL))
6497 /* Start with "dist" of zero */
6500 /* Scan for player */
6501 for (i = 0; i < grids; i++)
6505 /* Hack -- Notice new "dist" values */
6506 if (gm[dist+1] == i) dist++;
6508 /* Get the grid location */
6512 /* Affect the player? */
6513 if (!player_bold(y, x)) continue;
6515 /* Find the closest point in the blast */
6518 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6522 effective_dist = dist;
6525 /* Target may be your horse */
6528 /* Aimed on the player */
6529 if (flg & PROJECT_PLAYER)
6531 /* Hit the player with full damage */
6535 * Hack -- When this grid was not the
6536 * original target, a beam or bolt
6537 * would hit either player or mount,
6538 * and should be choosen randomly.
6540 * But already choosen to hit the
6541 * mount at this point.
6543 * Or aimed on your horse.
6545 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6548 * A beam or bolt is well aimed
6550 * So don't affects the player.
6557 * The spell is not well aimed,
6558 * So partly affect the player too.
6564 /* Affect the player */
6565 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6571 GAME_TEXT m_name[MAX_NLEN];
6573 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6575 if (rakubadam_m > 0)
6577 if (rakuba(rakubadam_m, FALSE))
6579 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6582 if (p_ptr->riding && rakubadam_p > 0)
6584 if(rakuba(rakubadam_p, FALSE))
6586 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6591 /* Return "something was noticed" */
6596 * @brief 鏡魔法「封魔結界」の効果処理
6598 * @return 効果があったらTRUEを返す
6600 bool binding_field(HIT_POINT dam)
6602 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6603 int mirror_num = 0; /* 鏡の数 */
6605 POSITION centersign;
6606 POSITION x1, x2, y1, y2;
6608 int msec = delay_factor*delay_factor*delay_factor;
6611 POSITION point_x[3];
6612 POSITION point_y[3];
6614 /* Default target of monsterspell is player */
6615 monster_target_y = p_ptr->y;
6616 monster_target_x = p_ptr->x;
6618 for (x = 0; x < current_floor_ptr->width; x++)
6620 for (y = 0; y < current_floor_ptr->height; y++)
6622 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6623 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6624 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6625 player_has_los_bold(y, x) &&
6626 projectable(p_ptr->y, p_ptr->x, y, x)
6628 mirror_y[mirror_num] = y;
6629 mirror_x[mirror_num] = x;
6635 if (mirror_num < 2)return FALSE;
6637 point_x[0] = randint0(mirror_num);
6639 point_x[1] = randint0(mirror_num);
6640 } while (point_x[0] == point_x[1]);
6642 point_y[0] = mirror_y[point_x[0]];
6643 point_x[0] = mirror_x[point_x[0]];
6644 point_y[1] = mirror_y[point_x[1]];
6645 point_x[1] = mirror_x[point_x[1]];
6646 point_y[2] = p_ptr->y;
6647 point_x[2] = p_ptr->x;
6649 x = point_x[0] + point_x[1] + point_x[2];
6650 y = point_y[0] + point_y[1] + point_y[2];
6652 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6653 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6654 if (centersign == 0)return FALSE;
6656 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6657 x1 = x1 < point_x[2] ? x1 : point_x[2];
6658 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6659 y1 = y1 < point_y[2] ? y1 : point_y[2];
6661 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6662 x2 = x2 > point_x[2] ? x2 : point_x[2];
6663 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6664 y2 = y2 > point_y[2] ? y2 : point_y[2];
6666 for (y = y1; y <= y2; y++) {
6667 for (x = x1; x <= x2; x++) {
6668 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6669 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6670 centersign*((point_x[1] - x)*(point_y[2] - y)
6671 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6672 centersign*((point_x[2] - x)*(point_y[0] - y)
6673 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6675 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6676 /* Visual effects */
6678 && panel_contains(y, x)) {
6679 p = bolt_pict(y, x, y, x, GF_MANA);
6680 print_rel(PICT_C(p), PICT_A(p), y, x);
6681 move_cursor_relative(y, x);
6682 /*if (fresh_before)*/ Term_fresh();
6683 Term_xtra(TERM_XTRA_DELAY, msec);
6689 for (y = y1; y <= y2; y++) {
6690 for (x = x1; x <= x2; x++) {
6691 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6692 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6693 centersign*((point_x[1] - x)*(point_y[2] - y)
6694 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6695 centersign*((point_x[2] - x)*(point_y[0] - y)
6696 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6698 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6699 (void)project_f(0, 0, y, x, dam, GF_MANA);
6704 for (y = y1; y <= y2; y++) {
6705 for (x = x1; x <= x2; x++) {
6706 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6707 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6708 centersign*((point_x[1] - x)*(point_y[2] - y)
6709 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6710 centersign*((point_x[2] - x)*(point_y[0] - y)
6711 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6713 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6714 (void)project_o(0, 0, y, x, dam, GF_MANA);
6719 for (y = y1; y <= y2; y++) {
6720 for (x = x1; x <= x2; x++) {
6721 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6722 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6723 centersign*((point_x[1] - x)*(point_y[2] - y)
6724 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6725 centersign*((point_x[2] - x)*(point_y[0] - y)
6726 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6728 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6729 (void)project_m(0, 0, y, x, dam, GF_MANA,
6730 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6736 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6737 remove_mirror(point_y[0], point_x[0]);
6744 * @brief 鏡魔法「鏡の封印」の効果処理
6746 * @return 効果があったらTRUEを返す
6748 void seal_of_mirror(HIT_POINT dam)
6752 for (x = 0; x < current_floor_ptr->width; x++)
6754 for (y = 0; y < current_floor_ptr->height; y++)
6756 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6758 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6759 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6761 if (!current_floor_ptr->grid_array[y][x].m_idx)
6763 remove_mirror(y, x);
6775 * @brief 領域魔法に応じて技能の名称を返す。
6776 * @param tval 魔法書のtval
6777 * @return 領域魔法の技能名称を保管した文字列ポインタ
6779 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6783 case TV_HISSATSU_BOOK:
6784 return _("必殺技", "art");
6786 return _("祈り", "prayer");
6788 return _("歌", "song");
6790 return _("呪文", "spell");