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.
21 #include "object-curse.h"
22 #include "player-damage.h"
23 #include "player-effects.h"
24 #include "player-race.h"
27 #include "monster-status.h"
28 #include "monster-spell.h"
30 #include "spells-status.h"
31 #include "spells-diceroll.h"
32 #include "spells-summon.h"
33 #include "monsterrace-hook.h"
41 #include "player-status.h"
42 #include "player-move.h"
43 #include "realm-hex.h"
44 #include "object-hook.h"
45 #include "object-broken.h"
46 #include "object-flavor.h"
51 #include "view-mainwindow.h"
55 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
56 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
58 int project_length = 0; /*!< 投射の射程距離 */
62 * @brief 歌、剣術、呪術領域情報テーブル
64 const magic_type technic_info[NUM_TECHNIC][32] =
187 * @brief 配置した鏡リストの次を取得する /
188 * Get another mirror. for SEEKER
189 * @param next_y 次の鏡のy座標を返す参照ポインタ
190 * @param next_x 次の鏡のx座標を返す参照ポインタ
191 * @param cury 現在の鏡のy座標
192 * @param curx 現在の鏡のx座標
194 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
196 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
197 int mirror_num = 0; /* 鏡の数 */
201 for (x = 0; x < current_floor_ptr->width; x++)
203 for (y = 0; y < current_floor_ptr->height; y++)
205 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
206 mirror_y[mirror_num] = y;
207 mirror_x[mirror_num] = x;
214 num = randint0(mirror_num);
215 *next_y = mirror_y[num];
216 *next_x = mirror_x[num];
219 *next_y = cury + randint0(5) - 2;
220 *next_x = curx + randint0(5) - 2;
226 * Mega-Hack -- track "affected" monsters (see "project()" comments)
228 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
229 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
230 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
231 /* Mega-Hack -- monsters target */
232 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
233 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
237 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
238 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
239 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
240 * @param y 目標Y座標 / Target y location (or location to travel "towards")
241 * @param x 目標X座標 / Target x location (or location to travel "towards")
242 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
243 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
244 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
247 * We are called both for "beam" effects and "ball" effects.
249 * The "r" parameter is the "distance from ground zero".
251 * Note that we determine if the player can "see" anything that happens
252 * by taking into account: blindness, line-of-sight, and illumination.
254 * We return "TRUE" if the effect of the projection is "obvious".
256 * We also "see" grids which are "memorized", probably a hack
258 * Perhaps we should affect doors?
261 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
263 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
264 feature_type *f_ptr = &f_info[g_ptr->feat];
266 bool obvious = FALSE;
267 bool known = player_has_los_bold(y, x);
272 /* Reduce damage by distance */
273 dam = (dam + r) / (r + 1);
276 if (have_flag(f_ptr->flags, FF_TREE))
284 message = _("枯れた", "was blasted."); break;
286 message = _("縮んだ", "shrank."); break;
288 message = _("溶けた", "melted."); break;
291 message = _("凍り、砕け散った", "was frozen and smashed."); break;
295 message = _("燃えた", "burns up!"); break;
307 message = _("粉砕された", "was crushed."); break;
309 message = NULL; break;
313 msg_format(_("木は%s。", "A tree %s"), message);
314 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
317 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
321 /* Analyze the type */
324 /* Ignore most effects */
359 /* Destroy Traps (and Locks) */
362 /* Reveal secret doors */
363 if (is_hidden_door(g_ptr))
368 /* Check line of sight */
376 if (is_trap(g_ptr->feat))
378 /* Check line of sight */
381 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
385 /* Destroy the trap */
386 cave_alter_feat(y, x, FF_DISARM);
389 /* Locked doors are unlocked */
390 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
392 FEAT_IDX old_feat = g_ptr->feat;
394 /* Unlock the door */
395 cave_alter_feat(y, x, FF_DISARM);
397 /* Check line of sound */
398 if (known && (old_feat != g_ptr->feat))
400 msg_print(_("カチッと音がした!", "Click!"));
405 /* Remove "unsafe" flag if player is not blind */
406 if (!p_ptr->blind && player_has_los_bold(y, x))
408 g_ptr->info &= ~(CAVE_UNSAFE);
416 /* Destroy Doors (and traps) */
419 /* Destroy all doors and traps */
420 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
422 /* Check line of sight */
425 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
429 /* Destroy the feature */
430 cave_alter_feat(y, x, FF_TUNNEL);
433 /* Remove "unsafe" flag if player is not blind */
434 if (!p_ptr->blind && player_has_los_bold(y, x))
436 g_ptr->info &= ~(CAVE_UNSAFE);
444 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
446 if (have_flag(f_ptr->flags, FF_SPIKE))
448 s16b old_mimic = g_ptr->mimic;
449 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
451 cave_alter_feat(y, x, FF_SPIKE);
452 g_ptr->mimic = old_mimic;
457 /* Check line of sight */
458 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
460 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
467 /* Destroy walls (and doors) */
470 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
472 if (known && (g_ptr->info & (CAVE_MARK)))
474 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
478 /* Destroy the wall */
479 cave_alter_feat(y, x, FF_HURT_ROCK);
480 p_ptr->update |= (PU_FLOW);
488 if (!cave_naked_bold(y, x)) break;
489 if (player_bold(y, x)) break;
490 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
491 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
503 if (!cave_naked_bold(y, x)) break;
504 if (player_bold(y, x)) break;
505 cave_set_feat(y, x, feat_tree);
506 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
512 if (!cave_naked_bold(y, x)) break;
513 g_ptr->info |= CAVE_OBJECT;
514 g_ptr->mimic = feat_glyph;
522 if (!cave_naked_bold(y, x)) break;
523 if (player_bold(y, x)) break;
524 cave_set_feat(y, x, feat_granite);
530 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
533 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
534 cave_set_feat(y, x, feat_shallow_lava);
538 cave_set_feat(y, x, feat_deep_lava);
545 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
548 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
549 cave_set_feat(y, x, feat_shallow_water);
553 cave_set_feat(y, x, feat_deep_water);
558 /* Lite up the grid */
562 /* Turn on the light */
563 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
565 g_ptr->info |= (CAVE_GLOW);
568 update_local_illumination(y, x);
571 if (player_can_see_bold(y, x)) obvious = TRUE;
573 /* Mega-Hack -- Update the monster in the affected grid */
574 /* This allows "spear of light" (etc) to work "correctly" */
575 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
577 if (p_ptr->special_defense & NINJA_S_STEALTH)
579 if (player_bold(y, x)) set_superstealth(FALSE);
586 /* Darken the grid */
590 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
593 /* Turn off the light. */
596 if (current_floor_ptr->dun_level || !is_daytime())
598 for (j = 0; j < 9; j++)
600 int by = y + ddy_ddd[j];
601 int bx = x + ddx_ddd[j];
603 if (in_bounds2(by, bx))
605 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
607 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
618 g_ptr->info &= ~(CAVE_GLOW);
620 /* Hack -- Forget "boring" grids */
621 if (!have_flag(f_ptr->flags, FF_REMEMBER))
624 g_ptr->info &= ~(CAVE_MARK);
631 update_local_illumination(y, x);
633 if (player_can_see_bold(y, x)) obvious = TRUE;
635 /* Mega-Hack -- Update the monster in the affected grid */
636 /* This allows "spear of light" (etc) to work "correctly" */
637 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
647 if (is_mirror_grid(g_ptr))
649 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
652 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
655 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
657 if (known && (g_ptr->info & CAVE_MARK))
659 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
663 /* Destroy the wall */
664 cave_alter_feat(y, x, FF_HURT_ROCK);
665 p_ptr->update |= (PU_FLOW);
672 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
674 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
677 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
680 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
682 if (known && (g_ptr->info & CAVE_MARK))
684 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
688 /* Destroy the wall */
689 cave_alter_feat(y, x, FF_HURT_ROCK);
690 p_ptr->update |= (PU_FLOW);
695 case GF_DISINTEGRATE:
697 /* Destroy mirror/glyph */
698 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
701 /* Permanent features don't get effect */
702 /* But not protect monsters and other objects */
703 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
705 cave_alter_feat(y, x, FF_HURT_DISI);
707 /* Update some things -- similar to GF_KILL_WALL */
708 p_ptr->update |= (PU_FLOW);
715 /* Return "Anything seen?" */
722 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
723 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
724 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
725 * @param y 目標Y座標 / Target y location (or location to travel "towards")
726 * @param x 目標X座標 / Target x location (or location to travel "towards")
727 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
728 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
729 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
732 * We are called from "project()" to "damage" objects
734 * We are called both for "beam" effects and "ball" effects.
736 * Perhaps we should only SOMETIMES damage things on the ground.
738 * The "r" parameter is the "distance from ground zero".
740 * Note that we determine if the player can "see" anything that happens
741 * by taking into account: blindness, line-of-sight, and illumination.
743 * We also "see" grids which are "memorized", probably a hack
745 * We return "TRUE" if the effect of the projection is "obvious".
748 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
750 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
752 OBJECT_IDX this_o_idx, next_o_idx = 0;
754 bool obvious = FALSE;
755 bool known = player_has_los_bold(y, x);
757 BIT_FLAGS flgs[TR_FLAG_SIZE];
759 GAME_TEXT o_name[MAX_NLEN];
761 KIND_OBJECT_IDX k_idx = 0;
762 bool is_potion = FALSE;
767 /* Reduce damage by distance */
768 dam = (dam + r) / (r + 1);
771 /* Scan all objects in the grid */
772 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
774 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
778 bool do_kill = FALSE;
780 concptr note_kill = NULL;
783 /* Get the "plural"-ness */
784 bool plural = (o_ptr->number > 1);
786 next_o_idx = o_ptr->next_o_idx;
787 object_flags(o_ptr, flgs);
789 /* Check for artifact */
790 if (object_is_artifact(o_ptr)) is_art = TRUE;
792 /* Analyze the type */
795 /* Acid -- Lots of things */
798 if (hates_acid(o_ptr))
801 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
802 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
807 /* Elec -- Rings and Wands */
810 if (hates_elec(o_ptr))
813 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
814 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
819 /* Fire -- Flammable objects */
822 if (hates_fire(o_ptr))
825 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
826 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
831 /* Cold -- potions and flasks */
834 if (hates_cold(o_ptr))
836 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
838 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
846 if (hates_fire(o_ptr))
849 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
850 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
852 if (hates_elec(o_ptr))
856 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
857 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
865 if (hates_fire(o_ptr))
868 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
869 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
871 if (hates_cold(o_ptr))
875 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
876 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
881 /* Hack -- break potions and such */
887 if (hates_cold(o_ptr))
889 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
895 /* Mana and Chaos -- destroy everything */
901 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
905 case GF_DISINTEGRATE:
908 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
915 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
916 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
917 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
921 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
925 if (object_is_cursed(o_ptr))
928 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
935 identify_item(o_ptr);
937 /* Auto-inscription */
938 autopick_alter_item((-this_o_idx), FALSE);
946 /* Chests are noticed only if trapped or locked */
947 if (o_ptr->tval == TV_CHEST)
949 /* Disarm/Unlock traps */
952 /* Disarm or Unlock */
953 o_ptr->pval = (0 - o_ptr->pval);
958 if (known && (o_ptr->marked & OM_FOUND))
960 msg_print(_("カチッと音がした!", "Click!"));
970 if (o_ptr->tval == TV_CORPSE)
975 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
976 mode |= PM_FORCE_PET;
978 for (i = 0; i < o_ptr->number ; i++)
980 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
981 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
985 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
989 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
991 note_kill = _("生き返った。", " revived.");
995 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1006 /* Attempt to destroy the object */
1009 /* Effect "observed" */
1010 if (known && (o_ptr->marked & OM_FOUND))
1013 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1016 /* Artifacts, and other objects, get to resist */
1017 if (is_art || ignore)
1019 /* Observe the resist */
1020 if (known && (o_ptr->marked & OM_FOUND))
1022 msg_format(_("%sは影響を受けない!",
1023 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1030 /* Describe if needed */
1031 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1033 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1036 k_idx = o_ptr->k_idx;
1037 is_potion = object_is_potion(o_ptr);
1038 delete_object_idx(this_o_idx);
1040 /* Potions produce effects when 'shattered' */
1043 (void)potion_smash_effect(who, y, x, k_idx);
1051 /* Return "Anything seen?" */
1057 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1058 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1059 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1060 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1061 * @param x 目標X座標 / Target x location (or location to travel "towards")
1062 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1063 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1065 * @param see_s_msg TRUEならばメッセージを表示する
1066 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1069 * This routine takes a "source monster" (by index) which is mostly used to
1070 * determine if the player is causing the damage, and a "radius" (see below),
1071 * which is used to decrease the power of explosions with distance, and a
1072 * location, via integers which are modified by certain types of attacks
1073 * (polymorph and teleport being the obvious ones), a default damage, which
1074 * is modified as needed based on various properties, and finally a "damage
1075 * type" (see below).
1078 * Note that this routine can handle "no damage" attacks (like teleport) by
1079 * taking a "zero" damage, and can even take "parameters" to attacks (like
1080 * confuse) by accepting a "damage", using it to calculate the effect, and
1081 * then setting the damage to zero. Note that the "damage" parameter is
1082 * divided by the radius, so monsters not at the "epicenter" will not take
1083 * as much damage (or whatever)...
1086 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1087 * may result in a dereference of an invalid pointer.
1090 * Various messages are produced, and damage is applied.
1093 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1094 * actually be "made" of that substance, or "breathe" big balls of it.
1095 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1097 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1098 * and hurts evil less. If can breath nether, then it resists it as well.
1101 * Damage reductions use the following formulas:
1102 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1103 * gives avg damage of .655, ranging from .858 to .500
1104 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1105 * gives avg damage of .544, ranging from .714 to .417
1106 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1107 * gives avg damage of .444, ranging from .556 to .333
1108 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1109 * gives avg damage of .327, ranging from .427 to .250
1110 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1111 * gives something simple.
1114 * In this function, "result" messages are postponed until the end, where
1115 * the "note" string is appended to the monster name, if not NULL. So,
1116 * to make a spell have "no effect" just set "note" to NULL. You should
1117 * also set "notice" to FALSE, or the player will learn what the spell does.
1120 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1124 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)
1128 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1130 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1131 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
1133 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1137 /* Is the monster "seen"? */
1138 bool seen = m_ptr->ml;
1139 bool seen_msg = is_seen(m_ptr);
1141 bool slept = (bool)MON_CSLEEP(m_ptr);
1143 /* Were the effects "obvious" (if seen)? */
1144 bool obvious = FALSE;
1146 /* Can the player know about this effect? */
1147 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1149 /* Were the effects "irrelevant"? */
1150 bool skipped = FALSE;
1152 /* Gets the monster angry at the source of the effect? */
1153 bool get_angry = FALSE;
1155 /* Polymorph setting (true or false) */
1156 bool do_poly = FALSE;
1158 /* Teleport setting (max distance) */
1161 /* Confusion setting (amount to confuse) */
1164 /* Stunning setting (amount to stun) */
1167 /* Sleep amount (amount to sleep) */
1170 /* Fear amount (amount to fear) */
1173 /* Time amount (amount to time) */
1176 bool heal_leper = FALSE;
1178 /* Hold the monster name */
1179 GAME_TEXT m_name[MAX_NLEN];
1182 PARAMETER_VALUE photo = 0;
1184 /* Assume no note */
1185 concptr note = NULL;
1187 /* Assume a default death */
1188 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1190 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1193 if (!g_ptr->m_idx) return (FALSE);
1195 /* Never affect projector */
1196 if (who && (g_ptr->m_idx == who)) return (FALSE);
1197 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1198 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1200 /* Don't affect already death monsters */
1201 /* Prevents problems with chain reactions of exploding monsters */
1202 if (m_ptr->hp < 0) return (FALSE);
1204 /* Reduce damage by distance */
1205 dam = (dam + r) / (r + 1);
1208 /* Get the monster name (BEFORE polymorphing) */
1209 monster_desc(m_name, m_ptr, 0);
1211 /* Get the monster possessive ("his"/"her"/"its") */
1212 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1214 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1216 if (r_ptr->flagsr & RFR_RES_ALL &&
1217 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1218 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1220 note = _("には完全な耐性がある!", " is immune.");
1222 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1223 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1227 /* Analyze the damage type */
1230 /* Magic Missile -- pure damage */
1233 if (seen) obvious = TRUE;
1240 if (seen) obvious = TRUE;
1241 if (r_ptr->flagsr & RFR_IM_ACID)
1243 note = _("にはかなり耐性がある!", " resists a lot.");
1245 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1253 if (seen) obvious = TRUE;
1254 if (r_ptr->flagsr & RFR_IM_ELEC)
1256 note = _("にはかなり耐性がある!", " resists a lot.");
1258 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1266 if (seen) obvious = TRUE;
1267 if (r_ptr->flagsr & RFR_IM_FIRE)
1269 note = _("にはかなり耐性がある!", " resists a lot.");
1271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1273 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1275 note = _("はひどい痛手をうけた。", " is hit hard.");
1277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1285 if (seen) obvious = TRUE;
1286 if (r_ptr->flagsr & RFR_IM_COLD)
1288 note = _("にはかなり耐性がある!", " resists a lot.");
1290 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1292 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1294 note = _("はひどい痛手をうけた。", " is hit hard.");
1296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1304 if (seen) obvious = TRUE;
1305 if (r_ptr->flagsr & RFR_IM_POIS)
1307 note = _("にはかなり耐性がある!", " resists a lot.");
1309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1317 if (seen) obvious = TRUE;
1318 if (r_ptr->flagsr & RFR_IM_POIS)
1320 note = _("には耐性がある。", " resists.");
1321 dam *= 3; dam /= randint1(6) + 6;
1322 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1324 else if (one_in_(3)) do_poly = TRUE;
1328 /* Hellfire -- hurts Evil */
1331 if (seen) obvious = TRUE;
1332 if (r_ptr->flags3 & RF3_GOOD)
1334 note = _("はひどい痛手をうけた。", " is hit hard.");
1336 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1341 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1344 if (seen) obvious = TRUE;
1345 if (r_ptr->flags3 & RF3_EVIL)
1348 note = _("はひどい痛手をうけた。", " is hit hard.");
1349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1353 note = _("には耐性がある。", " resists.");
1354 dam *= 3; dam /= randint1(6) + 6;
1359 /* Arrow -- XXX no defense */
1362 if (seen) obvious = TRUE;
1366 /* Plasma -- XXX perhaps check ELEC or FIRE */
1369 if (seen) obvious = TRUE;
1370 if (r_ptr->flagsr & RFR_RES_PLAS)
1372 note = _("には耐性がある。", " resists.");
1373 dam *= 3; dam /= randint1(6) + 6;
1374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1379 /* Nether -- see above */
1382 if (seen) obvious = TRUE;
1383 if (r_ptr->flagsr & RFR_RES_NETH)
1385 if (r_ptr->flags3 & RF3_UNDEAD)
1387 note = _("には完全な耐性がある!", " is immune.");
1389 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1393 note = _("には耐性がある。", " resists.");
1394 dam *= 3; dam /= randint1(6) + 6;
1396 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1398 else if (r_ptr->flags3 & RF3_EVIL)
1400 note = _("はいくらか耐性を示した。", " resists somewhat.");
1402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1407 /* Water (acid) damage -- Water spirits/elementals are immune */
1410 if (seen) obvious = TRUE;
1411 if (r_ptr->flagsr & RFR_RES_WATE)
1413 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1415 note = _("には完全な耐性がある!", " is immune.");
1420 note = _("には耐性がある。", " resists.");
1421 dam *= 3; dam /= randint1(6) + 6;
1423 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1428 /* Chaos -- Chaos breathers resist */
1431 if (seen) obvious = TRUE;
1432 if (r_ptr->flagsr & RFR_RES_CHAO)
1434 note = _("には耐性がある。", " resists.");
1435 dam *= 3; dam /= randint1(6) + 6;
1436 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1438 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1440 note = _("はいくらか耐性を示した。", " resists somewhat.");
1441 dam *= 3; dam /= randint1(6) + 6;
1442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1447 do_conf = (5 + randint1(11) + r) / (r + 1);
1452 /* Shards -- Shard breathers resist */
1455 if (seen) obvious = TRUE;
1456 if (r_ptr->flagsr & RFR_RES_SHAR)
1458 note = _("には耐性がある。", " resists.");
1459 dam *= 3; dam /= randint1(6) + 6;
1460 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1465 /* Rocket: Shard resistance helps */
1468 if (seen) obvious = TRUE;
1469 if (r_ptr->flagsr & RFR_RES_SHAR)
1471 note = _("はいくらか耐性を示した。", " resists somewhat.");
1473 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1479 /* Sound -- Sound breathers resist */
1482 if (seen) obvious = TRUE;
1483 if (r_ptr->flagsr & RFR_RES_SOUN)
1485 note = _("には耐性がある。", " resists.");
1486 dam *= 2; dam /= randint1(6) + 6;
1487 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1489 else do_stun = (10 + randint1(15) + r) / (r + 1);
1496 if (seen) obvious = TRUE;
1497 if (r_ptr->flags3 & RF3_NO_CONF)
1499 note = _("には耐性がある。", " resists.");
1500 dam *= 3; dam /= randint1(6) + 6;
1501 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1503 else do_conf = (10 + randint1(15) + r) / (r + 1);
1507 /* Disenchantment -- Breathers and Disenchanters resist */
1510 if (seen) obvious = TRUE;
1511 if (r_ptr->flagsr & RFR_RES_DISE)
1513 note = _("には耐性がある。", " resists.");
1514 dam *= 3; dam /= randint1(6) + 6;
1515 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1520 /* Nexus -- Breathers and Existers resist */
1523 if (seen) obvious = TRUE;
1524 if (r_ptr->flagsr & RFR_RES_NEXU)
1526 note = _("には耐性がある。", " resists.");
1527 dam *= 3; dam /= randint1(6) + 6;
1528 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1536 if (seen) obvious = TRUE;
1537 if (r_ptr->flagsr & RFR_RES_WALL)
1539 note = _("には耐性がある。", " resists.");
1540 dam *= 3; dam /= randint1(6) + 6;
1541 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1543 else do_stun = (randint1(15) + r) / (r + 1);
1547 /* Inertia -- breathers resist */
1550 if (seen) obvious = TRUE;
1551 if (r_ptr->flagsr & RFR_RES_INER)
1553 note = _("には耐性がある。", " resists.");
1554 dam *= 3; dam /= randint1(6) + 6;
1555 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1559 /* Powerful monsters can resist */
1560 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1561 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1565 /* Normal monsters slow down */
1568 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1570 note = _("の動きが遅くなった。", " starts moving slower.");
1577 /* Time -- breathers resist */
1580 if (seen) obvious = TRUE;
1581 if (r_ptr->flagsr & RFR_RES_TIME)
1583 note = _("には耐性がある。", " resists.");
1584 dam *= 3; dam /= randint1(6) + 6;
1585 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1587 else do_time = (dam + 1) / 2;
1591 /* Gravity -- breathers resist */
1594 bool resist_tele = FALSE;
1596 if (seen) obvious = TRUE;
1597 if (r_ptr->flagsr & RFR_RES_TELE)
1599 if (r_ptr->flags1 & (RF1_UNIQUE))
1601 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1602 note = _("には効果がなかった。", " is unaffected!");
1605 else if (r_ptr->level > randint1(100))
1607 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1608 note = _("には耐性がある!", " resists!");
1613 if (!resist_tele) do_dist = 10;
1615 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1617 if (r_ptr->flagsr & RFR_RES_GRAV)
1619 note = _("には耐性がある!", " resists!");
1620 dam *= 3; dam /= randint1(6) + 6;
1622 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1627 /* Powerful monsters can resist */
1628 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1629 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1633 /* Normal monsters slow down */
1636 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1638 note = _("の動きが遅くなった。", " starts moving slower.");
1643 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1645 /* Attempt a saving throw */
1646 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1647 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1651 /* No obvious effect */
1652 note = _("には効果がなかった。", " is unaffected!");
1664 if (seen) obvious = TRUE;
1670 case GF_DISINTEGRATE:
1672 if (seen) obvious = TRUE;
1673 if (r_ptr->flags3 & RF3_HURT_ROCK)
1675 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1676 note = _("の皮膚がただれた!", " loses some skin!");
1677 note_dies = _("は蒸発した!", " evaporates!");
1685 if (seen) obvious = TRUE;
1687 /* PSI only works if the monster can see you! -- RG */
1688 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1691 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1695 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1698 note = _("には完全な耐性がある!", " is immune.");
1699 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1702 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1703 (r_ptr->flags3 & RF3_ANIMAL) ||
1704 (r_ptr->level > randint1(3 * dam)))
1706 note = _("には耐性がある!", " resists!");
1710 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1711 * attacks back on them
1713 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1714 (r_ptr->level > p_ptr->lev / 2) &&
1718 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1719 (seen ? "%^s's corrupted mind backlashes your attack!" :
1720 "%^ss corrupted mind backlashes your attack!")), m_name);
1723 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1725 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1729 /* Injure +/- confusion */
1730 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1731 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1732 if (one_in_(4) && !CHECK_MULTISHADOW())
1734 switch (randint1(4))
1737 set_confused(p_ptr->confused + 3 + randint1(dam));
1740 set_stun(p_ptr->stun + randint1(dam));
1744 if (r_ptr->flags3 & RF3_NO_FEAR)
1745 note = _("には効果がなかった。", " is unaffected.");
1747 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1751 if (!p_ptr->free_act)
1752 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1761 if ((dam > 0) && one_in_(4))
1763 switch (randint1(4))
1766 do_conf = 3 + randint1(dam);
1769 do_stun = 3 + randint1(dam);
1772 do_fear = 3 + randint1(dam);
1775 note = _("は眠り込んでしまった!", " falls asleep!");
1776 do_sleep = 3 + randint1(dam);
1781 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1787 if (seen) obvious = TRUE;
1788 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1791 note = _("には完全な耐性がある!", " is immune.");
1793 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1794 (r_ptr->flags3 & RF3_ANIMAL) ||
1795 (r_ptr->level > randint1(3 * dam)))
1797 note = _("には耐性がある!", " resists!");
1801 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1802 * attacks back on them
1804 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1805 (r_ptr->level > p_ptr->lev / 2) &&
1809 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1810 (seen ? "%^s's corrupted mind backlashes your attack!" :
1811 "%^ss corrupted mind backlashes your attack!")), m_name);
1813 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1815 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1819 /* Injure + mana drain */
1820 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1821 if (!CHECK_MULTISHADOW())
1823 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1824 p_ptr->csp -= damroll(5, dam) / 2;
1825 if (p_ptr->csp < 0) p_ptr->csp = 0;
1826 p_ptr->redraw |= PR_MANA;
1827 p_ptr->window |= (PW_SPELL);
1829 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1836 int b = damroll(5, dam) / 4;
1837 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1838 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1839 (seen ? "You convert %s's pain into %s!" :
1840 "You convert %ss pain into %s!"));
1841 msg_format(msg, m_name, str);
1843 b = MIN(p_ptr->msp, p_ptr->csp + b);
1845 p_ptr->redraw |= PR_MANA;
1846 p_ptr->window |= (PW_SPELL);
1848 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1852 case GF_TELEKINESIS:
1854 if (seen) obvious = TRUE;
1857 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1862 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1864 /* Attempt a saving throw */
1865 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1866 (r_ptr->level > 5 + randint1(dam)))
1870 /* No obvious effect */
1876 /* Psycho-spear -- powerful magic missile */
1879 if (seen) obvious = TRUE;
1883 /* Meteor -- powerful magic missile */
1886 if (seen) obvious = TRUE;
1892 if (!is_hostile(m_ptr)) break;
1893 if (seen) obvious = TRUE;
1894 /* Attempt a saving throw */
1895 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1896 (r_ptr->flags3 & RF3_NO_CONF) ||
1897 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1899 /* Memorize a flag */
1900 if (r_ptr->flags3 & RF3_NO_CONF)
1902 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1909 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1910 * attacks back on them
1912 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1913 (r_ptr->level > p_ptr->lev / 2) &&
1917 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1918 (seen ? "%^s's corrupted mind backlashes your attack!" :
1919 "%^ss corrupted mind backlashes your attack!")), m_name);
1922 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1924 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1928 /* Confuse, stun, terrify */
1929 switch (randint1(4))
1932 set_stun(p_ptr->stun + dam / 2);
1935 set_confused(p_ptr->confused + dam / 2);
1939 if (r_ptr->flags3 & RF3_NO_FEAR)
1940 note = _("には効果がなかった。", " is unaffected.");
1942 set_afraid(p_ptr->afraid + dam);
1949 /* No obvious effect */
1950 note = _("には効果がなかった。", " is unaffected.");
1956 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1958 note = _("があなたに隷属した。", " is in your thrall!");
1963 switch (randint1(4))
1977 /* No "real" damage */
1982 /* Ice -- Cold + Cuts + Stun */
1985 if (seen) obvious = TRUE;
1986 do_stun = (randint1(15) + 1) / (r + 1);
1987 if (r_ptr->flagsr & RFR_IM_COLD)
1989 note = _("にはかなり耐性がある!", " resists a lot.");
1991 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1993 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1995 note = _("はひどい痛手をうけた。", " is hit hard.");
1997 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2004 case GF_HYPODYNAMIA:
2006 if (seen) obvious = TRUE;
2007 if (!monster_living(m_ptr->r_idx))
2009 if (is_original_ap_and_seen(m_ptr))
2011 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2012 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2013 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2015 note = _("には効果がなかった。", " is unaffected.");
2019 else do_time = (dam+7)/8;
2027 if (seen) obvious = TRUE;
2028 if (!monster_living(m_ptr->r_idx))
2030 if (is_original_ap_and_seen(m_ptr))
2032 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2033 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2034 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2036 note = _("には完全な耐性がある!", " is immune.");
2040 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2041 (randint1(888) != 666)) ||
2042 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2043 randint1(100) != 66))
2045 note = _("には耐性がある!", " resists!");
2053 /* Polymorph monster (Use "dam" as "power") */
2056 if (seen) obvious = TRUE;
2057 /* Attempt to polymorph (see below) */
2060 /* Powerful monsters can resist */
2061 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2062 (r_ptr->flags1 & RF1_QUESTOR) ||
2063 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2065 note = _("には効果がなかった。", " is unaffected.");
2070 /* No "real" damage */
2077 /* Clone monsters (Ignore "dam") */
2080 if (seen) obvious = TRUE;
2082 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2084 note = _("には効果がなかった。", " is unaffected.");
2089 m_ptr->hp = m_ptr->maxhp;
2091 /* Attempt to clone. */
2092 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2094 note = _("が分裂した!", " spawns!");
2098 /* No "real" damage */
2105 /* Heal Monster (use "dam" as amount of healing) */
2108 if (seen) obvious = TRUE;
2111 (void)set_monster_csleep(g_ptr->m_idx, 0);
2113 if (m_ptr->maxhp < m_ptr->max_maxhp)
2115 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2116 m_ptr->maxhp = m_ptr->max_maxhp;
2121 /* Redraw (later) if needed */
2122 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2123 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2131 if (seen) obvious = TRUE;
2134 (void)set_monster_csleep(g_ptr->m_idx, 0);
2135 if (MON_STUNNED(m_ptr))
2137 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2138 (void)set_monster_stunned(g_ptr->m_idx, 0);
2140 if (MON_CONFUSED(m_ptr))
2142 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2143 (void)set_monster_confused(g_ptr->m_idx, 0);
2145 if (MON_MONFEAR(m_ptr))
2147 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2148 (void)set_monster_monfear(g_ptr->m_idx, 0);
2152 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2155 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2159 chg_virtue(V_VITALITY, 1);
2161 if (r_ptr->flags1 & RF1_UNIQUE)
2162 chg_virtue(V_INDIVIDUALISM, 1);
2164 if (is_friendly(m_ptr))
2165 chg_virtue(V_HONOUR, 1);
2166 else if (!(r_ptr->flags3 & RF3_EVIL))
2168 if (r_ptr->flags3 & RF3_GOOD)
2169 chg_virtue(V_COMPASSION, 2);
2171 chg_virtue(V_COMPASSION, 1);
2174 if (r_ptr->flags3 & RF3_ANIMAL)
2175 chg_virtue(V_NATURE, 1);
2178 if (m_ptr->r_idx == MON_LEPER)
2181 if (!who) chg_virtue(V_COMPASSION, 5);
2184 /* Redraw (later) if needed */
2185 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2186 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2188 note = _("は体力を回復したようだ。", " looks healthier.");
2190 /* No "real" damage */
2196 /* Speed Monster (Ignore "dam") */
2199 if (seen) obvious = TRUE;
2202 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2204 note = _("の動きが速くなった。", " starts moving faster.");
2209 if (r_ptr->flags1 & RF1_UNIQUE)
2210 chg_virtue(V_INDIVIDUALISM, 1);
2211 if (is_friendly(m_ptr))
2212 chg_virtue(V_HONOUR, 1);
2215 /* No "real" damage */
2221 /* Slow Monster (Use "dam" as "power") */
2224 if (seen) obvious = TRUE;
2226 /* Powerful monsters can resist */
2227 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2228 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2230 note = _("には効果がなかった。", " is unaffected.");
2234 /* Normal monsters slow down */
2237 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2239 note = _("の動きが遅くなった。", " starts moving slower.");
2243 /* No "real" damage */
2249 /* Sleep (Use "dam" as "power") */
2252 if (seen) obvious = TRUE;
2254 /* Attempt a saving throw */
2255 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2256 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2257 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2259 /* Memorize a flag */
2260 if (r_ptr->flags3 & RF3_NO_SLEEP)
2262 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2264 /* No obvious effect */
2265 note = _("には効果がなかった。", " is unaffected.");
2270 /* Go to sleep (much) later */
2271 note = _("は眠り込んでしまった!", " falls asleep!");
2275 /* No "real" damage */
2281 /* Sleep (Use "dam" as "power") */
2282 case GF_STASIS_EVIL:
2284 if (seen) obvious = TRUE;
2286 /* Attempt a saving throw */
2287 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2288 !(r_ptr->flags3 & RF3_EVIL) ||
2289 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2291 note = _("には効果がなかった。", " is unaffected.");
2296 /* Go to sleep (much) later */
2297 note = _("は動けなくなった!", " is suspended!");
2301 /* No "real" damage */
2306 /* Sleep (Use "dam" as "power") */
2309 if (seen) obvious = TRUE;
2311 /* Attempt a saving throw */
2312 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2313 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2315 note = _("には効果がなかった。", " is unaffected.");
2320 /* Go to sleep (much) later */
2321 note = _("は動けなくなった!", " is suspended!");
2325 /* No "real" damage */
2334 vir = virtue_number(V_HARMONY);
2337 dam += p_ptr->virtues[vir-1]/10;
2340 vir = virtue_number(V_INDIVIDUALISM);
2343 dam -= p_ptr->virtues[vir-1]/20;
2346 if (seen) obvious = TRUE;
2348 /* Attempt a saving throw */
2349 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2353 /* No obvious effect */
2354 note = _("には効果がなかった。", " is unaffected.");
2357 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2359 else if (p_ptr->cursed & TRC_AGGRAVATE)
2361 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2362 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2366 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2369 chg_virtue(V_INDIVIDUALISM, -1);
2370 if (r_ptr->flags3 & RF3_ANIMAL)
2371 chg_virtue(V_NATURE, 1);
2374 /* No "real" damage */
2379 /* Control undead */
2380 case GF_CONTROL_UNDEAD:
2383 if (seen) obvious = TRUE;
2385 vir = virtue_number(V_UNLIFE);
2388 dam += p_ptr->virtues[vir-1]/10;
2391 vir = virtue_number(V_INDIVIDUALISM);
2394 dam -= p_ptr->virtues[vir-1]/20;
2397 /* Attempt a saving throw */
2398 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2399 !(r_ptr->flags3 & RF3_UNDEAD))
2401 /* No obvious effect */
2402 note = _("には効果がなかった。", " is unaffected.");
2404 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2406 else if (p_ptr->cursed & TRC_AGGRAVATE)
2408 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2409 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2413 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2417 /* No "real" damage */
2423 case GF_CONTROL_DEMON:
2426 if (seen) obvious = TRUE;
2428 vir = virtue_number(V_UNLIFE);
2431 dam += p_ptr->virtues[vir-1]/10;
2434 vir = virtue_number(V_INDIVIDUALISM);
2437 dam -= p_ptr->virtues[vir-1]/20;
2440 /* Attempt a saving throw */
2441 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2442 !(r_ptr->flags3 & RF3_DEMON))
2444 /* No obvious effect */
2445 note = _("には効果がなかった。", " is unaffected.");
2447 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2449 else if (p_ptr->cursed & TRC_AGGRAVATE)
2451 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2452 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2456 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2460 /* No "real" damage */
2466 case GF_CONTROL_ANIMAL:
2469 if (seen) obvious = TRUE;
2471 vir = virtue_number(V_NATURE);
2474 dam += p_ptr->virtues[vir-1]/10;
2477 vir = virtue_number(V_INDIVIDUALISM);
2480 dam -= p_ptr->virtues[vir-1]/20;
2483 /* Attempt a saving throw */
2484 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2485 !(r_ptr->flags3 & RF3_ANIMAL))
2488 /* No obvious effect */
2489 note = _("には効果がなかった。", " is unaffected.");
2491 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2493 else if (p_ptr->cursed & TRC_AGGRAVATE)
2495 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2496 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2500 note = _("はなついた。", " is tamed!");
2502 if (r_ptr->flags3 & RF3_ANIMAL)
2503 chg_virtue(V_NATURE, 1);
2506 /* No "real" damage */
2512 case GF_CHARM_LIVING:
2516 vir = virtue_number(V_UNLIFE);
2517 if (seen) obvious = TRUE;
2519 vir = virtue_number(V_UNLIFE);
2522 dam -= p_ptr->virtues[vir-1]/10;
2525 vir = virtue_number(V_INDIVIDUALISM);
2528 dam -= p_ptr->virtues[vir-1]/20;
2531 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2533 /* Attempt a saving throw */
2534 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2535 !monster_living(m_ptr->r_idx))
2538 /* No obvious effect */
2539 note = _("には効果がなかった。", " is unaffected.");
2541 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2543 else if (p_ptr->cursed & TRC_AGGRAVATE)
2545 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2546 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2550 note = _("を支配した。", " is tamed!");
2552 if (r_ptr->flags3 & RF3_ANIMAL)
2553 chg_virtue(V_NATURE, 1);
2556 /* No "real" damage */
2561 /* Confusion (Use "dam" as "power") */
2564 if (seen) obvious = TRUE;
2566 /* Get confused later */
2567 do_conf = damroll(3, (dam / 2)) + 1;
2569 /* Attempt a saving throw */
2570 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2571 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2572 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2574 /* Memorize a flag */
2575 if (r_ptr->flags3 & (RF3_NO_CONF))
2577 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2583 /* No obvious effect */
2584 note = _("には効果がなかった。", " is unaffected.");
2588 /* No "real" damage */
2595 if (seen) obvious = TRUE;
2597 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2599 /* Attempt a saving throw */
2600 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2601 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2606 /* No obvious effect */
2607 note = _("には効果がなかった。", " is unaffected.");
2611 /* No "real" damage */
2616 /* Lite, but only hurts susceptible creatures */
2625 if (r_ptr->flags3 & (RF3_HURT_LITE))
2627 /* Obvious effect */
2628 if (seen) obvious = TRUE;
2630 /* Memorize the effects */
2631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2633 /* Special effect */
2634 note = _("は光に身をすくめた!", " cringes from the light!");
2635 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2638 /* Normally no damage */
2650 /* Lite -- opposite of Dark */
2653 if (seen) obvious = TRUE;
2655 if (r_ptr->flagsr & RFR_RES_LITE)
2657 note = _("には耐性がある!", " resists!");
2658 dam *= 2; dam /= (randint1(6)+6);
2659 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2661 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2664 note = _("は光に身をすくめた!", " cringes from the light!");
2665 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2672 /* Dark -- opposite of Lite */
2675 if (seen) obvious = TRUE;
2677 if (r_ptr->flagsr & RFR_RES_DARK)
2679 note = _("には耐性がある!", " resists!");
2680 dam *= 2; dam /= (randint1(6)+6);
2681 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2690 /* Hurt by rock remover */
2691 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2694 if (seen) obvious = TRUE;
2696 /* Memorize the effects */
2697 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2699 /* Cute little message */
2700 note = _("の皮膚がただれた!", " loses some skin!");
2701 note_dies = _("はドロドロに溶けた!", " dissolves!");
2704 /* Usually, ignore the effects */
2715 /* Teleport undead (Use "dam" as "power") */
2716 case GF_AWAY_UNDEAD:
2718 /* Only affect undead */
2719 if (r_ptr->flags3 & (RF3_UNDEAD))
2721 bool resists_tele = FALSE;
2723 if (r_ptr->flagsr & RFR_RES_TELE)
2725 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2727 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2728 note = _("には効果がなかった。", " is unaffected.");
2729 resists_tele = TRUE;
2731 else if (r_ptr->level > randint1(100))
2733 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2734 note = _("には耐性がある!", " resists!");
2735 resists_tele = TRUE;
2741 if (seen) obvious = TRUE;
2742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2754 /* No "real" damage */
2760 /* Teleport evil (Use "dam" as "power") */
2763 /* Only affect evil */
2764 if (r_ptr->flags3 & (RF3_EVIL))
2766 bool resists_tele = FALSE;
2768 if (r_ptr->flagsr & RFR_RES_TELE)
2770 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2772 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2773 note = _("には効果がなかった。", " is unaffected.");
2774 resists_tele = TRUE;
2776 else if (r_ptr->level > randint1(100))
2778 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2779 note = _("には耐性がある!", " resists!");
2780 resists_tele = TRUE;
2786 if (seen) obvious = TRUE;
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2799 /* No "real" damage */
2805 /* Teleport monster (Use "dam" as "power") */
2808 bool resists_tele = FALSE;
2809 if (r_ptr->flagsr & RFR_RES_TELE)
2811 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2813 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2814 note = _("には効果がなかった。", " is unaffected.");
2815 resists_tele = TRUE;
2817 else if (r_ptr->level > randint1(100))
2819 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2820 note = _("には耐性がある!", " resists!");
2821 resists_tele = TRUE;
2827 if (seen) obvious = TRUE;
2829 /* Prepare to teleport */
2833 /* No "real" damage */
2839 /* Turn undead (Use "dam" as "power") */
2840 case GF_TURN_UNDEAD:
2842 /* Only affect undead */
2843 if (r_ptr->flags3 & (RF3_UNDEAD))
2845 if (seen) obvious = TRUE;
2847 /* Learn about type */
2848 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2850 /* Apply some fear */
2851 do_fear = damroll(3, (dam / 2)) + 1;
2853 /* Attempt a saving throw */
2854 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2856 /* No obvious effect */
2857 note = _("には効果がなかった。", " is unaffected.");
2870 /* No "real" damage */
2876 /* Turn evil (Use "dam" as "power") */
2879 /* Only affect evil */
2880 if (r_ptr->flags3 & (RF3_EVIL))
2882 if (seen) obvious = TRUE;
2884 /* Learn about type */
2885 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2887 /* Apply some fear */
2888 do_fear = damroll(3, (dam / 2)) + 1;
2890 /* Attempt a saving throw */
2891 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2893 /* No obvious effect */
2894 note = _("には効果がなかった。", " is unaffected.");
2907 /* No "real" damage */
2913 /* Turn monster (Use "dam" as "power") */
2916 if (seen) obvious = TRUE;
2918 /* Apply some fear */
2919 do_fear = damroll(3, (dam / 2)) + 1;
2921 /* Attempt a saving throw */
2922 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2923 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2924 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2926 /* No obvious effect */
2927 note = _("には効果がなかった。", " is unaffected.");
2932 /* No "real" damage */
2939 case GF_DISP_UNDEAD:
2941 /* Only affect undead */
2942 if (r_ptr->flags3 & (RF3_UNDEAD))
2944 if (seen) obvious = TRUE;
2946 /* Learn about type */
2947 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2949 note = _("は身震いした。", " shudders.");
2950 note_dies = _("はドロドロに溶けた!", " dissolves!");
2970 /* Only affect evil */
2971 if (r_ptr->flags3 & (RF3_EVIL))
2973 if (seen) obvious = TRUE;
2975 /* Learn about type */
2976 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2978 note = _("は身震いした。", " shudders.");
2979 note_dies = _("はドロドロに溶けた!", " dissolves!");
2998 /* Only affect good */
2999 if (r_ptr->flags3 & (RF3_GOOD))
3001 if (seen) obvious = TRUE;
3003 /* Learn about type */
3004 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3006 note = _("は身震いした。", " shudders.");
3007 note_dies = _("はドロドロに溶けた!", " dissolves!");
3024 case GF_DISP_LIVING:
3026 /* Only affect non-undead */
3027 if (monster_living(m_ptr->r_idx))
3029 if (seen) obvious = TRUE;
3031 note = _("は身震いした。", " shudders.");
3032 note_dies = _("はドロドロに溶けた!", " dissolves!");
3051 /* Only affect demons */
3052 if (r_ptr->flags3 & (RF3_DEMON))
3054 if (seen) obvious = TRUE;
3056 /* Learn about type */
3057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3059 note = _("は身震いした。", " shudders.");
3060 note_dies = _("はドロドロに溶けた!", " dissolves!");
3076 /* Dispel monster */
3079 if (seen) obvious = TRUE;
3080 note = _("は身震いした。", " shudders.");
3081 note_dies = _("はドロドロに溶けた!", " dissolves!");
3088 if (seen) obvious = TRUE;
3089 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3093 /* Heal the monster */
3094 if (caster_ptr->hp < caster_ptr->maxhp)
3097 caster_ptr->hp += dam;
3098 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3100 /* Redraw (later) if needed */
3101 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3102 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3104 /* Special message */
3107 monster_desc(killer, caster_ptr, 0);
3108 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3114 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3115 (void)hp_player(dam);
3120 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3129 if (seen) obvious = TRUE;
3130 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3131 /* Attempt a saving throw */
3132 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3133 (r_ptr->flags3 & RF3_NO_CONF) ||
3134 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3136 /* Memorize a flag */
3137 if (r_ptr->flags3 & (RF3_NO_CONF))
3139 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3141 note = _("には効果がなかった。", " is unaffected.");
3144 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3146 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3147 note = _("には完全な耐性がある!", " is immune.");
3150 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3152 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3153 note = _("には耐性がある。", " resists.");
3158 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3159 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3161 if (who > 0) do_conf = randint0(4) + 4;
3162 else do_conf = randint0(8) + 8;
3168 case GF_BRAIN_SMASH:
3170 if (seen) obvious = TRUE;
3171 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3173 /* Attempt a saving throw */
3174 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3175 (r_ptr->flags3 & RF3_NO_CONF) ||
3176 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3178 /* Memorize a flag */
3179 if (r_ptr->flags3 & (RF3_NO_CONF))
3181 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3183 note = _("には効果がなかった。", " is unaffected.");
3186 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3188 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3189 note = _("には完全な耐性がある!", " is immune.");
3192 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3194 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3195 note = _("には耐性がある!", " resists!");
3200 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3201 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3205 do_conf = randint0(4) + 4;
3206 do_stun = randint0(4) + 4;
3210 do_conf = randint0(8) + 8;
3211 do_stun = randint0(8) + 8;
3213 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3221 if (seen) obvious = TRUE;
3222 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3223 /* Attempt a saving throw */
3224 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3226 note = _("には効果がなかった。", " is unaffected.");
3235 if (seen) obvious = TRUE;
3236 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3237 /* Attempt a saving throw */
3238 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3240 note = _("には効果がなかった。", " is unaffected.");
3249 if (seen) obvious = TRUE;
3250 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3251 /* Attempt a saving throw */
3252 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3254 note = _("には効果がなかった。", " is unaffected.");
3263 if (seen) obvious = TRUE;
3265 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3266 "You point at %s, screaming the word, 'DIE!'."), m_name);
3267 /* Attempt a saving throw */
3268 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3270 note = _("には効果がなかった。", " is unaffected.");
3279 if (seen) obvious = TRUE;
3280 if (r_ptr->flags1 & RF1_UNIQUE)
3282 note = _("には効果がなかった。", " is unaffected.");
3287 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3288 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3290 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3292 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3296 note = _("は耐性を持っている!", "resists!");
3303 /* Capture monster */
3307 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3308 (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)
3310 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3315 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3316 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3317 nokori_hp = m_ptr->maxhp * 3 / 10;
3319 nokori_hp = m_ptr->maxhp * 3 / 20;
3321 if (m_ptr->hp >= nokori_hp)
3323 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3326 else if (m_ptr->hp < randint0(nokori_hp))
3328 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3329 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3330 cap_mon = m_ptr->r_idx;
3331 cap_mspeed = m_ptr->mspeed;
3333 cap_maxhp = m_ptr->max_maxhp;
3334 cap_nickname = m_ptr->nickname; /* Quark transfer */
3335 if (g_ptr->m_idx == p_ptr->riding)
3337 if (rakuba(-1, FALSE))
3339 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3343 delete_monster_idx(g_ptr->m_idx);
3349 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3355 /* Attack (Use "dam" as attack type) */
3358 /* Return this monster's death */
3359 return py_attack(y, x, dam);
3362 /* Sleep (Use "dam" as "power") */
3368 if (seen) obvious = TRUE;
3369 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3371 note = _("には効果がなかった。", " is unaffected.");
3374 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3377 if (MON_CSLEEP(m_ptr))
3379 note = _("には効果がなかった。", " is unaffected.");
3385 if (one_in_(5)) effect = 1;
3386 else if (one_in_(4)) effect = 2;
3387 else if (one_in_(3)) effect = 3;
3392 /* Powerful monsters can resist */
3393 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3394 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3396 note = _("には効果がなかった。", " is unaffected.");
3400 /* Normal monsters slow down */
3403 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3405 note = _("の動きが遅くなった。", " starts moving slower.");
3410 else if (effect == 2)
3412 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3414 /* Attempt a saving throw */
3415 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3416 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3421 /* No obvious effect */
3422 note = _("には効果がなかった。", " is unaffected.");
3427 else if (effect == 3)
3429 /* Attempt a saving throw */
3430 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3431 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3432 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3434 /* Memorize a flag */
3435 if (r_ptr->flags3 & RF3_NO_SLEEP)
3437 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3440 /* No obvious effect */
3441 note = _("には効果がなかった。", " is unaffected.");
3446 /* Go to sleep (much) later */
3447 note = _("は眠り込んでしまった!", " falls asleep!");
3454 note = _("には効果がなかった。", " is unaffected.");
3457 /* No "real" damage */
3465 if (seen) obvious = TRUE;
3466 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3468 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3469 chg_virtue(V_VITALITY, -1);
3479 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3481 if (r_ptr->flags3 & (RF3_HURT_LITE))
3483 /* Obvious effect */
3484 if (seen) obvious = TRUE;
3486 /* Memorize the effects */
3487 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3489 /* Special effect */
3490 note = _("は光に身をすくめた!", " cringes from the light!");
3491 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3494 /* Normally no damage */
3501 photo = m_ptr->r_idx;
3508 case GF_BLOOD_CURSE:
3510 if (seen) obvious = TRUE;
3516 bool success = FALSE;
3517 if (seen) obvious = TRUE;
3519 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3521 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3522 if (dam < 1) dam = 1;
3524 /* No need to tame your pet */
3527 note = _("の動きが速くなった。", " starts moving faster.");
3528 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3532 /* Attempt a saving throw */
3533 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3534 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3535 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3536 (p_ptr->cursed & TRC_AGGRAVATE) ||
3537 ((r_ptr->level+10) > randint1(dam)))
3540 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3544 note = _("を支配した。", " is tamed!");
3546 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3548 /* Learn about type */
3549 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3556 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3558 do_fear = randint1(90)+10;
3560 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3563 /* No "real" damage */
3570 if (seen) obvious = TRUE;
3571 /* Attempt a saving throw */
3572 if (randint0(100 + dam) < (r_ptr->level + 50))
3574 note = _("には効果がなかった。", " is unaffected.");
3594 /* Absolutely no effect */
3595 if (skipped) return (FALSE);
3597 /* "Unique" monsters cannot be polymorphed */
3598 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3600 /* Quest monsters cannot be polymorphed */
3601 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3603 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3605 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3606 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3608 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3613 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3614 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3617 /* Modify the damage */
3619 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3620 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3622 /* Check for death */
3623 if (dam > m_ptr->hp)
3625 /* Extract method of death */
3630 /* Sound and Impact resisters never stun */
3632 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3633 !(r_ptr->flags3 & RF3_NO_STUN))
3635 if (seen) obvious = TRUE;
3638 if (MON_STUNNED(m_ptr))
3640 note = _("はひどくもうろうとした。", " is more dazed.");
3641 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3645 note = _("はもうろうとした。", " is dazed.");
3650 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3656 /* Confusion and Chaos resisters (and sleepers) never confuse */
3658 !(r_ptr->flags3 & RF3_NO_CONF) &&
3659 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3661 if (seen) obvious = TRUE;
3663 /* Already partially confused */
3664 if (MON_CONFUSED(m_ptr))
3666 note = _("はさらに混乱したようだ。", " looks more confused.");
3667 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3670 /* Was not confused */
3673 note = _("は混乱したようだ。", " looks confused.");
3677 /* Apply confusion */
3678 (void)set_monster_confused(g_ptr->m_idx, tmp);
3686 if (seen) obvious = TRUE;
3688 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3692 note = _("は弱くなったようだ。", " seems weakened.");
3693 m_ptr->maxhp -= do_time;
3694 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3699 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3700 if (do_poly && (randint1(90) > r_ptr->level))
3702 if (polymorph_monster(y, x))
3704 if (seen) obvious = TRUE;
3706 /* Monster polymorphs */
3707 note = _("が変身した!", " changes!");
3709 /* Turn off the damage */
3715 note = _("には効果がなかった。", " is unaffected.");
3718 /* Hack -- Get new monster */
3719 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3721 /* Hack -- Get new race */
3722 r_ptr = &r_info[m_ptr->r_idx];
3725 /* Handle "teleport" */
3728 if (seen) obvious = TRUE;
3730 note = _("が消え去った!", " disappears!");
3732 if (!who) chg_virtue(V_VALOUR, -1);
3735 teleport_away(g_ptr->m_idx, do_dist,
3736 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3738 /* Hack -- get new location */
3742 /* Hack -- get new grid */
3743 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3750 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3757 if (typ == GF_DRAIN_MANA)
3759 /* Drain mana does nothing */
3762 /* If another monster did the damage, hurt the monster by hand */
3765 /* Redraw (later) if needed */
3766 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3767 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3769 /* Wake the monster up */
3770 (void)set_monster_csleep(g_ptr->m_idx, 0);
3772 /* Hurt the monster */
3780 if (is_pet(m_ptr) && !(m_ptr->ml))
3783 /* Give detailed messages if destroyed */
3786 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3789 msg_format("%^s%s", m_name, note);
3797 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3799 /* Generate treasure, etc */
3800 monster_death(g_ptr->m_idx, FALSE);
3803 delete_monster_idx(g_ptr->m_idx);
3807 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3811 /* Damaged monster */
3814 /* Give detailed messages if visible or destroyed */
3815 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3817 /* Hack -- Pain message */
3820 message_pain(g_ptr->m_idx, dam);
3827 /* Hack -- handle sleep */
3828 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3832 else if (heal_leper)
3834 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3836 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3838 char m2_name[MAX_NLEN];
3840 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3841 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3844 delete_monster_idx(g_ptr->m_idx);
3847 /* If the player did it, give him experience, check fear */
3852 /* Hurt the monster, check for fear and death */
3853 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3858 /* Damaged monster */
3861 /* HACK - anger the monster before showing the sleep message */
3862 if (do_sleep) anger_monster(m_ptr);
3864 /* Give detailed messages if visible or destroyed */
3865 if (note && seen_msg)
3866 msg_format(_("%s%s", "%^s%s"), m_name, note);
3868 /* Hack -- Pain message */
3869 else if (known && (dam || !do_fear))
3871 message_pain(g_ptr->m_idx, dam);
3874 /* Anger monsters */
3875 if (((dam > 0) || get_angry) && !do_sleep)
3876 anger_monster(m_ptr);
3878 if ((fear || do_fear) && seen)
3881 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3884 /* Hack -- handle sleep */
3885 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3889 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3891 blood_curse_to_enemy(who);
3894 if (p_ptr->inside_battle)
3896 p_ptr->health_who = g_ptr->m_idx;
3897 p_ptr->redraw |= (PR_HEALTH);
3901 /* Verify this code */
3902 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3904 /* Redraw the monster grid */
3907 /* Update monster recall window */
3908 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3910 p_ptr->window |= (PW_MONSTER);
3913 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3917 if (!(flg & PROJECT_NO_HANGEKI))
3919 set_target(m_ptr, monster_target_y, monster_target_x);
3922 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3924 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3928 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3930 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3931 rakubadam_m = (dam > 200) ? 200 : dam;
3941 /* Prepare to make a Blade of Chaos */
3942 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3944 q_ptr->pval = photo;
3946 /* Mark the item as fully known */
3947 q_ptr->ident |= (IDENT_MENTAL);
3948 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3956 /* Return "Anything seen?" */
3961 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3962 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3963 * @param who_name 効果を起こしたモンスターの名前
3964 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3965 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3966 * @param x 目標X座標 / Target x location (or location to travel "towards")
3967 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3968 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3970 * @param monspell 効果元のモンスター魔法ID
3971 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3973 * Handle a beam/bolt/ball causing damage to the player.
3974 * This routine takes a "source monster" (by index), a "distance", a default
3975 * "damage", and a "damage type". See "project_m()" above.
3976 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3977 * is reduced (see "project_m()" above). This can happen if a monster breathes
3978 * at the player and hits a wall instead.
3979 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3980 * to know if this is actually a ball or a bolt spell
3981 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3982 * we just assume that the effects were obvious, for historical reasons.
3984 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)
3989 /* Hack -- assume obvious */
3990 bool obvious = TRUE;
3992 /* Player blind-ness */
3993 bool blind = (p_ptr->blind ? TRUE : FALSE);
3995 /* Player needs a "description" (he is blind) */
3998 /* Source monster */
3999 monster_type *m_ptr = NULL;
4001 /* Monster name (for attacks) */
4002 GAME_TEXT m_name[MAX_NLEN];
4004 /* Monster name (for damage) */
4007 /* Hack -- messages */
4013 /* Player is not here */
4014 if (!player_bold(y, x)) return (FALSE);
4016 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4018 if (kawarimi(TRUE)) return FALSE;
4021 /* Player cannot hurt himself */
4022 if (!who) return (FALSE);
4023 if (who == p_ptr->riding) return (FALSE);
4025 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4028 int max_attempts = 10;
4029 sound(SOUND_REFLECT);
4032 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4033 else if (p_ptr->special_defense & KATA_FUUJIN)
4034 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4036 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4039 /* Choose 'new' target */
4044 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
4045 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
4048 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4050 if (max_attempts < 1)
4052 t_y = current_floor_ptr->m_list[who].fy;
4053 t_x = current_floor_ptr->m_list[who].fx;
4058 t_y = p_ptr->y - 1 + randint1(3);
4059 t_x = p_ptr->x - 1 + randint1(3);
4062 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4064 disturb(TRUE, TRUE);
4068 /* Limit maximum damage */
4069 if (dam > 1600) dam = 1600;
4071 /* Reduce damage by distance */
4072 dam = (dam + r) / (r + 1);
4075 /* If the player is blind, be more descriptive */
4076 if (blind) fuzzy = TRUE;
4081 m_ptr = ¤t_floor_ptr->m_list[who];
4082 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4083 monster_desc(m_name, m_ptr, 0);
4085 /* Get the monster's real name (gotten before polymorph!) */
4086 strcpy(killer, who_name);
4092 case PROJECT_WHO_UNCTRL_POWER:
4093 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4096 case PROJECT_WHO_GLASS_SHARDS:
4097 strcpy(killer, _("ガラスの破片", "shards of glass"));
4101 strcpy(killer, _("罠", "a trap"));
4104 strcpy(m_name, killer);
4107 /* Analyze the damage */
4110 /* Standard damage -- hurts p_ptr->inventory_list too */
4113 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4114 get_damage = acid_dam(dam, killer, monspell, FALSE);
4118 /* Standard damage -- hurts p_ptr->inventory_list too */
4121 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4122 get_damage = fire_dam(dam, killer, monspell, FALSE);
4126 /* Standard damage -- hurts p_ptr->inventory_list too */
4129 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4130 get_damage = cold_dam(dam, killer, monspell, FALSE);
4134 /* Standard damage -- hurts p_ptr->inventory_list too */
4137 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4138 get_damage = elec_dam(dam, killer, monspell, FALSE);
4142 /* Standard damage -- also poisons player */
4145 bool double_resist = IS_OPPOSE_POIS();
4146 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4148 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4149 if (double_resist) dam = (dam + 2) / 3;
4151 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4156 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4158 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4160 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4165 /* Standard damage -- also poisons / mutates player */
4168 bool double_resist = IS_OPPOSE_POIS();
4169 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4171 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4172 if (double_resist) dam = (2 * dam + 2) / 5;
4173 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4174 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4176 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4178 if (one_in_(5)) /* 6 */
4180 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4181 if (one_in_(4)) /* 4 */
4189 inven_damage(set_acid_destroy, 2);
4195 /* Standard damage */
4198 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4199 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4203 /* Holy Orb -- Player only takes partial damage */
4206 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4207 if (p_ptr->align > 10)
4209 else if (p_ptr->align < -10)
4211 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4217 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4218 if (p_ptr->align > 10)
4220 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4224 /* Arrow -- XXX no dodging */
4229 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4231 else if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (p_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
4233 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4236 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4240 /* Plasma -- XXX No resist */
4243 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4244 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4246 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4248 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4249 (void)set_stun(p_ptr->stun + plus_stun);
4252 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4254 inven_damage(set_acid_destroy, 3);
4260 /* Nether -- drain experience */
4263 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4264 if (p_ptr->resist_neth)
4266 if (!prace_is_(RACE_SPECTRE))
4268 dam *= 6; dam /= (randint1(4) + 7);
4271 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4273 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4275 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4277 learn_spell(monspell);
4281 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4287 /* Water -- stun/confuse */
4290 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4291 if (!CHECK_MULTISHADOW())
4293 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4295 set_stun(p_ptr->stun + randint1(40));
4297 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4299 set_confused(p_ptr->confused + randint1(5) + 5);
4302 if (one_in_(5) && !p_ptr->resist_water)
4304 inven_damage(set_cold_destroy, 3);
4307 if (p_ptr->resist_water) get_damage /= 4;
4310 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4314 /* Chaos -- many effects */
4317 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4318 if (p_ptr->resist_chaos)
4320 dam *= 6; dam /= (randint1(4) + 7);
4323 if (!CHECK_MULTISHADOW())
4325 if (!p_ptr->resist_conf)
4327 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4329 if (!p_ptr->resist_chaos)
4331 (void)set_image(p_ptr->image + randint1(10));
4334 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4335 (void)gain_mutation(p_ptr, 0);
4338 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4340 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4343 if (!p_ptr->resist_chaos || one_in_(9))
4345 inven_damage(set_elec_destroy, 2);
4346 inven_damage(set_fire_destroy, 2);
4350 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4354 /* Shards -- mostly cutting */
4357 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4358 if (p_ptr->resist_shard)
4360 dam *= 6; dam /= (randint1(4) + 7);
4362 else if (!CHECK_MULTISHADOW())
4364 (void)set_cut(p_ptr->cut + dam);
4367 if (!p_ptr->resist_shard || one_in_(13))
4369 inven_damage(set_cold_destroy, 2);
4372 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4376 /* Sound -- mostly stunning */
4379 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4380 if (p_ptr->resist_sound)
4382 dam *= 5; dam /= (randint1(4) + 7);
4384 else if (!CHECK_MULTISHADOW())
4386 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4387 (void)set_stun(p_ptr->stun + plus_stun);
4390 if (!p_ptr->resist_sound || one_in_(13))
4392 inven_damage(set_cold_destroy, 2);
4395 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4399 /* Pure confusion */
4402 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4403 if (p_ptr->resist_conf)
4405 dam *= 5; dam /= (randint1(4) + 7);
4407 else if (!CHECK_MULTISHADOW())
4409 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4411 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4415 /* Disenchantment -- see above */
4418 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4419 if (p_ptr->resist_disen)
4421 dam *= 6; dam /= (randint1(4) + 7);
4423 else if (!CHECK_MULTISHADOW())
4425 (void)apply_disenchant(0);
4427 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4431 /* Nexus -- see above */
4434 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4435 if (p_ptr->resist_nexus)
4437 dam *= 6; dam /= (randint1(4) + 7);
4439 else if (!CHECK_MULTISHADOW())
4443 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4447 /* Force -- mostly stun */
4450 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4451 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4453 (void)set_stun(p_ptr->stun + randint1(20));
4455 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4460 /* Rocket -- stun, cut */
4463 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4464 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4466 (void)set_stun(p_ptr->stun + randint1(20));
4469 if (p_ptr->resist_shard)
4473 else if (!CHECK_MULTISHADOW())
4475 (void)set_cut(p_ptr->cut + (dam / 2));
4478 if (!p_ptr->resist_shard || one_in_(12))
4480 inven_damage(set_cold_destroy, 3);
4483 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4487 /* Inertia -- slowness */
4490 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4491 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4492 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4496 /* Lite -- blinding */
4499 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4500 if (p_ptr->resist_lite)
4502 dam *= 4; dam /= (randint1(4) + 7);
4504 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4506 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4509 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4511 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4514 else if (prace_is_(RACE_S_FAIRY))
4519 if (p_ptr->wraith_form) dam *= 2;
4520 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4522 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4524 p_ptr->wraith_form = 0;
4525 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4526 "The light forces you out of your incorporeal shadow form."));
4528 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4529 p_ptr->update |= (PU_MONSTERS);
4530 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4536 /* Dark -- blinding */
4539 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4540 if (p_ptr->resist_dark)
4542 dam *= 4; dam /= (randint1(4) + 7);
4544 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4546 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4548 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4550 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4554 /* Time -- bolt fewer effects XXX */
4557 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4558 if (p_ptr->resist_time)
4561 dam /= (randint1(4) + 7);
4562 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4564 else if (!CHECK_MULTISHADOW())
4566 switch (randint1(10))
4568 case 1: case 2: case 3: case 4: case 5:
4570 if (p_ptr->prace == RACE_ANDROID) break;
4571 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4572 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4576 case 6: case 7: case 8: case 9:
4578 switch (randint1(6))
4580 case 1: k = A_STR; act = _("強く", "strong"); break;
4581 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4582 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4583 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4584 case 5: k = A_CON; act = _("健康で", "hale"); break;
4585 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4588 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4589 "You're not as %s as you used to be..."), act);
4591 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4592 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4593 p_ptr->update |= (PU_BONUS);
4599 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4600 "You're not as powerful as you used to be..."));
4602 for (k = 0; k < A_MAX; k++)
4604 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4605 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4607 p_ptr->update |= (PU_BONUS);
4613 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4617 /* Gravity -- stun plus slowness plus teleport */
4620 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4621 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4623 if (!CHECK_MULTISHADOW())
4625 teleport_player(5, TELEPORT_PASSIVE);
4626 if (!p_ptr->levitation)
4627 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4628 if (!(p_ptr->resist_sound || p_ptr->levitation))
4630 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4631 (void)set_stun(p_ptr->stun + plus_stun);
4634 if (p_ptr->levitation)
4636 dam = (dam * 2) / 3;
4639 if (!p_ptr->levitation || one_in_(13))
4641 inven_damage(set_cold_destroy, 2);
4644 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4648 /* Standard damage */
4649 case GF_DISINTEGRATE:
4651 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4653 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4659 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4661 (void)hp_player(dam);
4668 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4669 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4676 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4677 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4683 if (p_ptr->free_act) break;
4684 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4686 if (ironman_nightmare)
4688 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4689 /* Have some nightmares */
4690 sanity_blast(NULL, FALSE);
4693 set_paralyzed(p_ptr->paralyzed + dam);
4703 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4704 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4711 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4712 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4719 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4721 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4722 if (!p_ptr->resist_shard || one_in_(13))
4724 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4725 inven_damage(set_cold_destroy, 2);
4731 /* Ice -- cold plus stun plus cuts */
4734 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4735 get_damage = cold_dam(dam, killer, monspell, FALSE);
4736 if (!CHECK_MULTISHADOW())
4738 if (!p_ptr->resist_shard)
4740 (void)set_cut(p_ptr->cut + damroll(5, 8));
4742 if (!p_ptr->resist_sound)
4744 (void)set_stun(p_ptr->stun + randint1(15));
4747 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4749 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4759 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4761 if (p_ptr->mimic_form)
4763 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4764 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4769 switch (p_ptr->prace)
4771 /* Some races are immune */
4785 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4797 if (CHECK_MULTISHADOW())
4799 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4801 else if (p_ptr->csp)
4805 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4807 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4810 if (dam >= p_ptr->csp)
4814 p_ptr->csp_frac = 0;
4823 learn_spell(monspell);
4824 p_ptr->redraw |= (PR_MANA);
4825 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4829 /* Heal the monster */
4830 if (m_ptr->hp < m_ptr->maxhp)
4834 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4836 /* Redraw (later) if needed */
4837 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4838 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4840 /* Special message */
4843 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4856 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4858 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4859 learn_spell(monspell);
4863 if (!CHECK_MULTISHADOW())
4865 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4867 if (!p_ptr->resist_conf)
4869 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4872 if (!p_ptr->resist_chaos && one_in_(3))
4874 (void)set_image(p_ptr->image + randint0(250) + 150);
4881 p_ptr->csp_frac = 0;
4883 p_ptr->redraw |= PR_MANA;
4886 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4892 case GF_BRAIN_SMASH:
4894 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4896 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4897 learn_spell(monspell);
4901 if (!CHECK_MULTISHADOW())
4903 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4909 p_ptr->csp_frac = 0;
4911 p_ptr->redraw |= PR_MANA;
4914 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4915 if (!CHECK_MULTISHADOW())
4917 if (!p_ptr->resist_blind)
4919 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4921 if (!p_ptr->resist_conf)
4923 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4925 if (!p_ptr->free_act)
4927 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4929 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4931 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4932 (void)do_dec_stat(A_INT);
4933 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4934 (void)do_dec_stat(A_WIS);
4936 if (!p_ptr->resist_chaos)
4938 (void)set_image(p_ptr->image + randint0(250) + 150);
4948 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4950 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4951 learn_spell(monspell);
4955 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
4956 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4964 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4966 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4967 learn_spell(monspell);
4971 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4972 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4980 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4982 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4983 learn_spell(monspell);
4987 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4988 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4996 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
4998 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
4999 learn_spell(monspell);
5003 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5004 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5012 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5014 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5015 learn_spell(monspell);
5019 if (!CHECK_MULTISHADOW())
5021 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5022 curse_equipment(40, 20);
5025 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5027 if (p_ptr->chp < 1) p_ptr->chp = 1;
5042 /* Hex - revenge damage stored */
5043 revenge_store(get_damage);
5045 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5046 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5048 GAME_TEXT m_name_self[80];
5051 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5053 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5054 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5055 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5058 if (p_ptr->riding && dam > 0)
5060 rakubadam_p = (dam > 200) ? 200 : dam;
5064 disturb(TRUE, TRUE);
5067 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5069 (void)kawarimi(FALSE);
5072 /* Return "Anything seen?" */
5078 * Find the distance from (x, y) to a line.
5080 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5082 /* Vector from (x, y) to (x1, y1) */
5083 POSITION py = y1 - y;
5084 POSITION px = x1 - x;
5087 POSITION ny = x2 - x1;
5088 POSITION nx = y1 - y2;
5091 POSITION pd = distance(y1, x1, y, x);
5092 POSITION nd = distance(y1, x1, y2, x2);
5094 if (pd > nd) return distance(y, x, y2, x2);
5096 /* Component of P on N */
5097 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5099 /* Absolute value */
5100 return((nd >= 0) ? nd : 0 - nd);
5107 * Modified version of los() for calculation of disintegration balls.
5108 * Disintegration effects are stopped by permanent walls.
5110 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5112 POSITION dx, dy; /* Delta */
5113 POSITION ax, ay; /* Absolute */
5114 POSITION sx, sy; /* Signs */
5115 POSITION qx, qy; /* Fractions */
5116 POSITION tx, ty; /* Scanners */
5117 POSITION f1, f2; /* Scale factors */
5118 POSITION m; /* Slope, or 1/Slope, of LOS */
5120 /* Extract the offset */
5124 /* Extract the absolute offset */
5128 /* Handle adjacent (or identical) grids */
5129 if ((ax < 2) && (ay < 2)) return (TRUE);
5131 /* Paranoia -- require "safe" origin */
5132 /* if (!in_bounds(y1, x1)) return (FALSE); */
5134 /* Directly South/North */
5137 /* South -- check for walls */
5140 for (ty = y1 + 1; ty < y2; ty++)
5142 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5146 /* North -- check for walls */
5149 for (ty = y1 - 1; ty > y2; ty--)
5151 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5159 /* Directly East/West */
5162 /* East -- check for walls */
5165 for (tx = x1 + 1; tx < x2; tx++)
5167 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5171 /* West -- check for walls */
5174 for (tx = x1 - 1; tx > x2; tx--)
5176 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5184 /* Extract some signs */
5185 sx = (dx < 0) ? -1 : 1;
5186 sy = (dy < 0) ? -1 : 1;
5188 /* Vertical "knights" */
5193 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5197 /* Horizontal "knights" */
5202 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5206 /* Calculate scale factor div 2 */
5209 /* Calculate scale factor */
5213 /* Travel horizontally */
5216 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5222 /* Consider the special case where slope == 1. */
5233 /* Note (below) the case (qy == f2), where */
5234 /* the LOS exactly meets the corner of a tile. */
5237 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5248 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5261 /* Travel vertically */
5264 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5280 /* Note (below) the case (qx == f2), where */
5281 /* the LOS exactly meets the corner of a tile. */
5284 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5295 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5316 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)
5321 int brev = rad * rad / dist;
5325 int mdis = distance(y1, x1, y2, x2) + rad;
5327 while (bdis <= mdis)
5331 if ((0 < dist) && (path_n < dist))
5333 POSITION ny = GRID_Y(path_g[path_n]);
5334 POSITION nx = GRID_X(path_g[path_n]);
5335 POSITION nd = distance(ny, nx, y1, x1);
5337 /* Get next base point */
5346 /* Travel from center outward */
5347 for (cdis = 0; cdis <= brad; cdis++)
5349 /* Scan the maximal blast area of radius "cdis" */
5350 for (y = by - cdis; y <= by + cdis; y++)
5352 for (x = bx - cdis; x <= bx + cdis; x++)
5354 /* Ignore "illegal" locations */
5355 if (!in_bounds(y, x)) continue;
5357 /* Enforce a circular "ripple" */
5358 if (distance(y1, x1, y, x) != bdis) continue;
5360 /* Enforce an arc */
5361 if (distance(by, bx, y, x) != cdis) continue;
5367 /* Lights are stopped by opaque terrains */
5368 if (!los(by, bx, y, x)) continue;
5370 case GF_DISINTEGRATE:
5371 /* Disintegration are stopped only by perma-walls */
5372 if (!in_disintegration_range(by, bx, y, x)) continue;
5375 /* Ball explosions are stopped by walls */
5376 if (!projectable(by, bx, y, x)) continue;
5380 /* Save this grid */
5388 /* Encode some more "radius" info */
5389 gm[bdis + 1] = *pgrids;
5391 /* Increase the size */
5392 brad = rad * (path_n + brev) / (dist + brev);
5394 /* Find the next ripple */
5398 /* Store the effect size */
5404 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5405 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5406 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5407 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5408 * @param x 目標X座標 / Target x location (or location to travel "towards")
5409 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5410 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5411 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5412 * @param monspell 効果元のモンスター魔法ID
5413 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5416 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5417 * towards a given location (optionally passing over the heads of interposing
5418 * monsters), and have it do a given amount of damage to the monsters (and
5419 * optionally objects) within the given radius of the final location.
5421 * A "bolt" travels from source to target and affects only the target grid.
5422 * A "beam" travels from source to target, affecting all grids passed through.
5423 * A "ball" travels from source to the target, exploding at the target, and
5424 * affecting everything within the given radius of the target location.
5426 * Traditionally, a "bolt" does not affect anything on the ground, and does
5427 * not pass over the heads of interposing monsters, much like a traditional
5428 * missile, and will "stop" abruptly at the "target" even if no monster is
5429 * positioned there, while a "ball", on the other hand, passes over the heads
5430 * of monsters between the source and target, and affects everything except
5431 * the source monster which lies within the final radius, while a "beam"
5432 * affects every monster between the source and target, except for the casting
5433 * monster (or player), and rarely affects things on the ground.
5435 * Two special flags allow us to use this function in special ways, the
5436 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5437 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5438 * actually projecting from the source monster (or player).
5440 * The player will only get "experience" for monsters killed by himself
5441 * Unique monsters can only be destroyed by attacks from the player
5443 * Only 256 grids can be affected per projection, limiting the effective
5444 * "radius" of standard ball attacks to nine units (diameter nineteen).
5446 * One can project in a given "direction" by combining PROJECT_THRU with small
5447 * offsets to the initial location (see "line_spell()"), or by calculating
5448 * "virtual targets" far away from the player.
5450 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5451 * continuing until it actually hits somethings (useful for "stone to mud").
5453 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5455 * Balls must explode BEFORE hitting walls, or they would affect monsters
5456 * on both sides of a wall. Some bug reports indicate that this is still
5457 * happening in 2.7.8 for Windows, though it appears to be impossible.
5459 * We "pre-calculate" the blast area only in part for efficiency.
5460 * More importantly, this lets us do "explosions" from the "inside" out.
5461 * This results in a more logical distribution of "blast" treasure.
5462 * It also produces a better (in my opinion) animation of the explosion.
5463 * It could be (but is not) used to have the treasure dropped by monsters
5464 * in the middle of the explosion fall "outwards", and then be damaged by
5465 * the blast as it spreads outwards towards the treasure drop location.
5467 * Walls and doors are included in the blast area, so that they can be
5468 * "burned" or "melted" in later versions.
5470 * This algorithm is intended to maximize simplicity, not necessarily
5471 * efficiency, since this function is not a bottleneck in the code.
5473 * We apply the blast effect from ground zero outwards, in several passes,
5474 * first affecting features, then objects, then monsters, then the player.
5475 * This allows walls to be removed before checking the object or monster
5476 * in the wall, and protects objects which are dropped by monsters killed
5477 * in the blast, and allows the player to see all affects before he is
5478 * killed or teleported away. The semantics of this method are open to
5479 * various interpretations, but they seem to work well in practice.
5481 * We process the blast area from ground-zero outwards to allow for better
5482 * distribution of treasure dropped by monsters, and because it provides a
5483 * pleasing visual effect at low cost.
5485 * Note that the damage done by "ball" explosions decreases with distance.
5486 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5488 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5489 * the target, and then the damage "flows" along this beam of destruction.
5490 * The damage at every grid is the same as at the "center" of a "ball"
5491 * explosion, since the "beam" grids are treated as if they ARE at the
5492 * center of a "ball" explosion.
5494 * Currently, specifying "beam" plus "ball" means that locations which are
5495 * covered by the initial "beam", and also covered by the final "ball", except
5496 * for the final grid (the epicenter of the ball), will be "hit twice", once
5497 * by the initial beam, and once by the exploding ball. For the grid right
5498 * next to the epicenter, this results in 150% damage being done. The center
5499 * does not have this problem, for the same reason the final grid in a "beam"
5500 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5501 * grids which are covered by the "ball" will NOT work, as then they will
5502 * receive LESS damage than they should. Do not combine "beam" with "ball".
5504 * The array "gy[],gx[]" with current size "grids" is used to hold the
5505 * collected locations of all grids in the "blast area" plus "beam path".
5507 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5508 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5509 * first blast grid (see above) with radius "N" from the blast center. Note
5510 * that only the first gm[1] grids in the blast area thus take full damage.
5511 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5512 * number of blast grids.
5514 * Note that once the projection is complete, (y2,x2) holds the final location
5515 * of bolts/beams, and the "epicenter" of balls.
5517 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5518 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5519 * implementation of the "distance" function. Also, a bolt can be properly
5520 * viewed as a "ball" with a "rad" of "zero".
5522 * Note that if no "target" is reached before the beam/bolt/ball travels the
5523 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5524 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5526 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5527 * to move from point A to point B, even if the player cannot see part of the
5528 * projection path. Note that in general, the player will *always* see part
5529 * of the path, since it either starts at the player or ends on the player.
5531 * Hack -- we assume that every "projection" is "self-illuminating".
5533 * Hack -- when only a single monster is affected, we automatically track
5534 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5536 * Note that all projections now "explode" at their final destination, even
5537 * if they were being projected at a more distant destination. This means
5538 * that "ball" spells will *always* explode.
5540 * Note that we must call "handle_stuff()" after affecting terrain features
5541 * in the blast radius, in case the "illumination" of the grid was changed,
5542 * and "update_view()" and "update_monsters()" need to be called.
5545 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5555 POSITION y_saver, x_saver; /* For reflecting monsters */
5557 int msec = delay_factor * delay_factor * delay_factor;
5559 /* Assume the player sees nothing */
5560 bool notice = FALSE;
5562 /* Assume the player has seen nothing */
5563 bool visual = FALSE;
5565 /* Assume the player has seen no blast grids */
5568 /* Assume to be a normal ball spell */
5569 bool breath = FALSE;
5571 /* Is the player blind? */
5572 bool blind = (p_ptr->blind ? TRUE : FALSE);
5574 bool old_hide = FALSE;
5576 /* Number of grids in the "path" */
5579 /* Actual grids in the "path" */
5582 /* Number of grids in the "blast area" (including the "beam" path) */
5585 /* Coordinates of the affected grids */
5586 POSITION gx[1024], gy[1024];
5588 /* Encoded "radius" info (see above) */
5591 /* Actual radius encoded in gm[] */
5592 POSITION gm_rad = rad;
5596 /* Attacker's name (prepared before polymorph)*/
5597 GAME_TEXT who_name[MAX_NLEN];
5599 /* Can the player see the source of this effect? */
5600 bool see_s_msg = TRUE;
5602 /* Initialize by null string */
5608 /* Default target of monsterspell is player */
5609 monster_target_y = p_ptr->y;
5610 monster_target_x = p_ptr->x;
5612 /* Hack -- Jump to target */
5613 if (flg & (PROJECT_JUMP))
5618 /* Clear the flag */
5619 flg &= ~(PROJECT_JUMP);
5624 /* Start at player */
5631 /* Start at monster */
5634 x1 = current_floor_ptr->m_list[who].fx;
5635 y1 = current_floor_ptr->m_list[who].fy;
5636 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_WRONGDOER_NAME);
5648 /* Default "destination" */
5653 /* Hack -- verify stuff */
5654 if (flg & (PROJECT_THRU))
5656 if ((x1 == x2) && (y1 == y2))
5658 flg &= ~(PROJECT_THRU);
5662 /* Handle a breath attack */
5667 if (flg & PROJECT_HIDE) old_hide = TRUE;
5668 flg |= PROJECT_HIDE;
5672 /* Hack -- Assume there will be no blast (max radius 32) */
5673 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5681 /* Collect beam grids */
5682 if (flg & (PROJECT_BEAM))
5693 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5695 case GF_DISINTEGRATE:
5696 flg |= (PROJECT_GRID);
5697 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5701 /* Calculate the projection path */
5703 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5706 /* Giga-Hack SEEKER & SUPER_RAY */
5708 if( typ == GF_SEEKER )
5718 for (i = 0; i < path_n; ++i)
5723 POSITION ny = GRID_Y(path_g[i]);
5724 POSITION nx = GRID_X(path_g[i]);
5735 /* Only do visuals if requested */
5736 if (!blind && !(flg & (PROJECT_HIDE)))
5738 /* Only do visuals if the player can "see" the bolt */
5739 if (panel_contains(y, x) && player_has_los_bold(y, x))
5746 /* Obtain the bolt pict */
5747 p = bolt_pict(oy, ox, y, x, typ);
5749 /* Extract attr/char */
5753 /* Visual effects */
5754 print_rel(c, a, y, x);
5755 move_cursor_relative(y, x);
5756 /*if (fresh_before)*/ Term_fresh();
5757 Term_xtra(TERM_XTRA_DELAY, msec);
5759 /*if (fresh_before)*/ Term_fresh();
5761 /* Display "beam" grids */
5762 if (flg & (PROJECT_BEAM))
5764 /* Obtain the explosion pict */
5765 p = bolt_pict(y, x, y, x, typ);
5767 /* Extract attr/char */
5771 /* Visual effects */
5772 print_rel(c, a, y, x);
5775 /* Hack -- Activate delay */
5779 /* Hack -- delay anyway for consistency */
5782 /* Delay for consistency */
5783 Term_xtra(TERM_XTRA_DELAY, msec);
5786 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5787 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5789 /* The target of monsterspell becomes tha mirror(broken) */
5790 monster_target_y = y;
5791 monster_target_x = x;
5793 remove_mirror(y, x);
5794 next_mirror(&oy, &ox, y, x);
5796 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5797 for (j = last_i; j <= i; j++)
5799 y = GRID_Y(path_g[j]);
5800 x = GRID_X(path_g[j]);
5801 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5802 if (!who && (project_m_n == 1) && !jump) {
5803 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5804 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5808 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5809 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5813 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5818 for(i = last_i ; i < path_n ; i++)
5821 py = GRID_Y(path_g[i]);
5822 px = GRID_X(path_g[i]);
5823 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5825 if (!who && (project_m_n == 1) && !jump) {
5826 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5828 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5832 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5833 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5837 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5841 else if(typ == GF_SUPER_RAY){
5843 int second_step = 0;
5850 for (i = 0; i < path_n; ++i)
5855 POSITION ny = GRID_Y(path_g[i]);
5856 POSITION nx = GRID_X(path_g[i]);
5867 /* Only do visuals if requested */
5868 if (!blind && !(flg & (PROJECT_HIDE)))
5870 /* Only do visuals if the player can "see" the bolt */
5871 if (panel_contains(y, x) && player_has_los_bold(y, x))
5878 /* Obtain the bolt pict */
5879 p = bolt_pict(oy, ox, y, x, typ);
5881 /* Extract attr/char */
5885 /* Visual effects */
5886 print_rel(c, a, y, x);
5887 move_cursor_relative(y, x);
5888 /*if (fresh_before)*/ Term_fresh();
5889 Term_xtra(TERM_XTRA_DELAY, msec);
5891 /*if (fresh_before)*/ Term_fresh();
5893 /* Display "beam" grids */
5894 if (flg & (PROJECT_BEAM))
5896 /* Obtain the explosion pict */
5897 p = bolt_pict(y, x, y, x, typ);
5899 /* Extract attr/char */
5903 /* Visual effects */
5904 print_rel(c, a, y, x);
5907 /* Hack -- Activate delay */
5911 /* Hack -- delay anyway for consistency */
5914 /* Delay for consistency */
5915 Term_xtra(TERM_XTRA_DELAY, msec);
5918 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5919 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5921 if( second_step )continue;
5924 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5926 /* The target of monsterspell becomes tha mirror(broken) */
5927 monster_target_y = y;
5928 monster_target_x = x;
5931 for( j = 0; j <=i ; j++ )
5933 y = GRID_Y(path_g[j]);
5934 x = GRID_X(path_g[j]);
5935 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5939 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5940 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5941 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5942 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , 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+1, x-1, flg);
5945 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5946 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5949 for( i = 0; i < path_n ; i++ )
5952 py = GRID_Y(path_g[i]);
5953 px = GRID_X(path_g[i]);
5954 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5955 if(!who && (project_m_n == 1) && !jump){
5956 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5957 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5961 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5962 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5966 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5971 /* Project along the path */
5972 for (i = 0; i < path_n; ++i)
5977 POSITION ny = GRID_Y(path_g[i]);
5978 POSITION nx = GRID_X(path_g[i]);
5980 if (flg & PROJECT_DISI)
5982 /* Hack -- Balls explode before reaching walls */
5983 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5985 else if (flg & PROJECT_LOS)
5987 /* Hack -- Balls explode before reaching walls */
5988 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
5992 /* Hack -- Balls explode before reaching walls */
5993 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6000 /* Collect beam grids */
6001 if (flg & (PROJECT_BEAM))
6008 /* Only do visuals if requested */
6009 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6011 /* Only do visuals if the player can "see" the bolt */
6012 if (panel_contains(y, x) && player_has_los_bold(y, x))
6019 /* Obtain the bolt pict */
6020 p = bolt_pict(oy, ox, y, x, typ);
6022 /* Extract attr/char */
6026 /* Visual effects */
6027 print_rel(c, a, y, x);
6028 move_cursor_relative(y, x);
6029 /*if (fresh_before)*/ Term_fresh();
6030 Term_xtra(TERM_XTRA_DELAY, msec);
6032 /*if (fresh_before)*/ Term_fresh();
6034 /* Display "beam" grids */
6035 if (flg & (PROJECT_BEAM))
6037 /* Obtain the explosion pict */
6038 p = bolt_pict(y, x, y, x, typ);
6040 /* Extract attr/char */
6044 /* Visual effects */
6045 print_rel(c, a, y, x);
6048 /* Hack -- Activate delay */
6052 /* Hack -- delay anyway for consistency */
6055 /* Delay for consistency */
6056 Term_xtra(TERM_XTRA_DELAY, msec);
6063 /* Save the "blast epicenter" */
6067 if (breath && !path_n)
6073 flg &= ~(PROJECT_HIDE);
6077 /* Start the "explosion" */
6080 /* Hack -- make sure beams get to "explode" */
6088 /* If we found a "target", explode there */
6089 if (dist <= MAX_RANGE)
6091 /* Mega-Hack -- remove the final "beam" grid */
6092 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6095 * Create a conical breath attack
6106 flg &= ~(PROJECT_HIDE);
6108 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6112 /* Determine the blast area, work from the inside out */
6113 for (dist = 0; dist <= rad; dist++)
6115 /* Scan the maximal blast area of radius "dist" */
6116 for (y = by - dist; y <= by + dist; y++)
6118 for (x = bx - dist; x <= bx + dist; x++)
6120 /* Ignore "illegal" locations */
6121 if (!in_bounds2(y, x)) continue;
6123 /* Enforce a "circular" explosion */
6124 if (distance(by, bx, y, x) != dist) continue;
6130 /* Lights are stopped by opaque terrains */
6131 if (!los(by, bx, y, x)) continue;
6133 case GF_DISINTEGRATE:
6134 /* Disintegration are stopped only by perma-walls */
6135 if (!in_disintegration_range(by, bx, y, x)) continue;
6138 /* Ball explosions are stopped by walls */
6139 if (!projectable(by, bx, y, x)) continue;
6143 /* Save this grid */
6150 /* Encode some more "radius" info */
6156 /* Speed -- ignore "non-explosions" */
6157 if (!grids) return (FALSE);
6160 /* Display the "blast area" if requested */
6161 if (!blind && !(flg & (PROJECT_HIDE)))
6163 /* Then do the "blast", from inside out */
6164 for (t = 0; t <= gm_rad; t++)
6166 /* Dump everything with this radius */
6167 for (i = gm[t]; i < gm[t+1]; i++)
6169 /* Extract the location */
6173 /* Only do visuals if the player can "see" the blast */
6174 if (panel_contains(y, x) && player_has_los_bold(y, x))
6183 /* Obtain the explosion pict */
6184 p = bolt_pict(y, x, y, x, typ);
6186 /* Extract attr/char */
6190 /* Visual effects -- Display */
6191 print_rel(c, a, y, x);
6195 /* Hack -- center the cursor */
6196 move_cursor_relative(by, bx);
6198 /* Flush each "radius" seperately */
6199 /*if (fresh_before)*/ Term_fresh();
6201 /* Delay (efficiently) */
6202 if (visual || drawn)
6204 Term_xtra(TERM_XTRA_DELAY, msec);
6208 /* Flush the erasing */
6211 /* Erase the explosion drawn above */
6212 for (i = 0; i < grids; i++)
6214 /* Extract the location */
6218 /* Hack -- Erase if needed */
6219 if (panel_contains(y, x) && player_has_los_bold(y, x))
6225 /* Hack -- center the cursor */
6226 move_cursor_relative(by, bx);
6228 /* Flush the explosion */
6229 /*if (fresh_before)*/ Term_fresh();
6233 update_creature(p_ptr);
6235 if (flg & PROJECT_KILL)
6237 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6238 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6242 /* Check features */
6243 if (flg & (PROJECT_GRID))
6245 /* Start with "dist" of zero */
6248 /* Scan for features */
6249 for (i = 0; i < grids; i++)
6251 /* Hack -- Notice new "dist" values */
6252 if (gm[dist+1] == i) dist++;
6254 /* Get the grid location */
6258 /* Find the closest point in the blast */
6261 int d = dist_to_line(y, x, y1, x1, by, bx);
6263 /* Affect the grid */
6264 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6268 /* Affect the grid */
6269 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6274 update_creature(p_ptr);
6277 if (flg & (PROJECT_ITEM))
6279 /* Start with "dist" of zero */
6282 /* Scan for objects */
6283 for (i = 0; i < grids; i++)
6285 /* Hack -- Notice new "dist" values */
6286 if (gm[dist+1] == i) dist++;
6288 /* Get the grid location */
6292 /* Find the closest point in the blast */
6295 int d = dist_to_line(y, x, y1, x1, by, bx);
6297 /* Affect the object in the grid */
6298 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6302 /* Affect the object in the grid */
6303 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6309 /* Check monsters */
6310 if (flg & (PROJECT_KILL))
6317 /* Start with "dist" of zero */
6320 /* Scan for monsters */
6321 for (i = 0; i < grids; i++)
6325 /* Hack -- Notice new "dist" values */
6326 if (gm[dist + 1] == i) dist++;
6328 /* Get the grid location */
6332 /* A single bolt may be reflected */
6335 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6336 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6338 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6339 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6340 (!who || dist_hack > 1) && !one_in_(10))
6343 int max_attempts = 10;
6345 /* Choose 'new' target */
6348 t_y = y_saver - 1 + randint1(3);
6349 t_x = x_saver - 1 + randint1(3);
6352 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6354 if (max_attempts < 1)
6360 sound(SOUND_REFLECT);
6363 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6364 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6365 else if (m_ptr->r_idx == MON_DIO)
6366 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6368 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6370 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6372 /* Reflected bolts randomly target either one */
6373 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6374 else flg |= PROJECT_PLAYER;
6376 /* The bolt is reflected */
6377 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6379 /* Don't affect the monster any longer */
6385 /* Find the closest point in the blast */
6388 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6392 effective_dist = dist;
6396 /* There is the riding player on this monster */
6397 if (p_ptr->riding && player_bold(y, x))
6399 /* Aimed on the player */
6400 if (flg & PROJECT_PLAYER)
6402 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6405 * A beam or bolt is well aimed
6407 * So don't affects the mount.
6414 * The spell is not well aimed,
6415 * So partly affect the mount too.
6422 * This grid is the original target.
6423 * Or aimed on your horse.
6425 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6427 /* Hit the mount with full damage */
6431 * Otherwise this grid is not the
6432 * original target, it means that line
6433 * of fire is obstructed by this
6437 * A beam or bolt will hit either
6438 * player or mount. Choose randomly.
6440 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6444 /* Hit the mount with full damage */
6448 /* Hit the player later */
6449 flg |= PROJECT_PLAYER;
6451 /* Don't affect the mount */
6457 * The spell is not well aimed, so
6458 * partly affect both player and
6467 /* Affect the monster in the grid */
6468 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6472 /* Player affected one monster (without "jumping") */
6473 if (!who && (project_m_n == 1) && !jump)
6478 /* Track if possible */
6479 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6481 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6485 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6486 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6494 if (flg & (PROJECT_KILL))
6496 /* Start with "dist" of zero */
6499 /* Scan for player */
6500 for (i = 0; i < grids; i++)
6504 /* Hack -- Notice new "dist" values */
6505 if (gm[dist+1] == i) dist++;
6507 /* Get the grid location */
6511 /* Affect the player? */
6512 if (!player_bold(y, x)) continue;
6514 /* Find the closest point in the blast */
6517 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6521 effective_dist = dist;
6524 /* Target may be your horse */
6527 /* Aimed on the player */
6528 if (flg & PROJECT_PLAYER)
6530 /* Hit the player with full damage */
6534 * Hack -- When this grid was not the
6535 * original target, a beam or bolt
6536 * would hit either player or mount,
6537 * and should be choosen randomly.
6539 * But already choosen to hit the
6540 * mount at this point.
6542 * Or aimed on your horse.
6544 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6547 * A beam or bolt is well aimed
6549 * So don't affects the player.
6556 * The spell is not well aimed,
6557 * So partly affect the player too.
6563 /* Affect the player */
6564 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6570 GAME_TEXT m_name[MAX_NLEN];
6572 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6574 if (rakubadam_m > 0)
6576 if (rakuba(rakubadam_m, FALSE))
6578 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6581 if (p_ptr->riding && rakubadam_p > 0)
6583 if(rakuba(rakubadam_p, FALSE))
6585 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6590 /* Return "something was noticed" */
6595 * @brief 鏡魔法「封魔結界」の効果処理
6597 * @return 効果があったらTRUEを返す
6599 bool binding_field(HIT_POINT dam)
6601 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6602 int mirror_num = 0; /* 鏡の数 */
6604 POSITION centersign;
6605 POSITION x1, x2, y1, y2;
6607 int msec = delay_factor*delay_factor*delay_factor;
6610 POSITION point_x[3];
6611 POSITION point_y[3];
6613 /* Default target of monsterspell is player */
6614 monster_target_y = p_ptr->y;
6615 monster_target_x = p_ptr->x;
6617 for (x = 0; x < current_floor_ptr->width; x++)
6619 for (y = 0; y < current_floor_ptr->height; y++)
6621 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6622 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6623 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6624 player_has_los_bold(y, x) &&
6625 projectable(p_ptr->y, p_ptr->x, y, x)
6627 mirror_y[mirror_num] = y;
6628 mirror_x[mirror_num] = x;
6634 if (mirror_num < 2)return FALSE;
6636 point_x[0] = randint0(mirror_num);
6638 point_x[1] = randint0(mirror_num);
6639 } while (point_x[0] == point_x[1]);
6641 point_y[0] = mirror_y[point_x[0]];
6642 point_x[0] = mirror_x[point_x[0]];
6643 point_y[1] = mirror_y[point_x[1]];
6644 point_x[1] = mirror_x[point_x[1]];
6645 point_y[2] = p_ptr->y;
6646 point_x[2] = p_ptr->x;
6648 x = point_x[0] + point_x[1] + point_x[2];
6649 y = point_y[0] + point_y[1] + point_y[2];
6651 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6652 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6653 if (centersign == 0)return FALSE;
6655 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6656 x1 = x1 < point_x[2] ? x1 : point_x[2];
6657 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6658 y1 = y1 < point_y[2] ? y1 : point_y[2];
6660 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6661 x2 = x2 > point_x[2] ? x2 : point_x[2];
6662 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6663 y2 = y2 > point_y[2] ? y2 : point_y[2];
6665 for (y = y1; y <= y2; y++) {
6666 for (x = x1; x <= x2; x++) {
6667 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6668 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6669 centersign*((point_x[1] - x)*(point_y[2] - y)
6670 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6671 centersign*((point_x[2] - x)*(point_y[0] - y)
6672 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6674 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6675 /* Visual effects */
6677 && panel_contains(y, x)) {
6678 p = bolt_pict(y, x, y, x, GF_MANA);
6679 print_rel(PICT_C(p), PICT_A(p), y, x);
6680 move_cursor_relative(y, x);
6681 /*if (fresh_before)*/ Term_fresh();
6682 Term_xtra(TERM_XTRA_DELAY, msec);
6688 for (y = y1; y <= y2; y++) {
6689 for (x = x1; x <= x2; x++) {
6690 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6691 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6692 centersign*((point_x[1] - x)*(point_y[2] - y)
6693 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6694 centersign*((point_x[2] - x)*(point_y[0] - y)
6695 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6697 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6698 (void)project_f(0, 0, y, x, dam, GF_MANA);
6703 for (y = y1; y <= y2; y++) {
6704 for (x = x1; x <= x2; x++) {
6705 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6706 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6707 centersign*((point_x[1] - x)*(point_y[2] - y)
6708 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6709 centersign*((point_x[2] - x)*(point_y[0] - y)
6710 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6712 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6713 (void)project_o(0, 0, y, x, dam, GF_MANA);
6718 for (y = y1; y <= y2; y++) {
6719 for (x = x1; x <= x2; x++) {
6720 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6721 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6722 centersign*((point_x[1] - x)*(point_y[2] - y)
6723 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6724 centersign*((point_x[2] - x)*(point_y[0] - y)
6725 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6727 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6728 (void)project_m(0, 0, y, x, dam, GF_MANA,
6729 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6735 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6736 remove_mirror(point_y[0], point_x[0]);
6743 * @brief 鏡魔法「鏡の封印」の効果処理
6745 * @return 効果があったらTRUEを返す
6747 void seal_of_mirror(HIT_POINT dam)
6751 for (x = 0; x < current_floor_ptr->width; x++)
6753 for (y = 0; y < current_floor_ptr->height; y++)
6755 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6757 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6758 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6760 if (!current_floor_ptr->grid_array[y][x].m_idx)
6762 remove_mirror(y, x);
6774 * @brief 領域魔法に応じて技能の名称を返す。
6775 * @param tval 魔法書のtval
6776 * @return 領域魔法の技能名称を保管した文字列ポインタ
6778 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6782 case TV_HISSATSU_BOOK:
6783 return _("必殺技", "art");
6785 return _("祈り", "prayer");
6787 return _("歌", "song");
6789 return _("呪文", "spell");