3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
23 #include "object-curse.h"
24 #include "player-damage.h"
25 #include "player-effects.h"
26 #include "player-race.h"
27 #include "player-class.h"
30 #include "monster-status.h"
31 #include "monster-spell.h"
33 #include "spells-status.h"
34 #include "spells-diceroll.h"
35 #include "spells-summon.h"
36 #include "monsterrace-hook.h"
44 #include "player-status.h"
45 #include "player-move.h"
46 #include "realm-hex.h"
47 #include "realm-song.h"
48 #include "object-hook.h"
49 #include "object-broken.h"
50 #include "object-flavor.h"
55 #include "view-mainwindow.h"
59 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
60 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
62 int project_length = 0; /*!< 投射の射程距離 */
68 STR_OFFSET cap_nickname;
71 * @brief 歌、剣術、呪術領域情報テーブル
73 const magic_type technic_info[NUM_TECHNIC][32] =
196 * @brief 配置した鏡リストの次を取得する /
197 * Get another mirror. for SEEKER
198 * @param next_y 次の鏡のy座標を返す参照ポインタ
199 * @param next_x 次の鏡のx座標を返す参照ポインタ
200 * @param cury 現在の鏡のy座標
201 * @param curx 現在の鏡のx座標
203 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
205 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
206 int mirror_num = 0; /* 鏡の数 */
210 for (x = 0; x < current_floor_ptr->width; x++)
212 for (y = 0; y < current_floor_ptr->height; y++)
214 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x])) {
215 mirror_y[mirror_num] = y;
216 mirror_x[mirror_num] = x;
223 num = randint0(mirror_num);
224 *next_y = mirror_y[num];
225 *next_x = mirror_x[num];
228 *next_y = cury + randint0(5) - 2;
229 *next_x = curx + randint0(5) - 2;
235 * Mega-Hack -- track "affected" monsters (see "project()" comments)
237 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
238 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
239 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
240 /* Mega-Hack -- monsters target */
241 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
242 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
246 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
247 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
248 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
249 * @param y 目標Y座標 / Target y location (or location to travel "towards")
250 * @param x 目標X座標 / Target x location (or location to travel "towards")
251 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
252 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
253 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
256 * We are called both for "beam" effects and "ball" effects.
258 * The "r" parameter is the "distance from ground zero".
260 * Note that we determine if the player can "see" anything that happens
261 * by taking into account: blindness, line-of-sight, and illumination.
263 * We return "TRUE" if the effect of the projection is "obvious".
265 * We also "see" grids which are "memorized", probably a hack
267 * Perhaps we should affect doors?
270 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
272 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
273 feature_type *f_ptr = &f_info[g_ptr->feat];
275 bool obvious = FALSE;
276 bool known = player_has_los_bold(y, x);
281 /* Reduce damage by distance */
282 dam = (dam + r) / (r + 1);
285 if (have_flag(f_ptr->flags, FF_TREE))
293 message = _("枯れた", "was blasted."); break;
295 message = _("縮んだ", "shrank."); break;
297 message = _("溶けた", "melted."); break;
300 message = _("凍り、砕け散った", "was frozen and smashed."); break;
304 message = _("燃えた", "burns up!"); break;
316 message = _("粉砕された", "was crushed."); break;
318 message = NULL; break;
322 msg_format(_("木は%s。", "A tree %s"), message);
323 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
326 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
330 /* Analyze the type */
333 /* Ignore most effects */
368 /* Destroy Traps (and Locks) */
371 /* Reveal secret doors */
372 if (is_hidden_door(g_ptr))
377 /* Check line of sight */
385 if (is_trap(g_ptr->feat))
387 /* Check line of sight */
390 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
394 /* Destroy the trap */
395 cave_alter_feat(y, x, FF_DISARM);
398 /* Locked doors are unlocked */
399 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
401 FEAT_IDX old_feat = g_ptr->feat;
403 /* Unlock the door */
404 cave_alter_feat(y, x, FF_DISARM);
406 /* Check line of sound */
407 if (known && (old_feat != g_ptr->feat))
409 msg_print(_("カチッと音がした!", "Click!"));
414 /* Remove "unsafe" flag if player is not blind */
415 if (!p_ptr->blind && player_has_los_bold(y, x))
417 g_ptr->info &= ~(CAVE_UNSAFE);
425 /* Destroy Doors (and traps) */
428 /* Destroy all doors and traps */
429 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
431 /* Check line of sight */
434 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
438 /* Destroy the feature */
439 cave_alter_feat(y, x, FF_TUNNEL);
442 /* Remove "unsafe" flag if player is not blind */
443 if (!p_ptr->blind && player_has_los_bold(y, x))
445 g_ptr->info &= ~(CAVE_UNSAFE);
453 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
455 if (have_flag(f_ptr->flags, FF_SPIKE))
457 s16b old_mimic = g_ptr->mimic;
458 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
460 cave_alter_feat(y, x, FF_SPIKE);
461 g_ptr->mimic = old_mimic;
466 /* Check line of sight */
467 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
469 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
476 /* Destroy walls (and doors) */
479 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
481 if (known && (g_ptr->info & (CAVE_MARK)))
483 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
487 /* Destroy the wall */
488 cave_alter_feat(y, x, FF_HURT_ROCK);
489 p_ptr->update |= (PU_FLOW);
497 if (!cave_naked_bold(y, x)) break;
498 if (player_bold(y, x)) break;
499 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
500 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
512 if (!cave_naked_bold(y, x)) break;
513 if (player_bold(y, x)) break;
514 cave_set_feat(y, x, feat_tree);
515 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
521 if (!cave_naked_bold(y, x)) break;
522 g_ptr->info |= CAVE_OBJECT;
523 g_ptr->mimic = feat_glyph;
531 if (!cave_naked_bold(y, x)) break;
532 if (player_bold(y, x)) break;
533 cave_set_feat(y, x, feat_granite);
539 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
542 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
543 cave_set_feat(y, x, feat_shallow_lava);
547 cave_set_feat(y, x, feat_deep_lava);
554 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
557 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
558 cave_set_feat(y, x, feat_shallow_water);
562 cave_set_feat(y, x, feat_deep_water);
567 /* Lite up the grid */
571 /* Turn on the light */
572 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
574 g_ptr->info |= (CAVE_GLOW);
577 update_local_illumination(y, x);
580 if (player_can_see_bold(y, x)) obvious = TRUE;
582 /* Mega-Hack -- Update the monster in the affected grid */
583 /* This allows "spear of light" (etc) to work "correctly" */
584 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
586 if (p_ptr->special_defense & NINJA_S_STEALTH)
588 if (player_bold(y, x)) set_superstealth(FALSE);
595 /* Darken the grid */
599 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
602 /* Turn off the light. */
605 if (current_floor_ptr->dun_level || !is_daytime())
607 for (j = 0; j < 9; j++)
609 int by = y + ddy_ddd[j];
610 int bx = x + ddx_ddd[j];
612 if (in_bounds2(by, bx))
614 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
616 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
627 g_ptr->info &= ~(CAVE_GLOW);
629 /* Hack -- Forget "boring" grids */
630 if (!have_flag(f_ptr->flags, FF_REMEMBER))
633 g_ptr->info &= ~(CAVE_MARK);
640 update_local_illumination(y, x);
642 if (player_can_see_bold(y, x)) obvious = TRUE;
644 /* Mega-Hack -- Update the monster in the affected grid */
645 /* This allows "spear of light" (etc) to work "correctly" */
646 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
656 if (is_mirror_grid(g_ptr))
658 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
661 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
664 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
666 if (known && (g_ptr->info & CAVE_MARK))
668 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
672 /* Destroy the wall */
673 cave_alter_feat(y, x, FF_HURT_ROCK);
674 p_ptr->update |= (PU_FLOW);
681 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
683 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
686 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
689 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
691 if (known && (g_ptr->info & CAVE_MARK))
693 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
697 /* Destroy the wall */
698 cave_alter_feat(y, x, FF_HURT_ROCK);
699 p_ptr->update |= (PU_FLOW);
704 case GF_DISINTEGRATE:
706 /* Destroy mirror/glyph */
707 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
710 /* Permanent features don't get effect */
711 /* But not protect monsters and other objects */
712 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
714 cave_alter_feat(y, x, FF_HURT_DISI);
716 /* Update some things -- similar to GF_KILL_WALL */
717 p_ptr->update |= (PU_FLOW);
724 /* Return "Anything seen?" */
731 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
732 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
733 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
734 * @param y 目標Y座標 / Target y location (or location to travel "towards")
735 * @param x 目標X座標 / Target x location (or location to travel "towards")
736 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
737 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
738 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
741 * We are called from "project()" to "damage" objects
743 * We are called both for "beam" effects and "ball" effects.
745 * Perhaps we should only SOMETIMES damage things on the ground.
747 * The "r" parameter is the "distance from ground zero".
749 * Note that we determine if the player can "see" anything that happens
750 * by taking into account: blindness, line-of-sight, and illumination.
752 * We also "see" grids which are "memorized", probably a hack
754 * We return "TRUE" if the effect of the projection is "obvious".
757 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
759 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
761 OBJECT_IDX this_o_idx, next_o_idx = 0;
763 bool obvious = FALSE;
764 bool known = player_has_los_bold(y, x);
766 BIT_FLAGS flgs[TR_FLAG_SIZE];
768 GAME_TEXT o_name[MAX_NLEN];
770 KIND_OBJECT_IDX k_idx = 0;
771 bool is_potion = FALSE;
776 /* Reduce damage by distance */
777 dam = (dam + r) / (r + 1);
780 /* Scan all objects in the grid */
781 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
783 object_type *o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
787 bool do_kill = FALSE;
789 concptr note_kill = NULL;
792 /* Get the "plural"-ness */
793 bool plural = (o_ptr->number > 1);
795 next_o_idx = o_ptr->next_o_idx;
796 object_flags(o_ptr, flgs);
798 /* Check for artifact */
799 if (object_is_artifact(o_ptr)) is_art = TRUE;
801 /* Analyze the type */
804 /* Acid -- Lots of things */
807 if (hates_acid(o_ptr))
810 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
811 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
816 /* Elec -- Rings and Wands */
819 if (hates_elec(o_ptr))
822 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
823 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
828 /* Fire -- Flammable objects */
831 if (hates_fire(o_ptr))
834 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
835 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
840 /* Cold -- potions and flasks */
843 if (hates_cold(o_ptr))
845 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
847 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
855 if (hates_fire(o_ptr))
858 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
859 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
861 if (hates_elec(o_ptr))
865 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
866 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
874 if (hates_fire(o_ptr))
877 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
878 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
880 if (hates_cold(o_ptr))
884 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
885 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
890 /* Hack -- break potions and such */
896 if (hates_cold(o_ptr))
898 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
904 /* Mana and Chaos -- destroy everything */
910 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
914 case GF_DISINTEGRATE:
917 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
924 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
925 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
926 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
930 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
934 if (object_is_cursed(o_ptr))
937 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
944 identify_item(o_ptr);
946 /* Auto-inscription */
947 autopick_alter_item((-this_o_idx), FALSE);
955 /* Chests are noticed only if trapped or locked */
956 if (o_ptr->tval == TV_CHEST)
958 /* Disarm/Unlock traps */
961 /* Disarm or Unlock */
962 o_ptr->pval = (0 - o_ptr->pval);
967 if (known && (o_ptr->marked & OM_FOUND))
969 msg_print(_("カチッと音がした!", "Click!"));
979 if (o_ptr->tval == TV_CORPSE)
984 if (!who || is_pet(¤t_floor_ptr->m_list[who]))
985 mode |= PM_FORCE_PET;
987 for (i = 0; i < o_ptr->number ; i++)
989 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
990 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
994 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
998 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1000 note_kill = _("生き返った。", " revived.");
1002 else if (!note_kill)
1004 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1015 /* Attempt to destroy the object */
1018 /* Effect "observed" */
1019 if (known && (o_ptr->marked & OM_FOUND))
1022 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1025 /* Artifacts, and other objects, get to resist */
1026 if (is_art || ignore)
1028 /* Observe the resist */
1029 if (known && (o_ptr->marked & OM_FOUND))
1031 msg_format(_("%sは影響を受けない!",
1032 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1039 /* Describe if needed */
1040 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1042 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1045 k_idx = o_ptr->k_idx;
1046 is_potion = object_is_potion(o_ptr);
1047 delete_object_idx(this_o_idx);
1049 /* Potions produce effects when 'shattered' */
1052 (void)potion_smash_effect(who, y, x, k_idx);
1060 /* Return "Anything seen?" */
1066 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1067 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1068 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1069 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1070 * @param x 目標X座標 / Target x location (or location to travel "towards")
1071 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1072 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1074 * @param see_s_msg TRUEならばメッセージを表示する
1075 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1078 * This routine takes a "source monster" (by index) which is mostly used to
1079 * determine if the player is causing the damage, and a "radius" (see below),
1080 * which is used to decrease the power of explosions with distance, and a
1081 * location, via integers which are modified by certain types of attacks
1082 * (polymorph and teleport being the obvious ones), a default damage, which
1083 * is modified as needed based on various properties, and finally a "damage
1084 * type" (see below).
1087 * Note that this routine can handle "no damage" attacks (like teleport) by
1088 * taking a "zero" damage, and can even take "parameters" to attacks (like
1089 * confuse) by accepting a "damage", using it to calculate the effect, and
1090 * then setting the damage to zero. Note that the "damage" parameter is
1091 * divided by the radius, so monsters not at the "epicenter" will not take
1092 * as much damage (or whatever)...
1095 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1096 * may result in a dereference of an invalid pointer.
1099 * Various messages are produced, and damage is applied.
1102 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1103 * actually be "made" of that substance, or "breathe" big balls of it.
1104 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1106 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1107 * and hurts evil less. If can breath nether, then it resists it as well.
1110 * Damage reductions use the following formulas:
1111 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1112 * gives avg damage of .655, ranging from .858 to .500
1113 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1114 * gives avg damage of .544, ranging from .714 to .417
1115 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1116 * gives avg damage of .444, ranging from .556 to .333
1117 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1118 * gives avg damage of .327, ranging from .427 to .250
1119 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1120 * gives something simple.
1123 * In this function, "result" messages are postponed until the end, where
1124 * the "note" string is appended to the monster name, if not NULL. So,
1125 * to make a spell have "no effect" just set "note" to NULL. You should
1126 * also set "notice" to FALSE, or the player will learn what the spell does.
1129 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1133 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)
1137 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
1139 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1140 monster_type *caster_ptr = (who > 0) ? ¤t_floor_ptr->m_list[who] : NULL;
1142 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1146 /* Is the monster "seen"? */
1147 bool seen = m_ptr->ml;
1148 bool seen_msg = is_seen(m_ptr);
1150 bool slept = (bool)MON_CSLEEP(m_ptr);
1152 /* Were the effects "obvious" (if seen)? */
1153 bool obvious = FALSE;
1155 /* Can the player know about this effect? */
1156 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1158 /* Were the effects "irrelevant"? */
1159 bool skipped = FALSE;
1161 /* Gets the monster angry at the source of the effect? */
1162 bool get_angry = FALSE;
1164 /* Polymorph setting (true or false) */
1165 bool do_poly = FALSE;
1167 /* Teleport setting (max distance) */
1170 /* Confusion setting (amount to confuse) */
1173 /* Stunning setting (amount to stun) */
1176 /* Sleep amount (amount to sleep) */
1179 /* Fear amount (amount to fear) */
1182 /* Time amount (amount to time) */
1185 bool heal_leper = FALSE;
1187 /* Hold the monster name */
1188 GAME_TEXT m_name[MAX_NLEN];
1191 PARAMETER_VALUE photo = 0;
1193 /* Assume no note */
1194 concptr note = NULL;
1196 /* Assume a default death */
1197 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1199 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1202 if (!g_ptr->m_idx) return (FALSE);
1204 /* Never affect projector */
1205 if (who && (g_ptr->m_idx == who)) return (FALSE);
1206 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1207 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1209 /* Don't affect already death monsters */
1210 /* Prevents problems with chain reactions of exploding monsters */
1211 if (m_ptr->hp < 0) return (FALSE);
1213 /* Reduce damage by distance */
1214 dam = (dam + r) / (r + 1);
1217 /* Get the monster name (BEFORE polymorphing) */
1218 monster_desc(m_name, m_ptr, 0);
1220 /* Get the monster possessive ("his"/"her"/"its") */
1221 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1223 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1225 if (r_ptr->flagsr & RFR_RES_ALL &&
1226 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1227 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1229 note = _("には完全な耐性がある!", " is immune.");
1231 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1232 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1236 /* Analyze the damage type */
1239 /* Magic Missile -- pure damage */
1242 if (seen) obvious = TRUE;
1249 if (seen) obvious = TRUE;
1250 if (r_ptr->flagsr & RFR_IM_ACID)
1252 note = _("にはかなり耐性がある!", " resists a lot.");
1254 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1262 if (seen) obvious = TRUE;
1263 if (r_ptr->flagsr & RFR_IM_ELEC)
1265 note = _("にはかなり耐性がある!", " resists a lot.");
1267 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1275 if (seen) obvious = TRUE;
1276 if (r_ptr->flagsr & RFR_IM_FIRE)
1278 note = _("にはかなり耐性がある!", " resists a lot.");
1280 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1282 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1284 note = _("はひどい痛手をうけた。", " is hit hard.");
1286 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1294 if (seen) obvious = TRUE;
1295 if (r_ptr->flagsr & RFR_IM_COLD)
1297 note = _("にはかなり耐性がある!", " resists a lot.");
1299 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1301 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1303 note = _("はひどい痛手をうけた。", " is hit hard.");
1305 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1313 if (seen) obvious = TRUE;
1314 if (r_ptr->flagsr & RFR_IM_POIS)
1316 note = _("にはかなり耐性がある!", " resists a lot.");
1318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1326 if (seen) obvious = TRUE;
1327 if (r_ptr->flagsr & RFR_IM_POIS)
1329 note = _("には耐性がある。", " resists.");
1330 dam *= 3; dam /= randint1(6) + 6;
1331 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1333 else if (one_in_(3)) do_poly = TRUE;
1337 /* Hellfire -- hurts Evil */
1340 if (seen) obvious = TRUE;
1341 if (r_ptr->flags3 & RF3_GOOD)
1343 note = _("はひどい痛手をうけた。", " is hit hard.");
1345 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1350 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1353 if (seen) obvious = TRUE;
1354 if (r_ptr->flags3 & RF3_EVIL)
1357 note = _("はひどい痛手をうけた。", " is hit hard.");
1358 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1362 note = _("には耐性がある。", " resists.");
1363 dam *= 3; dam /= randint1(6) + 6;
1368 /* Arrow -- XXX no defense */
1371 if (seen) obvious = TRUE;
1375 /* Plasma -- XXX perhaps check ELEC or FIRE */
1378 if (seen) obvious = TRUE;
1379 if (r_ptr->flagsr & RFR_RES_PLAS)
1381 note = _("には耐性がある。", " resists.");
1382 dam *= 3; dam /= randint1(6) + 6;
1383 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1388 /* Nether -- see above */
1391 if (seen) obvious = TRUE;
1392 if (r_ptr->flagsr & RFR_RES_NETH)
1394 if (r_ptr->flags3 & RF3_UNDEAD)
1396 note = _("には完全な耐性がある!", " is immune.");
1398 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1402 note = _("には耐性がある。", " resists.");
1403 dam *= 3; dam /= randint1(6) + 6;
1405 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1407 else if (r_ptr->flags3 & RF3_EVIL)
1409 note = _("はいくらか耐性を示した。", " resists somewhat.");
1411 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1416 /* Water (acid) damage -- Water spirits/elementals are immune */
1419 if (seen) obvious = TRUE;
1420 if (r_ptr->flagsr & RFR_RES_WATE)
1422 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1424 note = _("には完全な耐性がある!", " is immune.");
1429 note = _("には耐性がある。", " resists.");
1430 dam *= 3; dam /= randint1(6) + 6;
1432 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1437 /* Chaos -- Chaos breathers resist */
1440 if (seen) obvious = TRUE;
1441 if (r_ptr->flagsr & RFR_RES_CHAO)
1443 note = _("には耐性がある。", " resists.");
1444 dam *= 3; dam /= randint1(6) + 6;
1445 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1447 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1449 note = _("はいくらか耐性を示した。", " resists somewhat.");
1450 dam *= 3; dam /= randint1(6) + 6;
1451 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1456 do_conf = (5 + randint1(11) + r) / (r + 1);
1461 /* Shards -- Shard breathers resist */
1464 if (seen) obvious = TRUE;
1465 if (r_ptr->flagsr & RFR_RES_SHAR)
1467 note = _("には耐性がある。", " resists.");
1468 dam *= 3; dam /= randint1(6) + 6;
1469 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1474 /* Rocket: Shard resistance helps */
1477 if (seen) obvious = TRUE;
1478 if (r_ptr->flagsr & RFR_RES_SHAR)
1480 note = _("はいくらか耐性を示した。", " resists somewhat.");
1482 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1488 /* Sound -- Sound breathers resist */
1491 if (seen) obvious = TRUE;
1492 if (r_ptr->flagsr & RFR_RES_SOUN)
1494 note = _("には耐性がある。", " resists.");
1495 dam *= 2; dam /= randint1(6) + 6;
1496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1498 else do_stun = (10 + randint1(15) + r) / (r + 1);
1505 if (seen) obvious = TRUE;
1506 if (r_ptr->flags3 & RF3_NO_CONF)
1508 note = _("には耐性がある。", " resists.");
1509 dam *= 3; dam /= randint1(6) + 6;
1510 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1512 else do_conf = (10 + randint1(15) + r) / (r + 1);
1516 /* Disenchantment -- Breathers and Disenchanters resist */
1519 if (seen) obvious = TRUE;
1520 if (r_ptr->flagsr & RFR_RES_DISE)
1522 note = _("には耐性がある。", " resists.");
1523 dam *= 3; dam /= randint1(6) + 6;
1524 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1529 /* Nexus -- Breathers and Existers resist */
1532 if (seen) obvious = TRUE;
1533 if (r_ptr->flagsr & RFR_RES_NEXU)
1535 note = _("には耐性がある。", " resists.");
1536 dam *= 3; dam /= randint1(6) + 6;
1537 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1545 if (seen) obvious = TRUE;
1546 if (r_ptr->flagsr & RFR_RES_WALL)
1548 note = _("には耐性がある。", " resists.");
1549 dam *= 3; dam /= randint1(6) + 6;
1550 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1552 else do_stun = (randint1(15) + r) / (r + 1);
1556 /* Inertia -- breathers resist */
1559 if (seen) obvious = TRUE;
1560 if (r_ptr->flagsr & RFR_RES_INER)
1562 note = _("には耐性がある。", " resists.");
1563 dam *= 3; dam /= randint1(6) + 6;
1564 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1568 /* Powerful monsters can resist */
1569 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1570 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1574 /* Normal monsters slow down */
1577 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1579 note = _("の動きが遅くなった。", " starts moving slower.");
1586 /* Time -- breathers resist */
1589 if (seen) obvious = TRUE;
1590 if (r_ptr->flagsr & RFR_RES_TIME)
1592 note = _("には耐性がある。", " resists.");
1593 dam *= 3; dam /= randint1(6) + 6;
1594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1596 else do_time = (dam + 1) / 2;
1600 /* Gravity -- breathers resist */
1603 bool resist_tele = FALSE;
1605 if (seen) obvious = TRUE;
1606 if (r_ptr->flagsr & RFR_RES_TELE)
1608 if (r_ptr->flags1 & (RF1_UNIQUE))
1610 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1611 note = _("には効果がなかった。", " is unaffected!");
1614 else if (r_ptr->level > randint1(100))
1616 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1617 note = _("には耐性がある!", " resists!");
1622 if (!resist_tele) do_dist = 10;
1624 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1626 if (r_ptr->flagsr & RFR_RES_GRAV)
1628 note = _("には耐性がある!", " resists!");
1629 dam *= 3; dam /= randint1(6) + 6;
1631 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1636 /* Powerful monsters can resist */
1637 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1638 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1642 /* Normal monsters slow down */
1645 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1647 note = _("の動きが遅くなった。", " starts moving slower.");
1652 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1654 /* Attempt a saving throw */
1655 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1656 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1660 /* No obvious effect */
1661 note = _("には効果がなかった。", " is unaffected!");
1673 if (seen) obvious = TRUE;
1679 case GF_DISINTEGRATE:
1681 if (seen) obvious = TRUE;
1682 if (r_ptr->flags3 & RF3_HURT_ROCK)
1684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1685 note = _("の皮膚がただれた!", " loses some skin!");
1686 note_dies = _("は蒸発した!", " evaporates!");
1694 if (seen) obvious = TRUE;
1696 /* PSI only works if the monster can see you! -- RG */
1697 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1700 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1704 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1707 note = _("には完全な耐性がある!", " is immune.");
1708 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1711 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1712 (r_ptr->flags3 & RF3_ANIMAL) ||
1713 (r_ptr->level > randint1(3 * dam)))
1715 note = _("には耐性がある!", " resists!");
1719 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1720 * attacks back on them
1722 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1723 (r_ptr->level > p_ptr->lev / 2) &&
1727 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1728 (seen ? "%^s's corrupted mind backlashes your attack!" :
1729 "%^ss corrupted mind backlashes your attack!")), m_name);
1732 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1734 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1738 /* Injure +/- confusion */
1739 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1740 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1741 if (one_in_(4) && !CHECK_MULTISHADOW())
1743 switch (randint1(4))
1746 set_confused(p_ptr->confused + 3 + randint1(dam));
1749 set_stun(p_ptr->stun + randint1(dam));
1753 if (r_ptr->flags3 & RF3_NO_FEAR)
1754 note = _("には効果がなかった。", " is unaffected.");
1756 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1760 if (!p_ptr->free_act)
1761 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1770 if ((dam > 0) && one_in_(4))
1772 switch (randint1(4))
1775 do_conf = 3 + randint1(dam);
1778 do_stun = 3 + randint1(dam);
1781 do_fear = 3 + randint1(dam);
1784 note = _("は眠り込んでしまった!", " falls asleep!");
1785 do_sleep = 3 + randint1(dam);
1790 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1796 if (seen) obvious = TRUE;
1797 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1800 note = _("には完全な耐性がある!", " is immune.");
1802 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1803 (r_ptr->flags3 & RF3_ANIMAL) ||
1804 (r_ptr->level > randint1(3 * dam)))
1806 note = _("には耐性がある!", " resists!");
1810 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1811 * attacks back on them
1813 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1814 (r_ptr->level > p_ptr->lev / 2) &&
1818 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1819 (seen ? "%^s's corrupted mind backlashes your attack!" :
1820 "%^ss corrupted mind backlashes your attack!")), m_name);
1822 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1824 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1828 /* Injure + mana drain */
1829 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1830 if (!CHECK_MULTISHADOW())
1832 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1833 p_ptr->csp -= damroll(5, dam) / 2;
1834 if (p_ptr->csp < 0) p_ptr->csp = 0;
1835 p_ptr->redraw |= PR_MANA;
1836 p_ptr->window |= (PW_SPELL);
1838 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1845 int b = damroll(5, dam) / 4;
1846 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1847 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1848 (seen ? "You convert %s's pain into %s!" :
1849 "You convert %ss pain into %s!"));
1850 msg_format(msg, m_name, str);
1852 b = MIN(p_ptr->msp, p_ptr->csp + b);
1854 p_ptr->redraw |= PR_MANA;
1855 p_ptr->window |= (PW_SPELL);
1857 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1861 case GF_TELEKINESIS:
1863 if (seen) obvious = TRUE;
1866 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1871 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1873 /* Attempt a saving throw */
1874 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1875 (r_ptr->level > 5 + randint1(dam)))
1879 /* No obvious effect */
1885 /* Psycho-spear -- powerful magic missile */
1888 if (seen) obvious = TRUE;
1892 /* Meteor -- powerful magic missile */
1895 if (seen) obvious = TRUE;
1901 if (!is_hostile(m_ptr)) break;
1902 if (seen) obvious = TRUE;
1903 /* Attempt a saving throw */
1904 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1905 (r_ptr->flags3 & RF3_NO_CONF) ||
1906 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1908 /* Memorize a flag */
1909 if (r_ptr->flags3 & RF3_NO_CONF)
1911 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1918 * Powerful demons & undead can current_world_ptr->game_turn a mindcrafter's
1919 * attacks back on them
1921 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1922 (r_ptr->level > p_ptr->lev / 2) &&
1926 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1927 (seen ? "%^s's corrupted mind backlashes your attack!" :
1928 "%^ss corrupted mind backlashes your attack!")), m_name);
1931 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1933 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1937 /* Confuse, stun, terrify */
1938 switch (randint1(4))
1941 set_stun(p_ptr->stun + dam / 2);
1944 set_confused(p_ptr->confused + dam / 2);
1948 if (r_ptr->flags3 & RF3_NO_FEAR)
1949 note = _("には効果がなかった。", " is unaffected.");
1951 set_afraid(p_ptr->afraid + dam);
1958 /* No obvious effect */
1959 note = _("には効果がなかった。", " is unaffected.");
1965 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
1967 note = _("があなたに隷属した。", " is in your thrall!");
1972 switch (randint1(4))
1986 /* No "real" damage */
1991 /* Ice -- Cold + Cuts + Stun */
1994 if (seen) obvious = TRUE;
1995 do_stun = (randint1(15) + 1) / (r + 1);
1996 if (r_ptr->flagsr & RFR_IM_COLD)
1998 note = _("にはかなり耐性がある!", " resists a lot.");
2000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2002 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2004 note = _("はひどい痛手をうけた。", " is hit hard.");
2006 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2013 case GF_HYPODYNAMIA:
2015 if (seen) obvious = TRUE;
2016 if (!monster_living(m_ptr->r_idx))
2018 if (is_original_ap_and_seen(m_ptr))
2020 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2021 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2022 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2024 note = _("には効果がなかった。", " is unaffected.");
2028 else do_time = (dam+7)/8;
2036 if (seen) obvious = TRUE;
2037 if (!monster_living(m_ptr->r_idx))
2039 if (is_original_ap_and_seen(m_ptr))
2041 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2042 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2043 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2045 note = _("には完全な耐性がある!", " is immune.");
2049 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2050 (randint1(888) != 666)) ||
2051 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2052 randint1(100) != 66))
2054 note = _("には耐性がある!", " resists!");
2062 /* Polymorph monster (Use "dam" as "power") */
2065 if (seen) obvious = TRUE;
2066 /* Attempt to polymorph (see below) */
2069 /* Powerful monsters can resist */
2070 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2071 (r_ptr->flags1 & RF1_QUESTOR) ||
2072 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2074 note = _("には効果がなかった。", " is unaffected.");
2079 /* No "real" damage */
2086 /* Clone monsters (Ignore "dam") */
2089 if (seen) obvious = TRUE;
2091 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2093 note = _("には効果がなかった。", " is unaffected.");
2098 m_ptr->hp = m_ptr->maxhp;
2100 /* Attempt to clone. */
2101 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2103 note = _("が分裂した!", " spawns!");
2107 /* No "real" damage */
2114 /* Heal Monster (use "dam" as amount of healing) */
2117 if (seen) obvious = TRUE;
2120 (void)set_monster_csleep(g_ptr->m_idx, 0);
2122 if (m_ptr->maxhp < m_ptr->max_maxhp)
2124 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2125 m_ptr->maxhp = m_ptr->max_maxhp;
2130 /* Redraw (later) if needed */
2131 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2132 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2140 if (seen) obvious = TRUE;
2143 (void)set_monster_csleep(g_ptr->m_idx, 0);
2144 if (MON_STUNNED(m_ptr))
2146 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2147 (void)set_monster_stunned(g_ptr->m_idx, 0);
2149 if (MON_CONFUSED(m_ptr))
2151 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2152 (void)set_monster_confused(g_ptr->m_idx, 0);
2154 if (MON_MONFEAR(m_ptr))
2156 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2157 (void)set_monster_monfear(g_ptr->m_idx, 0);
2161 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2164 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2168 chg_virtue(V_VITALITY, 1);
2170 if (r_ptr->flags1 & RF1_UNIQUE)
2171 chg_virtue(V_INDIVIDUALISM, 1);
2173 if (is_friendly(m_ptr))
2174 chg_virtue(V_HONOUR, 1);
2175 else if (!(r_ptr->flags3 & RF3_EVIL))
2177 if (r_ptr->flags3 & RF3_GOOD)
2178 chg_virtue(V_COMPASSION, 2);
2180 chg_virtue(V_COMPASSION, 1);
2183 if (r_ptr->flags3 & RF3_ANIMAL)
2184 chg_virtue(V_NATURE, 1);
2187 if (m_ptr->r_idx == MON_LEPER)
2190 if (!who) chg_virtue(V_COMPASSION, 5);
2193 /* Redraw (later) if needed */
2194 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2195 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2197 note = _("は体力を回復したようだ。", " looks healthier.");
2199 /* No "real" damage */
2205 /* Speed Monster (Ignore "dam") */
2208 if (seen) obvious = TRUE;
2211 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2213 note = _("の動きが速くなった。", " starts moving faster.");
2218 if (r_ptr->flags1 & RF1_UNIQUE)
2219 chg_virtue(V_INDIVIDUALISM, 1);
2220 if (is_friendly(m_ptr))
2221 chg_virtue(V_HONOUR, 1);
2224 /* No "real" damage */
2230 /* Slow Monster (Use "dam" as "power") */
2233 if (seen) obvious = TRUE;
2235 /* Powerful monsters can resist */
2236 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2237 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2239 note = _("には効果がなかった。", " is unaffected.");
2243 /* Normal monsters slow down */
2246 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2248 note = _("の動きが遅くなった。", " starts moving slower.");
2252 /* No "real" damage */
2258 /* Sleep (Use "dam" as "power") */
2261 if (seen) obvious = TRUE;
2263 /* Attempt a saving throw */
2264 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2265 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2266 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2268 /* Memorize a flag */
2269 if (r_ptr->flags3 & RF3_NO_SLEEP)
2271 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2273 /* No obvious effect */
2274 note = _("には効果がなかった。", " is unaffected.");
2279 /* Go to sleep (much) later */
2280 note = _("は眠り込んでしまった!", " falls asleep!");
2284 /* No "real" damage */
2290 /* Sleep (Use "dam" as "power") */
2291 case GF_STASIS_EVIL:
2293 if (seen) obvious = TRUE;
2295 /* Attempt a saving throw */
2296 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2297 !(r_ptr->flags3 & RF3_EVIL) ||
2298 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2300 note = _("には効果がなかった。", " is unaffected.");
2305 /* Go to sleep (much) later */
2306 note = _("は動けなくなった!", " is suspended!");
2310 /* No "real" damage */
2315 /* Sleep (Use "dam" as "power") */
2318 if (seen) obvious = TRUE;
2320 /* Attempt a saving throw */
2321 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2322 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2324 note = _("には効果がなかった。", " is unaffected.");
2329 /* Go to sleep (much) later */
2330 note = _("は動けなくなった!", " is suspended!");
2334 /* No "real" damage */
2343 vir = virtue_number(V_HARMONY);
2346 dam += p_ptr->virtues[vir-1]/10;
2349 vir = virtue_number(V_INDIVIDUALISM);
2352 dam -= p_ptr->virtues[vir-1]/20;
2355 if (seen) obvious = TRUE;
2357 /* Attempt a saving throw */
2358 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2362 /* No obvious effect */
2363 note = _("には効果がなかった。", " is unaffected.");
2366 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2368 else if (p_ptr->cursed & TRC_AGGRAVATE)
2370 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2371 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2375 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2378 chg_virtue(V_INDIVIDUALISM, -1);
2379 if (r_ptr->flags3 & RF3_ANIMAL)
2380 chg_virtue(V_NATURE, 1);
2383 /* No "real" damage */
2388 /* Control undead */
2389 case GF_CONTROL_UNDEAD:
2392 if (seen) obvious = TRUE;
2394 vir = virtue_number(V_UNLIFE);
2397 dam += p_ptr->virtues[vir-1]/10;
2400 vir = virtue_number(V_INDIVIDUALISM);
2403 dam -= p_ptr->virtues[vir-1]/20;
2406 /* Attempt a saving throw */
2407 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2408 !(r_ptr->flags3 & RF3_UNDEAD))
2410 /* No obvious effect */
2411 note = _("には効果がなかった。", " is unaffected.");
2413 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2415 else if (p_ptr->cursed & TRC_AGGRAVATE)
2417 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2418 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2422 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2426 /* No "real" damage */
2432 case GF_CONTROL_DEMON:
2435 if (seen) obvious = TRUE;
2437 vir = virtue_number(V_UNLIFE);
2440 dam += p_ptr->virtues[vir-1]/10;
2443 vir = virtue_number(V_INDIVIDUALISM);
2446 dam -= p_ptr->virtues[vir-1]/20;
2449 /* Attempt a saving throw */
2450 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2451 !(r_ptr->flags3 & RF3_DEMON))
2453 /* No obvious effect */
2454 note = _("には効果がなかった。", " is unaffected.");
2456 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2458 else if (p_ptr->cursed & TRC_AGGRAVATE)
2460 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2461 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2465 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2469 /* No "real" damage */
2475 case GF_CONTROL_ANIMAL:
2478 if (seen) obvious = TRUE;
2480 vir = virtue_number(V_NATURE);
2483 dam += p_ptr->virtues[vir-1]/10;
2486 vir = virtue_number(V_INDIVIDUALISM);
2489 dam -= p_ptr->virtues[vir-1]/20;
2492 /* Attempt a saving throw */
2493 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2494 !(r_ptr->flags3 & RF3_ANIMAL))
2497 /* No obvious effect */
2498 note = _("には効果がなかった。", " is unaffected.");
2500 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2502 else if (p_ptr->cursed & TRC_AGGRAVATE)
2504 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2505 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2509 note = _("はなついた。", " is tamed!");
2511 if (r_ptr->flags3 & RF3_ANIMAL)
2512 chg_virtue(V_NATURE, 1);
2515 /* No "real" damage */
2521 case GF_CHARM_LIVING:
2525 vir = virtue_number(V_UNLIFE);
2526 if (seen) obvious = TRUE;
2528 vir = virtue_number(V_UNLIFE);
2531 dam -= p_ptr->virtues[vir-1]/10;
2534 vir = virtue_number(V_INDIVIDUALISM);
2537 dam -= p_ptr->virtues[vir-1]/20;
2540 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2542 /* Attempt a saving throw */
2543 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2544 !monster_living(m_ptr->r_idx))
2547 /* No obvious effect */
2548 note = _("には効果がなかった。", " is unaffected.");
2550 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2552 else if (p_ptr->cursed & TRC_AGGRAVATE)
2554 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2555 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2559 note = _("を支配した。", " is tamed!");
2561 if (r_ptr->flags3 & RF3_ANIMAL)
2562 chg_virtue(V_NATURE, 1);
2565 /* No "real" damage */
2570 /* Confusion (Use "dam" as "power") */
2573 if (seen) obvious = TRUE;
2575 /* Get confused later */
2576 do_conf = damroll(3, (dam / 2)) + 1;
2578 /* Attempt a saving throw */
2579 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2580 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2581 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2583 /* Memorize a flag */
2584 if (r_ptr->flags3 & (RF3_NO_CONF))
2586 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2592 /* No obvious effect */
2593 note = _("には効果がなかった。", " is unaffected.");
2597 /* No "real" damage */
2604 if (seen) obvious = TRUE;
2606 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2608 /* Attempt a saving throw */
2609 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2610 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2615 /* No obvious effect */
2616 note = _("には効果がなかった。", " is unaffected.");
2620 /* No "real" damage */
2625 /* Lite, but only hurts susceptible creatures */
2634 if (r_ptr->flags3 & (RF3_HURT_LITE))
2636 /* Obvious effect */
2637 if (seen) obvious = TRUE;
2639 /* Memorize the effects */
2640 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2642 /* Special effect */
2643 note = _("は光に身をすくめた!", " cringes from the light!");
2644 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2647 /* Normally no damage */
2659 /* Lite -- opposite of Dark */
2662 if (seen) obvious = TRUE;
2664 if (r_ptr->flagsr & RFR_RES_LITE)
2666 note = _("には耐性がある!", " resists!");
2667 dam *= 2; dam /= (randint1(6)+6);
2668 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2670 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2672 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2673 note = _("は光に身をすくめた!", " cringes from the light!");
2674 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2681 /* Dark -- opposite of Lite */
2684 if (seen) obvious = TRUE;
2686 if (r_ptr->flagsr & RFR_RES_DARK)
2688 note = _("には耐性がある!", " resists!");
2689 dam *= 2; dam /= (randint1(6)+6);
2690 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2699 /* Hurt by rock remover */
2700 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2703 if (seen) obvious = TRUE;
2705 /* Memorize the effects */
2706 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2708 /* Cute little message */
2709 note = _("の皮膚がただれた!", " loses some skin!");
2710 note_dies = _("はドロドロに溶けた!", " dissolves!");
2713 /* Usually, ignore the effects */
2724 /* Teleport undead (Use "dam" as "power") */
2725 case GF_AWAY_UNDEAD:
2727 /* Only affect undead */
2728 if (r_ptr->flags3 & (RF3_UNDEAD))
2730 bool resists_tele = FALSE;
2732 if (r_ptr->flagsr & RFR_RES_TELE)
2734 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2736 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2737 note = _("には効果がなかった。", " is unaffected.");
2738 resists_tele = TRUE;
2740 else if (r_ptr->level > randint1(100))
2742 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2743 note = _("には耐性がある!", " resists!");
2744 resists_tele = TRUE;
2750 if (seen) obvious = TRUE;
2751 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2763 /* No "real" damage */
2769 /* Teleport evil (Use "dam" as "power") */
2772 /* Only affect evil */
2773 if (r_ptr->flags3 & (RF3_EVIL))
2775 bool resists_tele = FALSE;
2777 if (r_ptr->flagsr & RFR_RES_TELE)
2779 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2781 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2782 note = _("には効果がなかった。", " is unaffected.");
2783 resists_tele = TRUE;
2785 else if (r_ptr->level > randint1(100))
2787 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2788 note = _("には耐性がある!", " resists!");
2789 resists_tele = TRUE;
2795 if (seen) obvious = TRUE;
2796 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2808 /* No "real" damage */
2814 /* Teleport monster (Use "dam" as "power") */
2817 bool resists_tele = FALSE;
2818 if (r_ptr->flagsr & RFR_RES_TELE)
2820 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2822 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2823 note = _("には効果がなかった。", " is unaffected.");
2824 resists_tele = TRUE;
2826 else if (r_ptr->level > randint1(100))
2828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2829 note = _("には耐性がある!", " resists!");
2830 resists_tele = TRUE;
2836 if (seen) obvious = TRUE;
2838 /* Prepare to teleport */
2842 /* No "real" damage */
2848 /* Turn undead (Use "dam" as "power") */
2849 case GF_TURN_UNDEAD:
2851 /* Only affect undead */
2852 if (r_ptr->flags3 & (RF3_UNDEAD))
2854 if (seen) obvious = TRUE;
2856 /* Learn about type */
2857 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2859 /* Apply some fear */
2860 do_fear = damroll(3, (dam / 2)) + 1;
2862 /* Attempt a saving throw */
2863 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2865 /* No obvious effect */
2866 note = _("には効果がなかった。", " is unaffected.");
2879 /* No "real" damage */
2885 /* Turn evil (Use "dam" as "power") */
2888 /* Only affect evil */
2889 if (r_ptr->flags3 & (RF3_EVIL))
2891 if (seen) obvious = TRUE;
2893 /* Learn about type */
2894 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2896 /* Apply some fear */
2897 do_fear = damroll(3, (dam / 2)) + 1;
2899 /* Attempt a saving throw */
2900 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2902 /* No obvious effect */
2903 note = _("には効果がなかった。", " is unaffected.");
2916 /* No "real" damage */
2922 /* Turn monster (Use "dam" as "power") */
2925 if (seen) obvious = TRUE;
2927 /* Apply some fear */
2928 do_fear = damroll(3, (dam / 2)) + 1;
2930 /* Attempt a saving throw */
2931 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2932 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2933 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2935 /* No obvious effect */
2936 note = _("には効果がなかった。", " is unaffected.");
2941 /* No "real" damage */
2948 case GF_DISP_UNDEAD:
2950 /* Only affect undead */
2951 if (r_ptr->flags3 & (RF3_UNDEAD))
2953 if (seen) obvious = TRUE;
2955 /* Learn about type */
2956 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2958 note = _("は身震いした。", " shudders.");
2959 note_dies = _("はドロドロに溶けた!", " dissolves!");
2979 /* Only affect evil */
2980 if (r_ptr->flags3 & (RF3_EVIL))
2982 if (seen) obvious = TRUE;
2984 /* Learn about type */
2985 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2987 note = _("は身震いした。", " shudders.");
2988 note_dies = _("はドロドロに溶けた!", " dissolves!");
3007 /* Only affect good */
3008 if (r_ptr->flags3 & (RF3_GOOD))
3010 if (seen) obvious = TRUE;
3012 /* Learn about type */
3013 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3015 note = _("は身震いした。", " shudders.");
3016 note_dies = _("はドロドロに溶けた!", " dissolves!");
3033 case GF_DISP_LIVING:
3035 /* Only affect non-undead */
3036 if (monster_living(m_ptr->r_idx))
3038 if (seen) obvious = TRUE;
3040 note = _("は身震いした。", " shudders.");
3041 note_dies = _("はドロドロに溶けた!", " dissolves!");
3060 /* Only affect demons */
3061 if (r_ptr->flags3 & (RF3_DEMON))
3063 if (seen) obvious = TRUE;
3065 /* Learn about type */
3066 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3068 note = _("は身震いした。", " shudders.");
3069 note_dies = _("はドロドロに溶けた!", " dissolves!");
3085 /* Dispel monster */
3088 if (seen) obvious = TRUE;
3089 note = _("は身震いした。", " shudders.");
3090 note_dies = _("はドロドロに溶けた!", " dissolves!");
3097 if (seen) obvious = TRUE;
3098 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3102 /* Heal the monster */
3103 if (caster_ptr->hp < caster_ptr->maxhp)
3106 caster_ptr->hp += dam;
3107 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3109 /* Redraw (later) if needed */
3110 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3111 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3113 /* Special message */
3116 monster_desc(killer, caster_ptr, 0);
3117 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3123 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3124 (void)hp_player(dam);
3129 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3138 if (seen) obvious = TRUE;
3139 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3140 /* Attempt a saving throw */
3141 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3142 (r_ptr->flags3 & RF3_NO_CONF) ||
3143 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3145 /* Memorize a flag */
3146 if (r_ptr->flags3 & (RF3_NO_CONF))
3148 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3150 note = _("には効果がなかった。", " is unaffected.");
3153 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3155 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3156 note = _("には完全な耐性がある!", " is immune.");
3159 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3161 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3162 note = _("には耐性がある。", " resists.");
3167 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3168 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3170 if (who > 0) do_conf = randint0(4) + 4;
3171 else do_conf = randint0(8) + 8;
3177 case GF_BRAIN_SMASH:
3179 if (seen) obvious = TRUE;
3180 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3182 /* Attempt a saving throw */
3183 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3184 (r_ptr->flags3 & RF3_NO_CONF) ||
3185 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3187 /* Memorize a flag */
3188 if (r_ptr->flags3 & (RF3_NO_CONF))
3190 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3192 note = _("には効果がなかった。", " is unaffected.");
3195 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3197 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3198 note = _("には完全な耐性がある!", " is immune.");
3201 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3203 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3204 note = _("には耐性がある!", " resists!");
3209 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3210 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3214 do_conf = randint0(4) + 4;
3215 do_stun = randint0(4) + 4;
3219 do_conf = randint0(8) + 8;
3220 do_stun = randint0(8) + 8;
3222 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3230 if (seen) obvious = TRUE;
3231 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3232 /* Attempt a saving throw */
3233 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3235 note = _("には効果がなかった。", " is unaffected.");
3244 if (seen) obvious = TRUE;
3245 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3246 /* Attempt a saving throw */
3247 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3249 note = _("には効果がなかった。", " is unaffected.");
3258 if (seen) obvious = TRUE;
3259 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3260 /* Attempt a saving throw */
3261 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3263 note = _("には効果がなかった。", " is unaffected.");
3272 if (seen) obvious = TRUE;
3274 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3275 "You point at %s, screaming the word, 'DIE!'."), m_name);
3276 /* Attempt a saving throw */
3277 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3279 note = _("には効果がなかった。", " is unaffected.");
3288 if (seen) obvious = TRUE;
3289 if (r_ptr->flags1 & RF1_UNIQUE)
3291 note = _("には効果がなかった。", " is unaffected.");
3296 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3297 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3299 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3301 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3305 note = _("は耐性を持っている!", "resists!");
3312 /* Capture monster */
3316 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3317 (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)
3319 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3324 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3325 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3326 nokori_hp = m_ptr->maxhp * 3 / 10;
3328 nokori_hp = m_ptr->maxhp * 3 / 20;
3330 if (m_ptr->hp >= nokori_hp)
3332 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3335 else if (m_ptr->hp < randint0(nokori_hp))
3337 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3338 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3339 cap_mon = m_ptr->r_idx;
3340 cap_mspeed = m_ptr->mspeed;
3342 cap_maxhp = m_ptr->max_maxhp;
3343 cap_nickname = m_ptr->nickname; /* Quark transfer */
3344 if (g_ptr->m_idx == p_ptr->riding)
3346 if (rakuba(-1, FALSE))
3348 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3352 delete_monster_idx(g_ptr->m_idx);
3358 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3364 /* Attack (Use "dam" as attack type) */
3367 /* Return this monster's death */
3368 return py_attack(y, x, dam);
3371 /* Sleep (Use "dam" as "power") */
3377 if (seen) obvious = TRUE;
3378 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3380 note = _("には効果がなかった。", " is unaffected.");
3383 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3386 if (MON_CSLEEP(m_ptr))
3388 note = _("には効果がなかった。", " is unaffected.");
3394 if (one_in_(5)) effect = 1;
3395 else if (one_in_(4)) effect = 2;
3396 else if (one_in_(3)) effect = 3;
3401 /* Powerful monsters can resist */
3402 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3403 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3405 note = _("には効果がなかった。", " is unaffected.");
3409 /* Normal monsters slow down */
3412 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3414 note = _("の動きが遅くなった。", " starts moving slower.");
3419 else if (effect == 2)
3421 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3423 /* Attempt a saving throw */
3424 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3425 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3430 /* No obvious effect */
3431 note = _("には効果がなかった。", " is unaffected.");
3436 else if (effect == 3)
3438 /* Attempt a saving throw */
3439 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3440 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3441 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3443 /* Memorize a flag */
3444 if (r_ptr->flags3 & RF3_NO_SLEEP)
3446 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3449 /* No obvious effect */
3450 note = _("には効果がなかった。", " is unaffected.");
3455 /* Go to sleep (much) later */
3456 note = _("は眠り込んでしまった!", " falls asleep!");
3463 note = _("には効果がなかった。", " is unaffected.");
3466 /* No "real" damage */
3474 if (seen) obvious = TRUE;
3475 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3477 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3478 chg_virtue(V_VITALITY, -1);
3488 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3490 if (r_ptr->flags3 & (RF3_HURT_LITE))
3492 /* Obvious effect */
3493 if (seen) obvious = TRUE;
3495 /* Memorize the effects */
3496 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3498 /* Special effect */
3499 note = _("は光に身をすくめた!", " cringes from the light!");
3500 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3503 /* Normally no damage */
3510 photo = m_ptr->r_idx;
3517 case GF_BLOOD_CURSE:
3519 if (seen) obvious = TRUE;
3525 bool success = FALSE;
3526 if (seen) obvious = TRUE;
3528 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3530 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3531 if (dam < 1) dam = 1;
3533 /* No need to tame your pet */
3536 note = _("の動きが速くなった。", " starts moving faster.");
3537 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3541 /* Attempt a saving throw */
3542 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3543 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3544 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3545 (p_ptr->cursed & TRC_AGGRAVATE) ||
3546 ((r_ptr->level+10) > randint1(dam)))
3549 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3553 note = _("を支配した。", " is tamed!");
3555 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3557 /* Learn about type */
3558 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3565 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3567 do_fear = randint1(90)+10;
3569 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3572 /* No "real" damage */
3579 if (seen) obvious = TRUE;
3580 /* Attempt a saving throw */
3581 if (randint0(100 + dam) < (r_ptr->level + 50))
3583 note = _("には効果がなかった。", " is unaffected.");
3603 /* Absolutely no effect */
3604 if (skipped) return (FALSE);
3606 /* "Unique" monsters cannot be polymorphed */
3607 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3609 /* Quest monsters cannot be polymorphed */
3610 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3612 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3614 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3615 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3617 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3622 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3623 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3626 /* Modify the damage */
3628 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3629 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3631 /* Check for death */
3632 if (dam > m_ptr->hp)
3634 /* Extract method of death */
3639 /* Sound and Impact resisters never stun */
3641 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3642 !(r_ptr->flags3 & RF3_NO_STUN))
3644 if (seen) obvious = TRUE;
3647 if (MON_STUNNED(m_ptr))
3649 note = _("はひどくもうろうとした。", " is more dazed.");
3650 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3654 note = _("はもうろうとした。", " is dazed.");
3659 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3665 /* Confusion and Chaos resisters (and sleepers) never confuse */
3667 !(r_ptr->flags3 & RF3_NO_CONF) &&
3668 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3670 if (seen) obvious = TRUE;
3672 /* Already partially confused */
3673 if (MON_CONFUSED(m_ptr))
3675 note = _("はさらに混乱したようだ。", " looks more confused.");
3676 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3679 /* Was not confused */
3682 note = _("は混乱したようだ。", " looks confused.");
3686 /* Apply confusion */
3687 (void)set_monster_confused(g_ptr->m_idx, tmp);
3695 if (seen) obvious = TRUE;
3697 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3701 note = _("は弱くなったようだ。", " seems weakened.");
3702 m_ptr->maxhp -= do_time;
3703 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3708 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3709 if (do_poly && (randint1(90) > r_ptr->level))
3711 if (polymorph_monster(y, x))
3713 if (seen) obvious = TRUE;
3715 /* Monster polymorphs */
3716 note = _("が変身した!", " changes!");
3718 /* Turn off the damage */
3724 note = _("には効果がなかった。", " is unaffected.");
3727 /* Hack -- Get new monster */
3728 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
3730 /* Hack -- Get new race */
3731 r_ptr = &r_info[m_ptr->r_idx];
3734 /* Handle "teleport" */
3737 if (seen) obvious = TRUE;
3739 note = _("が消え去った!", " disappears!");
3741 if (!who) chg_virtue(V_VALOUR, -1);
3744 teleport_away(g_ptr->m_idx, do_dist,
3745 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3747 /* Hack -- get new location */
3751 /* Hack -- get new grid */
3752 g_ptr = ¤t_floor_ptr->grid_array[y][x];
3759 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3766 if (typ == GF_DRAIN_MANA)
3768 /* Drain mana does nothing */
3771 /* If another monster did the damage, hurt the monster by hand */
3774 /* Redraw (later) if needed */
3775 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3776 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3778 /* Wake the monster up */
3779 (void)set_monster_csleep(g_ptr->m_idx, 0);
3781 /* Hurt the monster */
3789 if (is_pet(m_ptr) && !(m_ptr->ml))
3792 /* Give detailed messages if destroyed */
3795 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3798 msg_format("%^s%s", m_name, note);
3802 current_floor_ptr->monster_noise = TRUE;
3806 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3808 /* Generate treasure, etc */
3809 monster_death(g_ptr->m_idx, FALSE);
3812 delete_monster_idx(g_ptr->m_idx);
3816 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3820 /* Damaged monster */
3823 /* Give detailed messages if visible or destroyed */
3824 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3826 /* Hack -- Pain message */
3829 message_pain(g_ptr->m_idx, dam);
3833 current_floor_ptr->monster_noise = TRUE;
3836 /* Hack -- handle sleep */
3837 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3841 else if (heal_leper)
3843 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3845 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3847 char m2_name[MAX_NLEN];
3849 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3850 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3853 delete_monster_idx(g_ptr->m_idx);
3856 /* If the player did it, give him experience, check fear */
3861 /* Hurt the monster, check for fear and death */
3862 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3867 /* Damaged monster */
3870 /* HACK - anger the monster before showing the sleep message */
3871 if (do_sleep) anger_monster(m_ptr);
3873 /* Give detailed messages if visible or destroyed */
3874 if (note && seen_msg)
3875 msg_format(_("%s%s", "%^s%s"), m_name, note);
3877 /* Hack -- Pain message */
3878 else if (known && (dam || !do_fear))
3880 message_pain(g_ptr->m_idx, dam);
3883 /* Anger monsters */
3884 if (((dam > 0) || get_angry) && !do_sleep)
3885 anger_monster(m_ptr);
3887 if ((fear || do_fear) && seen)
3890 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3893 /* Hack -- handle sleep */
3894 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3898 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3900 blood_curse_to_enemy(who);
3903 if (p_ptr->inside_battle)
3905 p_ptr->health_who = g_ptr->m_idx;
3906 p_ptr->redraw |= (PR_HEALTH);
3910 /* Verify this code */
3911 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3913 /* Redraw the monster grid */
3916 /* Update monster recall window */
3917 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3919 p_ptr->window |= (PW_MONSTER);
3922 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3926 if (!(flg & PROJECT_NO_HANGEKI))
3928 set_target(m_ptr, monster_target_y, monster_target_x);
3931 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3933 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3937 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3939 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3940 rakubadam_m = (dam > 200) ? 200 : dam;
3950 /* Prepare to make a Blade of Chaos */
3951 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3953 q_ptr->pval = photo;
3955 /* Mark the item as fully known */
3956 q_ptr->ident |= (IDENT_MENTAL);
3957 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
3965 /* Return "Anything seen?" */
3970 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3971 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3972 * @param who_name 効果を起こしたモンスターの名前
3973 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3974 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3975 * @param x 目標X座標 / Target x location (or location to travel "towards")
3976 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3977 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3979 * @param monspell 効果元のモンスター魔法ID
3980 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3982 * Handle a beam/bolt/ball causing damage to the player.
3983 * This routine takes a "source monster" (by index), a "distance", a default
3984 * "damage", and a "damage type". See "project_m()" above.
3985 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3986 * is reduced (see "project_m()" above). This can happen if a monster breathes
3987 * at the player and hits a wall instead.
3988 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3989 * to know if this is actually a ball or a bolt spell
3990 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3991 * we just assume that the effects were obvious, for historical reasons.
3993 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)
3998 /* Hack -- assume obvious */
3999 bool obvious = TRUE;
4001 /* Player blind-ness */
4002 bool blind = (p_ptr->blind ? TRUE : FALSE);
4004 /* Player needs a "description" (he is blind) */
4007 /* Source monster */
4008 monster_type *m_ptr = NULL;
4010 /* Monster name (for attacks) */
4011 GAME_TEXT m_name[MAX_NLEN];
4013 /* Monster name (for damage) */
4016 /* Hack -- messages */
4022 /* Player is not here */
4023 if (!player_bold(y, x)) return (FALSE);
4025 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4027 if (kawarimi(TRUE)) return FALSE;
4030 /* Player cannot hurt himself */
4031 if (!who) return (FALSE);
4032 if (who == p_ptr->riding) return (FALSE);
4034 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4037 int max_attempts = 10;
4038 sound(SOUND_REFLECT);
4041 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4042 else if (p_ptr->special_defense & KATA_FUUJIN)
4043 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4045 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4048 /* Choose 'new' target */
4053 t_y = current_floor_ptr->m_list[who].fy - 1 + randint1(3);
4054 t_x = current_floor_ptr->m_list[who].fx - 1 + randint1(3);
4057 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4059 if (max_attempts < 1)
4061 t_y = current_floor_ptr->m_list[who].fy;
4062 t_x = current_floor_ptr->m_list[who].fx;
4067 t_y = p_ptr->y - 1 + randint1(3);
4068 t_x = p_ptr->x - 1 + randint1(3);
4071 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4073 disturb(TRUE, TRUE);
4077 /* Limit maximum damage */
4078 if (dam > 1600) dam = 1600;
4080 /* Reduce damage by distance */
4081 dam = (dam + r) / (r + 1);
4084 /* If the player is blind, be more descriptive */
4085 if (blind) fuzzy = TRUE;
4090 m_ptr = ¤t_floor_ptr->m_list[who];
4091 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4092 monster_desc(m_name, m_ptr, 0);
4094 /* Get the monster's real name (gotten before polymorph!) */
4095 strcpy(killer, who_name);
4101 case PROJECT_WHO_UNCTRL_POWER:
4102 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4105 case PROJECT_WHO_GLASS_SHARDS:
4106 strcpy(killer, _("ガラスの破片", "shards of glass"));
4110 strcpy(killer, _("罠", "a trap"));
4113 strcpy(m_name, killer);
4116 /* Analyze the damage */
4119 /* Standard damage -- hurts p_ptr->inventory_list too */
4122 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4123 get_damage = acid_dam(dam, killer, monspell, FALSE);
4127 /* Standard damage -- hurts p_ptr->inventory_list too */
4130 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4131 get_damage = fire_dam(dam, killer, monspell, FALSE);
4135 /* Standard damage -- hurts p_ptr->inventory_list too */
4138 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4139 get_damage = cold_dam(dam, killer, monspell, FALSE);
4143 /* Standard damage -- hurts p_ptr->inventory_list too */
4146 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4147 get_damage = elec_dam(dam, killer, monspell, FALSE);
4151 /* Standard damage -- also poisons player */
4154 bool double_resist = IS_OPPOSE_POIS();
4155 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4157 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4158 if (double_resist) dam = (dam + 2) / 3;
4160 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4165 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4167 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4169 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4174 /* Standard damage -- also poisons / mutates player */
4177 bool double_resist = IS_OPPOSE_POIS();
4178 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4180 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4181 if (double_resist) dam = (2 * dam + 2) / 5;
4182 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4183 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4185 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4187 if (one_in_(5)) /* 6 */
4189 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4190 if (one_in_(4)) /* 4 */
4198 inven_damage(set_acid_destroy, 2);
4204 /* Standard damage */
4207 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4208 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4212 /* Holy Orb -- Player only takes partial damage */
4215 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4216 if (p_ptr->align > 10)
4218 else if (p_ptr->align < -10)
4220 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4226 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4227 if (p_ptr->align > 10)
4229 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4233 /* Arrow -- XXX no dodging */
4238 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4240 else if ((p_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (p_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
4242 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4245 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4249 /* Plasma -- XXX No resist */
4252 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4253 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4255 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4257 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4258 (void)set_stun(p_ptr->stun + plus_stun);
4261 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4263 inven_damage(set_acid_destroy, 3);
4269 /* Nether -- drain experience */
4272 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4273 if (p_ptr->resist_neth)
4275 if (!PRACE_IS_(RACE_SPECTRE))
4277 dam *= 6; dam /= (randint1(4) + 7);
4280 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4282 if (PRACE_IS_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4284 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4286 learn_spell(monspell);
4290 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4296 /* Water -- stun/confuse */
4299 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4300 if (!CHECK_MULTISHADOW())
4302 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4304 set_stun(p_ptr->stun + randint1(40));
4306 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4308 set_confused(p_ptr->confused + randint1(5) + 5);
4311 if (one_in_(5) && !p_ptr->resist_water)
4313 inven_damage(set_cold_destroy, 3);
4316 if (p_ptr->resist_water) get_damage /= 4;
4319 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4323 /* Chaos -- many effects */
4326 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4327 if (p_ptr->resist_chaos)
4329 dam *= 6; dam /= (randint1(4) + 7);
4332 if (!CHECK_MULTISHADOW())
4334 if (!p_ptr->resist_conf)
4336 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4338 if (!p_ptr->resist_chaos)
4340 (void)set_image(p_ptr->image + randint1(10));
4343 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4344 (void)gain_mutation(p_ptr, 0);
4347 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4349 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4352 if (!p_ptr->resist_chaos || one_in_(9))
4354 inven_damage(set_elec_destroy, 2);
4355 inven_damage(set_fire_destroy, 2);
4359 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4363 /* Shards -- mostly cutting */
4366 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4367 if (p_ptr->resist_shard)
4369 dam *= 6; dam /= (randint1(4) + 7);
4371 else if (!CHECK_MULTISHADOW())
4373 (void)set_cut(p_ptr->cut + dam);
4376 if (!p_ptr->resist_shard || one_in_(13))
4378 inven_damage(set_cold_destroy, 2);
4381 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4385 /* Sound -- mostly stunning */
4388 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4389 if (p_ptr->resist_sound)
4391 dam *= 5; dam /= (randint1(4) + 7);
4393 else if (!CHECK_MULTISHADOW())
4395 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4396 (void)set_stun(p_ptr->stun + plus_stun);
4399 if (!p_ptr->resist_sound || one_in_(13))
4401 inven_damage(set_cold_destroy, 2);
4404 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4408 /* Pure confusion */
4411 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4412 if (p_ptr->resist_conf)
4414 dam *= 5; dam /= (randint1(4) + 7);
4416 else if (!CHECK_MULTISHADOW())
4418 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4420 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4424 /* Disenchantment -- see above */
4427 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4428 if (p_ptr->resist_disen)
4430 dam *= 6; dam /= (randint1(4) + 7);
4432 else if (!CHECK_MULTISHADOW())
4434 (void)apply_disenchant(0);
4436 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4440 /* Nexus -- see above */
4443 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4444 if (p_ptr->resist_nexus)
4446 dam *= 6; dam /= (randint1(4) + 7);
4448 else if (!CHECK_MULTISHADOW())
4452 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4456 /* Force -- mostly stun */
4459 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4460 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4462 (void)set_stun(p_ptr->stun + randint1(20));
4464 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4469 /* Rocket -- stun, cut */
4472 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4473 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4475 (void)set_stun(p_ptr->stun + randint1(20));
4478 if (p_ptr->resist_shard)
4482 else if (!CHECK_MULTISHADOW())
4484 (void)set_cut(p_ptr->cut + (dam / 2));
4487 if (!p_ptr->resist_shard || one_in_(12))
4489 inven_damage(set_cold_destroy, 3);
4492 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4496 /* Inertia -- slowness */
4499 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4500 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4501 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4505 /* Lite -- blinding */
4508 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4509 if (p_ptr->resist_lite)
4511 dam *= 4; dam /= (randint1(4) + 7);
4513 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4515 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4518 if (PRACE_IS_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4520 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4523 else if (PRACE_IS_(RACE_S_FAIRY))
4528 if (p_ptr->wraith_form) dam *= 2;
4529 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4531 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4533 p_ptr->wraith_form = 0;
4534 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4535 "The light forces you out of your incorporeal shadow form."));
4537 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4538 p_ptr->update |= (PU_MONSTERS);
4539 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4545 /* Dark -- blinding */
4548 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4549 if (p_ptr->resist_dark)
4551 dam *= 4; dam /= (randint1(4) + 7);
4553 if (PRACE_IS_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4555 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4557 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4559 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4563 /* Time -- bolt fewer effects XXX */
4566 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4567 if (p_ptr->resist_time)
4570 dam /= (randint1(4) + 7);
4571 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4573 else if (!CHECK_MULTISHADOW())
4575 switch (randint1(10))
4577 case 1: case 2: case 3: case 4: case 5:
4579 if (p_ptr->prace == RACE_ANDROID) break;
4580 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4581 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4585 case 6: case 7: case 8: case 9:
4587 switch (randint1(6))
4589 case 1: k = A_STR; act = _("強く", "strong"); break;
4590 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4591 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4592 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4593 case 5: k = A_CON; act = _("健康で", "hale"); break;
4594 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4597 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4598 "You're not as %s as you used to be..."), act);
4600 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4601 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4602 p_ptr->update |= (PU_BONUS);
4608 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4609 "You're not as powerful as you used to be..."));
4611 for (k = 0; k < A_MAX; k++)
4613 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4614 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4616 p_ptr->update |= (PU_BONUS);
4622 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4626 /* Gravity -- stun plus slowness plus teleport */
4629 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4630 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4632 if (!CHECK_MULTISHADOW())
4634 teleport_player(5, TELEPORT_PASSIVE);
4635 if (!p_ptr->levitation)
4636 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4637 if (!(p_ptr->resist_sound || p_ptr->levitation))
4639 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4640 (void)set_stun(p_ptr->stun + plus_stun);
4643 if (p_ptr->levitation)
4645 dam = (dam * 2) / 3;
4648 if (!p_ptr->levitation || one_in_(13))
4650 inven_damage(set_cold_destroy, 2);
4653 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4657 /* Standard damage */
4658 case GF_DISINTEGRATE:
4660 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4662 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4668 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4670 (void)hp_player(dam);
4677 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4678 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4685 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4686 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4692 if (p_ptr->free_act) break;
4693 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4695 if (ironman_nightmare)
4697 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4698 /* Have some nightmares */
4699 sanity_blast(NULL, FALSE);
4702 set_paralyzed(p_ptr->paralyzed + dam);
4712 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4713 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4720 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4721 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4728 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4730 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4731 if (!p_ptr->resist_shard || one_in_(13))
4733 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4734 inven_damage(set_cold_destroy, 2);
4740 /* Ice -- cold plus stun plus cuts */
4743 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4744 get_damage = cold_dam(dam, killer, monspell, FALSE);
4745 if (!CHECK_MULTISHADOW())
4747 if (!p_ptr->resist_shard)
4749 (void)set_cut(p_ptr->cut + damroll(5, 8));
4751 if (!p_ptr->resist_sound)
4753 (void)set_stun(p_ptr->stun + randint1(15));
4756 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4758 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4768 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4770 if (p_ptr->mimic_form)
4772 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4773 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4778 switch (p_ptr->prace)
4780 /* Some races are immune */
4794 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4806 if (CHECK_MULTISHADOW())
4808 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4810 else if (p_ptr->csp)
4814 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4816 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4819 if (dam >= p_ptr->csp)
4823 p_ptr->csp_frac = 0;
4832 learn_spell(monspell);
4833 p_ptr->redraw |= (PR_MANA);
4834 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4838 /* Heal the monster */
4839 if (m_ptr->hp < m_ptr->maxhp)
4843 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4845 /* Redraw (later) if needed */
4846 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4847 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4849 /* Special message */
4852 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4865 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4867 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4868 learn_spell(monspell);
4872 if (!CHECK_MULTISHADOW())
4874 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4876 if (!p_ptr->resist_conf)
4878 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4881 if (!p_ptr->resist_chaos && one_in_(3))
4883 (void)set_image(p_ptr->image + randint0(250) + 150);
4890 p_ptr->csp_frac = 0;
4892 p_ptr->redraw |= PR_MANA;
4895 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4901 case GF_BRAIN_SMASH:
4903 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4905 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4906 learn_spell(monspell);
4910 if (!CHECK_MULTISHADOW())
4912 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4918 p_ptr->csp_frac = 0;
4920 p_ptr->redraw |= PR_MANA;
4923 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4924 if (!CHECK_MULTISHADOW())
4926 if (!p_ptr->resist_blind)
4928 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4930 if (!p_ptr->resist_conf)
4932 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4934 if (!p_ptr->free_act)
4936 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4938 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4940 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4941 (void)do_dec_stat(A_INT);
4942 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4943 (void)do_dec_stat(A_WIS);
4945 if (!p_ptr->resist_chaos)
4947 (void)set_image(p_ptr->image + randint0(250) + 150);
4957 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4959 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4960 learn_spell(monspell);
4964 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
4965 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4973 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4975 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4976 learn_spell(monspell);
4980 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4981 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4989 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
4991 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4992 learn_spell(monspell);
4996 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
4997 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5005 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5007 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5008 learn_spell(monspell);
5012 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5013 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5021 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5023 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5024 learn_spell(monspell);
5028 if (!CHECK_MULTISHADOW())
5030 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5031 curse_equipment(40, 20);
5034 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5036 if (p_ptr->chp < 1) p_ptr->chp = 1;
5051 /* Hex - revenge damage stored */
5052 revenge_store(get_damage);
5054 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5055 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5057 GAME_TEXT m_name_self[80];
5060 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5062 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5063 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5064 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5067 if (p_ptr->riding && dam > 0)
5069 rakubadam_p = (dam > 200) ? 200 : dam;
5073 disturb(TRUE, TRUE);
5076 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5078 (void)kawarimi(FALSE);
5081 /* Return "Anything seen?" */
5087 * Find the distance from (x, y) to a line.
5089 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5091 /* Vector from (x, y) to (x1, y1) */
5092 POSITION py = y1 - y;
5093 POSITION px = x1 - x;
5096 POSITION ny = x2 - x1;
5097 POSITION nx = y1 - y2;
5100 POSITION pd = distance(y1, x1, y, x);
5101 POSITION nd = distance(y1, x1, y2, x2);
5103 if (pd > nd) return distance(y, x, y2, x2);
5105 /* Component of P on N */
5106 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5108 /* Absolute value */
5109 return((nd >= 0) ? nd : 0 - nd);
5116 * Modified version of los() for calculation of disintegration balls.
5117 * Disintegration effects are stopped by permanent walls.
5119 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5121 POSITION dx, dy; /* Delta */
5122 POSITION ax, ay; /* Absolute */
5123 POSITION sx, sy; /* Signs */
5124 POSITION qx, qy; /* Fractions */
5125 POSITION tx, ty; /* Scanners */
5126 POSITION f1, f2; /* Scale factors */
5127 POSITION m; /* Slope, or 1/Slope, of LOS */
5129 /* Extract the offset */
5133 /* Extract the absolute offset */
5137 /* Handle adjacent (or identical) grids */
5138 if ((ax < 2) && (ay < 2)) return (TRUE);
5140 /* Paranoia -- require "safe" origin */
5141 /* if (!in_bounds(y1, x1)) return (FALSE); */
5143 /* Directly South/North */
5146 /* South -- check for walls */
5149 for (ty = y1 + 1; ty < y2; ty++)
5151 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5155 /* North -- check for walls */
5158 for (ty = y1 - 1; ty > y2; ty--)
5160 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5168 /* Directly East/West */
5171 /* East -- check for walls */
5174 for (tx = x1 + 1; tx < x2; tx++)
5176 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5180 /* West -- check for walls */
5183 for (tx = x1 - 1; tx > x2; tx--)
5185 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5193 /* Extract some signs */
5194 sx = (dx < 0) ? -1 : 1;
5195 sy = (dy < 0) ? -1 : 1;
5197 /* Vertical "knights" */
5202 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5206 /* Horizontal "knights" */
5211 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5215 /* Calculate scale factor div 2 */
5218 /* Calculate scale factor */
5222 /* Travel horizontally */
5225 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5231 /* Consider the special case where slope == 1. */
5242 /* Note (below) the case (qy == f2), where */
5243 /* the LOS exactly meets the corner of a tile. */
5246 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5257 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5270 /* Travel vertically */
5273 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5289 /* Note (below) the case (qx == f2), where */
5290 /* the LOS exactly meets the corner of a tile. */
5293 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5304 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5325 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)
5330 int brev = rad * rad / dist;
5334 int mdis = distance(y1, x1, y2, x2) + rad;
5336 while (bdis <= mdis)
5340 if ((0 < dist) && (path_n < dist))
5342 POSITION ny = GRID_Y(path_g[path_n]);
5343 POSITION nx = GRID_X(path_g[path_n]);
5344 POSITION nd = distance(ny, nx, y1, x1);
5346 /* Get next base point */
5355 /* Travel from center outward */
5356 for (cdis = 0; cdis <= brad; cdis++)
5358 /* Scan the maximal blast area of radius "cdis" */
5359 for (y = by - cdis; y <= by + cdis; y++)
5361 for (x = bx - cdis; x <= bx + cdis; x++)
5363 /* Ignore "illegal" locations */
5364 if (!in_bounds(y, x)) continue;
5366 /* Enforce a circular "ripple" */
5367 if (distance(y1, x1, y, x) != bdis) continue;
5369 /* Enforce an arc */
5370 if (distance(by, bx, y, x) != cdis) continue;
5376 /* Lights are stopped by opaque terrains */
5377 if (!los(by, bx, y, x)) continue;
5379 case GF_DISINTEGRATE:
5380 /* Disintegration are stopped only by perma-walls */
5381 if (!in_disintegration_range(by, bx, y, x)) continue;
5384 /* Ball explosions are stopped by walls */
5385 if (!projectable(by, bx, y, x)) continue;
5389 /* Save this grid */
5397 /* Encode some more "radius" info */
5398 gm[bdis + 1] = *pgrids;
5400 /* Increase the size */
5401 brad = rad * (path_n + brev) / (dist + brev);
5403 /* Find the next ripple */
5407 /* Store the effect size */
5413 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5414 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5415 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5416 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5417 * @param x 目標X座標 / Target x location (or location to travel "towards")
5418 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5419 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5420 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx)
5421 * @param monspell 効果元のモンスター魔法ID
5422 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5425 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5426 * towards a given location (optionally passing over the heads of interposing
5427 * monsters), and have it do a given amount of damage to the monsters (and
5428 * optionally objects) within the given radius of the final location.
5430 * A "bolt" travels from source to target and affects only the target grid.
5431 * A "beam" travels from source to target, affecting all grids passed through.
5432 * A "ball" travels from source to the target, exploding at the target, and
5433 * affecting everything within the given radius of the target location.
5435 * Traditionally, a "bolt" does not affect anything on the ground, and does
5436 * not pass over the heads of interposing monsters, much like a traditional
5437 * missile, and will "stop" abruptly at the "target" even if no monster is
5438 * positioned there, while a "ball", on the other hand, passes over the heads
5439 * of monsters between the source and target, and affects everything except
5440 * the source monster which lies within the final radius, while a "beam"
5441 * affects every monster between the source and target, except for the casting
5442 * monster (or player), and rarely affects things on the ground.
5444 * Two special flags allow us to use this function in special ways, the
5445 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5446 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5447 * actually projecting from the source monster (or player).
5449 * The player will only get "experience" for monsters killed by himself
5450 * Unique monsters can only be destroyed by attacks from the player
5452 * Only 256 grids can be affected per projection, limiting the effective
5453 * "radius" of standard ball attacks to nine units (diameter nineteen).
5455 * One can project in a given "direction" by combining PROJECT_THRU with small
5456 * offsets to the initial location (see "line_spell()"), or by calculating
5457 * "virtual targets" far away from the player.
5459 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5460 * continuing until it actually hits somethings (useful for "stone to mud").
5462 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5464 * Balls must explode BEFORE hitting walls, or they would affect monsters
5465 * on both sides of a wall. Some bug reports indicate that this is still
5466 * happening in 2.7.8 for Windows, though it appears to be impossible.
5468 * We "pre-calculate" the blast area only in part for efficiency.
5469 * More importantly, this lets us do "explosions" from the "inside" out.
5470 * This results in a more logical distribution of "blast" treasure.
5471 * It also produces a better (in my opinion) animation of the explosion.
5472 * It could be (but is not) used to have the treasure dropped by monsters
5473 * in the middle of the explosion fall "outwards", and then be damaged by
5474 * the blast as it spreads outwards towards the treasure drop location.
5476 * Walls and doors are included in the blast area, so that they can be
5477 * "burned" or "melted" in later versions.
5479 * This algorithm is intended to maximize simplicity, not necessarily
5480 * efficiency, since this function is not a bottleneck in the code.
5482 * We apply the blast effect from ground zero outwards, in several passes,
5483 * first affecting features, then objects, then monsters, then the player.
5484 * This allows walls to be removed before checking the object or monster
5485 * in the wall, and protects objects which are dropped by monsters killed
5486 * in the blast, and allows the player to see all affects before he is
5487 * killed or teleported away. The semantics of this method are open to
5488 * various interpretations, but they seem to work well in practice.
5490 * We process the blast area from ground-zero outwards to allow for better
5491 * distribution of treasure dropped by monsters, and because it provides a
5492 * pleasing visual effect at low cost.
5494 * Note that the damage done by "ball" explosions decreases with distance.
5495 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5497 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5498 * the target, and then the damage "flows" along this beam of destruction.
5499 * The damage at every grid is the same as at the "center" of a "ball"
5500 * explosion, since the "beam" grids are treated as if they ARE at the
5501 * center of a "ball" explosion.
5503 * Currently, specifying "beam" plus "ball" means that locations which are
5504 * covered by the initial "beam", and also covered by the final "ball", except
5505 * for the final grid (the epicenter of the ball), will be "hit twice", once
5506 * by the initial beam, and once by the exploding ball. For the grid right
5507 * next to the epicenter, this results in 150% damage being done. The center
5508 * does not have this problem, for the same reason the final grid in a "beam"
5509 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5510 * grids which are covered by the "ball" will NOT work, as then they will
5511 * receive LESS damage than they should. Do not combine "beam" with "ball".
5513 * The array "gy[],gx[]" with current size "grids" is used to hold the
5514 * collected locations of all grids in the "blast area" plus "beam path".
5516 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5517 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5518 * first blast grid (see above) with radius "N" from the blast center. Note
5519 * that only the first gm[1] grids in the blast area thus take full damage.
5520 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5521 * number of blast grids.
5523 * Note that once the projection is complete, (y2,x2) holds the final location
5524 * of bolts/beams, and the "epicenter" of balls.
5526 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5527 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5528 * implementation of the "distance" function. Also, a bolt can be properly
5529 * viewed as a "ball" with a "rad" of "zero".
5531 * Note that if no "target" is reached before the beam/bolt/ball travels the
5532 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5533 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5535 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5536 * to move from point A to point B, even if the player cannot see part of the
5537 * projection path. Note that in general, the player will *always* see part
5538 * of the path, since it either starts at the player or ends on the player.
5540 * Hack -- we assume that every "projection" is "self-illuminating".
5542 * Hack -- when only a single monster is affected, we automatically track
5543 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5545 * Note that all projections now "explode" at their final destination, even
5546 * if they were being projected at a more distant destination. This means
5547 * that "ball" spells will *always* explode.
5549 * Note that we must call "handle_stuff()" after affecting terrain features
5550 * in the blast radius, in case the "illumination" of the grid was changed,
5551 * and "update_view()" and "update_monsters()" need to be called.
5554 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5564 POSITION y_saver, x_saver; /* For reflecting monsters */
5566 int msec = delay_factor * delay_factor * delay_factor;
5568 /* Assume the player sees nothing */
5569 bool notice = FALSE;
5571 /* Assume the player has seen nothing */
5572 bool visual = FALSE;
5574 /* Assume the player has seen no blast grids */
5577 /* Assume to be a normal ball spell */
5578 bool breath = FALSE;
5580 /* Is the player blind? */
5581 bool blind = (p_ptr->blind ? TRUE : FALSE);
5583 bool old_hide = FALSE;
5585 /* Number of grids in the "path" */
5588 /* Actual grids in the "path" */
5591 /* Number of grids in the "blast area" (including the "beam" path) */
5594 /* Coordinates of the affected grids */
5595 POSITION gx[1024], gy[1024];
5597 /* Encoded "radius" info (see above) */
5600 /* Actual radius encoded in gm[] */
5601 POSITION gm_rad = rad;
5605 /* Attacker's name (prepared before polymorph)*/
5606 GAME_TEXT who_name[MAX_NLEN];
5608 /* Can the player see the source of this effect? */
5609 bool see_s_msg = TRUE;
5611 /* Initialize by null string */
5617 /* Default target of monsterspell is player */
5618 monster_target_y = p_ptr->y;
5619 monster_target_x = p_ptr->x;
5621 /* Hack -- Jump to target */
5622 if (flg & (PROJECT_JUMP))
5627 /* Clear the flag */
5628 flg &= ~(PROJECT_JUMP);
5633 /* Start at player */
5640 /* Start at monster */
5643 x1 = current_floor_ptr->m_list[who].fx;
5644 y1 = current_floor_ptr->m_list[who].fy;
5645 monster_desc(who_name, ¤t_floor_ptr->m_list[who], MD_WRONGDOER_NAME);
5657 /* Default "destination" */
5662 /* Hack -- verify stuff */
5663 if (flg & (PROJECT_THRU))
5665 if ((x1 == x2) && (y1 == y2))
5667 flg &= ~(PROJECT_THRU);
5671 /* Handle a breath attack */
5676 if (flg & PROJECT_HIDE) old_hide = TRUE;
5677 flg |= PROJECT_HIDE;
5681 /* Hack -- Assume there will be no blast (max radius 32) */
5682 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5690 /* Collect beam grids */
5691 if (flg & (PROJECT_BEAM))
5702 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5704 case GF_DISINTEGRATE:
5705 flg |= (PROJECT_GRID);
5706 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5710 /* Calculate the projection path */
5712 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5715 /* Giga-Hack SEEKER & SUPER_RAY */
5717 if( typ == GF_SEEKER )
5727 for (i = 0; i < path_n; ++i)
5732 POSITION ny = GRID_Y(path_g[i]);
5733 POSITION nx = GRID_X(path_g[i]);
5744 /* Only do visuals if requested */
5745 if (!blind && !(flg & (PROJECT_HIDE)))
5747 /* Only do visuals if the player can "see" the bolt */
5748 if (panel_contains(y, x) && player_has_los_bold(y, x))
5755 /* Obtain the bolt pict */
5756 p = bolt_pict(oy, ox, y, x, typ);
5758 /* Extract attr/char */
5762 /* Visual effects */
5763 print_rel(c, a, y, x);
5764 move_cursor_relative(y, x);
5765 /*if (fresh_before)*/ Term_fresh();
5766 Term_xtra(TERM_XTRA_DELAY, msec);
5768 /*if (fresh_before)*/ Term_fresh();
5770 /* Display "beam" grids */
5771 if (flg & (PROJECT_BEAM))
5773 /* Obtain the explosion pict */
5774 p = bolt_pict(y, x, y, x, typ);
5776 /* Extract attr/char */
5780 /* Visual effects */
5781 print_rel(c, a, y, x);
5784 /* Hack -- Activate delay */
5788 /* Hack -- delay anyway for consistency */
5791 /* Delay for consistency */
5792 Term_xtra(TERM_XTRA_DELAY, msec);
5795 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5796 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
5798 /* The target of monsterspell becomes tha mirror(broken) */
5799 monster_target_y = y;
5800 monster_target_x = x;
5802 remove_mirror(y, x);
5803 next_mirror(&oy, &ox, y, x);
5805 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5806 for (j = last_i; j <= i; j++)
5808 y = GRID_Y(path_g[j]);
5809 x = GRID_X(path_g[j]);
5810 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5811 if (!who && (project_m_n == 1) && !jump) {
5812 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5813 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5817 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5818 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5822 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5827 for(i = last_i ; i < path_n ; i++)
5830 py = GRID_Y(path_g[i]);
5831 px = GRID_X(path_g[i]);
5832 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5834 if (!who && (project_m_n == 1) && !jump) {
5835 if (current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5837 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5841 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5842 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5846 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5850 else if(typ == GF_SUPER_RAY){
5852 int second_step = 0;
5859 for (i = 0; i < path_n; ++i)
5864 POSITION ny = GRID_Y(path_g[i]);
5865 POSITION nx = GRID_X(path_g[i]);
5876 /* Only do visuals if requested */
5877 if (!blind && !(flg & (PROJECT_HIDE)))
5879 /* Only do visuals if the player can "see" the bolt */
5880 if (panel_contains(y, x) && player_has_los_bold(y, x))
5887 /* Obtain the bolt pict */
5888 p = bolt_pict(oy, ox, y, x, typ);
5890 /* Extract attr/char */
5894 /* Visual effects */
5895 print_rel(c, a, y, x);
5896 move_cursor_relative(y, x);
5897 /*if (fresh_before)*/ Term_fresh();
5898 Term_xtra(TERM_XTRA_DELAY, msec);
5900 /*if (fresh_before)*/ Term_fresh();
5902 /* Display "beam" grids */
5903 if (flg & (PROJECT_BEAM))
5905 /* Obtain the explosion pict */
5906 p = bolt_pict(y, x, y, x, typ);
5908 /* Extract attr/char */
5912 /* Visual effects */
5913 print_rel(c, a, y, x);
5916 /* Hack -- Activate delay */
5920 /* Hack -- delay anyway for consistency */
5923 /* Delay for consistency */
5924 Term_xtra(TERM_XTRA_DELAY, msec);
5927 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5928 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5930 if( second_step )continue;
5933 if( is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) && !second_step )
5935 /* The target of monsterspell becomes tha mirror(broken) */
5936 monster_target_y = y;
5937 monster_target_x = x;
5940 for( j = 0; j <=i ; j++ )
5942 y = GRID_Y(path_g[j]);
5943 x = GRID_X(path_g[j]);
5944 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5948 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5949 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5950 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5951 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5952 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5953 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
5954 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
5955 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
5958 for( i = 0; i < path_n ; i++ )
5961 py = GRID_Y(path_g[i]);
5962 px = GRID_X(path_g[i]);
5963 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5964 if(!who && (project_m_n == 1) && !jump){
5965 if(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx >0 ){
5966 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5970 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5971 health_track(current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5975 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
5980 /* Project along the path */
5981 for (i = 0; i < path_n; ++i)
5986 POSITION ny = GRID_Y(path_g[i]);
5987 POSITION nx = GRID_X(path_g[i]);
5989 if (flg & PROJECT_DISI)
5991 /* Hack -- Balls explode before reaching walls */
5992 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
5994 else if (flg & PROJECT_LOS)
5996 /* Hack -- Balls explode before reaching walls */
5997 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6001 /* Hack -- Balls explode before reaching walls */
6002 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6009 /* Collect beam grids */
6010 if (flg & (PROJECT_BEAM))
6017 /* Only do visuals if requested */
6018 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6020 /* Only do visuals if the player can "see" the bolt */
6021 if (panel_contains(y, x) && player_has_los_bold(y, x))
6028 /* Obtain the bolt pict */
6029 p = bolt_pict(oy, ox, y, x, typ);
6031 /* Extract attr/char */
6035 /* Visual effects */
6036 print_rel(c, a, y, x);
6037 move_cursor_relative(y, x);
6038 /*if (fresh_before)*/ Term_fresh();
6039 Term_xtra(TERM_XTRA_DELAY, msec);
6041 /*if (fresh_before)*/ Term_fresh();
6043 /* Display "beam" grids */
6044 if (flg & (PROJECT_BEAM))
6046 /* Obtain the explosion pict */
6047 p = bolt_pict(y, x, y, x, typ);
6049 /* Extract attr/char */
6053 /* Visual effects */
6054 print_rel(c, a, y, x);
6057 /* Hack -- Activate delay */
6061 /* Hack -- delay anyway for consistency */
6064 /* Delay for consistency */
6065 Term_xtra(TERM_XTRA_DELAY, msec);
6072 /* Save the "blast epicenter" */
6076 if (breath && !path_n)
6082 flg &= ~(PROJECT_HIDE);
6086 /* Start the "explosion" */
6089 /* Hack -- make sure beams get to "explode" */
6097 /* If we found a "target", explode there */
6098 if (dist <= MAX_RANGE)
6100 /* Mega-Hack -- remove the final "beam" grid */
6101 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6104 * Create a conical breath attack
6115 flg &= ~(PROJECT_HIDE);
6117 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6121 /* Determine the blast area, work from the inside out */
6122 for (dist = 0; dist <= rad; dist++)
6124 /* Scan the maximal blast area of radius "dist" */
6125 for (y = by - dist; y <= by + dist; y++)
6127 for (x = bx - dist; x <= bx + dist; x++)
6129 /* Ignore "illegal" locations */
6130 if (!in_bounds2(y, x)) continue;
6132 /* Enforce a "circular" explosion */
6133 if (distance(by, bx, y, x) != dist) continue;
6139 /* Lights are stopped by opaque terrains */
6140 if (!los(by, bx, y, x)) continue;
6142 case GF_DISINTEGRATE:
6143 /* Disintegration are stopped only by perma-walls */
6144 if (!in_disintegration_range(by, bx, y, x)) continue;
6147 /* Ball explosions are stopped by walls */
6148 if (!projectable(by, bx, y, x)) continue;
6152 /* Save this grid */
6159 /* Encode some more "radius" info */
6165 /* Speed -- ignore "non-explosions" */
6166 if (!grids) return (FALSE);
6169 /* Display the "blast area" if requested */
6170 if (!blind && !(flg & (PROJECT_HIDE)))
6172 /* Then do the "blast", from inside out */
6173 for (t = 0; t <= gm_rad; t++)
6175 /* Dump everything with this radius */
6176 for (i = gm[t]; i < gm[t+1]; i++)
6178 /* Extract the location */
6182 /* Only do visuals if the player can "see" the blast */
6183 if (panel_contains(y, x) && player_has_los_bold(y, x))
6192 /* Obtain the explosion pict */
6193 p = bolt_pict(y, x, y, x, typ);
6195 /* Extract attr/char */
6199 /* Visual effects -- Display */
6200 print_rel(c, a, y, x);
6204 /* Hack -- center the cursor */
6205 move_cursor_relative(by, bx);
6207 /* Flush each "radius" seperately */
6208 /*if (fresh_before)*/ Term_fresh();
6210 /* Delay (efficiently) */
6211 if (visual || drawn)
6213 Term_xtra(TERM_XTRA_DELAY, msec);
6217 /* Flush the erasing */
6220 /* Erase the explosion drawn above */
6221 for (i = 0; i < grids; i++)
6223 /* Extract the location */
6227 /* Hack -- Erase if needed */
6228 if (panel_contains(y, x) && player_has_los_bold(y, x))
6234 /* Hack -- center the cursor */
6235 move_cursor_relative(by, bx);
6237 /* Flush the explosion */
6238 /*if (fresh_before)*/ Term_fresh();
6242 update_creature(p_ptr);
6244 if (flg & PROJECT_KILL)
6246 see_s_msg = (who > 0) ? is_seen(¤t_floor_ptr->m_list[who]) :
6247 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6251 /* Check features */
6252 if (flg & (PROJECT_GRID))
6254 /* Start with "dist" of zero */
6257 /* Scan for features */
6258 for (i = 0; i < grids; i++)
6260 /* Hack -- Notice new "dist" values */
6261 if (gm[dist+1] == i) dist++;
6263 /* Get the grid location */
6267 /* Find the closest point in the blast */
6270 int d = dist_to_line(y, x, y1, x1, by, bx);
6272 /* Affect the grid */
6273 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6277 /* Affect the grid */
6278 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6283 update_creature(p_ptr);
6286 if (flg & (PROJECT_ITEM))
6288 /* Start with "dist" of zero */
6291 /* Scan for objects */
6292 for (i = 0; i < grids; i++)
6294 /* Hack -- Notice new "dist" values */
6295 if (gm[dist+1] == i) dist++;
6297 /* Get the grid location */
6301 /* Find the closest point in the blast */
6304 int d = dist_to_line(y, x, y1, x1, by, bx);
6306 /* Affect the object in the grid */
6307 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6311 /* Affect the object in the grid */
6312 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6318 /* Check monsters */
6319 if (flg & (PROJECT_KILL))
6326 /* Start with "dist" of zero */
6329 /* Scan for monsters */
6330 for (i = 0; i < grids; i++)
6334 /* Hack -- Notice new "dist" values */
6335 if (gm[dist + 1] == i) dist++;
6337 /* Get the grid location */
6341 /* A single bolt may be reflected */
6344 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6345 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6347 if ((flg & PROJECT_REFLECTABLE) && current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6348 ((current_floor_ptr->grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6349 (!who || dist_hack > 1) && !one_in_(10))
6352 int max_attempts = 10;
6354 /* Choose 'new' target */
6357 t_y = y_saver - 1 + randint1(3);
6358 t_x = x_saver - 1 + randint1(3);
6361 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6363 if (max_attempts < 1)
6369 sound(SOUND_REFLECT);
6372 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6373 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6374 else if (m_ptr->r_idx == MON_DIO)
6375 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6377 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6379 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6381 /* Reflected bolts randomly target either one */
6382 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6383 else flg |= PROJECT_PLAYER;
6385 /* The bolt is reflected */
6386 project(current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6388 /* Don't affect the monster any longer */
6394 /* Find the closest point in the blast */
6397 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6401 effective_dist = dist;
6405 /* There is the riding player on this monster */
6406 if (p_ptr->riding && player_bold(y, x))
6408 /* Aimed on the player */
6409 if (flg & PROJECT_PLAYER)
6411 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6414 * A beam or bolt is well aimed
6416 * So don't affects the mount.
6423 * The spell is not well aimed,
6424 * So partly affect the mount too.
6431 * This grid is the original target.
6432 * Or aimed on your horse.
6434 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6436 /* Hit the mount with full damage */
6440 * Otherwise this grid is not the
6441 * original target, it means that line
6442 * of fire is obstructed by this
6446 * A beam or bolt will hit either
6447 * player or mount. Choose randomly.
6449 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6453 /* Hit the mount with full damage */
6457 /* Hit the player later */
6458 flg |= PROJECT_PLAYER;
6460 /* Don't affect the mount */
6466 * The spell is not well aimed, so
6467 * partly affect both player and
6476 /* Affect the monster in the grid */
6477 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6481 /* Player affected one monster (without "jumping") */
6482 if (!who && (project_m_n == 1) && !jump)
6487 /* Track if possible */
6488 if (current_floor_ptr->grid_array[y][x].m_idx > 0)
6490 monster_type *m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
6494 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6495 health_track(current_floor_ptr->grid_array[y][x].m_idx);
6503 if (flg & (PROJECT_KILL))
6505 /* Start with "dist" of zero */
6508 /* Scan for player */
6509 for (i = 0; i < grids; i++)
6513 /* Hack -- Notice new "dist" values */
6514 if (gm[dist+1] == i) dist++;
6516 /* Get the grid location */
6520 /* Affect the player? */
6521 if (!player_bold(y, x)) continue;
6523 /* Find the closest point in the blast */
6526 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6530 effective_dist = dist;
6533 /* Target may be your horse */
6536 /* Aimed on the player */
6537 if (flg & PROJECT_PLAYER)
6539 /* Hit the player with full damage */
6543 * Hack -- When this grid was not the
6544 * original target, a beam or bolt
6545 * would hit either player or mount,
6546 * and should be choosen randomly.
6548 * But already choosen to hit the
6549 * mount at this point.
6551 * Or aimed on your horse.
6553 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6556 * A beam or bolt is well aimed
6558 * So don't affects the player.
6565 * The spell is not well aimed,
6566 * So partly affect the player too.
6572 /* Affect the player */
6573 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6579 GAME_TEXT m_name[MAX_NLEN];
6581 monster_desc(m_name, ¤t_floor_ptr->m_list[p_ptr->riding], 0);
6583 if (rakubadam_m > 0)
6585 if (rakuba(rakubadam_m, FALSE))
6587 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6590 if (p_ptr->riding && rakubadam_p > 0)
6592 if(rakuba(rakubadam_p, FALSE))
6594 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6599 /* Return "something was noticed" */
6604 * @brief 鏡魔法「封魔結界」の効果処理
6606 * @return 効果があったらTRUEを返す
6608 bool binding_field(HIT_POINT dam)
6610 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6611 int mirror_num = 0; /* 鏡の数 */
6613 POSITION centersign;
6614 POSITION x1, x2, y1, y2;
6616 int msec = delay_factor*delay_factor*delay_factor;
6619 POSITION point_x[3];
6620 POSITION point_y[3];
6622 /* Default target of monsterspell is player */
6623 monster_target_y = p_ptr->y;
6624 monster_target_x = p_ptr->x;
6626 for (x = 0; x < current_floor_ptr->width; x++)
6628 for (y = 0; y < current_floor_ptr->height; y++)
6630 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]) &&
6631 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6632 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6633 player_has_los_bold(y, x) &&
6634 projectable(p_ptr->y, p_ptr->x, y, x)
6636 mirror_y[mirror_num] = y;
6637 mirror_x[mirror_num] = x;
6643 if (mirror_num < 2)return FALSE;
6645 point_x[0] = randint0(mirror_num);
6647 point_x[1] = randint0(mirror_num);
6648 } while (point_x[0] == point_x[1]);
6650 point_y[0] = mirror_y[point_x[0]];
6651 point_x[0] = mirror_x[point_x[0]];
6652 point_y[1] = mirror_y[point_x[1]];
6653 point_x[1] = mirror_x[point_x[1]];
6654 point_y[2] = p_ptr->y;
6655 point_x[2] = p_ptr->x;
6657 x = point_x[0] + point_x[1] + point_x[2];
6658 y = point_y[0] + point_y[1] + point_y[2];
6660 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6661 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6662 if (centersign == 0)return FALSE;
6664 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6665 x1 = x1 < point_x[2] ? x1 : point_x[2];
6666 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6667 y1 = y1 < point_y[2] ? y1 : point_y[2];
6669 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6670 x2 = x2 > point_x[2] ? x2 : point_x[2];
6671 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6672 y2 = y2 > point_y[2] ? y2 : point_y[2];
6674 for (y = y1; y <= y2; y++) {
6675 for (x = x1; x <= x2; x++) {
6676 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6677 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6678 centersign*((point_x[1] - x)*(point_y[2] - y)
6679 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6680 centersign*((point_x[2] - x)*(point_y[0] - y)
6681 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6683 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6684 /* Visual effects */
6686 && panel_contains(y, x)) {
6687 p = bolt_pict(y, x, y, x, GF_MANA);
6688 print_rel(PICT_C(p), PICT_A(p), y, x);
6689 move_cursor_relative(y, x);
6690 /*if (fresh_before)*/ Term_fresh();
6691 Term_xtra(TERM_XTRA_DELAY, msec);
6697 for (y = y1; y <= y2; y++) {
6698 for (x = x1; x <= x2; x++) {
6699 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6700 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6701 centersign*((point_x[1] - x)*(point_y[2] - y)
6702 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6703 centersign*((point_x[2] - x)*(point_y[0] - y)
6704 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6706 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6707 (void)project_f(0, 0, y, x, dam, GF_MANA);
6712 for (y = y1; y <= y2; y++) {
6713 for (x = x1; x <= x2; x++) {
6714 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6715 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6716 centersign*((point_x[1] - x)*(point_y[2] - y)
6717 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6718 centersign*((point_x[2] - x)*(point_y[0] - y)
6719 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6721 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6722 (void)project_o(0, 0, y, x, dam, GF_MANA);
6727 for (y = y1; y <= y2; y++) {
6728 for (x = x1; x <= x2; x++) {
6729 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6730 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6731 centersign*((point_x[1] - x)*(point_y[2] - y)
6732 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6733 centersign*((point_x[2] - x)*(point_y[0] - y)
6734 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6736 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6737 (void)project_m(0, 0, y, x, dam, GF_MANA,
6738 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6744 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6745 remove_mirror(point_y[0], point_x[0]);
6752 * @brief 鏡魔法「鏡の封印」の効果処理
6754 * @return 効果があったらTRUEを返す
6756 void seal_of_mirror(HIT_POINT dam)
6760 for (x = 0; x < current_floor_ptr->width; x++)
6762 for (y = 0; y < current_floor_ptr->height; y++)
6764 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
6766 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6767 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6769 if (!current_floor_ptr->grid_array[y][x].m_idx)
6771 remove_mirror(y, x);
6783 * @brief 領域魔法に応じて技能の名称を返す。
6784 * @param tval 魔法書のtval
6785 * @return 領域魔法の技能名称を保管した文字列ポインタ
6787 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6791 case TV_HISSATSU_BOOK:
6792 return _("必殺技", "art");
6794 return _("祈り", "prayer");
6796 return _("歌", "song");
6798 return _("呪文", "spell");