3 * @brief 魔法による遠隔処理の実装 / Spell projection
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
23 #include "object-curse.h"
24 #include "player-damage.h"
25 #include "player-effects.h"
26 #include "player-race.h"
27 #include "player-class.h"
30 #include "monster-status.h"
31 #include "monster-spell.h"
33 #include "spells-status.h"
34 #include "spells-diceroll.h"
35 #include "spells-summon.h"
36 #include "monsterrace-hook.h"
44 #include "player-status.h"
45 #include "player-move.h"
46 #include "realm-hex.h"
47 #include "realm-song.h"
48 #include "object-hook.h"
49 #include "object-broken.h"
50 #include "object-flavor.h"
55 #include "view-mainwindow.h"
59 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
60 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
63 int project_length = 0; /*!< 投射の射程距離 */
69 STR_OFFSET cap_nickname;
72 * @brief 歌、剣術、呪術領域情報テーブル
74 const magic_type technic_info[NUM_TECHNIC][32] =
197 * @brief 配置した鏡リストの次を取得する /
198 * Get another mirror. for SEEKER
199 * @param next_y 次の鏡のy座標を返す参照ポインタ
200 * @param next_x 次の鏡のx座標を返す参照ポインタ
201 * @param cury 現在の鏡のy座標
202 * @param curx 現在の鏡のx座標
204 static void next_mirror(player_type *creature_ptr, POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
206 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
207 int mirror_num = 0; /* 鏡の数 */
211 for (x = 0; x < creature_ptr->current_floor_ptr->width; x++)
213 for (y = 0; y < creature_ptr->current_floor_ptr->height; y++)
215 if (is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[y][x])) {
216 mirror_y[mirror_num] = y;
217 mirror_x[mirror_num] = x;
224 num = randint0(mirror_num);
225 *next_y = mirror_y[num];
226 *next_x = mirror_x[num];
229 *next_y = cury + randint0(5) - 2;
230 *next_x = curx + randint0(5) - 2;
236 * Mega-Hack -- track "affected" monsters (see "project()" comments)
238 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
239 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
240 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
241 /* Mega-Hack -- monsters target */
242 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
243 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
247 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
248 * @param caster_ptr プレーヤーへの参照ポインタ
249 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
250 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
251 * @param y 目標Y座標 / Target y location (or location to travel "towards")
252 * @param x 目標X座標 / Target x location (or location to travel "towards")
253 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
254 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
255 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
258 * We are called both for "beam" effects and "ball" effects.
260 * The "r" parameter is the "distance from ground zero".
262 * Note that we determine if the player can "see" anything that happens
263 * by taking into account: blindness, line-of-sight, and illumination.
265 * We return "TRUE" if the effect of the projection is "obvious".
267 * We also "see" grids which are "memorized", probably a hack
269 * Perhaps we should affect doors?
272 static bool project_f(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
274 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
275 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
276 feature_type *f_ptr = &f_info[g_ptr->feat];
278 bool obvious = FALSE;
279 bool known = player_has_los_bold(caster_ptr, y, x);
283 /* Reduce damage by distance */
284 dam = (dam + r) / (r + 1);
286 if (have_flag(f_ptr->flags, FF_TREE))
294 message = _("枯れた", "was blasted."); break;
296 message = _("縮んだ", "shrank."); break;
298 message = _("溶けた", "melted."); break;
301 message = _("凍り、砕け散った", "was frozen and smashed."); break;
305 message = _("燃えた", "burns up!"); break;
317 message = _("粉砕された", "was crushed."); break;
319 message = NULL; break;
323 msg_format(_("木は%s。", "A tree %s"), message);
324 cave_set_feat(floor_ptr, y, x, one_in_(3) ? feat_brake : feat_grass);
327 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
331 /* Analyze the type */
334 /* Ignore most effects */
369 /* Destroy Traps (and Locks) */
372 /* Reveal secret doors */
373 if (is_hidden_door(g_ptr))
376 disclose_grid(caster_ptr, y, x);
378 /* Check line of sight */
386 if (is_trap(g_ptr->feat))
388 /* Check line of sight */
391 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
395 /* Destroy the trap */
396 cave_alter_feat(caster_ptr, y, x, FF_DISARM);
399 /* Locked doors are unlocked */
400 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
402 FEAT_IDX old_feat = g_ptr->feat;
404 /* Unlock the door */
405 cave_alter_feat(caster_ptr, y, x, FF_DISARM);
407 /* Check line of sound */
408 if (known && (old_feat != g_ptr->feat))
410 msg_print(_("カチッと音がした!", "Click!"));
415 /* Remove "unsafe" flag if player is not blind */
416 if (!caster_ptr->blind && player_has_los_bold(caster_ptr, y, x))
418 g_ptr->info &= ~(CAVE_UNSAFE);
426 /* Destroy Doors (and traps) */
429 /* Destroy all doors and traps */
430 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
432 /* Check line of sight */
435 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
439 /* Destroy the feature */
440 cave_alter_feat(caster_ptr, y, x, FF_TUNNEL);
443 /* Remove "unsafe" flag if player is not blind */
444 if (!caster_ptr->blind && player_has_los_bold(caster_ptr, y, x))
446 g_ptr->info &= ~(CAVE_UNSAFE);
454 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
456 if (have_flag(f_ptr->flags, FF_SPIKE))
458 s16b old_mimic = g_ptr->mimic;
459 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
461 cave_alter_feat(caster_ptr, y, x, FF_SPIKE);
462 g_ptr->mimic = old_mimic;
467 /* Check line of sight */
468 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
470 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
478 /* Destroy walls (and doors) */
481 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
483 if (known && (g_ptr->info & (CAVE_MARK)))
485 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
489 /* Destroy the wall */
490 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
491 caster_ptr->update |= (PU_FLOW);
499 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
500 if (player_bold(caster_ptr, y, x)) break;
501 cave_set_feat(floor_ptr, y, x, feat_door[DOOR_DOOR].closed);
502 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
508 place_trap(floor_ptr, y, x);
514 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
515 if (player_bold(caster_ptr, y, x)) break;
516 cave_set_feat(floor_ptr, y, x, feat_tree);
517 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
523 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
524 g_ptr->info |= CAVE_OBJECT;
525 g_ptr->mimic = feat_glyph;
533 if (!cave_naked_bold(caster_ptr, floor_ptr, y, x)) break;
534 if (player_bold(caster_ptr, y, x)) break;
535 cave_set_feat(floor_ptr, y, x, feat_granite);
541 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
544 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
545 cave_set_feat(floor_ptr, y, x, feat_shallow_lava);
549 cave_set_feat(floor_ptr, y, x, feat_deep_lava);
557 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
560 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
561 cave_set_feat(floor_ptr, y, x, feat_shallow_water);
565 cave_set_feat(floor_ptr, y, x, feat_deep_water);
571 /* Lite up the grid */
575 /* Turn on the light */
576 if (!(d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
578 g_ptr->info |= (CAVE_GLOW);
581 update_local_illumination(caster_ptr, y, x);
584 if (player_can_see_bold(caster_ptr, y, x)) obvious = TRUE;
586 /* Mega-Hack -- Update the monster in the affected grid */
587 /* This allows "spear of light" (etc) to work "correctly" */
588 if (g_ptr->m_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
590 if (caster_ptr->special_defense & NINJA_S_STEALTH)
592 if (player_bold(caster_ptr, y, x)) set_superstealth(caster_ptr, FALSE);
599 /* Darken the grid */
603 bool do_dark = !caster_ptr->phase_out && !is_mirror_grid(g_ptr);
606 /* Turn off the light. */
609 if (floor_ptr->dun_level || !is_daytime())
611 for (j = 0; j < 9; j++)
613 int by = y + ddy_ddd[j];
614 int bx = x + ddx_ddd[j];
616 if (in_bounds2(floor_ptr, by, bx))
618 grid_type *cc_ptr = &floor_ptr->grid_array[by][bx];
620 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
631 g_ptr->info &= ~(CAVE_GLOW);
633 /* Hack -- Forget "boring" grids */
634 if (!have_flag(f_ptr->flags, FF_REMEMBER))
637 g_ptr->info &= ~(CAVE_MARK);
644 update_local_illumination(caster_ptr, y, x);
646 if (player_can_see_bold(caster_ptr, y, x)) obvious = TRUE;
648 /* Mega-Hack -- Update the monster in the affected grid */
649 /* This allows "spear of light" (etc) to work "correctly" */
650 if (g_ptr->m_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
660 if (is_mirror_grid(g_ptr))
662 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
664 remove_mirror(caster_ptr, y, x);
665 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
668 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
670 if (known && (g_ptr->info & CAVE_MARK))
672 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
676 /* Destroy the wall */
677 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
678 caster_ptr->update |= (PU_FLOW);
686 if (is_mirror_grid(g_ptr) && caster_ptr->lev < 40)
688 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
690 remove_mirror(caster_ptr, y, x);
691 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
694 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
696 if (known && (g_ptr->info & CAVE_MARK))
698 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
702 /* Destroy the wall */
703 cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
704 caster_ptr->update |= (PU_FLOW);
710 case GF_DISINTEGRATE:
712 /* Destroy mirror/glyph */
713 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
714 remove_mirror(caster_ptr, y, x);
716 /* Permanent features don't get effect */
717 /* But not protect monsters and other objects */
718 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
720 cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI);
722 /* Update some things -- similar to GF_KILL_WALL */
723 caster_ptr->update |= (PU_FLOW);
731 /* Return "Anything seen?" */
738 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
739 * @param caster_ptr プレーヤーへの参照ポインタ
740 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
741 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
742 * @param y 目標Y座標 / Target y location (or location to travel "towards")
743 * @param x 目標X座標 / Target x location (or location to travel "towards")
744 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
745 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
746 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
749 * We are called from "project()" to "damage" objects
751 * We are called both for "beam" effects and "ball" effects.
753 * Perhaps we should only SOMETIMES damage things on the ground.
755 * The "r" parameter is the "distance from ground zero".
757 * Note that we determine if the player can "see" anything that happens
758 * by taking into account: blindness, line-of-sight, and illumination.
760 * We also "see" grids which are "memorized", probably a hack
762 * We return "TRUE" if the effect of the projection is "obvious".
765 static bool project_o(player_type *caster_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
767 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
769 OBJECT_IDX this_o_idx, next_o_idx = 0;
771 bool obvious = FALSE;
772 bool known = player_has_los_bold(caster_ptr, y, x);
774 BIT_FLAGS flgs[TR_FLAG_SIZE];
776 GAME_TEXT o_name[MAX_NLEN];
778 KIND_OBJECT_IDX k_idx = 0;
779 bool is_potion = FALSE;
784 /* Reduce damage by distance */
785 dam = (dam + r) / (r + 1);
788 /* Scan all objects in the grid */
789 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
791 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[this_o_idx];
795 bool do_kill = FALSE;
797 concptr note_kill = NULL;
800 /* Get the "plural"-ness */
801 bool plural = (o_ptr->number > 1);
803 next_o_idx = o_ptr->next_o_idx;
804 object_flags(o_ptr, flgs);
806 /* Check for artifact */
807 if (object_is_artifact(o_ptr)) is_art = TRUE;
809 /* Analyze the type */
812 /* Acid -- Lots of things */
815 if (hates_acid(o_ptr))
818 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
819 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
824 /* Elec -- Rings and Wands */
827 if (hates_elec(o_ptr))
830 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
831 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
836 /* Fire -- Flammable objects */
839 if (hates_fire(o_ptr))
842 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
843 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
848 /* Cold -- potions and flasks */
851 if (hates_cold(o_ptr))
853 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
855 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
863 if (hates_fire(o_ptr))
866 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
867 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
869 if (hates_elec(o_ptr))
873 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
874 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
882 if (hates_fire(o_ptr))
885 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
886 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
888 if (hates_cold(o_ptr))
892 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
893 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
898 /* Hack -- break potions and such */
904 if (hates_cold(o_ptr))
906 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
912 /* Mana and Chaos -- destroy everything */
918 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
922 case GF_DISINTEGRATE:
925 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
932 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
933 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
934 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
938 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
942 if (object_is_cursed(o_ptr))
945 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
952 identify_item(caster_ptr, o_ptr);
954 /* Auto-inscription */
955 autopick_alter_item((-this_o_idx), FALSE);
963 /* Chests are noticed only if trapped or locked */
964 if (o_ptr->tval == TV_CHEST)
966 /* Disarm/Unlock traps */
969 /* Disarm or Unlock */
970 o_ptr->pval = (0 - o_ptr->pval);
975 if (known && (o_ptr->marked & OM_FOUND))
977 msg_print(_("カチッと音がした!", "Click!"));
987 if (o_ptr->tval == TV_CORPSE)
992 if (!who || is_pet(&caster_ptr->current_floor_ptr->m_list[who]))
993 mode |= PM_FORCE_PET;
995 for (i = 0; i < o_ptr->number ; i++)
997 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
998 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1002 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1006 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1008 note_kill = _("生き返った。", " revived.");
1010 else if (!note_kill)
1012 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1023 /* Attempt to destroy the object */
1026 /* Effect "observed" */
1027 if (known && (o_ptr->marked & OM_FOUND))
1030 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1033 /* Artifacts, and other objects, get to resist */
1034 if (is_art || ignore)
1036 /* Observe the resist */
1037 if (known && (o_ptr->marked & OM_FOUND))
1039 msg_format(_("%sは影響を受けない!",
1040 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1047 /* Describe if needed */
1048 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1050 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1053 k_idx = o_ptr->k_idx;
1054 is_potion = object_is_potion(o_ptr);
1055 delete_object_idx(caster_ptr->current_floor_ptr, this_o_idx);
1057 /* Potions produce effects when 'shattered' */
1060 (void)potion_smash_effect(who, y, x, k_idx);
1068 /* Return "Anything seen?" */
1074 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1075 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1076 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1077 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1078 * @param x 目標X座標 / Target x location (or location to travel "towards")
1079 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1080 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1082 * @param see_s_msg TRUEならばメッセージを表示する
1083 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1086 * This routine takes a "source monster" (by index) which is mostly used to
1087 * determine if the player is causing the damage, and a "radius" (see below),
1088 * which is used to decrease the power of explosions with distance, and a
1089 * location, via integers which are modified by certain types of attacks
1090 * (polymorph and teleport being the obvious ones), a default damage, which
1091 * is modified as needed based on various properties, and finally a "damage
1092 * type" (see below).
1095 * Note that this routine can handle "no damage" attacks (like teleport) by
1096 * taking a "zero" damage, and can even take "parameters" to attacks (like
1097 * confuse) by accepting a "damage", using it to calculate the effect, and
1098 * then setting the damage to zero. Note that the "damage" parameter is
1099 * divided by the radius, so monsters not at the "epicenter" will not take
1100 * as much damage (or whatever)...
1103 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1104 * may result in a dereference of an invalid pointer.
1107 * Various messages are produced, and damage is applied.
1110 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1111 * actually be "made" of that substance, or "breathe" big balls of it.
1112 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1114 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1115 * and hurts evil less. If can breath nether, then it resists it as well.
1118 * Damage reductions use the following formulas:
1119 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1120 * gives avg damage of .655, ranging from .858 to .500
1121 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1122 * gives avg damage of .544, ranging from .714 to .417
1123 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1124 * gives avg damage of .444, ranging from .556 to .333
1125 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1126 * gives avg damage of .327, ranging from .427 to .250
1127 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1128 * gives something simple.
1131 * In this function, "result" messages are postponed until the end, where
1132 * the "note" string is appended to the monster name, if not NULL. So,
1133 * to make a spell have "no effect" just set "note" to NULL. You should
1134 * also set "notice" to FALSE, or the player will learn what the spell does.
1137 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1143 static bool project_m(player_type *caster_ptr, floor_type *floor_ptr, MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1147 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
1149 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
1150 monster_type *m_caster_ptr = (who > 0) ? &floor_ptr->m_list[who] : NULL;
1152 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1156 /* Is the monster "seen"? */
1157 bool seen = m_ptr->ml;
1158 bool seen_msg = is_seen(m_ptr);
1160 bool slept = (bool)MON_CSLEEP(m_ptr);
1162 /* Were the effects "obvious" (if seen)? */
1163 bool obvious = FALSE;
1165 /* Can the player know about this effect? */
1166 bool known = ((m_ptr->cdis <= MAX_SIGHT) || caster_ptr->phase_out);
1168 /* Were the effects "irrelevant"? */
1169 bool skipped = FALSE;
1171 /* Gets the monster angry at the source of the effect? */
1172 bool get_angry = FALSE;
1174 /* Polymorph setting (true or false) */
1175 bool do_poly = FALSE;
1177 /* Teleport setting (max distance) */
1180 /* Confusion setting (amount to confuse) */
1183 /* Stunning setting (amount to stun) */
1186 /* Sleep amount (amount to sleep) */
1189 /* Fear amount (amount to fear) */
1192 /* Time amount (amount to time) */
1195 bool heal_leper = FALSE;
1197 /* Hold the monster name */
1198 GAME_TEXT m_name[MAX_NLEN];
1201 PARAMETER_VALUE photo = 0;
1203 /* Assume no note */
1204 concptr note = NULL;
1206 /* Assume a default death */
1207 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1209 DEPTH caster_lev = (who > 0) ? r_info[m_caster_ptr->r_idx].level : (caster_ptr->lev * 2);
1212 if (!g_ptr->m_idx) return (FALSE);
1214 /* Never affect projector */
1215 if (who && (g_ptr->m_idx == who)) return (FALSE);
1216 if ((g_ptr->m_idx == caster_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1217 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1219 /* Don't affect already death monsters */
1220 /* Prevents problems with chain reactions of exploding monsters */
1221 if (m_ptr->hp < 0) return (FALSE);
1223 /* Reduce damage by distance */
1224 dam = (dam + r) / (r + 1);
1227 /* Get the monster name (BEFORE polymorphing) */
1228 monster_desc(m_name, m_ptr, 0);
1230 /* Get the monster possessive ("his"/"her"/"its") */
1231 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1233 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) disturb(caster_ptr, TRUE, TRUE);
1235 if (r_ptr->flagsr & RFR_RES_ALL &&
1236 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1237 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1239 note = _("には完全な耐性がある!", " is immune.");
1241 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1242 if (typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1246 /* Analyze the damage type */
1249 /* Magic Missile -- pure damage */
1252 if (seen) obvious = TRUE;
1259 if (seen) obvious = TRUE;
1260 if (r_ptr->flagsr & RFR_IM_ACID)
1262 note = _("にはかなり耐性がある!", " resists a lot.");
1264 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1272 if (seen) obvious = TRUE;
1273 if (r_ptr->flagsr & RFR_IM_ELEC)
1275 note = _("にはかなり耐性がある!", " resists a lot.");
1277 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1285 if (seen) obvious = TRUE;
1286 if (r_ptr->flagsr & RFR_IM_FIRE)
1288 note = _("にはかなり耐性がある!", " resists a lot.");
1290 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1292 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1294 note = _("はひどい痛手をうけた。", " is hit hard.");
1296 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1304 if (seen) obvious = TRUE;
1305 if (r_ptr->flagsr & RFR_IM_COLD)
1307 note = _("にはかなり耐性がある!", " resists a lot.");
1309 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1311 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1313 note = _("はひどい痛手をうけた。", " is hit hard.");
1315 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1323 if (seen) obvious = TRUE;
1324 if (r_ptr->flagsr & RFR_IM_POIS)
1326 note = _("にはかなり耐性がある!", " resists a lot.");
1328 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1336 if (seen) obvious = TRUE;
1337 if (r_ptr->flagsr & RFR_IM_POIS)
1339 note = _("には耐性がある。", " resists.");
1340 dam *= 3; dam /= randint1(6) + 6;
1341 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1343 else if (one_in_(3)) do_poly = TRUE;
1347 /* Hellfire -- hurts Evil */
1350 if (seen) obvious = TRUE;
1351 if (r_ptr->flags3 & RF3_GOOD)
1353 note = _("はひどい痛手をうけた。", " is hit hard.");
1355 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1360 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1363 if (seen) obvious = TRUE;
1364 if (r_ptr->flags3 & RF3_EVIL)
1367 note = _("はひどい痛手をうけた。", " is hit hard.");
1368 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1372 note = _("には耐性がある。", " resists.");
1373 dam *= 3; dam /= randint1(6) + 6;
1378 /* Arrow -- XXX no defense */
1381 if (seen) obvious = TRUE;
1385 /* Plasma -- XXX perhaps check ELEC or FIRE */
1388 if (seen) obvious = TRUE;
1389 if (r_ptr->flagsr & RFR_RES_PLAS)
1391 note = _("には耐性がある。", " resists.");
1392 dam *= 3; dam /= randint1(6) + 6;
1393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1398 /* Nether -- see above */
1401 if (seen) obvious = TRUE;
1402 if (r_ptr->flagsr & RFR_RES_NETH)
1404 if (r_ptr->flags3 & RF3_UNDEAD)
1406 note = _("には完全な耐性がある!", " is immune.");
1408 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1412 note = _("には耐性がある。", " resists.");
1413 dam *= 3; dam /= randint1(6) + 6;
1415 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1417 else if (r_ptr->flags3 & RF3_EVIL)
1419 note = _("はいくらか耐性を示した。", " resists somewhat.");
1421 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1426 /* Water (acid) damage -- Water spirits/elementals are immune */
1429 if (seen) obvious = TRUE;
1430 if (r_ptr->flagsr & RFR_RES_WATE)
1432 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1434 note = _("には完全な耐性がある!", " is immune.");
1439 note = _("には耐性がある。", " resists.");
1440 dam *= 3; dam /= randint1(6) + 6;
1442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1447 /* Chaos -- Chaos breathers resist */
1450 if (seen) obvious = TRUE;
1451 if (r_ptr->flagsr & RFR_RES_CHAO)
1453 note = _("には耐性がある。", " resists.");
1454 dam *= 3; dam /= randint1(6) + 6;
1455 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1457 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1459 note = _("はいくらか耐性を示した。", " resists somewhat.");
1460 dam *= 3; dam /= randint1(6) + 6;
1461 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1466 do_conf = (5 + randint1(11) + r) / (r + 1);
1471 /* Shards -- Shard breathers resist */
1474 if (seen) obvious = TRUE;
1475 if (r_ptr->flagsr & RFR_RES_SHAR)
1477 note = _("には耐性がある。", " resists.");
1478 dam *= 3; dam /= randint1(6) + 6;
1479 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1484 /* Rocket: Shard resistance helps */
1487 if (seen) obvious = TRUE;
1488 if (r_ptr->flagsr & RFR_RES_SHAR)
1490 note = _("はいくらか耐性を示した。", " resists somewhat.");
1492 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1498 /* Sound -- Sound breathers resist */
1501 if (seen) obvious = TRUE;
1502 if (r_ptr->flagsr & RFR_RES_SOUN)
1504 note = _("には耐性がある。", " resists.");
1505 dam *= 2; dam /= randint1(6) + 6;
1506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1508 else do_stun = (10 + randint1(15) + r) / (r + 1);
1515 if (seen) obvious = TRUE;
1516 if (r_ptr->flags3 & RF3_NO_CONF)
1518 note = _("には耐性がある。", " resists.");
1519 dam *= 3; dam /= randint1(6) + 6;
1520 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1522 else do_conf = (10 + randint1(15) + r) / (r + 1);
1526 /* Disenchantment -- Breathers and Disenchanters resist */
1529 if (seen) obvious = TRUE;
1530 if (r_ptr->flagsr & RFR_RES_DISE)
1532 note = _("には耐性がある。", " resists.");
1533 dam *= 3; dam /= randint1(6) + 6;
1534 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1539 /* Nexus -- Breathers and Existers resist */
1542 if (seen) obvious = TRUE;
1543 if (r_ptr->flagsr & RFR_RES_NEXU)
1545 note = _("には耐性がある。", " resists.");
1546 dam *= 3; dam /= randint1(6) + 6;
1547 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1555 if (seen) obvious = TRUE;
1556 if (r_ptr->flagsr & RFR_RES_WALL)
1558 note = _("には耐性がある。", " resists.");
1559 dam *= 3; dam /= randint1(6) + 6;
1560 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1562 else do_stun = (randint1(15) + r) / (r + 1);
1566 /* Inertia -- breathers resist */
1569 if (seen) obvious = TRUE;
1570 if (r_ptr->flagsr & RFR_RES_INER)
1572 note = _("には耐性がある。", " resists.");
1573 dam *= 3; dam /= randint1(6) + 6;
1574 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1578 /* Powerful monsters can resist */
1579 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1580 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1584 /* Normal monsters slow down */
1587 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1589 note = _("の動きが遅くなった。", " starts moving slower.");
1596 /* Time -- breathers resist */
1599 if (seen) obvious = TRUE;
1600 if (r_ptr->flagsr & RFR_RES_TIME)
1602 note = _("には耐性がある。", " resists.");
1603 dam *= 3; dam /= randint1(6) + 6;
1604 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1606 else do_time = (dam + 1) / 2;
1610 /* Gravity -- breathers resist */
1613 bool resist_tele = FALSE;
1615 if (seen) obvious = TRUE;
1616 if (r_ptr->flagsr & RFR_RES_TELE)
1618 if (r_ptr->flags1 & (RF1_UNIQUE))
1620 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1621 note = _("には効果がなかった。", " is unaffected!");
1624 else if (r_ptr->level > randint1(100))
1626 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1627 note = _("には耐性がある!", " resists!");
1632 if (!resist_tele) do_dist = 10;
1634 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) do_dist = 0;
1636 if (r_ptr->flagsr & RFR_RES_GRAV)
1638 note = _("には耐性がある!", " resists!");
1639 dam *= 3; dam /= randint1(6) + 6;
1641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1646 /* Powerful monsters can resist */
1647 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1648 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1652 /* Normal monsters slow down */
1655 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1657 note = _("の動きが遅くなった。", " starts moving slower.");
1662 do_stun = damroll((caster_lev / 20) + 3, (dam)) + 1;
1664 /* Attempt a saving throw */
1665 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1666 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1670 /* No obvious effect */
1671 note = _("には効果がなかった。", " is unaffected!");
1683 if (seen) obvious = TRUE;
1689 case GF_DISINTEGRATE:
1691 if (seen) obvious = TRUE;
1692 if (r_ptr->flags3 & RF3_HURT_ROCK)
1694 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1695 note = _("の皮膚がただれた!", " loses some skin!");
1696 note_dies = _("は蒸発した!", " evaporates!");
1704 if (seen) obvious = TRUE;
1706 /* PSI only works if the monster can see you! -- RG */
1707 if (!(los(floor_ptr, m_ptr->fy, m_ptr->fx, caster_ptr->y, caster_ptr->x)))
1710 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1714 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1717 note = _("には完全な耐性がある!", " is immune.");
1718 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1721 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1722 (r_ptr->flags3 & RF3_ANIMAL) ||
1723 (r_ptr->level > randint1(3 * dam)))
1725 note = _("には耐性がある!", " resists!");
1729 * Powerful demons & undead can turn a mindcrafter's
1730 * attacks back on them
1732 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1733 (r_ptr->level > caster_ptr->lev / 2) &&
1737 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1738 (seen ? "%^s's corrupted mind backlashes your attack!" :
1739 "%^ss corrupted mind backlashes your attack!")), m_name);
1742 if ((randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav) && !CHECK_MULTISHADOW(caster_ptr))
1744 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1748 /* Injure +/- confusion */
1749 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1750 take_hit(caster_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1751 if (one_in_(4) && !CHECK_MULTISHADOW(caster_ptr))
1753 switch (randint1(4))
1756 set_confused(caster_ptr, caster_ptr->confused + 3 + randint1(dam));
1759 set_stun(caster_ptr, caster_ptr->stun + randint1(dam));
1763 if (r_ptr->flags3 & RF3_NO_FEAR)
1764 note = _("には効果がなかった。", " is unaffected.");
1766 set_afraid(caster_ptr, caster_ptr->afraid + 3 + randint1(dam));
1770 if (!caster_ptr->free_act)
1771 (void)set_paralyzed(caster_ptr, caster_ptr->paralyzed + randint1(dam));
1780 if ((dam > 0) && one_in_(4))
1782 switch (randint1(4))
1785 do_conf = 3 + randint1(dam);
1788 do_stun = 3 + randint1(dam);
1791 do_fear = 3 + randint1(dam);
1794 note = _("は眠り込んでしまった!", " falls asleep!");
1795 do_sleep = 3 + randint1(dam);
1800 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1806 if (seen) obvious = TRUE;
1807 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1810 note = _("には完全な耐性がある!", " is immune.");
1812 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1813 (r_ptr->flags3 & RF3_ANIMAL) ||
1814 (r_ptr->level > randint1(3 * dam)))
1816 note = _("には耐性がある!", " resists!");
1820 * Powerful demons & undead can turn a mindcrafter's
1821 * attacks back on them
1823 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1824 (r_ptr->level > caster_ptr->lev / 2) &&
1828 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1829 (seen ? "%^s's corrupted mind backlashes your attack!" :
1830 "%^ss corrupted mind backlashes your attack!")), m_name);
1832 if ((randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav) && !CHECK_MULTISHADOW(caster_ptr))
1834 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1838 /* Injure + mana drain */
1839 monster_desc(killer, m_ptr, MD_WRONGDOER_NAME);
1840 if (!CHECK_MULTISHADOW(caster_ptr))
1842 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1843 caster_ptr->csp -= damroll(5, dam) / 2;
1844 if (caster_ptr->csp < 0) caster_ptr->csp = 0;
1845 caster_ptr->redraw |= PR_MANA;
1846 caster_ptr->window |= (PW_SPELL);
1848 take_hit(caster_ptr, DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1855 int b = damroll(5, dam) / 4;
1856 concptr str = (caster_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1857 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1858 (seen ? "You convert %s's pain into %s!" :
1859 "You convert %ss pain into %s!"));
1860 msg_format(msg, m_name, str);
1862 b = MIN(caster_ptr->msp, caster_ptr->csp + b);
1863 caster_ptr->csp = b;
1864 caster_ptr->redraw |= PR_MANA;
1865 caster_ptr->window |= (PW_SPELL);
1867 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1871 case GF_TELEKINESIS:
1873 if (seen) obvious = TRUE;
1876 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) do_dist = 0;
1881 do_stun = damroll((caster_lev / 20) + 3, dam) + 1;
1883 /* Attempt a saving throw */
1884 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1885 (r_ptr->level > 5 + randint1(dam)))
1889 /* No obvious effect */
1895 /* Psycho-spear -- powerful magic missile */
1898 if (seen) obvious = TRUE;
1902 /* Meteor -- powerful magic missile */
1905 if (seen) obvious = TRUE;
1911 if (!is_hostile(m_ptr)) break;
1912 if (seen) obvious = TRUE;
1913 /* Attempt a saving throw */
1914 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1915 (r_ptr->flags3 & RF3_NO_CONF) ||
1916 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1918 /* Memorize a flag */
1919 if (r_ptr->flags3 & RF3_NO_CONF)
1921 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1928 * Powerful demons & undead can turn a mindcrafter's
1929 * attacks back on them
1931 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1932 (r_ptr->level > caster_ptr->lev / 2) &&
1936 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1937 (seen ? "%^s's corrupted mind backlashes your attack!" :
1938 "%^ss corrupted mind backlashes your attack!")), m_name);
1941 if (randint0(100 + r_ptr->level / 2) < caster_ptr->skill_sav)
1943 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1947 /* Confuse, stun, terrify */
1948 switch (randint1(4))
1951 set_stun(caster_ptr, caster_ptr->stun + dam / 2);
1954 set_confused(caster_ptr, caster_ptr->confused + dam / 2);
1958 if (r_ptr->flags3 & RF3_NO_FEAR)
1959 note = _("には効果がなかった。", " is unaffected.");
1961 set_afraid(caster_ptr, caster_ptr->afraid + dam);
1968 /* No obvious effect */
1969 note = _("には効果がなかった。", " is unaffected.");
1975 if (!common_saving_throw_charm(caster_ptr, dam, m_ptr))
1977 note = _("があなたに隷属した。", " is in your thrall!");
1982 switch (randint1(4))
1996 /* No "real" damage */
2001 /* Ice -- Cold + Cuts + Stun */
2004 if (seen) obvious = TRUE;
2005 do_stun = (randint1(15) + 1) / (r + 1);
2006 if (r_ptr->flagsr & RFR_IM_COLD)
2008 note = _("にはかなり耐性がある!", " resists a lot.");
2010 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2012 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2014 note = _("はひどい痛手をうけた。", " is hit hard.");
2016 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2023 case GF_HYPODYNAMIA:
2025 if (seen) obvious = TRUE;
2026 if (!monster_living(m_ptr->r_idx))
2028 if (is_original_ap_and_seen(m_ptr))
2030 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2031 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2032 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2034 note = _("には効果がなかった。", " is unaffected.");
2038 else do_time = (dam + 7) / 8;
2046 if (seen) obvious = TRUE;
2047 if (!monster_living(m_ptr->r_idx))
2049 if (is_original_ap_and_seen(m_ptr))
2051 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2052 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2053 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2055 note = _("には完全な耐性がある!", " is immune.");
2059 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2060 (randint1(888) != 666)) ||
2061 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2062 randint1(100) != 66))
2064 note = _("には耐性がある!", " resists!");
2072 /* Polymorph monster (Use "dam" as "power") */
2075 if (seen) obvious = TRUE;
2076 /* Attempt to polymorph (see below) */
2079 /* Powerful monsters can resist */
2080 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2081 (r_ptr->flags1 & RF1_QUESTOR) ||
2082 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2084 note = _("には効果がなかった。", " is unaffected.");
2089 /* No "real" damage */
2096 /* Clone monsters (Ignore "dam") */
2099 if (seen) obvious = TRUE;
2101 if ((floor_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2103 note = _("には効果がなかった。", " is unaffected.");
2108 m_ptr->hp = m_ptr->maxhp;
2110 /* Attempt to clone. */
2111 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2113 note = _("が分裂した!", " spawns!");
2117 /* No "real" damage */
2124 /* Heal Monster (use "dam" as amount of healing) */
2127 if (seen) obvious = TRUE;
2130 (void)set_monster_csleep(g_ptr->m_idx, 0);
2132 if (m_ptr->maxhp < m_ptr->max_maxhp)
2134 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2135 m_ptr->maxhp = m_ptr->max_maxhp;
2140 /* Redraw (later) if needed */
2141 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
2142 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
2150 if (seen) obvious = TRUE;
2153 (void)set_monster_csleep(g_ptr->m_idx, 0);
2154 if (MON_STUNNED(m_ptr))
2156 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2157 (void)set_monster_stunned(g_ptr->m_idx, 0);
2159 if (MON_CONFUSED(m_ptr))
2161 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2162 (void)set_monster_confused(g_ptr->m_idx, 0);
2164 if (MON_MONFEAR(m_ptr))
2166 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2167 (void)set_monster_monfear(g_ptr->m_idx, 0);
2171 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2174 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2178 chg_virtue(caster_ptr, V_VITALITY, 1);
2180 if (r_ptr->flags1 & RF1_UNIQUE)
2181 chg_virtue(caster_ptr, V_INDIVIDUALISM, 1);
2183 if (is_friendly(m_ptr))
2184 chg_virtue(caster_ptr, V_HONOUR, 1);
2185 else if (!(r_ptr->flags3 & RF3_EVIL))
2187 if (r_ptr->flags3 & RF3_GOOD)
2188 chg_virtue(caster_ptr, V_COMPASSION, 2);
2190 chg_virtue(caster_ptr, V_COMPASSION, 1);
2193 if (r_ptr->flags3 & RF3_ANIMAL)
2194 chg_virtue(caster_ptr, V_NATURE, 1);
2197 if (m_ptr->r_idx == MON_LEPER)
2200 if (!who) chg_virtue(caster_ptr, V_COMPASSION, 5);
2203 /* Redraw (later) if needed */
2204 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
2205 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
2207 note = _("は体力を回復したようだ。", " looks healthier.");
2209 /* No "real" damage */
2215 /* Speed Monster (Ignore "dam") */
2218 if (seen) obvious = TRUE;
2221 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2223 note = _("の動きが速くなった。", " starts moving faster.");
2228 if (r_ptr->flags1 & RF1_UNIQUE)
2229 chg_virtue(caster_ptr, V_INDIVIDUALISM, 1);
2230 if (is_friendly(m_ptr))
2231 chg_virtue(caster_ptr, V_HONOUR, 1);
2234 /* No "real" damage */
2240 /* Slow Monster (Use "dam" as "power") */
2243 if (seen) obvious = TRUE;
2245 /* Powerful monsters can resist */
2246 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2247 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2249 note = _("には効果がなかった。", " is unaffected.");
2253 /* Normal monsters slow down */
2256 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2258 note = _("の動きが遅くなった。", " starts moving slower.");
2262 /* No "real" damage */
2268 /* Sleep (Use "dam" as "power") */
2271 if (seen) obvious = TRUE;
2273 /* Attempt a saving throw */
2274 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2275 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2276 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2278 /* Memorize a flag */
2279 if (r_ptr->flags3 & RF3_NO_SLEEP)
2281 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2283 /* No obvious effect */
2284 note = _("には効果がなかった。", " is unaffected.");
2289 /* Go to sleep (much) later */
2290 note = _("は眠り込んでしまった!", " falls asleep!");
2294 /* No "real" damage */
2300 /* Sleep (Use "dam" as "power") */
2301 case GF_STASIS_EVIL:
2303 if (seen) obvious = TRUE;
2305 /* Attempt a saving throw */
2306 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2307 !(r_ptr->flags3 & RF3_EVIL) ||
2308 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2310 note = _("には効果がなかった。", " is unaffected.");
2315 /* Go to sleep (much) later */
2316 note = _("は動けなくなった!", " is suspended!");
2320 /* No "real" damage */
2325 /* Sleep (Use "dam" as "power") */
2328 if (seen) obvious = TRUE;
2330 /* Attempt a saving throw */
2331 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2332 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2334 note = _("には効果がなかった。", " is unaffected.");
2339 /* Go to sleep (much) later */
2340 note = _("は動けなくなった!", " is suspended!");
2344 /* No "real" damage */
2353 vir = virtue_number(caster_ptr, V_HARMONY);
2356 dam += caster_ptr->virtues[vir - 1] / 10;
2359 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2362 dam -= caster_ptr->virtues[vir - 1] / 20;
2365 if (seen) obvious = TRUE;
2367 /* Attempt a saving throw */
2368 if (common_saving_throw_charm(caster_ptr, dam, m_ptr))
2372 /* No obvious effect */
2373 note = _("には効果がなかった。", " is unaffected.");
2376 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2378 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2380 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2381 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2385 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2388 chg_virtue(caster_ptr, V_INDIVIDUALISM, -1);
2389 if (r_ptr->flags3 & RF3_ANIMAL)
2390 chg_virtue(caster_ptr, V_NATURE, 1);
2393 /* No "real" damage */
2398 /* Control undead */
2399 case GF_CONTROL_UNDEAD:
2402 if (seen) obvious = TRUE;
2404 vir = virtue_number(caster_ptr, V_UNLIFE);
2407 dam += caster_ptr->virtues[vir - 1] / 10;
2410 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2413 dam -= caster_ptr->virtues[vir - 1] / 20;
2416 /* Attempt a saving throw */
2417 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2418 !(r_ptr->flags3 & RF3_UNDEAD))
2420 /* No obvious effect */
2421 note = _("には効果がなかった。", " is unaffected.");
2423 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2425 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2427 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2428 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2432 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2436 /* No "real" damage */
2442 case GF_CONTROL_DEMON:
2445 if (seen) obvious = TRUE;
2447 vir = virtue_number(caster_ptr, V_UNLIFE);
2450 dam += caster_ptr->virtues[vir - 1] / 10;
2453 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2456 dam -= caster_ptr->virtues[vir - 1] / 20;
2459 /* Attempt a saving throw */
2460 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2461 !(r_ptr->flags3 & RF3_DEMON))
2463 /* No obvious effect */
2464 note = _("には効果がなかった。", " is unaffected.");
2466 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2468 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2470 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2471 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2475 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2479 /* No "real" damage */
2485 case GF_CONTROL_ANIMAL:
2488 if (seen) obvious = TRUE;
2490 vir = virtue_number(caster_ptr, V_NATURE);
2493 dam += caster_ptr->virtues[vir - 1] / 10;
2496 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2499 dam -= caster_ptr->virtues[vir - 1] / 20;
2502 /* Attempt a saving throw */
2503 if (common_saving_throw_control(caster_ptr, dam, m_ptr) ||
2504 !(r_ptr->flags3 & RF3_ANIMAL))
2507 /* No obvious effect */
2508 note = _("には効果がなかった。", " is unaffected.");
2510 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2512 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2514 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2515 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2519 note = _("はなついた。", " is tamed!");
2521 if (r_ptr->flags3 & RF3_ANIMAL)
2522 chg_virtue(caster_ptr, V_NATURE, 1);
2525 /* No "real" damage */
2531 case GF_CHARM_LIVING:
2535 vir = virtue_number(caster_ptr, V_UNLIFE);
2536 if (seen) obvious = TRUE;
2538 vir = virtue_number(caster_ptr, V_UNLIFE);
2541 dam -= caster_ptr->virtues[vir - 1] / 10;
2544 vir = virtue_number(caster_ptr, V_INDIVIDUALISM);
2547 dam -= caster_ptr->virtues[vir - 1] / 20;
2550 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2552 /* Attempt a saving throw */
2553 if (common_saving_throw_charm(caster_ptr, dam, m_ptr) ||
2554 !monster_living(m_ptr->r_idx))
2557 /* No obvious effect */
2558 note = _("には効果がなかった。", " is unaffected.");
2560 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2562 else if (caster_ptr->cursed & TRC_AGGRAVATE)
2564 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2565 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2569 note = _("を支配した。", " is tamed!");
2571 if (r_ptr->flags3 & RF3_ANIMAL)
2572 chg_virtue(caster_ptr, V_NATURE, 1);
2575 /* No "real" damage */
2580 /* Confusion (Use "dam" as "power") */
2583 if (seen) obvious = TRUE;
2585 /* Get confused later */
2586 do_conf = damroll(3, (dam / 2)) + 1;
2588 /* Attempt a saving throw */
2589 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2590 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2591 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2593 /* Memorize a flag */
2594 if (r_ptr->flags3 & (RF3_NO_CONF))
2596 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2602 /* No obvious effect */
2603 note = _("には効果がなかった。", " is unaffected.");
2607 /* No "real" damage */
2614 if (seen) obvious = TRUE;
2616 do_stun = damroll((caster_lev / 20) + 3, (dam)) + 1;
2618 /* Attempt a saving throw */
2619 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2620 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2625 /* No obvious effect */
2626 note = _("には効果がなかった。", " is unaffected.");
2630 /* No "real" damage */
2635 /* Lite, but only hurts susceptible creatures */
2644 if (r_ptr->flags3 & (RF3_HURT_LITE))
2646 /* Obvious effect */
2647 if (seen) obvious = TRUE;
2649 /* Memorize the effects */
2650 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2652 /* Special effect */
2653 note = _("は光に身をすくめた!", " cringes from the light!");
2654 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2657 /* Normally no damage */
2669 /* Lite -- opposite of Dark */
2672 if (seen) obvious = TRUE;
2674 if (r_ptr->flagsr & RFR_RES_LITE)
2676 note = _("には耐性がある!", " resists!");
2677 dam *= 2; dam /= (randint1(6) + 6);
2678 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2680 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2682 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2683 note = _("は光に身をすくめた!", " cringes from the light!");
2684 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2691 /* Dark -- opposite of Lite */
2694 if (seen) obvious = TRUE;
2696 if (r_ptr->flagsr & RFR_RES_DARK)
2698 note = _("には耐性がある!", " resists!");
2699 dam *= 2; dam /= (randint1(6) + 6);
2700 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2709 /* Hurt by rock remover */
2710 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2713 if (seen) obvious = TRUE;
2715 /* Memorize the effects */
2716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2718 /* Cute little message */
2719 note = _("の皮膚がただれた!", " loses some skin!");
2720 note_dies = _("はドロドロに溶けた!", " dissolves!");
2723 /* Usually, ignore the effects */
2734 /* Teleport undead (Use "dam" as "power") */
2735 case GF_AWAY_UNDEAD:
2737 /* Only affect undead */
2738 if (r_ptr->flags3 & (RF3_UNDEAD))
2740 bool resists_tele = FALSE;
2742 if (r_ptr->flagsr & RFR_RES_TELE)
2744 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2746 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2747 note = _("には効果がなかった。", " is unaffected.");
2748 resists_tele = TRUE;
2750 else if (r_ptr->level > randint1(100))
2752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2753 note = _("には耐性がある!", " resists!");
2754 resists_tele = TRUE;
2760 if (seen) obvious = TRUE;
2761 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2773 /* No "real" damage */
2779 /* Teleport evil (Use "dam" as "power") */
2782 /* Only affect evil */
2783 if (r_ptr->flags3 & (RF3_EVIL))
2785 bool resists_tele = FALSE;
2787 if (r_ptr->flagsr & RFR_RES_TELE)
2789 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2791 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2792 note = _("には効果がなかった。", " is unaffected.");
2793 resists_tele = TRUE;
2795 else if (r_ptr->level > randint1(100))
2797 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2798 note = _("には耐性がある!", " resists!");
2799 resists_tele = TRUE;
2805 if (seen) obvious = TRUE;
2806 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2818 /* No "real" damage */
2824 /* Teleport monster (Use "dam" as "power") */
2827 bool resists_tele = FALSE;
2828 if (r_ptr->flagsr & RFR_RES_TELE)
2830 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2832 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2833 note = _("には効果がなかった。", " is unaffected.");
2834 resists_tele = TRUE;
2836 else if (r_ptr->level > randint1(100))
2838 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2839 note = _("には耐性がある!", " resists!");
2840 resists_tele = TRUE;
2846 if (seen) obvious = TRUE;
2848 /* Prepare to teleport */
2852 /* No "real" damage */
2858 /* Turn undead (Use "dam" as "power") */
2859 case GF_TURN_UNDEAD:
2861 /* Only affect undead */
2862 if (r_ptr->flags3 & (RF3_UNDEAD))
2864 if (seen) obvious = TRUE;
2866 /* Learn about type */
2867 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2869 /* Apply some fear */
2870 do_fear = damroll(3, (dam / 2)) + 1;
2872 /* Attempt a saving throw */
2873 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2875 /* No obvious effect */
2876 note = _("には効果がなかった。", " is unaffected.");
2889 /* No "real" damage */
2895 /* Turn evil (Use "dam" as "power") */
2898 /* Only affect evil */
2899 if (r_ptr->flags3 & (RF3_EVIL))
2901 if (seen) obvious = TRUE;
2903 /* Learn about type */
2904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2906 /* Apply some fear */
2907 do_fear = damroll(3, (dam / 2)) + 1;
2909 /* Attempt a saving throw */
2910 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2912 /* No obvious effect */
2913 note = _("には効果がなかった。", " is unaffected.");
2926 /* No "real" damage */
2932 /* Turn monster (Use "dam" as "power") */
2935 if (seen) obvious = TRUE;
2937 /* Apply some fear */
2938 do_fear = damroll(3, (dam / 2)) + 1;
2940 /* Attempt a saving throw */
2941 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2942 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2943 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2945 /* No obvious effect */
2946 note = _("には効果がなかった。", " is unaffected.");
2951 /* No "real" damage */
2958 case GF_DISP_UNDEAD:
2960 /* Only affect undead */
2961 if (r_ptr->flags3 & (RF3_UNDEAD))
2963 if (seen) obvious = TRUE;
2965 /* Learn about type */
2966 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2968 note = _("は身震いした。", " shudders.");
2969 note_dies = _("はドロドロに溶けた!", " dissolves!");
2989 /* Only affect evil */
2990 if (r_ptr->flags3 & (RF3_EVIL))
2992 if (seen) obvious = TRUE;
2994 /* Learn about type */
2995 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2997 note = _("は身震いした。", " shudders.");
2998 note_dies = _("はドロドロに溶けた!", " dissolves!");
3017 /* Only affect good */
3018 if (r_ptr->flags3 & (RF3_GOOD))
3020 if (seen) obvious = TRUE;
3022 /* Learn about type */
3023 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3025 note = _("は身震いした。", " shudders.");
3026 note_dies = _("はドロドロに溶けた!", " dissolves!");
3043 case GF_DISP_LIVING:
3045 /* Only affect non-undead */
3046 if (monster_living(m_ptr->r_idx))
3048 if (seen) obvious = TRUE;
3050 note = _("は身震いした。", " shudders.");
3051 note_dies = _("はドロドロに溶けた!", " dissolves!");
3070 /* Only affect demons */
3071 if (r_ptr->flags3 & (RF3_DEMON))
3073 if (seen) obvious = TRUE;
3075 /* Learn about type */
3076 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3078 note = _("は身震いした。", " shudders.");
3079 note_dies = _("はドロドロに溶けた!", " dissolves!");
3095 /* Dispel monster */
3098 if (seen) obvious = TRUE;
3099 note = _("は身震いした。", " shudders.");
3100 note_dies = _("はドロドロに溶けた!", " dissolves!");
3107 if (seen) obvious = TRUE;
3108 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3112 /* Heal the monster */
3113 if (m_caster_ptr->hp < m_caster_ptr->maxhp)
3116 m_caster_ptr->hp += dam;
3117 if (m_caster_ptr->hp > m_caster_ptr->maxhp) m_caster_ptr->hp = m_caster_ptr->maxhp;
3119 /* Redraw (later) if needed */
3120 if (caster_ptr->health_who == who) caster_ptr->redraw |= (PR_HEALTH);
3121 if (caster_ptr->riding == who) caster_ptr->redraw |= (PR_UHEALTH);
3123 /* Special message */
3126 monster_desc(killer, m_caster_ptr, 0);
3127 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3133 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3134 (void)hp_player(caster_ptr, dam);
3139 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3148 if (seen) obvious = TRUE;
3149 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3150 /* Attempt a saving throw */
3151 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3152 (r_ptr->flags3 & RF3_NO_CONF) ||
3153 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3155 /* Memorize a flag */
3156 if (r_ptr->flags3 & (RF3_NO_CONF))
3158 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3160 note = _("には効果がなかった。", " is unaffected.");
3163 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3165 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3166 note = _("には完全な耐性がある!", " is immune.");
3169 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3171 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3172 note = _("には耐性がある。", " resists.");
3177 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3178 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3180 if (who > 0) do_conf = randint0(4) + 4;
3181 else do_conf = randint0(8) + 8;
3187 case GF_BRAIN_SMASH:
3189 if (seen) obvious = TRUE;
3190 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3192 /* Attempt a saving throw */
3193 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3194 (r_ptr->flags3 & RF3_NO_CONF) ||
3195 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3197 /* Memorize a flag */
3198 if (r_ptr->flags3 & (RF3_NO_CONF))
3200 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3202 note = _("には効果がなかった。", " is unaffected.");
3205 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3207 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3208 note = _("には完全な耐性がある!", " is immune.");
3211 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3213 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3214 note = _("には耐性がある!", " resists!");
3219 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3220 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3224 do_conf = randint0(4) + 4;
3225 do_stun = randint0(4) + 4;
3229 do_conf = randint0(8) + 8;
3230 do_stun = randint0(8) + 8;
3232 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3240 if (seen) obvious = TRUE;
3241 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3242 /* Attempt a saving throw */
3243 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3245 note = _("には効果がなかった。", " is unaffected.");
3254 if (seen) obvious = TRUE;
3255 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3256 /* Attempt a saving throw */
3257 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3259 note = _("には効果がなかった。", " is unaffected.");
3268 if (seen) obvious = TRUE;
3269 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3270 /* Attempt a saving throw */
3271 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3273 note = _("には効果がなかった。", " is unaffected.");
3282 if (seen) obvious = TRUE;
3284 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3285 "You point at %s, screaming the word, 'DIE!'."), m_name);
3286 /* Attempt a saving throw */
3287 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (m_caster_ptr->r_idx != MON_KENSHIROU)))
3289 note = _("には効果がなかった。", " is unaffected.");
3298 if (seen) obvious = TRUE;
3299 if (r_ptr->flags1 & RF1_UNIQUE)
3301 note = _("には効果がなかった。", " is unaffected.");
3306 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3307 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3309 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3311 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3315 note = _("は耐性を持っている!", "resists!");
3322 /* Capture monster */
3326 if ((floor_ptr->inside_quest && (quest[floor_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3327 (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)
3329 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3334 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3335 else if ((caster_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3336 nokori_hp = m_ptr->maxhp * 3 / 10;
3338 nokori_hp = m_ptr->maxhp * 3 / 20;
3340 if (m_ptr->hp >= nokori_hp)
3342 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3345 else if (m_ptr->hp < randint0(nokori_hp))
3347 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3348 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3349 cap_mon = m_ptr->r_idx;
3350 cap_mspeed = m_ptr->mspeed;
3352 cap_maxhp = m_ptr->max_maxhp;
3353 cap_nickname = m_ptr->nickname; /* Quark transfer */
3354 if (g_ptr->m_idx == caster_ptr->riding)
3356 if (rakuba(caster_ptr, -1, FALSE))
3358 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3362 delete_monster_idx(g_ptr->m_idx);
3368 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3374 /* Attack (Use "dam" as attack type) */
3377 /* Return this monster's death */
3378 return py_attack(caster_ptr, y, x, dam);
3381 /* Sleep (Use "dam" as "power") */
3387 if (seen) obvious = TRUE;
3388 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3390 note = _("には効果がなかった。", " is unaffected.");
3393 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3396 if (MON_CSLEEP(m_ptr))
3398 note = _("には効果がなかった。", " is unaffected.");
3404 if (one_in_(5)) effect = 1;
3405 else if (one_in_(4)) effect = 2;
3406 else if (one_in_(3)) effect = 3;
3411 /* Powerful monsters can resist */
3412 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3413 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3415 note = _("には効果がなかった。", " is unaffected.");
3419 /* Normal monsters slow down */
3422 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3424 note = _("の動きが遅くなった。", " starts moving slower.");
3429 else if (effect == 2)
3431 do_stun = damroll((caster_ptr->lev / 10) + 3, (dam)) + 1;
3433 /* Attempt a saving throw */
3434 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3435 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3440 /* No obvious effect */
3441 note = _("には効果がなかった。", " is unaffected.");
3446 else if (effect == 3)
3448 /* Attempt a saving throw */
3449 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3450 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3451 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3453 /* Memorize a flag */
3454 if (r_ptr->flags3 & RF3_NO_SLEEP)
3456 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3459 /* No obvious effect */
3460 note = _("には効果がなかった。", " is unaffected.");
3465 /* Go to sleep (much) later */
3466 note = _("は眠り込んでしまった!", " falls asleep!");
3473 note = _("には効果がなかった。", " is unaffected.");
3476 /* No "real" damage */
3484 if (seen) obvious = TRUE;
3485 if (genocide_aux(caster_ptr, g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3487 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3488 chg_virtue(caster_ptr, V_VITALITY, -1);
3498 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3500 if (r_ptr->flags3 & (RF3_HURT_LITE))
3502 /* Obvious effect */
3503 if (seen) obvious = TRUE;
3505 /* Memorize the effects */
3506 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3508 /* Special effect */
3509 note = _("は光に身をすくめた!", " cringes from the light!");
3510 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3513 /* Normally no damage */
3520 photo = m_ptr->r_idx;
3527 case GF_BLOOD_CURSE:
3529 if (seen) obvious = TRUE;
3535 bool success = FALSE;
3536 if (seen) obvious = TRUE;
3538 if ((r_ptr->flags3 & (RF3_GOOD)) && !floor_ptr->inside_arena)
3540 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3541 if (dam < 1) dam = 1;
3543 /* No need to tame your pet */
3546 note = _("の動きが速くなった。", " starts moving faster.");
3547 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3551 /* Attempt a saving throw */
3552 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3553 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3554 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3555 (caster_ptr->cursed & TRC_AGGRAVATE) ||
3556 ((r_ptr->level + 10) > randint1(dam)))
3559 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3563 note = _("を支配した。", " is tamed!");
3565 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3567 /* Learn about type */
3568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3575 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3577 do_fear = randint1(90) + 10;
3579 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3582 /* No "real" damage */
3589 if (seen) obvious = TRUE;
3590 /* Attempt a saving throw */
3591 if (randint0(100 + dam) < (r_ptr->level + 50))
3593 note = _("には効果がなかった。", " is unaffected.");
3613 /* Absolutely no effect */
3614 if (skipped) return (FALSE);
3616 /* "Unique" monsters cannot be polymorphed */
3617 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3619 /* Quest monsters cannot be polymorphed */
3620 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3622 if (caster_ptr->riding && (g_ptr->m_idx == caster_ptr->riding)) do_poly = FALSE;
3624 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3625 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !caster_ptr->phase_out)
3627 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3632 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(caster_ptr, V_COMPASSION, -1);
3633 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(caster_ptr, V_HONOUR, -1);
3636 /* Modify the damage */
3638 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3639 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3641 /* Check for death */
3642 if (dam > m_ptr->hp)
3644 /* Extract method of death */
3649 /* Sound and Impact resisters never stun */
3651 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3652 !(r_ptr->flags3 & RF3_NO_STUN))
3654 if (seen) obvious = TRUE;
3657 if (MON_STUNNED(m_ptr))
3659 note = _("はひどくもうろうとした。", " is more dazed.");
3660 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3664 note = _("はもうろうとした。", " is dazed.");
3669 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3675 /* Confusion and Chaos resisters (and sleepers) never confuse */
3677 !(r_ptr->flags3 & RF3_NO_CONF) &&
3678 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3680 if (seen) obvious = TRUE;
3682 /* Already partially confused */
3683 if (MON_CONFUSED(m_ptr))
3685 note = _("はさらに混乱したようだ。", " looks more confused.");
3686 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3689 /* Was not confused */
3692 note = _("は混乱したようだ。", " looks confused.");
3696 /* Apply confusion */
3697 (void)set_monster_confused(g_ptr->m_idx, tmp);
3705 if (seen) obvious = TRUE;
3707 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3711 note = _("は弱くなったようだ。", " seems weakened.");
3712 m_ptr->maxhp -= do_time;
3713 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3718 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3719 if (do_poly && (randint1(90) > r_ptr->level))
3721 if (polymorph_monster(caster_ptr, y, x))
3723 if (seen) obvious = TRUE;
3725 /* Monster polymorphs */
3726 note = _("が変身した!", " changes!");
3728 /* Turn off the damage */
3732 /* Hack -- Get new monster */
3733 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
3735 /* Hack -- Get new race */
3736 r_ptr = &r_info[m_ptr->r_idx];
3739 /* Handle "teleport" */
3742 if (seen) obvious = TRUE;
3744 note = _("が消え去った!", " disappears!");
3746 if (!who) chg_virtue(caster_ptr, V_VALOUR, -1);
3749 teleport_away(caster_ptr, g_ptr->m_idx, do_dist,
3750 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3752 /* Hack -- get new location */
3756 /* Hack -- get new grid */
3757 g_ptr = &floor_ptr->grid_array[y][x];
3764 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3771 if (typ == GF_DRAIN_MANA)
3773 /* Drain mana does nothing */
3776 /* If another monster did the damage, hurt the monster by hand */
3779 /* Redraw (later) if needed */
3780 if (caster_ptr->health_who == g_ptr->m_idx) caster_ptr->redraw |= (PR_HEALTH);
3781 if (caster_ptr->riding == g_ptr->m_idx) caster_ptr->redraw |= (PR_UHEALTH);
3783 /* Wake the monster up */
3784 (void)set_monster_csleep(g_ptr->m_idx, 0);
3786 /* Hurt the monster */
3794 if (is_pet(m_ptr) && !(m_ptr->ml))
3797 /* Give detailed messages if destroyed */
3800 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3803 msg_format("%^s%s", m_name, note);
3807 floor_ptr->monster_noise = TRUE;
3811 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3813 /* Generate treasure, etc */
3814 monster_death(g_ptr->m_idx, FALSE);
3817 delete_monster_idx(g_ptr->m_idx);
3821 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3825 /* Damaged monster */
3828 /* Give detailed messages if visible or destroyed */
3829 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3831 /* Hack -- Pain message */
3834 message_pain(g_ptr->m_idx, dam);
3838 floor_ptr->monster_noise = TRUE;
3841 /* Hack -- handle sleep */
3842 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3846 else if (heal_leper)
3848 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3850 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3852 char m2_name[MAX_NLEN];
3854 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3855 exe_write_diary(caster_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3858 delete_monster_idx(g_ptr->m_idx);
3861 /* If the player did it, give him experience, check fear */
3866 /* Hurt the monster, check for fear and death */
3867 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3872 /* Damaged monster */
3875 /* HACK - anger the monster before showing the sleep message */
3876 if (do_sleep) anger_monster(m_ptr);
3878 /* Give detailed messages if visible or destroyed */
3879 if (note && seen_msg)
3880 msg_format(_("%s%s", "%^s%s"), m_name, note);
3882 /* Hack -- Pain message */
3883 else if (known && (dam || !do_fear))
3885 message_pain(g_ptr->m_idx, dam);
3888 /* Anger monsters */
3889 if (((dam > 0) || get_angry) && !do_sleep)
3890 anger_monster(m_ptr);
3892 if ((fear || do_fear) && seen)
3895 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3898 /* Hack -- handle sleep */
3899 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3903 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3905 blood_curse_to_enemy(caster_ptr, who);
3908 if (caster_ptr->phase_out)
3910 caster_ptr->health_who = g_ptr->m_idx;
3911 caster_ptr->redraw |= (PR_HEALTH);
3912 handle_stuff(caster_ptr);
3915 /* Verify this code */
3916 if (m_ptr->r_idx) update_monster(caster_ptr, g_ptr->m_idx, FALSE);
3918 /* Redraw the monster grid */
3921 /* Update monster recall window */
3922 if ((caster_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3924 caster_ptr->window |= (PW_MONSTER);
3927 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3931 if (!(flg & PROJECT_NO_HANGEKI))
3933 set_target(m_ptr, monster_target_y, monster_target_x);
3936 else if ((who > 0) && is_pet(m_caster_ptr) && !player_bold(caster_ptr, m_ptr->target_y, m_ptr->target_x))
3938 set_target(m_ptr, m_caster_ptr->fy, m_caster_ptr->fx);
3942 if (caster_ptr->riding && (caster_ptr->riding == g_ptr->m_idx) && (dam > 0))
3944 if (m_ptr->hp > m_ptr->maxhp / 3) dam = (dam + 1) / 2;
3945 rakubadam_m = (dam > 200) ? 200 : dam;
3955 /* Prepare to make a Blade of Chaos */
3956 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3958 q_ptr->pval = photo;
3960 /* Mark the item as fully known */
3961 q_ptr->ident |= (IDENT_MENTAL);
3962 (void)drop_near(caster_ptr, q_ptr, -1, caster_ptr->y, caster_ptr->x);
3970 /* Return "Anything seen?" */
3976 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
3977 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
3978 * @param who_name 効果を起こしたモンスターの名前
3979 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
3980 * @param y 目標Y座標 / Target y location (or location to travel "towards")
3981 * @param x 目標X座標 / Target x location (or location to travel "towards")
3982 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
3983 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
3985 * @param monspell 効果元のモンスター魔法ID
3986 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
3988 * Handle a beam/bolt/ball causing damage to the player.
3989 * This routine takes a "source monster" (by index), a "distance", a default
3990 * "damage", and a "damage type". See "project_m()" above.
3991 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
3992 * is reduced (see "project_m()" above). This can happen if a monster breathes
3993 * at the player and hits a wall instead.
3994 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
3995 * to know if this is actually a ball or a bolt spell
3996 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
3997 * we just assume that the effects were obvious, for historical reasons.
3999 static bool project_p(MONSTER_IDX who, player_type *target_ptr, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
4004 /* Hack -- assume obvious */
4005 bool obvious = TRUE;
4007 /* Player blind-ness */
4008 bool blind = (target_ptr->blind ? TRUE : FALSE);
4010 /* Player needs a "description" (he is blind) */
4013 /* Source monster */
4014 monster_type *m_ptr = NULL;
4016 /* Monster name (for attacks) */
4017 GAME_TEXT m_name[MAX_NLEN];
4019 /* Monster name (for damage) */
4022 /* Hack -- messages */
4028 /* Player is not here */
4029 if (!player_bold(target_ptr, y, x)) return (FALSE);
4031 if ((target_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (target_ptr->lev * 3 / 5 + 20)) && who && (who != target_ptr->riding))
4033 if (kawarimi(target_ptr, TRUE)) return FALSE;
4036 /* Player cannot hurt himself */
4037 if (!who) return (FALSE);
4038 if (who == target_ptr->riding) return (FALSE);
4040 if ((target_ptr->reflect || ((target_ptr->special_defense & KATA_FUUJIN) && !target_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4043 int max_attempts = 10;
4044 sound(SOUND_REFLECT);
4047 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4048 else if (target_ptr->special_defense & KATA_FUUJIN)
4049 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4051 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4053 /* Choose 'new' target */
4058 t_y = target_ptr->current_floor_ptr->m_list[who].fy - 1 + randint1(3);
4059 t_x = target_ptr->current_floor_ptr->m_list[who].fx - 1 + randint1(3);
4061 } while (max_attempts && in_bounds2u(target_ptr->current_floor_ptr, t_y, t_x) && !projectable(target_ptr->current_floor_ptr, target_ptr->y, target_ptr->x, t_y, t_x));
4063 if (max_attempts < 1)
4065 t_y = target_ptr->current_floor_ptr->m_list[who].fy;
4066 t_x = target_ptr->current_floor_ptr->m_list[who].fx;
4071 t_y = target_ptr->y - 1 + randint1(3);
4072 t_x = target_ptr->x - 1 + randint1(3);
4075 project(target_ptr, 0, 0, t_y, t_x, dam, typ, (PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE), monspell);
4077 disturb(target_ptr, TRUE, TRUE);
4081 /* Limit maximum damage */
4082 if (dam > 1600) dam = 1600;
4084 /* Reduce damage by distance */
4085 dam = (dam + r) / (r + 1);
4088 /* If the player is blind, be more descriptive */
4089 if (blind) fuzzy = TRUE;
4094 m_ptr = &target_ptr->current_floor_ptr->m_list[who];
4095 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4096 monster_desc(m_name, m_ptr, 0);
4098 /* Get the monster's real name (gotten before polymorph!) */
4099 strcpy(killer, who_name);
4105 case PROJECT_WHO_UNCTRL_POWER:
4106 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4109 case PROJECT_WHO_GLASS_SHARDS:
4110 strcpy(killer, _("ガラスの破片", "shards of glass"));
4114 strcpy(killer, _("罠", "a trap"));
4117 strcpy(m_name, killer);
4120 /* Analyze the damage */
4123 /* Standard damage -- hurts target_ptr->inventory_list too */
4126 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4127 get_damage = acid_dam(target_ptr, dam, killer, monspell, FALSE);
4131 /* Standard damage -- hurts target_ptr->inventory_list too */
4134 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4135 get_damage = fire_dam(target_ptr, dam, killer, monspell, FALSE);
4139 /* Standard damage -- hurts target_ptr->inventory_list too */
4142 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4143 get_damage = cold_dam(target_ptr, dam, killer, monspell, FALSE);
4147 /* Standard damage -- hurts target_ptr->inventory_list too */
4150 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4151 get_damage = elec_dam(target_ptr, dam, killer, monspell, FALSE);
4155 /* Standard damage -- also poisons player */
4158 bool double_resist = IS_OPPOSE_POIS();
4159 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4161 if (target_ptr->resist_pois) dam = (dam + 2) / 3;
4162 if (double_resist) dam = (dam + 2) / 3;
4164 if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW(target_ptr))
4166 do_dec_stat(target_ptr, A_CON);
4169 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4171 if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
4173 set_poisoned(target_ptr, target_ptr->poisoned + randint0(dam) + 10);
4178 /* Standard damage -- also poisons / mutates player */
4181 bool double_resist = IS_OPPOSE_POIS();
4182 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4184 if (target_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4185 if (double_resist) dam = (2 * dam + 2) / 5;
4186 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4187 if (!(double_resist || target_ptr->resist_pois) && !CHECK_MULTISHADOW(target_ptr))
4189 set_poisoned(target_ptr, target_ptr->poisoned + randint0(dam) + 10);
4191 if (one_in_(5)) /* 6 */
4193 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4194 if (one_in_(4)) /* 4 */
4195 do_poly_self(target_ptr);
4197 status_shuffle(target_ptr);
4202 inventory_damage(target_ptr, set_acid_destroy, 2);
4208 /* Standard damage */
4211 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4212 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4216 /* Holy Orb -- Player only takes partial damage */
4219 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4220 if (target_ptr->align > 10)
4222 else if (target_ptr->align < -10)
4224 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4230 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4231 if (target_ptr->align > 10)
4233 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4237 /* Arrow -- XXX no dodging */
4242 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4244 else if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
4246 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4249 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4253 /* Plasma -- XXX No resist */
4256 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4257 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4259 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
4261 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4262 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
4265 if (!(target_ptr->resist_fire || IS_OPPOSE_FIRE() || target_ptr->immune_fire))
4267 inventory_damage(target_ptr, set_acid_destroy, 3);
4273 /* Nether -- drain experience */
4276 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4277 if (target_ptr->resist_neth)
4279 if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
4281 dam *= 6; dam /= (randint1(4) + 7);
4284 else if (!CHECK_MULTISHADOW(target_ptr)) drain_exp(target_ptr, 200 + (target_ptr->exp / 100), 200 + (target_ptr->exp / 1000), 75);
4286 if (PRACE_IS_(target_ptr, RACE_SPECTRE) && !CHECK_MULTISHADOW(target_ptr))
4288 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4289 hp_player(target_ptr, dam / 4);
4290 learn_spell(target_ptr, monspell);
4294 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4300 /* Water -- stun/confuse */
4303 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4304 if (!CHECK_MULTISHADOW(target_ptr))
4306 if (!target_ptr->resist_sound && !target_ptr->resist_water)
4308 set_stun(target_ptr, target_ptr->stun + randint1(40));
4310 if (!target_ptr->resist_conf && !target_ptr->resist_water)
4312 set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
4315 if (one_in_(5) && !target_ptr->resist_water)
4317 inventory_damage(target_ptr, set_cold_destroy, 3);
4320 if (target_ptr->resist_water) get_damage /= 4;
4323 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4327 /* Chaos -- many effects */
4330 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4331 if (target_ptr->resist_chaos)
4333 dam *= 6; dam /= (randint1(4) + 7);
4336 if (!CHECK_MULTISHADOW(target_ptr))
4338 if (!target_ptr->resist_conf)
4340 (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
4342 if (!target_ptr->resist_chaos)
4344 (void)set_image(target_ptr, target_ptr->image + randint1(10));
4347 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4348 (void)gain_mutation(target_ptr, 0);
4351 if (!target_ptr->resist_neth && !target_ptr->resist_chaos)
4353 drain_exp(target_ptr, 5000 + (target_ptr->exp / 100), 500 + (target_ptr->exp / 1000), 75);
4356 if (!target_ptr->resist_chaos || one_in_(9))
4358 inventory_damage(target_ptr, set_elec_destroy, 2);
4359 inventory_damage(target_ptr, set_fire_destroy, 2);
4363 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4367 /* Shards -- mostly cutting */
4370 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4371 if (target_ptr->resist_shard)
4373 dam *= 6; dam /= (randint1(4) + 7);
4375 else if (!CHECK_MULTISHADOW(target_ptr))
4377 (void)set_cut(target_ptr, target_ptr->cut + dam);
4380 if (!target_ptr->resist_shard || one_in_(13))
4382 inventory_damage(target_ptr, set_cold_destroy, 2);
4385 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4389 /* Sound -- mostly stunning */
4392 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4393 if (target_ptr->resist_sound)
4395 dam *= 5; dam /= (randint1(4) + 7);
4397 else if (!CHECK_MULTISHADOW(target_ptr))
4399 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4400 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
4403 if (!target_ptr->resist_sound || one_in_(13))
4405 inventory_damage(target_ptr, set_cold_destroy, 2);
4408 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4412 /* Pure confusion */
4415 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4416 if (target_ptr->resist_conf)
4418 dam *= 5; dam /= (randint1(4) + 7);
4420 else if (!CHECK_MULTISHADOW(target_ptr))
4422 (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
4424 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4428 /* Disenchantment -- see above */
4431 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4432 if (target_ptr->resist_disen)
4434 dam *= 6; dam /= (randint1(4) + 7);
4436 else if (!CHECK_MULTISHADOW(target_ptr))
4438 (void)apply_disenchant(target_ptr, 0);
4440 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4444 /* Nexus -- see above */
4447 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4448 if (target_ptr->resist_nexus)
4450 dam *= 6; dam /= (randint1(4) + 7);
4452 else if (!CHECK_MULTISHADOW(target_ptr))
4454 apply_nexus(m_ptr, target_ptr);
4456 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4460 /* Force -- mostly stun */
4463 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4464 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
4466 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
4468 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4473 /* Rocket -- stun, cut */
4476 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4477 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr))
4479 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
4482 if (target_ptr->resist_shard)
4486 else if (!CHECK_MULTISHADOW(target_ptr))
4488 (void)set_cut(target_ptr, target_ptr->cut + (dam / 2));
4491 if (!target_ptr->resist_shard || one_in_(12))
4493 inventory_damage(target_ptr, set_cold_destroy, 3);
4496 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4500 /* Inertia -- slowness */
4503 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4504 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4505 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4509 /* Lite -- blinding */
4512 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4513 if (target_ptr->resist_lite)
4515 dam *= 4; dam /= (randint1(4) + 7);
4517 else if (!blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
4519 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
4522 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE))
4524 if (!CHECK_MULTISHADOW(target_ptr)) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4527 else if (PRACE_IS_(target_ptr, RACE_S_FAIRY))
4532 if (target_ptr->wraith_form) dam *= 2;
4533 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4535 if (target_ptr->wraith_form && !CHECK_MULTISHADOW(target_ptr))
4537 target_ptr->wraith_form = 0;
4538 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4539 "The light forces you out of your incorporeal shadow form."));
4541 target_ptr->redraw |= (PR_MAP | PR_STATUS);
4542 target_ptr->update |= (PU_MONSTERS);
4543 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4549 /* Dark -- blinding */
4552 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4553 if (target_ptr->resist_dark)
4555 dam *= 4; dam /= (randint1(4) + 7);
4557 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) || (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form) dam = 0;
4559 else if (!blind && !target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
4561 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
4563 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4567 /* Time -- bolt fewer effects XXX */
4570 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4571 if (target_ptr->resist_time)
4574 dam /= (randint1(4) + 7);
4575 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4577 else if (!CHECK_MULTISHADOW(target_ptr))
4579 switch (randint1(10))
4581 case 1: case 2: case 3: case 4: case 5:
4583 if (target_ptr->prace == RACE_ANDROID) break;
4584 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4585 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
4589 case 6: case 7: case 8: case 9:
4591 switch (randint1(6))
4593 case 1: k = A_STR; act = _("強く", "strong"); break;
4594 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4595 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4596 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4597 case 5: k = A_CON; act = _("健康で", "hale"); break;
4598 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4601 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4602 "You're not as %s as you used to be..."), act);
4604 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
4605 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
4606 target_ptr->update |= (PU_BONUS);
4612 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4613 "You're not as powerful as you used to be..."));
4615 for (k = 0; k < A_MAX; k++)
4617 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
4618 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
4620 target_ptr->update |= (PU_BONUS);
4626 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4630 /* Gravity -- stun plus slowness plus teleport */
4633 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4634 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4636 if (!CHECK_MULTISHADOW(target_ptr))
4638 teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
4639 if (!target_ptr->levitation)
4640 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4641 if (!(target_ptr->resist_sound || target_ptr->levitation))
4643 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4644 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
4647 if (target_ptr->levitation)
4649 dam = (dam * 2) / 3;
4652 if (!target_ptr->levitation || one_in_(13))
4654 inventory_damage(target_ptr, set_cold_destroy, 2);
4657 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4661 /* Standard damage */
4662 case GF_DISINTEGRATE:
4664 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4666 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4672 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4674 (void)hp_player(target_ptr, dam);
4681 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4682 (void)set_fast(target_ptr, target_ptr->fast + randint1(5), FALSE);
4689 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4690 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4696 if (target_ptr->free_act) break;
4697 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4699 if (ironman_nightmare)
4701 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4702 /* Have some nightmares */
4703 sanity_blast(target_ptr, NULL, FALSE);
4706 set_paralyzed(target_ptr, target_ptr->paralyzed + dam);
4716 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4717 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4724 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4725 get_damage = take_hit(target_ptr, DAMAGE_FORCE, dam, killer, monspell);
4732 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4734 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4735 if (!target_ptr->resist_shard || one_in_(13))
4737 if (!target_ptr->immune_fire) inventory_damage(target_ptr, set_fire_destroy, 2);
4738 inventory_damage(target_ptr, set_cold_destroy, 2);
4744 /* Ice -- cold plus stun plus cuts */
4747 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4748 get_damage = cold_dam(target_ptr, dam, killer, monspell, FALSE);
4749 if (!CHECK_MULTISHADOW(target_ptr))
4751 if (!target_ptr->resist_shard)
4753 (void)set_cut(target_ptr, target_ptr->cut + damroll(5, 8));
4755 if (!target_ptr->resist_sound)
4757 (void)set_stun(target_ptr, target_ptr->stun + randint1(15));
4760 if ((!(target_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4762 if (!target_ptr->immune_cold) inventory_damage(target_ptr, set_cold_destroy, 3);
4772 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4774 if (target_ptr->mimic_form)
4776 if (!(mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4777 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4782 switch (target_ptr->prace)
4784 /* Some races are immune */
4798 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4810 if (CHECK_MULTISHADOW(target_ptr))
4812 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4814 else if (target_ptr->csp)
4818 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4820 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4823 if (dam >= target_ptr->csp)
4825 dam = target_ptr->csp;
4826 target_ptr->csp = 0;
4827 target_ptr->csp_frac = 0;
4833 target_ptr->csp -= dam;
4836 learn_spell(target_ptr, monspell);
4837 target_ptr->redraw |= (PR_MANA);
4838 target_ptr->window |= (PW_PLAYER | PW_SPELL);
4842 /* Heal the monster */
4843 if (m_ptr->hp < m_ptr->maxhp)
4847 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4849 /* Redraw (later) if needed */
4850 if (target_ptr->health_who == who) target_ptr->redraw |= (PR_HEALTH);
4851 if (target_ptr->riding == who) target_ptr->redraw |= (PR_UHEALTH);
4853 /* Special message */
4856 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4869 if ((randint0(100 + rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
4871 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4872 learn_spell(target_ptr, monspell);
4876 if (!CHECK_MULTISHADOW(target_ptr))
4878 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4880 if (!target_ptr->resist_conf)
4882 (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
4885 if (!target_ptr->resist_chaos && one_in_(3))
4887 (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
4890 target_ptr->csp -= 50;
4891 if (target_ptr->csp < 0)
4893 target_ptr->csp = 0;
4894 target_ptr->csp_frac = 0;
4896 target_ptr->redraw |= PR_MANA;
4899 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4905 case GF_BRAIN_SMASH:
4907 if ((randint0(100 + rlev / 2) < MAX(5, target_ptr->skill_sav)) && !CHECK_MULTISHADOW(target_ptr))
4909 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4910 learn_spell(target_ptr, monspell);
4914 if (!CHECK_MULTISHADOW(target_ptr))
4916 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4918 target_ptr->csp -= 100;
4919 if (target_ptr->csp < 0)
4921 target_ptr->csp = 0;
4922 target_ptr->csp_frac = 0;
4924 target_ptr->redraw |= PR_MANA;
4927 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4928 if (!CHECK_MULTISHADOW(target_ptr))
4930 if (!target_ptr->resist_blind)
4932 (void)set_blind(target_ptr, target_ptr->blind + 8 + randint0(8));
4934 if (!target_ptr->resist_conf)
4936 (void)set_confused(target_ptr, target_ptr->confused + randint0(4) + 4);
4938 if (!target_ptr->free_act)
4940 (void)set_paralyzed(target_ptr, target_ptr->paralyzed + randint0(4) + 4);
4942 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
4944 while (randint0(100 + rlev / 2) > (MAX(5, target_ptr->skill_sav)))
4945 (void)do_dec_stat(target_ptr, A_INT);
4946 while (randint0(100 + rlev / 2) > (MAX(5, target_ptr->skill_sav)))
4947 (void)do_dec_stat(target_ptr, A_WIS);
4949 if (!target_ptr->resist_chaos)
4951 (void)set_image(target_ptr, target_ptr->image + randint0(250) + 150);
4961 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4963 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4964 learn_spell(target_ptr, monspell);
4968 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(15, 0);
4969 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4977 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4979 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4980 learn_spell(target_ptr, monspell);
4984 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(25, MIN(rlev / 2 - 15, 5));
4985 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
4993 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
4995 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4996 learn_spell(target_ptr, monspell);
5000 if (!CHECK_MULTISHADOW(target_ptr)) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5001 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
5009 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW(target_ptr))
5011 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5012 learn_spell(target_ptr, monspell);
5016 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, killer, monspell);
5017 if (!CHECK_MULTISHADOW(target_ptr)) (void)set_cut(target_ptr, target_ptr->cut + damroll(10, 10));
5025 if ((randint0(100 + rlev / 2) < target_ptr->skill_sav) && !CHECK_MULTISHADOW(target_ptr))
5027 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5028 learn_spell(target_ptr, monspell);
5032 if (!CHECK_MULTISHADOW(target_ptr))
5034 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5035 curse_equipment(40, 20);
5038 get_damage = take_hit(target_ptr, DAMAGE_ATTACK, dam, m_name, monspell);
5040 if (target_ptr->chp < 1) target_ptr->chp = 1;
5055 /* Hex - revenge damage stored */
5056 revenge_store(target_ptr, get_damage);
5058 if ((target_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5059 && (get_damage > 0) && !target_ptr->is_dead && (who > 0))
5061 GAME_TEXT m_name_self[80];
5064 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5066 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5067 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5068 if (target_ptr->tim_eyeeye) set_tim_eyeeye(target_ptr, target_ptr->tim_eyeeye - 5, TRUE);
5071 if (target_ptr->riding && dam > 0)
5073 rakubadam_p = (dam > 200) ? 200 : dam;
5077 disturb(target_ptr, TRUE, TRUE);
5080 if ((target_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != target_ptr->riding))
5082 (void)kawarimi(target_ptr, FALSE);
5085 /* Return "Anything seen?" */
5091 * Find the distance from (x, y) to a line.
5093 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5095 /* Vector from (x, y) to (x1, y1) */
5096 POSITION py = y1 - y;
5097 POSITION px = x1 - x;
5100 POSITION ny = x2 - x1;
5101 POSITION nx = y1 - y2;
5104 POSITION pd = distance(y1, x1, y, x);
5105 POSITION nd = distance(y1, x1, y2, x2);
5107 if (pd > nd) return distance(y, x, y2, x2);
5109 /* Component of P on N */
5110 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5112 /* Absolute value */
5113 return((nd >= 0) ? nd : 0 - nd);
5119 * Modified version of los() for calculation of disintegration balls.
5120 * Disintegration effects are stopped by permanent walls.
5122 bool in_disintegration_range(floor_type *floor_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5124 POSITION dx, dy; /* Delta */
5125 POSITION ax, ay; /* Absolute */
5126 POSITION sx, sy; /* Signs */
5127 POSITION qx, qy; /* Fractions */
5128 POSITION tx, ty; /* Scanners */
5129 POSITION f1, f2; /* Scale factors */
5130 POSITION m; /* Slope, or 1/Slope, of LOS */
5132 /* Extract the offset */
5136 /* Extract the absolute offset */
5140 /* Handle adjacent (or identical) grids */
5141 if ((ax < 2) && (ay < 2)) return (TRUE);
5143 /* Paranoia -- require "safe" origin */
5144 /* if (!in_bounds(floor_ptr, y1, x1)) return (FALSE); */
5146 /* Directly South/North */
5149 /* South -- check for walls */
5152 for (ty = y1 + 1; ty < y2; ty++)
5154 if (cave_stop_disintegration(floor_ptr, ty, x1)) return (FALSE);
5158 /* North -- check for walls */
5161 for (ty = y1 - 1; ty > y2; ty--)
5163 if (cave_stop_disintegration(floor_ptr, ty, x1)) return (FALSE);
5171 /* Directly East/West */
5174 /* East -- check for walls */
5177 for (tx = x1 + 1; tx < x2; tx++)
5179 if (cave_stop_disintegration(floor_ptr, y1, tx)) return (FALSE);
5183 /* West -- check for walls */
5186 for (tx = x1 - 1; tx > x2; tx--)
5188 if (cave_stop_disintegration(floor_ptr, y1, tx)) return (FALSE);
5196 /* Extract some signs */
5197 sx = (dx < 0) ? -1 : 1;
5198 sy = (dy < 0) ? -1 : 1;
5200 /* Vertical "knights" */
5205 if (!cave_stop_disintegration(floor_ptr, y1 + sy, x1)) return (TRUE);
5209 /* Horizontal "knights" */
5214 if (!cave_stop_disintegration(floor_ptr, y1, x1 + sx)) return (TRUE);
5218 /* Calculate scale factor div 2 */
5221 /* Calculate scale factor */
5225 /* Travel horizontally */
5228 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5234 /* Consider the special case where slope == 1. */
5245 /* Note (below) the case (qy == f2), where */
5246 /* the LOS exactly meets the corner of a tile. */
5249 if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
5260 if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
5275 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5291 /* Note (below) the case (qx == f2), where */
5292 /* the LOS exactly meets the corner of a tile. */
5295 if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
5306 if (cave_stop_disintegration(floor_ptr, ty, tx)) return (FALSE);
5325 void breath_shape(floor_type *floor_ptr, u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
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(floor_ptr, 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(floor_ptr, by, bx, y, x)) continue;
5379 case GF_DISINTEGRATE:
5380 /* Disintegration are stopped only by perma-walls */
5381 if (!in_disintegration_range(floor_ptr, by, bx, y, x)) continue;
5384 /* Ball explosions are stopped by walls */
5385 if (!projectable(floor_ptr, 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(player_type *caster_ptr, 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 = (caster_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 = caster_ptr->y;
5619 monster_target_x = caster_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 = caster_ptr->current_floor_ptr->m_list[who].fx;
5644 y1 = caster_ptr->current_floor_ptr->m_list[who].fy;
5645 monster_desc(who_name, &caster_ptr->current_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;
5680 /* Hack -- Assume there will be no blast (max radius 32) */
5681 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5689 /* Collect beam grids */
5690 if (flg & (PROJECT_BEAM))
5701 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5703 case GF_DISINTEGRATE:
5704 flg |= (PROJECT_GRID);
5705 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5709 /* Calculate the projection path */
5711 path_n = project_path(caster_ptr->current_floor_ptr, path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5712 handle_stuff(caster_ptr);
5714 /* Giga-Hack SEEKER & SUPER_RAY */
5716 if (typ == GF_SEEKER)
5726 for (i = 0; i < path_n; ++i)
5731 POSITION ny = GRID_Y(path_g[i]);
5732 POSITION nx = GRID_X(path_g[i]);
5742 /* Only do visuals if requested */
5743 if (!blind && !(flg & (PROJECT_HIDE)))
5745 /* Only do visuals if the player can "see" the bolt */
5746 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5751 /* Obtain the bolt pict */
5752 u16b p = bolt_pict(oy, ox, y, x, typ);
5754 /* Extract attr/char */
5758 /* Visual effects */
5759 print_rel(caster_ptr, c, a, y, x);
5760 move_cursor_relative(y, x);
5762 Term_xtra(TERM_XTRA_DELAY, msec);
5766 /* Display "beam" grids */
5767 if (flg & (PROJECT_BEAM))
5769 /* Obtain the explosion pict */
5770 p = bolt_pict(y, x, y, x, typ);
5772 /* Extract attr/char */
5776 /* Visual effects */
5777 print_rel(caster_ptr, c, a, y, x);
5780 /* Hack -- Activate delay */
5784 /* Hack -- delay anyway for consistency */
5787 /* Delay for consistency */
5788 Term_xtra(TERM_XTRA_DELAY, msec);
5792 if (project_o(caster_ptr, 0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5793 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
5795 /* The target of monsterspell becomes tha mirror(broken) */
5796 monster_target_y = y;
5797 monster_target_x = x;
5799 remove_mirror(caster_ptr, y, x);
5800 next_mirror(caster_ptr, &oy, &ox, y, x);
5802 path_n = i + project_path(caster_ptr->current_floor_ptr, &(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5803 for (j = last_i; j <= i; j++)
5805 y = GRID_Y(path_g[j]);
5806 x = GRID_X(path_g[j]);
5807 if (project_m(caster_ptr, caster_ptr->current_floor_ptr, 0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5808 if (!who && (project_m_n == 1) && !jump) {
5809 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5811 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5815 if (!caster_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5816 health_track(caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5821 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_SEEKER);
5828 for (i = last_i; i < path_n; i++)
5831 py = GRID_Y(path_g[i]);
5832 px = GRID_X(path_g[i]);
5833 if (project_m(caster_ptr, caster_ptr->current_floor_ptr, 0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5835 if (!who && (project_m_n == 1) && !jump) {
5836 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0)
5838 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5842 if (!caster_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5843 health_track(caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5848 (void)project_f(caster_ptr, 0, 0, py, px, dam, GF_SEEKER);
5853 else if (typ == GF_SUPER_RAY)
5856 int second_step = 0;
5863 for (i = 0; i < path_n; ++i)
5868 POSITION ny = GRID_Y(path_g[i]);
5869 POSITION nx = GRID_X(path_g[i]);
5879 /* Only do visuals if requested */
5880 if (!blind && !(flg & (PROJECT_HIDE)))
5882 /* Only do visuals if the player can "see" the bolt */
5883 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
5890 /* Obtain the bolt pict */
5891 p = bolt_pict(oy, ox, y, x, typ);
5893 /* Extract attr/char */
5897 /* Visual effects */
5898 print_rel(caster_ptr, c, a, y, x);
5899 move_cursor_relative(y, x);
5900 /*if (fresh_before)*/ Term_fresh();
5901 Term_xtra(TERM_XTRA_DELAY, msec);
5903 /*if (fresh_before)*/ Term_fresh();
5905 /* Display "beam" grids */
5906 if (flg & (PROJECT_BEAM))
5908 /* Obtain the explosion pict */
5909 p = bolt_pict(y, x, y, x, typ);
5911 /* Extract attr/char */
5915 /* Visual effects */
5916 print_rel(caster_ptr, c, a, y, x);
5919 /* Hack -- Activate delay */
5923 /* Hack -- delay anyway for consistency */
5926 /* Delay for consistency */
5927 Term_xtra(TERM_XTRA_DELAY, msec);
5931 if (project_o(caster_ptr, 0, 0, y, x, dam, GF_SUPER_RAY))notice = TRUE;
5932 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT))
5934 if (second_step)continue;
5938 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) && !second_step)
5940 /* The target of monsterspell becomes tha mirror(broken) */
5941 monster_target_y = y;
5942 monster_target_x = x;
5944 remove_mirror(caster_ptr, y, x);
5945 for (j = 0; j <= i; j++)
5947 y = GRID_Y(path_g[j]);
5948 x = GRID_X(path_g[j]);
5949 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_SUPER_RAY);
5953 second_step = i + 1;
5954 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x - 1, flg);
5955 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x, flg);
5956 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y - 1, x + 1, flg);
5957 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x - 1, flg);
5958 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y, x + 1, flg);
5959 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x - 1, flg);
5960 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x, flg);
5961 path_n += project_path(caster_ptr->current_floor_ptr, &(path_g[path_n + 1]), (project_length ? project_length : MAX_RANGE), y, x, y + 1, x + 1, flg);
5965 for (i = 0; i < path_n; i++)
5967 POSITION py = GRID_Y(path_g[i]);
5968 POSITION px = GRID_X(path_g[i]);
5969 (void)project_m(caster_ptr, caster_ptr->current_floor_ptr, 0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
5970 if (!who && (project_m_n == 1) && !jump) {
5971 if (caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx > 0) {
5972 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx];
5976 if (!caster_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5977 health_track(caster_ptr->current_floor_ptr->grid_array[project_m_y][project_m_x].m_idx);
5982 (void)project_f(caster_ptr, 0, 0, py, px, dam, GF_SUPER_RAY);
5988 /* Project along the path */
5989 for (i = 0; i < path_n; ++i)
5994 POSITION ny = GRID_Y(path_g[i]);
5995 POSITION nx = GRID_X(path_g[i]);
5997 if (flg & PROJECT_DISI)
5999 /* Hack -- Balls explode before reaching walls */
6000 if (cave_stop_disintegration(caster_ptr->current_floor_ptr, ny, nx) && (rad > 0)) break;
6002 else if (flg & PROJECT_LOS)
6004 /* Hack -- Balls explode before reaching walls */
6005 if (!cave_los_bold(caster_ptr->current_floor_ptr, ny, nx) && (rad > 0)) break;
6009 /* Hack -- Balls explode before reaching walls */
6010 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT) && (rad > 0)) break;
6017 /* Collect beam grids */
6018 if (flg & (PROJECT_BEAM))
6025 /* Only do visuals if requested */
6026 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6028 /* Only do visuals if the player can "see" the bolt */
6029 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
6036 /* Obtain the bolt pict */
6037 p = bolt_pict(oy, ox, y, x, typ);
6039 /* Extract attr/char */
6043 /* Visual effects */
6044 print_rel(caster_ptr, c, a, y, x);
6045 move_cursor_relative(y, x);
6046 /*if (fresh_before)*/ Term_fresh();
6047 Term_xtra(TERM_XTRA_DELAY, msec);
6049 /*if (fresh_before)*/ Term_fresh();
6051 /* Display "beam" grids */
6052 if (flg & (PROJECT_BEAM))
6054 /* Obtain the explosion pict */
6055 p = bolt_pict(y, x, y, x, typ);
6057 /* Extract attr/char */
6061 /* Visual effects */
6062 print_rel(caster_ptr, c, a, y, x);
6065 /* Hack -- Activate delay */
6069 /* Hack -- delay anyway for consistency */
6072 /* Delay for consistency */
6073 Term_xtra(TERM_XTRA_DELAY, msec);
6080 /* Save the "blast epicenter" */
6084 if (breath && !path_n)
6090 flg &= ~(PROJECT_HIDE);
6094 /* Start the "explosion" */
6097 /* Hack -- make sure beams get to "explode" */
6105 /* If we found a "target", explode there */
6106 if (dist <= MAX_RANGE)
6108 /* Mega-Hack -- remove the final "beam" grid */
6109 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6112 * Create a conical breath attack
6123 flg &= ~(PROJECT_HIDE);
6125 breath_shape(caster_ptr->current_floor_ptr, path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6129 /* Determine the blast area, work from the inside out */
6130 for (dist = 0; dist <= rad; dist++)
6132 /* Scan the maximal blast area of radius "dist" */
6133 for (y = by - dist; y <= by + dist; y++)
6135 for (x = bx - dist; x <= bx + dist; x++)
6137 /* Ignore "illegal" locations */
6138 if (!in_bounds2(caster_ptr->current_floor_ptr, y, x)) continue;
6140 /* Enforce a "circular" explosion */
6141 if (distance(by, bx, y, x) != dist) continue;
6147 /* Lights are stopped by opaque terrains */
6148 if (!los(caster_ptr->current_floor_ptr, by, bx, y, x)) continue;
6150 case GF_DISINTEGRATE:
6151 /* Disintegration are stopped only by perma-walls */
6152 if (!in_disintegration_range(caster_ptr->current_floor_ptr, by, bx, y, x)) continue;
6155 /* Ball explosions are stopped by walls */
6156 if (!projectable(caster_ptr->current_floor_ptr, by, bx, y, x)) continue;
6160 /* Save this grid */
6167 /* Encode some more "radius" info */
6168 gm[dist + 1] = grids;
6173 /* Speed -- ignore "non-explosions" */
6174 if (!grids) return (FALSE);
6177 /* Display the "blast area" if requested */
6178 if (!blind && !(flg & (PROJECT_HIDE)))
6180 /* Then do the "blast", from inside out */
6181 for (t = 0; t <= gm_rad; t++)
6183 /* Dump everything with this radius */
6184 for (i = gm[t]; i < gm[t + 1]; i++)
6189 /* Only do visuals if the player can "see" the blast */
6190 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
6199 /* Obtain the explosion pict */
6200 p = bolt_pict(y, x, y, x, typ);
6202 /* Extract attr/char */
6206 /* Visual effects -- Display */
6207 print_rel(caster_ptr, c, a, y, x);
6211 /* Hack -- center the cursor */
6212 move_cursor_relative(by, bx);
6214 /* Flush each "radius" seperately */
6215 /*if (fresh_before)*/ Term_fresh();
6217 /* Delay (efficiently) */
6218 if (visual || drawn)
6220 Term_xtra(TERM_XTRA_DELAY, msec);
6224 /* Flush the erasing */
6227 /* Erase the explosion drawn above */
6228 for (i = 0; i < grids; i++)
6233 /* Hack -- Erase if needed */
6234 if (panel_contains(y, x) && player_has_los_bold(caster_ptr, y, x))
6240 /* Hack -- center the cursor */
6241 move_cursor_relative(by, bx);
6243 /* Flush the explosion */
6244 /*if (fresh_before)*/ Term_fresh();
6248 update_creature(caster_ptr);
6250 if (flg & PROJECT_KILL)
6252 see_s_msg = (who > 0) ? is_seen(&caster_ptr->current_floor_ptr->m_list[who]) :
6253 (!who ? TRUE : (player_can_see_bold(caster_ptr, y1, x1) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y1, x1)));
6256 /* Check features */
6257 if (flg & (PROJECT_GRID))
6259 /* Start with "dist" of zero */
6262 /* Scan for features */
6263 for (i = 0; i < grids; i++)
6265 /* Hack -- Notice new "dist" values */
6266 if (gm[dist + 1] == i) dist++;
6268 /* Get the grid location */
6272 /* Find the closest point in the blast */
6275 int d = dist_to_line(y, x, y1, x1, by, bx);
6277 /* Affect the grid */
6278 if (project_f(caster_ptr, who, d, y, x, dam, typ)) notice = TRUE;
6283 /* Affect the grid */
6284 if (project_f(caster_ptr, who, dist, y, x, dam, typ)) notice = TRUE;
6289 update_creature(caster_ptr);
6292 if (flg & (PROJECT_ITEM))
6294 /* Start with "dist" of zero */
6297 /* Scan for objects */
6298 for (i = 0; i < grids; i++)
6300 /* Hack -- Notice new "dist" values */
6301 if (gm[dist + 1] == i) dist++;
6303 /* Get the grid location */
6307 /* Find the closest point in the blast */
6310 int d = dist_to_line(y, x, y1, x1, by, bx);
6312 /* Affect the object in the grid */
6313 if (project_o(caster_ptr, who, d, y, x, dam, typ)) notice = TRUE;
6317 /* Affect the object in the grid */
6318 if (project_o(caster_ptr, who, dist, y, x, dam, typ)) notice = TRUE;
6323 /* Check monsters */
6324 if (flg & (PROJECT_KILL))
6331 /* Start with "dist" of zero */
6334 /* Scan for monsters */
6335 for (i = 0; i < grids; i++)
6339 /* Hack -- Notice new "dist" values */
6340 if (gm[dist + 1] == i) dist++;
6342 /* Get the grid location */
6346 /* A single bolt may be reflected */
6349 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[y][x].m_idx];
6350 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6352 if ((flg & PROJECT_REFLECTABLE) && caster_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6353 ((caster_ptr->current_floor_ptr->grid_array[y][x].m_idx != caster_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6354 (!who || dist_hack > 1) && !one_in_(10))
6357 int max_attempts = 10;
6359 /* Choose 'new' target */
6362 t_y = y_saver - 1 + randint1(3);
6363 t_x = x_saver - 1 + randint1(3);
6365 } while (max_attempts && in_bounds2u(caster_ptr->current_floor_ptr, t_y, t_x) && !projectable(caster_ptr->current_floor_ptr, y, x, t_y, t_x));
6367 if (max_attempts < 1)
6373 sound(SOUND_REFLECT);
6376 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6377 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6378 else if (m_ptr->r_idx == MON_DIO)
6379 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6381 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6383 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6385 /* Reflected bolts randomly target either one */
6386 if (player_bold(caster_ptr, y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6387 else flg |= PROJECT_PLAYER;
6389 /* The bolt is reflected */
6390 project(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6392 /* Don't affect the monster any longer */
6398 /* Find the closest point in the blast */
6401 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6405 effective_dist = dist;
6409 /* There is the riding player on this monster */
6410 if (caster_ptr->riding && player_bold(caster_ptr, y, x))
6412 /* Aimed on the player */
6413 if (flg & PROJECT_PLAYER)
6415 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6418 * A beam or bolt is well aimed
6420 * So don't affects the mount.
6427 * The spell is not well aimed,
6428 * So partly affect the mount too.
6435 * This grid is the original target.
6436 * Or aimed on your horse.
6438 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6440 /* Hit the mount with full damage */
6444 * Otherwise this grid is not the
6445 * original target, it means that line
6446 * of fire is obstructed by this
6450 * A beam or bolt will hit either
6451 * player or mount. Choose randomly.
6453 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6457 /* Hit the mount with full damage */
6461 /* Hit the player later */
6462 flg |= PROJECT_PLAYER;
6464 /* Don't affect the mount */
6470 * The spell is not well aimed, so
6471 * partly affect both player and
6480 /* Affect the monster in the grid */
6481 if (project_m(caster_ptr, caster_ptr->current_floor_ptr, who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6485 /* Player affected one monster (without "jumping") */
6486 if (!who && (project_m_n == 1) && !jump)
6491 /* Track if possible */
6492 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx > 0)
6494 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[caster_ptr->current_floor_ptr->grid_array[y][x].m_idx];
6498 if (!caster_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6499 health_track(caster_ptr->current_floor_ptr->grid_array[y][x].m_idx);
6507 if (flg & (PROJECT_KILL))
6509 /* Start with "dist" of zero */
6512 /* Scan for player */
6513 for (i = 0; i < grids; i++)
6517 /* Hack -- Notice new "dist" values */
6518 if (gm[dist + 1] == i) dist++;
6520 /* Get the grid location */
6524 /* Affect the player? */
6525 if (!player_bold(caster_ptr, y, x)) continue;
6527 /* Find the closest point in the blast */
6530 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6534 effective_dist = dist;
6537 /* Target may be your horse */
6538 if (caster_ptr->riding)
6540 /* Aimed on the player */
6541 if (flg & PROJECT_PLAYER)
6543 /* Hit the player with full damage */
6547 * Hack -- When this grid was not the
6548 * original target, a beam or bolt
6549 * would hit either player or mount,
6550 * and should be choosen randomly.
6552 * But already choosen to hit the
6553 * mount at this point.
6555 * Or aimed on your horse.
6557 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6560 * A beam or bolt is well aimed
6562 * So don't affects the player.
6569 * The spell is not well aimed,
6570 * So partly affect the player too.
6576 /* Affect the player */
6577 if (project_p(who, caster_ptr, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6581 if (caster_ptr->riding)
6583 GAME_TEXT m_name[MAX_NLEN];
6585 monster_desc(m_name, &caster_ptr->current_floor_ptr->m_list[caster_ptr->riding], 0);
6587 if (rakubadam_m > 0)
6589 if (rakuba(caster_ptr, rakubadam_m, FALSE))
6591 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6594 if (caster_ptr->riding && rakubadam_p > 0)
6596 if (rakuba(caster_ptr, rakubadam_p, FALSE))
6598 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6603 /* Return "something was noticed" */
6608 * @brief 鏡魔法「封魔結界」の効果処理
6610 * @return 効果があったらTRUEを返す
6612 bool binding_field(player_type *caster_ptr, HIT_POINT dam)
6614 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6615 int mirror_num = 0; /* 鏡の数 */
6617 POSITION centersign;
6618 POSITION x1, x2, y1, y2;
6620 int msec = delay_factor*delay_factor*delay_factor;
6623 POSITION point_x[3];
6624 POSITION point_y[3];
6626 /* Default target of monsterspell is player */
6627 monster_target_y = caster_ptr->y;
6628 monster_target_x = caster_ptr->x;
6630 for (x = 0; x < caster_ptr->current_floor_ptr->width; x++)
6632 for (y = 0; y < caster_ptr->current_floor_ptr->height; y++)
6634 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]) &&
6635 distance(caster_ptr->y, caster_ptr->x, y, x) <= MAX_RANGE &&
6636 distance(caster_ptr->y, caster_ptr->x, y, x) != 0 &&
6637 player_has_los_bold(caster_ptr, y, x) &&
6638 projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
6640 mirror_y[mirror_num] = y;
6641 mirror_x[mirror_num] = x;
6647 if (mirror_num < 2)return FALSE;
6649 point_x[0] = randint0(mirror_num);
6651 point_x[1] = randint0(mirror_num);
6652 } while (point_x[0] == point_x[1]);
6654 point_y[0] = mirror_y[point_x[0]];
6655 point_x[0] = mirror_x[point_x[0]];
6656 point_y[1] = mirror_y[point_x[1]];
6657 point_x[1] = mirror_x[point_x[1]];
6658 point_y[2] = caster_ptr->y;
6659 point_x[2] = caster_ptr->x;
6661 x = point_x[0] + point_x[1] + point_x[2];
6662 y = point_y[0] + point_y[1] + point_y[2];
6664 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6665 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6666 if (centersign == 0)return FALSE;
6668 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6669 x1 = x1 < point_x[2] ? x1 : point_x[2];
6670 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6671 y1 = y1 < point_y[2] ? y1 : point_y[2];
6673 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6674 x2 = x2 > point_x[2] ? x2 : point_x[2];
6675 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6676 y2 = y2 > point_y[2] ? y2 : point_y[2];
6678 for (y = y1; y <= y2; y++)
6680 for (x = x1; x <= x2; x++)
6682 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6683 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6684 centersign*((point_x[1] - x)*(point_y[2] - y)
6685 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6686 centersign*((point_x[2] - x)*(point_y[0] - y)
6687 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6689 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
6691 /* Visual effects */
6692 if (!(caster_ptr->blind)
6693 && panel_contains(y, x))
6695 p = bolt_pict(y, x, y, x, GF_MANA);
6696 print_rel(caster_ptr, PICT_C(p), PICT_A(p), y, x);
6697 move_cursor_relative(y, x);
6698 /*if (fresh_before)*/ Term_fresh();
6699 Term_xtra(TERM_XTRA_DELAY, msec);
6706 for (y = y1; y <= y2; y++)
6708 for (x = x1; x <= x2; x++)
6710 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6711 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6712 centersign*((point_x[1] - x)*(point_y[2] - y)
6713 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6714 centersign*((point_x[2] - x)*(point_y[0] - y)
6715 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6717 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
6719 (void)project_f(caster_ptr, 0, 0, y, x, dam, GF_MANA);
6725 for (y = y1; y <= y2; y++)
6727 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(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
6738 (void)project_o(caster_ptr, 0, 0, y, x, dam, GF_MANA);
6744 for (y = y1; y <= y2; y++)
6746 for (x = x1; x <= x2; x++)
6748 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6749 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6750 centersign*((point_x[1] - x)*(point_y[2] - y)
6751 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6752 centersign*((point_x[2] - x)*(point_y[0] - y)
6753 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6755 if (player_has_los_bold(caster_ptr, y, x) && projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x))
6757 (void)project_m(caster_ptr, caster_ptr->current_floor_ptr, 0, 0, y, x, dam, GF_MANA,
6758 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6766 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6767 remove_mirror(caster_ptr, point_y[0], point_x[0]);
6774 * @brief 鏡魔法「鏡の封印」の効果処理
6776 * @return 効果があったらTRUEを返す
6778 void seal_of_mirror(player_type *caster_ptr, HIT_POINT dam)
6780 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
6782 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
6784 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
6787 if (!project_m(caster_ptr, caster_ptr->current_floor_ptr, 0, 0, y, x, dam, GF_GENOCIDE,
6788 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6791 if (!caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
6793 remove_mirror(caster_ptr, y, x);
6801 * @brief 領域魔法に応じて技能の名称を返す。
6802 * @param tval 魔法書のtval
6803 * @return 領域魔法の技能名称を保管した文字列ポインタ
6805 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6809 case TV_HISSATSU_BOOK:
6810 return _("必殺技", "art");
6812 return _("祈り", "prayer");
6814 return _("歌", "song");
6816 return _("呪文", "spell");