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.
17 #include "object-curse.h"
18 #include "player-damage.h"
21 #include "monster-status.h"
22 #include "spells-diceroll.h"
23 #include "spells-summon.h"
24 #include "monsterrace-hook.h"
28 #include "projection.h"
33 #include "player-status.h"
34 #include "realm-hex.h"
35 #include "object-hook.h"
38 static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
39 static int rakubadam_p; /*!< 落馬した際のダメージ量 */
41 int project_length = 0; /*!< 投射の射程距離 */
46 * @brief 配置した鏡リストの次を取得する /
47 * Get another mirror. for SEEKER
48 * @param next_y 次の鏡のy座標を返す参照ポインタ
49 * @param next_x 次の鏡のx座標を返す参照ポインタ
50 * @param cury 現在の鏡のy座標
51 * @param curx 現在の鏡のx座標
53 static void next_mirror(POSITION* next_y, POSITION* next_x, POSITION cury, POSITION curx)
55 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
56 int mirror_num = 0; /* 鏡の数 */
60 for (x = 0; x < cur_wid; x++)
62 for (y = 0; y < cur_hgt; y++)
64 if (is_mirror_grid(&grid_array[y][x])) {
65 mirror_y[mirror_num] = y;
66 mirror_x[mirror_num] = x;
73 num = randint0(mirror_num);
74 *next_y = mirror_y[num];
75 *next_x = mirror_x[num];
78 *next_y = cury + randint0(5) - 2;
79 *next_x = curx + randint0(5) - 2;
84 * @brief 万色表現用にランダムな色を選択する関数 /
85 * Get a legal "multi-hued" color for drawing "spells"
89 static TERM_COLOR mh_attr(int max)
91 switch (randint1(max))
93 case 1: return (TERM_RED);
94 case 2: return (TERM_GREEN);
95 case 3: return (TERM_BLUE);
96 case 4: return (TERM_YELLOW);
97 case 5: return (TERM_ORANGE);
98 case 6: return (TERM_VIOLET);
99 case 7: return (TERM_L_RED);
100 case 8: return (TERM_L_GREEN);
101 case 9: return (TERM_L_BLUE);
102 case 10: return (TERM_UMBER);
103 case 11: return (TERM_L_UMBER);
104 case 12: return (TERM_SLATE);
105 case 13: return (TERM_WHITE);
106 case 14: return (TERM_L_WHITE);
107 case 15: return (TERM_L_DARK);
115 * @brief 魔法属性に応じたエフェクトの色を返す /
116 * Return a color to use for the bolt/ball spells
120 static TERM_COLOR spell_color(EFFECT_ID type)
122 /* Check if A.B.'s new graphics should be used (rr9) */
123 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
128 case GF_PSY_SPEAR: return (0x06);
129 case GF_MISSILE: return (0x0F);
130 case GF_ACID: return (0x04);
131 case GF_ELEC: return (0x02);
132 case GF_FIRE: return (0x00);
133 case GF_COLD: return (0x01);
134 case GF_POIS: return (0x03);
135 case GF_HOLY_FIRE: return (0x00);
136 case GF_HELL_FIRE: return (0x00);
137 case GF_MANA: return (0x0E);
139 case GF_SEEKER: return (0x0E);
140 case GF_SUPER_RAY: return (0x0E);
142 case GF_ARROW: return (0x0F);
143 case GF_WATER: return (0x04);
144 case GF_NETHER: return (0x07);
145 case GF_CHAOS: return (mh_attr(15));
146 case GF_DISENCHANT: return (0x05);
147 case GF_NEXUS: return (0x0C);
148 case GF_CONFUSION: return (mh_attr(4));
149 case GF_SOUND: return (0x09);
150 case GF_SHARDS: return (0x08);
151 case GF_FORCE: return (0x09);
152 case GF_INERTIAL: return (0x09);
153 case GF_GRAVITY: return (0x09);
154 case GF_TIME: return (0x09);
155 case GF_LITE_WEAK: return (0x06);
156 case GF_LITE: return (0x06);
157 case GF_DARK_WEAK: return (0x07);
158 case GF_DARK: return (0x07);
159 case GF_PLASMA: return (0x0B);
160 case GF_METEOR: return (0x00);
161 case GF_ICE: return (0x01);
162 case GF_ROCKET: return (0x0F);
163 case GF_DEATH_RAY: return (0x07);
164 case GF_NUKE: return (mh_attr(2));
165 case GF_DISINTEGRATE: return (0x05);
177 case GF_CAUSE_4: return (0x0E);
178 case GF_HAND_DOOM: return (0x07);
179 case GF_CAPTURE : return (0x0E);
180 case GF_IDENTIFY: return (0x01);
181 case GF_ATTACK: return (0x0F);
182 case GF_PHOTO : return (0x06);
185 /* Normal tiles or ASCII */
191 /* Lookup the default colors for this type */
192 concptr s = quark_str(gf_color[type]);
194 if (!s) return (TERM_WHITE);
196 /* Pick a random color */
197 c = s[randint0(strlen(s))];
199 /* Lookup this color */
200 a = my_strchr(color_char, c) - color_char;
202 /* Invalid color (note check for < 0 removed, gave a silly
203 * warning because bytes are always >= 0 -- RG) */
204 if (a > 15) return (TERM_WHITE);
210 /* Standard "color" */
216 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
217 * Find the attr/char pair to use for a spell effect
226 * It is moving (or has moved) from (x,y) to (nx,ny).
227 * If the distance is not "one", we (may) return "*".
230 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
240 if ((ny == y) && (nx == x)) base = 0x30;
243 else if (nx == x) base = 0x40;
246 else if (ny == y) base = 0x50;
249 else if ((ny - y) == (x - nx)) base = 0x60;
252 else if ((ny - y) == (nx - x)) base = 0x70;
257 /* Basic spell color */
258 k = spell_color(typ);
260 /* Obtain attr/char */
261 a = misc_to_attr[base + k];
262 c = misc_to_char[base + k];
271 * Mega-Hack -- track "affected" monsters (see "project()" comments)
273 static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
274 static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
275 static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
276 /* Mega-Hack -- monsters target */
277 static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
278 static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
282 * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
283 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
284 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
285 * @param y 目標Y座標 / Target y location (or location to travel "towards")
286 * @param x 目標X座標 / Target x location (or location to travel "towards")
287 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
288 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
289 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
292 * We are called both for "beam" effects and "ball" effects.
294 * The "r" parameter is the "distance from ground zero".
296 * Note that we determine if the player can "see" anything that happens
297 * by taking into account: blindness, line-of-sight, and illumination.
299 * We return "TRUE" if the effect of the projection is "obvious".
301 * We also "see" grids which are "memorized", probably a hack
303 * Perhaps we should affect doors?
306 static bool project_f(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
308 grid_type *g_ptr = &grid_array[y][x];
309 feature_type *f_ptr = &f_info[g_ptr->feat];
311 bool obvious = FALSE;
312 bool known = player_has_los_bold(y, x);
317 /* Reduce damage by distance */
318 dam = (dam + r) / (r + 1);
321 if (have_flag(f_ptr->flags, FF_TREE))
329 message = _("枯れた", "was blasted."); break;
331 message = _("縮んだ", "shrank."); break;
333 message = _("溶けた", "melted."); break;
336 message = _("凍り、砕け散った", "was frozen and smashed."); break;
340 message = _("燃えた", "burns up!"); break;
352 message = _("粉砕された", "was crushed."); break;
354 message = NULL; break;
358 msg_format(_("木は%s。", "A tree %s"), message);
359 cave_set_feat(y, x, one_in_(3) ? feat_brake : feat_grass);
362 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
366 /* Analyze the type */
369 /* Ignore most effects */
404 /* Destroy Traps (and Locks) */
407 /* Reveal secret doors */
408 if (is_hidden_door(g_ptr))
413 /* Check line of sight */
421 if (is_trap(g_ptr->feat))
423 /* Check line of sight */
426 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
430 /* Destroy the trap */
431 cave_alter_feat(y, x, FF_DISARM);
434 /* Locked doors are unlocked */
435 if (is_closed_door(g_ptr->feat) && f_ptr->power && have_flag(f_ptr->flags, FF_OPEN))
437 FEAT_IDX old_feat = g_ptr->feat;
439 /* Unlock the door */
440 cave_alter_feat(y, x, FF_DISARM);
442 /* Check line of sound */
443 if (known && (old_feat != g_ptr->feat))
445 msg_print(_("カチッと音がした!", "Click!"));
450 /* Remove "unsafe" flag if player is not blind */
451 if (!p_ptr->blind && player_has_los_bold(y, x))
453 g_ptr->info &= ~(CAVE_UNSAFE);
461 /* Destroy Doors (and traps) */
464 /* Destroy all doors and traps */
465 if (is_trap(g_ptr->feat) || have_flag(f_ptr->flags, FF_DOOR))
467 /* Check line of sight */
470 msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
474 /* Destroy the feature */
475 cave_alter_feat(y, x, FF_TUNNEL);
478 /* Remove "unsafe" flag if player is not blind */
479 if (!p_ptr->blind && player_has_los_bold(y, x))
481 g_ptr->info &= ~(CAVE_UNSAFE);
489 case GF_JAM_DOOR: /* Jams a door (as if with a spike) */
491 if (have_flag(f_ptr->flags, FF_SPIKE))
493 s16b old_mimic = g_ptr->mimic;
494 feature_type *mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
496 cave_alter_feat(y, x, FF_SPIKE);
497 g_ptr->mimic = old_mimic;
502 /* Check line of sight */
503 if (known && have_flag(mimic_f_ptr->flags, FF_OPEN))
505 msg_format(_("%sに何かがつっかえて開かなくなった。", "The %s seems stuck."), f_name + mimic_f_ptr->name);
512 /* Destroy walls (and doors) */
515 if (have_flag(f_ptr->flags, FF_HURT_ROCK))
517 if (known && (g_ptr->info & (CAVE_MARK)))
519 msg_format(_("%sが溶けて泥になった!", "The %s turns into mud!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
523 /* Destroy the wall */
524 cave_alter_feat(y, x, FF_HURT_ROCK);
526 /* Update some things */
527 p_ptr->update |= (PU_FLOW);
535 if (!cave_naked_bold(y, x)) break;
536 if (player_bold(y, x)) break;
537 cave_set_feat(y, x, feat_door[DOOR_DOOR].closed);
538 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
550 if (!cave_naked_bold(y, x)) break;
551 if (player_bold(y, x)) break;
552 cave_set_feat(y, x, feat_tree);
553 if (g_ptr->info & (CAVE_MARK)) obvious = TRUE;
559 if (!cave_naked_bold(y, x)) break;
560 g_ptr->info |= CAVE_OBJECT;
561 g_ptr->mimic = feat_glyph;
569 if (!cave_naked_bold(y, x)) break;
570 if (player_bold(y, x)) break;
571 cave_set_feat(y, x, feat_granite);
577 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
580 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
581 cave_set_feat(y, x, feat_shallow_lava);
585 cave_set_feat(y, x, feat_deep_lava);
592 if (have_flag(f_ptr->flags, FF_PERMANENT)) break;
595 if (!have_flag(f_ptr->flags, FF_FLOOR)) break;
596 cave_set_feat(y, x, feat_shallow_water);
600 cave_set_feat(y, x, feat_deep_water);
605 /* Lite up the grid */
609 /* Turn on the light */
610 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
612 g_ptr->info |= (CAVE_GLOW);
615 update_local_illumination(y, x);
618 if (player_can_see_bold(y, x)) obvious = TRUE;
620 /* Mega-Hack -- Update the monster in the affected grid */
621 /* This allows "spear of light" (etc) to work "correctly" */
622 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
624 if (p_ptr->special_defense & NINJA_S_STEALTH)
626 if (player_bold(y, x)) set_superstealth(FALSE);
633 /* Darken the grid */
637 bool do_dark = !p_ptr->inside_battle && !is_mirror_grid(g_ptr);
640 /* Turn off the light. */
643 if (dun_level || !is_daytime())
645 for (j = 0; j < 9; j++)
647 int by = y + ddy_ddd[j];
648 int bx = x + ddx_ddd[j];
650 if (in_bounds2(by, bx))
652 grid_type *cc_ptr = &grid_array[by][bx];
654 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
665 g_ptr->info &= ~(CAVE_GLOW);
667 /* Hack -- Forget "boring" grids */
668 if (!have_flag(f_ptr->flags, FF_REMEMBER))
671 g_ptr->info &= ~(CAVE_MARK);
678 update_local_illumination(y, x);
680 if (player_can_see_bold(y, x)) obvious = TRUE;
682 /* Mega-Hack -- Update the monster in the affected grid */
683 /* This allows "spear of light" (etc) to work "correctly" */
684 if (g_ptr->m_idx) update_monster(g_ptr->m_idx, FALSE);
694 if (is_mirror_grid(g_ptr))
696 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
699 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
702 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 50))
704 if (known && (g_ptr->info & CAVE_MARK))
706 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
710 /* Destroy the wall */
711 cave_alter_feat(y, x, FF_HURT_ROCK);
713 /* Update some things */
714 p_ptr->update |= (PU_FLOW);
721 if (is_mirror_grid(g_ptr) && p_ptr->lev < 40)
723 msg_print(_("鏡が割れた!", "The mirror was crashed!"));
726 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS, (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
729 if (have_flag(f_ptr->flags, FF_GLASS) && !have_flag(f_ptr->flags, FF_PERMANENT) && (dam >= 200))
731 if (known && (g_ptr->info & CAVE_MARK))
733 msg_format(_("%sが割れた!", "The %s was crashed!"), f_name + f_info[get_feat_mimic(g_ptr)].name);
737 /* Destroy the wall */
738 cave_alter_feat(y, x, FF_HURT_ROCK);
740 /* Update some things */
741 p_ptr->update |= (PU_FLOW);
746 case GF_DISINTEGRATE:
748 /* Destroy mirror/glyph */
749 if (is_mirror_grid(g_ptr) || is_glyph_grid(g_ptr) || is_explosive_rune_grid(g_ptr))
752 /* Permanent features don't get effect */
753 /* But not protect monsters and other objects */
754 if (have_flag(f_ptr->flags, FF_HURT_DISI) && !have_flag(f_ptr->flags, FF_PERMANENT))
756 cave_alter_feat(y, x, FF_HURT_DISI);
758 /* Update some things -- similar to GF_KILL_WALL */
759 p_ptr->update |= (PU_FLOW);
766 /* Return "Anything seen?" */
773 * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
774 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
775 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
776 * @param y 目標Y座標 / Target y location (or location to travel "towards")
777 * @param x 目標X座標 / Target x location (or location to travel "towards")
778 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
779 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
780 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
783 * We are called from "project()" to "damage" objects
785 * We are called both for "beam" effects and "ball" effects.
787 * Perhaps we should only SOMETIMES damage things on the ground.
789 * The "r" parameter is the "distance from ground zero".
791 * Note that we determine if the player can "see" anything that happens
792 * by taking into account: blindness, line-of-sight, and illumination.
794 * We also "see" grids which are "memorized", probably a hack
796 * We return "TRUE" if the effect of the projection is "obvious".
799 static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ)
801 grid_type *g_ptr = &grid_array[y][x];
803 OBJECT_IDX this_o_idx, next_o_idx = 0;
805 bool obvious = FALSE;
806 bool known = player_has_los_bold(y, x);
808 BIT_FLAGS flgs[TR_FLAG_SIZE];
810 GAME_TEXT o_name[MAX_NLEN];
812 KIND_OBJECT_IDX k_idx = 0;
813 bool is_potion = FALSE;
818 /* Reduce damage by distance */
819 dam = (dam + r) / (r + 1);
822 /* Scan all objects in the grid */
823 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
825 object_type *o_ptr = &o_list[this_o_idx];
829 bool do_kill = FALSE;
831 concptr note_kill = NULL;
834 /* Get the "plural"-ness */
835 bool plural = (o_ptr->number > 1);
838 /* Acquire next object */
839 next_o_idx = o_ptr->next_o_idx;
840 object_flags(o_ptr, flgs);
842 /* Check for artifact */
843 if (object_is_artifact(o_ptr)) is_art = TRUE;
845 /* Analyze the type */
848 /* Acid -- Lots of things */
851 if (hates_acid(o_ptr))
854 note_kill = _("融けてしまった!", (plural ? " melt!" : " melts!"));
855 if (have_flag(flgs, TR_IGNORE_ACID)) ignore = TRUE;
860 /* Elec -- Rings and Wands */
863 if (hates_elec(o_ptr))
866 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
867 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
872 /* Fire -- Flammable objects */
875 if (hates_fire(o_ptr))
878 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
879 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
884 /* Cold -- potions and flasks */
887 if (hates_cold(o_ptr))
889 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
891 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
899 if (hates_fire(o_ptr))
902 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
903 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
905 if (hates_elec(o_ptr))
909 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
910 if (have_flag(flgs, TR_IGNORE_ELEC)) ignore = TRUE;
918 if (hates_fire(o_ptr))
921 note_kill = _("燃えてしまった!", (plural ? " burn up!" : " burns up!"));
922 if (have_flag(flgs, TR_IGNORE_FIRE)) ignore = TRUE;
924 if (hates_cold(o_ptr))
928 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
929 if (have_flag(flgs, TR_IGNORE_COLD)) ignore = TRUE;
934 /* Hack -- break potions and such */
940 if (hates_cold(o_ptr))
942 note_kill = _("砕け散ってしまった!", (plural ? " shatter!" : " shatters!"));
948 /* Mana and Chaos -- destroy everything */
954 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
958 case GF_DISINTEGRATE:
961 note_kill = _("蒸発してしまった!", (plural ? " evaporate!" : " evaporates!"));
968 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
969 if (have_flag(flgs, TR_RES_CHAOS)) ignore = TRUE;
970 else if ((o_ptr->tval == TV_SCROLL) && (o_ptr->sval == SV_SCROLL_CHAOS)) ignore = TRUE;
974 /* Holy Fire and Hell Fire -- destroys cursed non-artifacts */
978 if (object_is_cursed(o_ptr))
981 note_kill = _("壊れてしまった!", (plural ? " are destroyed!" : " is destroyed!"));
988 identify_item(o_ptr);
990 /* Auto-inscription */
991 autopick_alter_item((-this_o_idx), FALSE);
999 /* Chests are noticed only if trapped or locked */
1000 if (o_ptr->tval == TV_CHEST)
1002 /* Disarm/Unlock traps */
1003 if (o_ptr->pval > 0)
1005 /* Disarm or Unlock */
1006 o_ptr->pval = (0 - o_ptr->pval);
1009 object_known(o_ptr);
1011 if (known && (o_ptr->marked & OM_FOUND))
1013 msg_print(_("カチッと音がした!", "Click!"));
1023 if (o_ptr->tval == TV_CORPSE)
1026 BIT_FLAGS mode = 0L;
1028 if (!who || is_pet(&m_list[who]))
1029 mode |= PM_FORCE_PET;
1031 for (i = 0; i < o_ptr->number ; i++)
1033 if (((o_ptr->sval == SV_CORPSE) && (randint1(100) > 80)) ||
1034 ((o_ptr->sval == SV_SKELETON) && (randint1(100) > 60)))
1038 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1042 else if (summon_named_creature(who, y, x, o_ptr->pval, mode))
1044 note_kill = _("生き返った。", " revived.");
1046 else if (!note_kill)
1048 note_kill = _("灰になった。", (plural ? " become dust." : " becomes dust."));
1059 /* Attempt to destroy the object */
1062 /* Effect "observed" */
1063 if (known && (o_ptr->marked & OM_FOUND))
1066 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1069 /* Artifacts, and other objects, get to resist */
1070 if (is_art || ignore)
1072 /* Observe the resist */
1073 if (known && (o_ptr->marked & OM_FOUND))
1075 msg_format(_("%sは影響を受けない!",
1076 (plural ? "The %s are unaffected!" : "The %s is unaffected!")), o_name);
1083 /* Describe if needed */
1084 if (known && (o_ptr->marked & OM_FOUND) && note_kill)
1086 msg_format(_("%sは%s", "The %s%s"), o_name, note_kill);
1089 k_idx = o_ptr->k_idx;
1090 is_potion = object_is_potion(o_ptr);
1091 delete_object_idx(this_o_idx);
1093 /* Potions produce effects when 'shattered' */
1096 (void)potion_smash_effect(who, y, x, k_idx);
1104 /* Return "Anything seen?" */
1110 * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
1111 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
1112 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
1113 * @param y 目標Y座標 / Target y location (or location to travel "towards")
1114 * @param x 目標X座標 / Target x location (or location to travel "towards")
1115 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
1116 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
1118 * @param see_s_msg TRUEならばメッセージを表示する
1119 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
1122 * This routine takes a "source monster" (by index) which is mostly used to
1123 * determine if the player is causing the damage, and a "radius" (see below),
1124 * which is used to decrease the power of explosions with distance, and a
1125 * location, via integers which are modified by certain types of attacks
1126 * (polymorph and teleport being the obvious ones), a default damage, which
1127 * is modified as needed based on various properties, and finally a "damage
1128 * type" (see below).
1131 * Note that this routine can handle "no damage" attacks (like teleport) by
1132 * taking a "zero" damage, and can even take "parameters" to attacks (like
1133 * confuse) by accepting a "damage", using it to calculate the effect, and
1134 * then setting the damage to zero. Note that the "damage" parameter is
1135 * divided by the radius, so monsters not at the "epicenter" will not take
1136 * as much damage (or whatever)...
1139 * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
1140 * may result in a dereference of an invalid pointer.
1143 * Various messages are produced, and damage is applied.
1146 * Just "casting" a substance (i.e. plasma) does not make you immune, you must
1147 * actually be "made" of that substance, or "breathe" big balls of it.
1148 * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
1150 * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
1151 * and hurts evil less. If can breath nether, then it resists it as well.
1154 * Damage reductions use the following formulas:
1155 * Note that "dam = dam * 6 / (randint1(6) + 6);"
1156 * gives avg damage of .655, ranging from .858 to .500
1157 * Note that "dam = dam * 5 / (randint1(6) + 6);"
1158 * gives avg damage of .544, ranging from .714 to .417
1159 * Note that "dam = dam * 4 / (randint1(6) + 6);"
1160 * gives avg damage of .444, ranging from .556 to .333
1161 * Note that "dam = dam * 3 / (randint1(6) + 6);"
1162 * gives avg damage of .327, ranging from .427 to .250
1163 * Note that "dam = dam * 2 / (randint1(6) + 6);"
1164 * gives something simple.
1167 * In this function, "result" messages are postponed until the end, where
1168 * the "note" string is appended to the monster name, if not NULL. So,
1169 * to make a spell have "no effect" just set "note" to NULL. You should
1170 * also set "notice" to FALSE, or the player will learn what the spell does.
1173 * We attempt to return "TRUE" if the player saw anything "useful" happen.
1177 static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, bool see_s_msg)
1181 grid_type *g_ptr = &grid_array[y][x];
1183 monster_type *m_ptr = &m_list[g_ptr->m_idx];
1184 monster_type *caster_ptr = (who > 0) ? &m_list[who] : NULL;
1186 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1190 /* Is the monster "seen"? */
1191 bool seen = m_ptr->ml;
1192 bool seen_msg = is_seen(m_ptr);
1194 bool slept = (bool)MON_CSLEEP(m_ptr);
1196 /* Were the effects "obvious" (if seen)? */
1197 bool obvious = FALSE;
1199 /* Can the player know about this effect? */
1200 bool known = ((m_ptr->cdis <= MAX_SIGHT) || p_ptr->inside_battle);
1202 /* Were the effects "irrelevant"? */
1203 bool skipped = FALSE;
1205 /* Gets the monster angry at the source of the effect? */
1206 bool get_angry = FALSE;
1208 /* Polymorph setting (true or false) */
1209 bool do_poly = FALSE;
1211 /* Teleport setting (max distance) */
1214 /* Confusion setting (amount to confuse) */
1217 /* Stunning setting (amount to stun) */
1220 /* Sleep amount (amount to sleep) */
1223 /* Fear amount (amount to fear) */
1226 /* Time amount (amount to time) */
1229 bool heal_leper = FALSE;
1231 /* Hold the monster name */
1232 GAME_TEXT m_name[MAX_NLEN];
1235 PARAMETER_VALUE photo = 0;
1237 /* Assume no note */
1238 concptr note = NULL;
1240 /* Assume a default death */
1241 concptr note_dies = extract_note_dies(real_r_idx(m_ptr));
1243 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1246 if (!g_ptr->m_idx) return (FALSE);
1248 /* Never affect projector */
1249 if (who && (g_ptr->m_idx == who)) return (FALSE);
1250 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1251 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1253 /* Don't affect already death monsters */
1254 /* Prevents problems with chain reactions of exploding monsters */
1255 if (m_ptr->hp < 0) return (FALSE);
1257 /* Reduce damage by distance */
1258 dam = (dam + r) / (r + 1);
1261 /* Get the monster name (BEFORE polymorphing) */
1262 monster_desc(m_name, m_ptr, 0);
1264 /* Get the monster possessive ("his"/"her"/"its") */
1265 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1267 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1269 if (r_ptr->flagsr & RFR_RES_ALL &&
1270 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1271 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1273 note = _("には完全な耐性がある!", " is immune.");
1275 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1276 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1280 /* Analyze the damage type */
1283 /* Magic Missile -- pure damage */
1286 if (seen) obvious = TRUE;
1293 if (seen) obvious = TRUE;
1294 if (r_ptr->flagsr & RFR_IM_ACID)
1296 note = _("にはかなり耐性がある!", " resists a lot.");
1298 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1306 if (seen) obvious = TRUE;
1307 if (r_ptr->flagsr & RFR_IM_ELEC)
1309 note = _("にはかなり耐性がある!", " resists a lot.");
1311 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1319 if (seen) obvious = TRUE;
1320 if (r_ptr->flagsr & RFR_IM_FIRE)
1322 note = _("にはかなり耐性がある!", " resists a lot.");
1324 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1326 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1328 note = _("はひどい痛手をうけた。", " is hit hard.");
1330 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1338 if (seen) obvious = TRUE;
1339 if (r_ptr->flagsr & RFR_IM_COLD)
1341 note = _("にはかなり耐性がある!", " resists a lot.");
1343 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1345 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1347 note = _("はひどい痛手をうけた。", " is hit hard.");
1349 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1357 if (seen) obvious = TRUE;
1358 if (r_ptr->flagsr & RFR_IM_POIS)
1360 note = _("にはかなり耐性がある!", " resists a lot.");
1362 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1370 if (seen) obvious = TRUE;
1371 if (r_ptr->flagsr & RFR_IM_POIS)
1373 note = _("には耐性がある。", " resists.");
1374 dam *= 3; dam /= randint1(6) + 6;
1375 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1377 else if (one_in_(3)) do_poly = TRUE;
1381 /* Hellfire -- hurts Evil */
1384 if (seen) obvious = TRUE;
1385 if (r_ptr->flags3 & RF3_GOOD)
1387 note = _("はひどい痛手をうけた。", " is hit hard.");
1389 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1394 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1397 if (seen) obvious = TRUE;
1398 if (r_ptr->flags3 & RF3_EVIL)
1401 note = _("はひどい痛手をうけた。", " is hit hard.");
1402 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1406 note = _("には耐性がある。", " resists.");
1407 dam *= 3; dam /= randint1(6) + 6;
1412 /* Arrow -- XXX no defense */
1415 if (seen) obvious = TRUE;
1419 /* Plasma -- XXX perhaps check ELEC or FIRE */
1422 if (seen) obvious = TRUE;
1423 if (r_ptr->flagsr & RFR_RES_PLAS)
1425 note = _("には耐性がある。", " resists.");
1426 dam *= 3; dam /= randint1(6) + 6;
1427 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1432 /* Nether -- see above */
1435 if (seen) obvious = TRUE;
1436 if (r_ptr->flagsr & RFR_RES_NETH)
1438 if (r_ptr->flags3 & RF3_UNDEAD)
1440 note = _("には完全な耐性がある!", " is immune.");
1442 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1446 note = _("には耐性がある。", " resists.");
1447 dam *= 3; dam /= randint1(6) + 6;
1449 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1451 else if (r_ptr->flags3 & RF3_EVIL)
1453 note = _("はいくらか耐性を示した。", " resists somewhat.");
1455 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1460 /* Water (acid) damage -- Water spirits/elementals are immune */
1463 if (seen) obvious = TRUE;
1464 if (r_ptr->flagsr & RFR_RES_WATE)
1466 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1468 note = _("には完全な耐性がある!", " is immune.");
1473 note = _("には耐性がある。", " resists.");
1474 dam *= 3; dam /= randint1(6) + 6;
1476 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1481 /* Chaos -- Chaos breathers resist */
1484 if (seen) obvious = TRUE;
1485 if (r_ptr->flagsr & RFR_RES_CHAO)
1487 note = _("には耐性がある。", " resists.");
1488 dam *= 3; dam /= randint1(6) + 6;
1489 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1491 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1493 note = _("はいくらか耐性を示した。", " resists somewhat.");
1494 dam *= 3; dam /= randint1(6) + 6;
1495 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1500 do_conf = (5 + randint1(11) + r) / (r + 1);
1505 /* Shards -- Shard breathers resist */
1508 if (seen) obvious = TRUE;
1509 if (r_ptr->flagsr & RFR_RES_SHAR)
1511 note = _("には耐性がある。", " resists.");
1512 dam *= 3; dam /= randint1(6) + 6;
1513 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1518 /* Rocket: Shard resistance helps */
1521 if (seen) obvious = TRUE;
1522 if (r_ptr->flagsr & RFR_RES_SHAR)
1524 note = _("はいくらか耐性を示した。", " resists somewhat.");
1526 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1532 /* Sound -- Sound breathers resist */
1535 if (seen) obvious = TRUE;
1536 if (r_ptr->flagsr & RFR_RES_SOUN)
1538 note = _("には耐性がある。", " resists.");
1539 dam *= 2; dam /= randint1(6) + 6;
1540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1542 else do_stun = (10 + randint1(15) + r) / (r + 1);
1549 if (seen) obvious = TRUE;
1550 if (r_ptr->flags3 & RF3_NO_CONF)
1552 note = _("には耐性がある。", " resists.");
1553 dam *= 3; dam /= randint1(6) + 6;
1554 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1556 else do_conf = (10 + randint1(15) + r) / (r + 1);
1560 /* Disenchantment -- Breathers and Disenchanters resist */
1563 if (seen) obvious = TRUE;
1564 if (r_ptr->flagsr & RFR_RES_DISE)
1566 note = _("には耐性がある。", " resists.");
1567 dam *= 3; dam /= randint1(6) + 6;
1568 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1573 /* Nexus -- Breathers and Existers resist */
1576 if (seen) obvious = TRUE;
1577 if (r_ptr->flagsr & RFR_RES_NEXU)
1579 note = _("には耐性がある。", " resists.");
1580 dam *= 3; dam /= randint1(6) + 6;
1581 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1589 if (seen) obvious = TRUE;
1590 if (r_ptr->flagsr & RFR_RES_WALL)
1592 note = _("には耐性がある。", " resists.");
1593 dam *= 3; dam /= randint1(6) + 6;
1594 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1596 else do_stun = (randint1(15) + r) / (r + 1);
1600 /* Inertia -- breathers resist */
1603 if (seen) obvious = TRUE;
1604 if (r_ptr->flagsr & RFR_RES_INER)
1606 note = _("には耐性がある。", " resists.");
1607 dam *= 3; dam /= randint1(6) + 6;
1608 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1612 /* Powerful monsters can resist */
1613 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1614 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1618 /* Normal monsters slow down */
1621 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1623 note = _("の動きが遅くなった。", " starts moving slower.");
1630 /* Time -- breathers resist */
1633 if (seen) obvious = TRUE;
1634 if (r_ptr->flagsr & RFR_RES_TIME)
1636 note = _("には耐性がある。", " resists.");
1637 dam *= 3; dam /= randint1(6) + 6;
1638 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1640 else do_time = (dam + 1) / 2;
1644 /* Gravity -- breathers resist */
1647 bool resist_tele = FALSE;
1649 if (seen) obvious = TRUE;
1650 if (r_ptr->flagsr & RFR_RES_TELE)
1652 if (r_ptr->flags1 & (RF1_UNIQUE))
1654 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1655 note = _("には効果がなかった。", " is unaffected!");
1658 else if (r_ptr->level > randint1(100))
1660 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1661 note = _("には耐性がある!", " resists!");
1666 if (!resist_tele) do_dist = 10;
1668 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1670 if (r_ptr->flagsr & RFR_RES_GRAV)
1672 note = _("には耐性がある!", " resists!");
1673 dam *= 3; dam /= randint1(6) + 6;
1675 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1680 /* Powerful monsters can resist */
1681 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1682 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1686 /* Normal monsters slow down */
1689 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1691 note = _("の動きが遅くなった。", " starts moving slower.");
1696 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1698 /* Attempt a saving throw */
1699 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1700 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1704 /* No obvious effect */
1705 note = _("には効果がなかった。", " is unaffected!");
1717 if (seen) obvious = TRUE;
1723 case GF_DISINTEGRATE:
1725 if (seen) obvious = TRUE;
1726 if (r_ptr->flags3 & RF3_HURT_ROCK)
1728 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1729 note = _("の皮膚がただれた!", " loses some skin!");
1730 note_dies = _("は蒸発した!", " evaporates!");
1738 if (seen) obvious = TRUE;
1740 /* PSI only works if the monster can see you! -- RG */
1741 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1744 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1748 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1751 note = _("には完全な耐性がある!", " is immune.");
1752 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1755 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1756 (r_ptr->flags3 & RF3_ANIMAL) ||
1757 (r_ptr->level > randint1(3 * dam)))
1759 note = _("には耐性がある!", " resists!");
1763 * Powerful demons & undead can turn a mindcrafter's
1764 * attacks back on them
1766 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1767 (r_ptr->level > p_ptr->lev / 2) &&
1771 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1772 (seen ? "%^s's corrupted mind backlashes your attack!" :
1773 "%^ss corrupted mind backlashes your attack!")), m_name);
1776 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1778 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1782 /* Injure +/- confusion */
1783 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1784 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1785 if (one_in_(4) && !CHECK_MULTISHADOW())
1787 switch (randint1(4))
1790 set_confused(p_ptr->confused + 3 + randint1(dam));
1793 set_stun(p_ptr->stun + randint1(dam));
1797 if (r_ptr->flags3 & RF3_NO_FEAR)
1798 note = _("には効果がなかった。", " is unaffected.");
1800 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1804 if (!p_ptr->free_act)
1805 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1814 if ((dam > 0) && one_in_(4))
1816 switch (randint1(4))
1819 do_conf = 3 + randint1(dam);
1822 do_stun = 3 + randint1(dam);
1825 do_fear = 3 + randint1(dam);
1828 note = _("は眠り込んでしまった!", " falls asleep!");
1829 do_sleep = 3 + randint1(dam);
1834 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1840 if (seen) obvious = TRUE;
1841 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1844 note = _("には完全な耐性がある!", " is immune.");
1846 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1847 (r_ptr->flags3 & RF3_ANIMAL) ||
1848 (r_ptr->level > randint1(3 * dam)))
1850 note = _("には耐性がある!", " resists!");
1854 * Powerful demons & undead can turn a mindcrafter's
1855 * attacks back on them
1857 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1858 (r_ptr->level > p_ptr->lev / 2) &&
1862 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1863 (seen ? "%^s's corrupted mind backlashes your attack!" :
1864 "%^ss corrupted mind backlashes your attack!")), m_name);
1866 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1868 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1872 /* Injure + mana drain */
1873 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1874 if (!CHECK_MULTISHADOW())
1876 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1877 p_ptr->csp -= damroll(5, dam) / 2;
1878 if (p_ptr->csp < 0) p_ptr->csp = 0;
1879 p_ptr->redraw |= PR_MANA;
1880 p_ptr->window |= (PW_SPELL);
1882 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1889 int b = damroll(5, dam) / 4;
1890 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1891 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1892 (seen ? "You convert %s's pain into %s!" :
1893 "You convert %ss pain into %s!"));
1894 msg_format(msg, m_name, str);
1896 b = MIN(p_ptr->msp, p_ptr->csp + b);
1898 p_ptr->redraw |= PR_MANA;
1899 p_ptr->window |= (PW_SPELL);
1901 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1905 case GF_TELEKINESIS:
1907 if (seen) obvious = TRUE;
1910 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1915 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1917 /* Attempt a saving throw */
1918 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1919 (r_ptr->level > 5 + randint1(dam)))
1923 /* No obvious effect */
1929 /* Psycho-spear -- powerful magic missile */
1932 if (seen) obvious = TRUE;
1936 /* Meteor -- powerful magic missile */
1939 if (seen) obvious = TRUE;
1945 if (!is_hostile(m_ptr)) break;
1946 if (seen) obvious = TRUE;
1947 /* Attempt a saving throw */
1948 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1949 (r_ptr->flags3 & RF3_NO_CONF) ||
1950 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1952 /* Memorize a flag */
1953 if (r_ptr->flags3 & RF3_NO_CONF)
1955 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1962 * Powerful demons & undead can turn a mindcrafter's
1963 * attacks back on them
1965 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1966 (r_ptr->level > p_ptr->lev / 2) &&
1970 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1971 (seen ? "%^s's corrupted mind backlashes your attack!" :
1972 "%^ss corrupted mind backlashes your attack!")), m_name);
1975 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1977 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1981 /* Confuse, stun, terrify */
1982 switch (randint1(4))
1985 set_stun(p_ptr->stun + dam / 2);
1988 set_confused(p_ptr->confused + dam / 2);
1992 if (r_ptr->flags3 & RF3_NO_FEAR)
1993 note = _("には効果がなかった。", " is unaffected.");
1995 set_afraid(p_ptr->afraid + dam);
2002 /* No obvious effect */
2003 note = _("には効果がなかった。", " is unaffected.");
2009 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2011 note = _("があなたに隷属した。", " is in your thrall!");
2016 switch (randint1(4))
2030 /* No "real" damage */
2035 /* Ice -- Cold + Cuts + Stun */
2038 if (seen) obvious = TRUE;
2039 do_stun = (randint1(15) + 1) / (r + 1);
2040 if (r_ptr->flagsr & RFR_IM_COLD)
2042 note = _("にはかなり耐性がある!", " resists a lot.");
2044 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2046 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2048 note = _("はひどい痛手をうけた。", " is hit hard.");
2050 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2057 case GF_HYPODYNAMIA:
2059 if (seen) obvious = TRUE;
2060 if (!monster_living(m_ptr->r_idx))
2062 if (is_original_ap_and_seen(m_ptr))
2064 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2065 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2066 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2068 note = _("には効果がなかった。", " is unaffected.");
2072 else do_time = (dam+7)/8;
2080 if (seen) obvious = TRUE;
2081 if (!monster_living(m_ptr->r_idx))
2083 if (is_original_ap_and_seen(m_ptr))
2085 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2086 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2087 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2089 note = _("には完全な耐性がある!", " is immune.");
2093 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2094 (randint1(888) != 666)) ||
2095 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2096 randint1(100) != 66))
2098 note = _("には耐性がある!", " resists!");
2106 /* Polymorph monster (Use "dam" as "power") */
2109 if (seen) obvious = TRUE;
2110 /* Attempt to polymorph (see below) */
2113 /* Powerful monsters can resist */
2114 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2115 (r_ptr->flags1 & RF1_QUESTOR) ||
2116 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2118 note = _("には効果がなかった。", " is unaffected.");
2123 /* No "real" damage */
2130 /* Clone monsters (Ignore "dam") */
2133 if (seen) obvious = TRUE;
2135 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2137 note = _("には効果がなかった。", " is unaffected.");
2142 m_ptr->hp = m_ptr->maxhp;
2144 /* Attempt to clone. */
2145 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2147 note = _("が分裂した!", " spawns!");
2151 /* No "real" damage */
2158 /* Heal Monster (use "dam" as amount of healing) */
2161 if (seen) obvious = TRUE;
2164 (void)set_monster_csleep(g_ptr->m_idx, 0);
2166 if (m_ptr->maxhp < m_ptr->max_maxhp)
2168 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2169 m_ptr->maxhp = m_ptr->max_maxhp;
2174 /* Redraw (later) if needed */
2175 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2176 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2184 if (seen) obvious = TRUE;
2187 (void)set_monster_csleep(g_ptr->m_idx, 0);
2188 if (MON_STUNNED(m_ptr))
2190 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2191 (void)set_monster_stunned(g_ptr->m_idx, 0);
2193 if (MON_CONFUSED(m_ptr))
2195 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2196 (void)set_monster_confused(g_ptr->m_idx, 0);
2198 if (MON_MONFEAR(m_ptr))
2200 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2201 (void)set_monster_monfear(g_ptr->m_idx, 0);
2205 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2208 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2212 chg_virtue(V_VITALITY, 1);
2214 if (r_ptr->flags1 & RF1_UNIQUE)
2215 chg_virtue(V_INDIVIDUALISM, 1);
2217 if (is_friendly(m_ptr))
2218 chg_virtue(V_HONOUR, 1);
2219 else if (!(r_ptr->flags3 & RF3_EVIL))
2221 if (r_ptr->flags3 & RF3_GOOD)
2222 chg_virtue(V_COMPASSION, 2);
2224 chg_virtue(V_COMPASSION, 1);
2227 if (r_ptr->flags3 & RF3_ANIMAL)
2228 chg_virtue(V_NATURE, 1);
2231 if (m_ptr->r_idx == MON_LEPER)
2234 if (!who) chg_virtue(V_COMPASSION, 5);
2237 /* Redraw (later) if needed */
2238 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2239 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2241 note = _("は体力を回復したようだ。", " looks healthier.");
2243 /* No "real" damage */
2249 /* Speed Monster (Ignore "dam") */
2252 if (seen) obvious = TRUE;
2255 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2257 note = _("の動きが速くなった。", " starts moving faster.");
2262 if (r_ptr->flags1 & RF1_UNIQUE)
2263 chg_virtue(V_INDIVIDUALISM, 1);
2264 if (is_friendly(m_ptr))
2265 chg_virtue(V_HONOUR, 1);
2268 /* No "real" damage */
2274 /* Slow Monster (Use "dam" as "power") */
2277 if (seen) obvious = TRUE;
2279 /* Powerful monsters can resist */
2280 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2281 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2283 note = _("には効果がなかった。", " is unaffected.");
2287 /* Normal monsters slow down */
2290 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2292 note = _("の動きが遅くなった。", " starts moving slower.");
2296 /* No "real" damage */
2302 /* Sleep (Use "dam" as "power") */
2305 if (seen) obvious = TRUE;
2307 /* Attempt a saving throw */
2308 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2309 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2310 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2312 /* Memorize a flag */
2313 if (r_ptr->flags3 & RF3_NO_SLEEP)
2315 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2317 /* No obvious effect */
2318 note = _("には効果がなかった。", " is unaffected.");
2323 /* Go to sleep (much) later */
2324 note = _("は眠り込んでしまった!", " falls asleep!");
2328 /* No "real" damage */
2334 /* Sleep (Use "dam" as "power") */
2335 case GF_STASIS_EVIL:
2337 if (seen) obvious = TRUE;
2339 /* Attempt a saving throw */
2340 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2341 !(r_ptr->flags3 & RF3_EVIL) ||
2342 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2344 note = _("には効果がなかった。", " is unaffected.");
2349 /* Go to sleep (much) later */
2350 note = _("は動けなくなった!", " is suspended!");
2354 /* No "real" damage */
2359 /* Sleep (Use "dam" as "power") */
2362 if (seen) obvious = TRUE;
2364 /* Attempt a saving throw */
2365 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2366 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2368 note = _("には効果がなかった。", " is unaffected.");
2373 /* Go to sleep (much) later */
2374 note = _("は動けなくなった!", " is suspended!");
2378 /* No "real" damage */
2387 vir = virtue_number(V_HARMONY);
2390 dam += p_ptr->virtues[vir-1]/10;
2393 vir = virtue_number(V_INDIVIDUALISM);
2396 dam -= p_ptr->virtues[vir-1]/20;
2399 if (seen) obvious = TRUE;
2401 /* Attempt a saving throw */
2402 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2406 /* No obvious effect */
2407 note = _("には効果がなかった。", " is unaffected.");
2410 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2412 else if (p_ptr->cursed & TRC_AGGRAVATE)
2414 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2415 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2419 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2422 chg_virtue(V_INDIVIDUALISM, -1);
2423 if (r_ptr->flags3 & RF3_ANIMAL)
2424 chg_virtue(V_NATURE, 1);
2427 /* No "real" damage */
2432 /* Control undead */
2433 case GF_CONTROL_UNDEAD:
2436 if (seen) obvious = TRUE;
2438 vir = virtue_number(V_UNLIFE);
2441 dam += p_ptr->virtues[vir-1]/10;
2444 vir = virtue_number(V_INDIVIDUALISM);
2447 dam -= p_ptr->virtues[vir-1]/20;
2450 /* Attempt a saving throw */
2451 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2452 !(r_ptr->flags3 & RF3_UNDEAD))
2454 /* No obvious effect */
2455 note = _("には効果がなかった。", " is unaffected.");
2457 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2459 else if (p_ptr->cursed & TRC_AGGRAVATE)
2461 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2462 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2466 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2470 /* No "real" damage */
2476 case GF_CONTROL_DEMON:
2479 if (seen) obvious = TRUE;
2481 vir = virtue_number(V_UNLIFE);
2484 dam += p_ptr->virtues[vir-1]/10;
2487 vir = virtue_number(V_INDIVIDUALISM);
2490 dam -= p_ptr->virtues[vir-1]/20;
2493 /* Attempt a saving throw */
2494 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2495 !(r_ptr->flags3 & RF3_DEMON))
2497 /* No obvious effect */
2498 note = _("には効果がなかった。", " is unaffected.");
2500 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2502 else if (p_ptr->cursed & TRC_AGGRAVATE)
2504 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2505 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2509 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2513 /* No "real" damage */
2519 case GF_CONTROL_ANIMAL:
2522 if (seen) obvious = TRUE;
2524 vir = virtue_number(V_NATURE);
2527 dam += p_ptr->virtues[vir-1]/10;
2530 vir = virtue_number(V_INDIVIDUALISM);
2533 dam -= p_ptr->virtues[vir-1]/20;
2536 /* Attempt a saving throw */
2537 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2538 !(r_ptr->flags3 & RF3_ANIMAL))
2541 /* No obvious effect */
2542 note = _("には効果がなかった。", " is unaffected.");
2544 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2546 else if (p_ptr->cursed & TRC_AGGRAVATE)
2548 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2549 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2553 note = _("はなついた。", " is tamed!");
2555 if (r_ptr->flags3 & RF3_ANIMAL)
2556 chg_virtue(V_NATURE, 1);
2559 /* No "real" damage */
2565 case GF_CHARM_LIVING:
2569 vir = virtue_number(V_UNLIFE);
2570 if (seen) obvious = TRUE;
2572 vir = virtue_number(V_UNLIFE);
2575 dam -= p_ptr->virtues[vir-1]/10;
2578 vir = virtue_number(V_INDIVIDUALISM);
2581 dam -= p_ptr->virtues[vir-1]/20;
2584 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2586 /* Attempt a saving throw */
2587 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2588 !monster_living(m_ptr->r_idx))
2591 /* No obvious effect */
2592 note = _("には効果がなかった。", " is unaffected.");
2594 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2596 else if (p_ptr->cursed & TRC_AGGRAVATE)
2598 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2599 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2603 note = _("を支配した。", " is tamed!");
2605 if (r_ptr->flags3 & RF3_ANIMAL)
2606 chg_virtue(V_NATURE, 1);
2609 /* No "real" damage */
2614 /* Confusion (Use "dam" as "power") */
2617 if (seen) obvious = TRUE;
2619 /* Get confused later */
2620 do_conf = damroll(3, (dam / 2)) + 1;
2622 /* Attempt a saving throw */
2623 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2624 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2625 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2627 /* Memorize a flag */
2628 if (r_ptr->flags3 & (RF3_NO_CONF))
2630 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2636 /* No obvious effect */
2637 note = _("には効果がなかった。", " is unaffected.");
2641 /* No "real" damage */
2648 if (seen) obvious = TRUE;
2650 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2652 /* Attempt a saving throw */
2653 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2654 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2659 /* No obvious effect */
2660 note = _("には効果がなかった。", " is unaffected.");
2664 /* No "real" damage */
2669 /* Lite, but only hurts susceptible creatures */
2678 if (r_ptr->flags3 & (RF3_HURT_LITE))
2680 /* Obvious effect */
2681 if (seen) obvious = TRUE;
2683 /* Memorize the effects */
2684 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2686 /* Special effect */
2687 note = _("は光に身をすくめた!", " cringes from the light!");
2688 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2691 /* Normally no damage */
2703 /* Lite -- opposite of Dark */
2706 if (seen) obvious = TRUE;
2708 if (r_ptr->flagsr & RFR_RES_LITE)
2710 note = _("には耐性がある!", " resists!");
2711 dam *= 2; dam /= (randint1(6)+6);
2712 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2714 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2716 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2717 note = _("は光に身をすくめた!", " cringes from the light!");
2718 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2725 /* Dark -- opposite of Lite */
2728 if (seen) obvious = TRUE;
2730 if (r_ptr->flagsr & RFR_RES_DARK)
2732 note = _("には耐性がある!", " resists!");
2733 dam *= 2; dam /= (randint1(6)+6);
2734 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2743 /* Hurt by rock remover */
2744 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2747 if (seen) obvious = TRUE;
2749 /* Memorize the effects */
2750 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2752 /* Cute little message */
2753 note = _("の皮膚がただれた!", " loses some skin!");
2754 note_dies = _("はドロドロに溶けた!", " dissolves!");
2757 /* Usually, ignore the effects */
2768 /* Teleport undead (Use "dam" as "power") */
2769 case GF_AWAY_UNDEAD:
2771 /* Only affect undead */
2772 if (r_ptr->flags3 & (RF3_UNDEAD))
2774 bool resists_tele = FALSE;
2776 if (r_ptr->flagsr & RFR_RES_TELE)
2778 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2780 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2781 note = _("には効果がなかった。", " is unaffected.");
2782 resists_tele = TRUE;
2784 else if (r_ptr->level > randint1(100))
2786 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2787 note = _("には耐性がある!", " resists!");
2788 resists_tele = TRUE;
2794 if (seen) obvious = TRUE;
2795 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2807 /* No "real" damage */
2813 /* Teleport evil (Use "dam" as "power") */
2816 /* Only affect evil */
2817 if (r_ptr->flags3 & (RF3_EVIL))
2819 bool resists_tele = FALSE;
2821 if (r_ptr->flagsr & RFR_RES_TELE)
2823 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2825 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2826 note = _("には効果がなかった。", " is unaffected.");
2827 resists_tele = TRUE;
2829 else if (r_ptr->level > randint1(100))
2831 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2832 note = _("には耐性がある!", " resists!");
2833 resists_tele = TRUE;
2839 if (seen) obvious = TRUE;
2840 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2852 /* No "real" damage */
2858 /* Teleport monster (Use "dam" as "power") */
2861 bool resists_tele = FALSE;
2862 if (r_ptr->flagsr & RFR_RES_TELE)
2864 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2866 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2867 note = _("には効果がなかった。", " is unaffected.");
2868 resists_tele = TRUE;
2870 else if (r_ptr->level > randint1(100))
2872 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2873 note = _("には耐性がある!", " resists!");
2874 resists_tele = TRUE;
2880 if (seen) obvious = TRUE;
2882 /* Prepare to teleport */
2886 /* No "real" damage */
2892 /* Turn undead (Use "dam" as "power") */
2893 case GF_TURN_UNDEAD:
2895 /* Only affect undead */
2896 if (r_ptr->flags3 & (RF3_UNDEAD))
2898 if (seen) obvious = TRUE;
2900 /* Learn about type */
2901 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2903 /* Apply some fear */
2904 do_fear = damroll(3, (dam / 2)) + 1;
2906 /* Attempt a saving throw */
2907 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2909 /* No obvious effect */
2910 note = _("には効果がなかった。", " is unaffected.");
2923 /* No "real" damage */
2929 /* Turn evil (Use "dam" as "power") */
2932 /* Only affect evil */
2933 if (r_ptr->flags3 & (RF3_EVIL))
2935 if (seen) obvious = TRUE;
2937 /* Learn about type */
2938 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2940 /* Apply some fear */
2941 do_fear = damroll(3, (dam / 2)) + 1;
2943 /* Attempt a saving throw */
2944 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2946 /* No obvious effect */
2947 note = _("には効果がなかった。", " is unaffected.");
2960 /* No "real" damage */
2966 /* Turn monster (Use "dam" as "power") */
2969 if (seen) obvious = TRUE;
2971 /* Apply some fear */
2972 do_fear = damroll(3, (dam / 2)) + 1;
2974 /* Attempt a saving throw */
2975 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2976 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2977 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2979 /* No obvious effect */
2980 note = _("には効果がなかった。", " is unaffected.");
2985 /* No "real" damage */
2992 case GF_DISP_UNDEAD:
2994 /* Only affect undead */
2995 if (r_ptr->flags3 & (RF3_UNDEAD))
2997 if (seen) obvious = TRUE;
2999 /* Learn about type */
3000 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3002 note = _("は身震いした。", " shudders.");
3003 note_dies = _("はドロドロに溶けた!", " dissolves!");
3023 /* Only affect evil */
3024 if (r_ptr->flags3 & (RF3_EVIL))
3026 if (seen) obvious = TRUE;
3028 /* Learn about type */
3029 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3031 note = _("は身震いした。", " shudders.");
3032 note_dies = _("はドロドロに溶けた!", " dissolves!");
3051 /* Only affect good */
3052 if (r_ptr->flags3 & (RF3_GOOD))
3054 if (seen) obvious = TRUE;
3056 /* Learn about type */
3057 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3059 note = _("は身震いした。", " shudders.");
3060 note_dies = _("はドロドロに溶けた!", " dissolves!");
3077 case GF_DISP_LIVING:
3079 /* Only affect non-undead */
3080 if (monster_living(m_ptr->r_idx))
3082 if (seen) obvious = TRUE;
3084 note = _("は身震いした。", " shudders.");
3085 note_dies = _("はドロドロに溶けた!", " dissolves!");
3104 /* Only affect demons */
3105 if (r_ptr->flags3 & (RF3_DEMON))
3107 if (seen) obvious = TRUE;
3109 /* Learn about type */
3110 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3112 note = _("は身震いした。", " shudders.");
3113 note_dies = _("はドロドロに溶けた!", " dissolves!");
3129 /* Dispel monster */
3132 if (seen) obvious = TRUE;
3133 note = _("は身震いした。", " shudders.");
3134 note_dies = _("はドロドロに溶けた!", " dissolves!");
3141 if (seen) obvious = TRUE;
3142 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3146 /* Heal the monster */
3147 if (caster_ptr->hp < caster_ptr->maxhp)
3150 caster_ptr->hp += dam;
3151 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3153 /* Redraw (later) if needed */
3154 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3155 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3157 /* Special message */
3160 monster_desc(killer, caster_ptr, 0);
3161 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3167 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3168 (void)hp_player(dam);
3173 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3182 if (seen) obvious = TRUE;
3183 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3184 /* Attempt a saving throw */
3185 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3186 (r_ptr->flags3 & RF3_NO_CONF) ||
3187 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3189 /* Memorize a flag */
3190 if (r_ptr->flags3 & (RF3_NO_CONF))
3192 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3194 note = _("には効果がなかった。", " is unaffected.");
3197 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3199 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3200 note = _("には完全な耐性がある!", " is immune.");
3203 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3205 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3206 note = _("には耐性がある。", " resists.");
3211 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3212 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3214 if (who > 0) do_conf = randint0(4) + 4;
3215 else do_conf = randint0(8) + 8;
3221 case GF_BRAIN_SMASH:
3223 if (seen) obvious = TRUE;
3224 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3226 /* Attempt a saving throw */
3227 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3228 (r_ptr->flags3 & RF3_NO_CONF) ||
3229 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3231 /* Memorize a flag */
3232 if (r_ptr->flags3 & (RF3_NO_CONF))
3234 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3236 note = _("には効果がなかった。", " is unaffected.");
3239 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3241 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3242 note = _("には完全な耐性がある!", " is immune.");
3245 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3247 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3248 note = _("には耐性がある!", " resists!");
3253 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3254 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3258 do_conf = randint0(4) + 4;
3259 do_stun = randint0(4) + 4;
3263 do_conf = randint0(8) + 8;
3264 do_stun = randint0(8) + 8;
3266 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3274 if (seen) obvious = TRUE;
3275 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3276 /* Attempt a saving throw */
3277 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3279 note = _("には効果がなかった。", " is unaffected.");
3288 if (seen) obvious = TRUE;
3289 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3290 /* Attempt a saving throw */
3291 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3293 note = _("には効果がなかった。", " is unaffected.");
3302 if (seen) obvious = TRUE;
3303 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3304 /* Attempt a saving throw */
3305 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3307 note = _("には効果がなかった。", " is unaffected.");
3316 if (seen) obvious = TRUE;
3318 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3319 "You point at %s, screaming the word, 'DIE!'."), m_name);
3320 /* Attempt a saving throw */
3321 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3323 note = _("には効果がなかった。", " is unaffected.");
3332 if (seen) obvious = TRUE;
3333 if (r_ptr->flags1 & RF1_UNIQUE)
3335 note = _("には効果がなかった。", " is unaffected.");
3340 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3341 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3343 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3345 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3349 note = _("は耐性を持っている!", "resists!");
3356 /* Capture monster */
3360 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3361 (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)
3363 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3368 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3369 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3370 nokori_hp = m_ptr->maxhp * 3 / 10;
3372 nokori_hp = m_ptr->maxhp * 3 / 20;
3374 if (m_ptr->hp >= nokori_hp)
3376 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3379 else if (m_ptr->hp < randint0(nokori_hp))
3381 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3382 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3383 cap_mon = m_ptr->r_idx;
3384 cap_mspeed = m_ptr->mspeed;
3386 cap_maxhp = m_ptr->max_maxhp;
3387 cap_nickname = m_ptr->nickname; /* Quark transfer */
3388 if (g_ptr->m_idx == p_ptr->riding)
3390 if (rakuba(-1, FALSE))
3392 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3396 delete_monster_idx(g_ptr->m_idx);
3402 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3408 /* Attack (Use "dam" as attack type) */
3411 /* Return this monster's death */
3412 return py_attack(y, x, dam);
3415 /* Sleep (Use "dam" as "power") */
3421 if (seen) obvious = TRUE;
3422 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3424 note = _("には効果がなかった。", " is unaffected.");
3427 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3430 if (MON_CSLEEP(m_ptr))
3432 note = _("には効果がなかった。", " is unaffected.");
3438 if (one_in_(5)) effect = 1;
3439 else if (one_in_(4)) effect = 2;
3440 else if (one_in_(3)) effect = 3;
3445 /* Powerful monsters can resist */
3446 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3447 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3449 note = _("には効果がなかった。", " is unaffected.");
3453 /* Normal monsters slow down */
3456 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3458 note = _("の動きが遅くなった。", " starts moving slower.");
3463 else if (effect == 2)
3465 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3467 /* Attempt a saving throw */
3468 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3469 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3474 /* No obvious effect */
3475 note = _("には効果がなかった。", " is unaffected.");
3480 else if (effect == 3)
3482 /* Attempt a saving throw */
3483 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3484 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3485 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3487 /* Memorize a flag */
3488 if (r_ptr->flags3 & RF3_NO_SLEEP)
3490 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3493 /* No obvious effect */
3494 note = _("には効果がなかった。", " is unaffected.");
3499 /* Go to sleep (much) later */
3500 note = _("は眠り込んでしまった!", " falls asleep!");
3507 note = _("には効果がなかった。", " is unaffected.");
3510 /* No "real" damage */
3518 if (seen) obvious = TRUE;
3519 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3521 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3522 chg_virtue(V_VITALITY, -1);
3532 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3534 if (r_ptr->flags3 & (RF3_HURT_LITE))
3536 /* Obvious effect */
3537 if (seen) obvious = TRUE;
3539 /* Memorize the effects */
3540 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3542 /* Special effect */
3543 note = _("は光に身をすくめた!", " cringes from the light!");
3544 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3547 /* Normally no damage */
3554 photo = m_ptr->r_idx;
3561 case GF_BLOOD_CURSE:
3563 if (seen) obvious = TRUE;
3569 bool success = FALSE;
3570 if (seen) obvious = TRUE;
3572 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3574 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3575 if (dam < 1) dam = 1;
3577 /* No need to tame your pet */
3580 note = _("の動きが速くなった。", " starts moving faster.");
3581 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3585 /* Attempt a saving throw */
3586 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3587 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3588 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3589 (p_ptr->cursed & TRC_AGGRAVATE) ||
3590 ((r_ptr->level+10) > randint1(dam)))
3593 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3597 note = _("を支配した。", " is tamed!");
3599 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3601 /* Learn about type */
3602 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3609 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3611 do_fear = randint1(90)+10;
3613 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3616 /* No "real" damage */
3623 if (seen) obvious = TRUE;
3624 /* Attempt a saving throw */
3625 if (randint0(100 + dam) < (r_ptr->level + 50))
3627 note = _("には効果がなかった。", " is unaffected.");
3647 /* Absolutely no effect */
3648 if (skipped) return (FALSE);
3650 /* "Unique" monsters cannot be polymorphed */
3651 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3653 /* Quest monsters cannot be polymorphed */
3654 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3656 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3658 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3659 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3661 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3666 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3667 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3670 /* Modify the damage */
3672 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3673 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3675 /* Check for death */
3676 if (dam > m_ptr->hp)
3678 /* Extract method of death */
3683 /* Sound and Impact resisters never stun */
3685 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3686 !(r_ptr->flags3 & RF3_NO_STUN))
3688 if (seen) obvious = TRUE;
3691 if (MON_STUNNED(m_ptr))
3693 note = _("はひどくもうろうとした。", " is more dazed.");
3694 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3698 note = _("はもうろうとした。", " is dazed.");
3703 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3709 /* Confusion and Chaos resisters (and sleepers) never confuse */
3711 !(r_ptr->flags3 & RF3_NO_CONF) &&
3712 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3714 if (seen) obvious = TRUE;
3716 /* Already partially confused */
3717 if (MON_CONFUSED(m_ptr))
3719 note = _("はさらに混乱したようだ。", " looks more confused.");
3720 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3723 /* Was not confused */
3726 note = _("は混乱したようだ。", " looks confused.");
3730 /* Apply confusion */
3731 (void)set_monster_confused(g_ptr->m_idx, tmp);
3739 if (seen) obvious = TRUE;
3741 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3745 note = _("は弱くなったようだ。", " seems weakened.");
3746 m_ptr->maxhp -= do_time;
3747 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3752 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3753 if (do_poly && (randint1(90) > r_ptr->level))
3755 if (polymorph_monster(y, x))
3757 if (seen) obvious = TRUE;
3759 /* Monster polymorphs */
3760 note = _("が変身した!", " changes!");
3762 /* Turn off the damage */
3768 note = _("には効果がなかった。", " is unaffected.");
3771 /* Hack -- Get new monster */
3772 m_ptr = &m_list[g_ptr->m_idx];
3774 /* Hack -- Get new race */
3775 r_ptr = &r_info[m_ptr->r_idx];
3778 /* Handle "teleport" */
3781 if (seen) obvious = TRUE;
3783 note = _("が消え去った!", " disappears!");
3785 if (!who) chg_virtue(V_VALOUR, -1);
3788 teleport_away(g_ptr->m_idx, do_dist,
3789 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3791 /* Hack -- get new location */
3795 /* Hack -- get new grid */
3796 g_ptr = &grid_array[y][x];
3803 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3810 if (typ == GF_DRAIN_MANA)
3812 /* Drain mana does nothing */
3815 /* If another monster did the damage, hurt the monster by hand */
3818 /* Redraw (later) if needed */
3819 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3820 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3822 /* Wake the monster up */
3823 (void)set_monster_csleep(g_ptr->m_idx, 0);
3825 /* Hurt the monster */
3833 if (is_pet(m_ptr) && !(m_ptr->ml))
3836 /* Give detailed messages if destroyed */
3839 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3842 msg_format("%^s%s", m_name, note);
3850 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3852 /* Generate treasure, etc */
3853 monster_death(g_ptr->m_idx, FALSE);
3856 delete_monster_idx(g_ptr->m_idx);
3860 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3864 /* Damaged monster */
3867 /* Give detailed messages if visible or destroyed */
3868 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3870 /* Hack -- Pain message */
3873 message_pain(g_ptr->m_idx, dam);
3880 /* Hack -- handle sleep */
3881 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3885 else if (heal_leper)
3887 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3889 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3891 char m2_name[MAX_NLEN];
3893 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3894 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3897 delete_monster_idx(g_ptr->m_idx);
3900 /* If the player did it, give him experience, check fear */
3905 /* Hurt the monster, check for fear and death */
3906 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3911 /* Damaged monster */
3914 /* HACK - anger the monster before showing the sleep message */
3915 if (do_sleep) anger_monster(m_ptr);
3917 /* Give detailed messages if visible or destroyed */
3918 if (note && seen_msg)
3919 msg_format(_("%s%s", "%^s%s"), m_name, note);
3921 /* Hack -- Pain message */
3922 else if (known && (dam || !do_fear))
3924 message_pain(g_ptr->m_idx, dam);
3927 /* Anger monsters */
3928 if (((dam > 0) || get_angry) && !do_sleep)
3929 anger_monster(m_ptr);
3931 if ((fear || do_fear) && seen)
3934 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3937 /* Hack -- handle sleep */
3938 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3942 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3944 blood_curse_to_enemy(who);
3947 if (p_ptr->inside_battle)
3949 p_ptr->health_who = g_ptr->m_idx;
3950 p_ptr->redraw |= (PR_HEALTH);
3954 /* Verify this code */
3955 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
3957 /* Redraw the monster grid */
3960 /* Update monster recall window */
3961 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
3963 p_ptr->window |= (PW_MONSTER);
3966 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
3970 if (!(flg & PROJECT_NO_HANGEKI))
3972 set_target(m_ptr, monster_target_y, monster_target_x);
3975 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
3977 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
3981 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
3983 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
3984 rakubadam_m = (dam > 200) ? 200 : dam;
3994 /* Prepare to make a Blade of Chaos */
3995 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
3997 q_ptr->pval = photo;
3999 /* Mark the item as fully known */
4000 q_ptr->ident |= (IDENT_MENTAL);
4001 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
4009 /* Return "Anything seen?" */
4014 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
4015 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4016 * @param who_name 効果を起こしたモンスターの名前
4017 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4018 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4019 * @param x 目標X座標 / Target x location (or location to travel "towards")
4020 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4021 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4023 * @param monspell 効果元のモンスター魔法ID
4024 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4026 * Handle a beam/bolt/ball causing damage to the player.
4027 * This routine takes a "source monster" (by index), a "distance", a default
4028 * "damage", and a "damage type". See "project_m()" above.
4029 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
4030 * is reduced (see "project_m()" above). This can happen if a monster breathes
4031 * at the player and hits a wall instead.
4032 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
4033 * to know if this is actually a ball or a bolt spell
4034 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
4035 * we just assume that the effects were obvious, for historical reasons.
4037 static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
4042 /* Hack -- assume obvious */
4043 bool obvious = TRUE;
4045 /* Player blind-ness */
4046 bool blind = (p_ptr->blind ? TRUE : FALSE);
4048 /* Player needs a "description" (he is blind) */
4051 /* Source monster */
4052 monster_type *m_ptr = NULL;
4054 /* Monster name (for attacks) */
4055 GAME_TEXT m_name[MAX_NLEN];
4057 /* Monster name (for damage) */
4060 /* Hack -- messages */
4066 /* Player is not here */
4067 if (!player_bold(y, x)) return (FALSE);
4069 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4071 if (kawarimi(TRUE)) return FALSE;
4074 /* Player cannot hurt himself */
4075 if (!who) return (FALSE);
4076 if (who == p_ptr->riding) return (FALSE);
4078 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4081 int max_attempts = 10;
4082 sound(SOUND_REFLECT);
4085 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4086 else if (p_ptr->special_defense & KATA_FUUJIN)
4087 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4089 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4092 /* Choose 'new' target */
4097 t_y = m_list[who].fy - 1 + randint1(3);
4098 t_x = m_list[who].fx - 1 + randint1(3);
4101 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4103 if (max_attempts < 1)
4105 t_y = m_list[who].fy;
4106 t_x = m_list[who].fx;
4111 t_y = p_ptr->y - 1 + randint1(3);
4112 t_x = p_ptr->x - 1 + randint1(3);
4115 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4117 disturb(TRUE, TRUE);
4121 /* Limit maximum damage */
4122 if (dam > 1600) dam = 1600;
4124 /* Reduce damage by distance */
4125 dam = (dam + r) / (r + 1);
4128 /* If the player is blind, be more descriptive */
4129 if (blind) fuzzy = TRUE;
4134 m_ptr = &m_list[who];
4135 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4136 monster_desc(m_name, m_ptr, 0);
4138 /* Get the monster's real name (gotten before polymorph!) */
4139 strcpy(killer, who_name);
4145 case PROJECT_WHO_UNCTRL_POWER:
4146 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4149 case PROJECT_WHO_GLASS_SHARDS:
4150 strcpy(killer, _("ガラスの破片", "shards of glass"));
4154 strcpy(killer, _("罠", "a trap"));
4159 strcpy(m_name, killer);
4162 /* Analyze the damage */
4165 /* Standard damage -- hurts inventory too */
4168 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4169 get_damage = acid_dam(dam, killer, monspell, FALSE);
4173 /* Standard damage -- hurts inventory too */
4176 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4177 get_damage = fire_dam(dam, killer, monspell, FALSE);
4181 /* Standard damage -- hurts inventory too */
4184 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4185 get_damage = cold_dam(dam, killer, monspell, FALSE);
4189 /* Standard damage -- hurts inventory too */
4192 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4193 get_damage = elec_dam(dam, killer, monspell, FALSE);
4197 /* Standard damage -- also poisons player */
4200 bool double_resist = IS_OPPOSE_POIS();
4201 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4203 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4204 if (double_resist) dam = (dam + 2) / 3;
4206 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4211 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4213 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4215 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4220 /* Standard damage -- also poisons / mutates player */
4223 bool double_resist = IS_OPPOSE_POIS();
4224 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4226 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4227 if (double_resist) dam = (2 * dam + 2) / 5;
4228 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4229 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4231 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4233 if (one_in_(5)) /* 6 */
4235 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4236 if (one_in_(4)) /* 4 */
4244 inven_damage(set_acid_destroy, 2);
4250 /* Standard damage */
4253 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4254 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4258 /* Holy Orb -- Player only takes partial damage */
4261 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4262 if (p_ptr->align > 10)
4264 else if (p_ptr->align < -10)
4266 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4272 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4273 if (p_ptr->align > 10)
4275 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4279 /* Arrow -- XXX no dodging */
4284 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4286 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4288 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4291 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4295 /* Plasma -- XXX No resist */
4298 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4299 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4301 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4303 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4304 (void)set_stun(p_ptr->stun + plus_stun);
4307 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4309 inven_damage(set_acid_destroy, 3);
4315 /* Nether -- drain experience */
4318 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4319 if (p_ptr->resist_neth)
4321 if (!prace_is_(RACE_SPECTRE))
4323 dam *= 6; dam /= (randint1(4) + 7);
4326 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4328 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4330 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4332 learn_spell(monspell);
4336 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4342 /* Water -- stun/confuse */
4345 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4346 if (!CHECK_MULTISHADOW())
4348 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4350 set_stun(p_ptr->stun + randint1(40));
4352 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4354 set_confused(p_ptr->confused + randint1(5) + 5);
4357 if (one_in_(5) && !p_ptr->resist_water)
4359 inven_damage(set_cold_destroy, 3);
4362 if (p_ptr->resist_water) get_damage /= 4;
4365 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4369 /* Chaos -- many effects */
4372 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4373 if (p_ptr->resist_chaos)
4375 dam *= 6; dam /= (randint1(4) + 7);
4378 if (!CHECK_MULTISHADOW())
4380 if (!p_ptr->resist_conf)
4382 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4384 if (!p_ptr->resist_chaos)
4386 (void)set_image(p_ptr->image + randint1(10));
4389 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4390 (void)gain_random_mutation(0);
4393 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4395 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4398 if (!p_ptr->resist_chaos || one_in_(9))
4400 inven_damage(set_elec_destroy, 2);
4401 inven_damage(set_fire_destroy, 2);
4405 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4409 /* Shards -- mostly cutting */
4412 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4413 if (p_ptr->resist_shard)
4415 dam *= 6; dam /= (randint1(4) + 7);
4417 else if (!CHECK_MULTISHADOW())
4419 (void)set_cut(p_ptr->cut + dam);
4422 if (!p_ptr->resist_shard || one_in_(13))
4424 inven_damage(set_cold_destroy, 2);
4427 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4431 /* Sound -- mostly stunning */
4434 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4435 if (p_ptr->resist_sound)
4437 dam *= 5; dam /= (randint1(4) + 7);
4439 else if (!CHECK_MULTISHADOW())
4441 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4442 (void)set_stun(p_ptr->stun + plus_stun);
4445 if (!p_ptr->resist_sound || one_in_(13))
4447 inven_damage(set_cold_destroy, 2);
4450 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4454 /* Pure confusion */
4457 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4458 if (p_ptr->resist_conf)
4460 dam *= 5; dam /= (randint1(4) + 7);
4462 else if (!CHECK_MULTISHADOW())
4464 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4466 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4470 /* Disenchantment -- see above */
4473 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4474 if (p_ptr->resist_disen)
4476 dam *= 6; dam /= (randint1(4) + 7);
4478 else if (!CHECK_MULTISHADOW())
4480 (void)apply_disenchant(0);
4482 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4486 /* Nexus -- see above */
4489 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4490 if (p_ptr->resist_nexus)
4492 dam *= 6; dam /= (randint1(4) + 7);
4494 else if (!CHECK_MULTISHADOW())
4498 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4502 /* Force -- mostly stun */
4505 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4506 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4508 (void)set_stun(p_ptr->stun + randint1(20));
4510 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4515 /* Rocket -- stun, cut */
4518 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4519 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4521 (void)set_stun(p_ptr->stun + randint1(20));
4524 if (p_ptr->resist_shard)
4528 else if (!CHECK_MULTISHADOW())
4530 (void)set_cut(p_ptr->cut + (dam / 2));
4533 if (!p_ptr->resist_shard || one_in_(12))
4535 inven_damage(set_cold_destroy, 3);
4538 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4542 /* Inertia -- slowness */
4545 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4546 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4547 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4551 /* Lite -- blinding */
4554 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4555 if (p_ptr->resist_lite)
4557 dam *= 4; dam /= (randint1(4) + 7);
4559 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4561 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4564 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4566 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4569 else if (prace_is_(RACE_S_FAIRY))
4574 if (p_ptr->wraith_form) dam *= 2;
4575 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4577 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4579 p_ptr->wraith_form = 0;
4580 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4581 "The light forces you out of your incorporeal shadow form."));
4583 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4584 p_ptr->update |= (PU_MONSTERS);
4585 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4591 /* Dark -- blinding */
4594 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4595 if (p_ptr->resist_dark)
4597 dam *= 4; dam /= (randint1(4) + 7);
4599 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4601 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4603 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4605 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4609 /* Time -- bolt fewer effects XXX */
4612 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4613 if (p_ptr->resist_time)
4616 dam /= (randint1(4) + 7);
4617 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4619 else if (!CHECK_MULTISHADOW())
4621 switch (randint1(10))
4623 case 1: case 2: case 3: case 4: case 5:
4625 if (p_ptr->prace == RACE_ANDROID) break;
4626 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4627 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4631 case 6: case 7: case 8: case 9:
4633 switch (randint1(6))
4635 case 1: k = A_STR; act = _("強く", "strong"); break;
4636 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4637 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4638 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4639 case 5: k = A_CON; act = _("健康で", "hale"); break;
4640 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4643 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4644 "You're not as %s as you used to be..."), act);
4646 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4647 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4648 p_ptr->update |= (PU_BONUS);
4654 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4655 "You're not as powerful as you used to be..."));
4657 for (k = 0; k < A_MAX; k++)
4659 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4660 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4662 p_ptr->update |= (PU_BONUS);
4668 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4672 /* Gravity -- stun plus slowness plus teleport */
4675 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4676 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4678 if (!CHECK_MULTISHADOW())
4680 teleport_player(5, TELEPORT_PASSIVE);
4681 if (!p_ptr->levitation)
4682 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4683 if (!(p_ptr->resist_sound || p_ptr->levitation))
4685 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4686 (void)set_stun(p_ptr->stun + plus_stun);
4689 if (p_ptr->levitation)
4691 dam = (dam * 2) / 3;
4694 if (!p_ptr->levitation || one_in_(13))
4696 inven_damage(set_cold_destroy, 2);
4699 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4703 /* Standard damage */
4704 case GF_DISINTEGRATE:
4706 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4708 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4714 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4716 (void)hp_player(dam);
4723 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4724 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4731 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4732 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4738 if (p_ptr->free_act) break;
4739 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4741 if (ironman_nightmare)
4743 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4744 /* Have some nightmares */
4745 sanity_blast(NULL, FALSE);
4748 set_paralyzed(p_ptr->paralyzed + dam);
4758 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4759 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4766 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4767 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4774 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4776 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4777 if (!p_ptr->resist_shard || one_in_(13))
4779 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4780 inven_damage(set_cold_destroy, 2);
4786 /* Ice -- cold plus stun plus cuts */
4789 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4790 get_damage = cold_dam(dam, killer, monspell, FALSE);
4791 if (!CHECK_MULTISHADOW())
4793 if (!p_ptr->resist_shard)
4795 (void)set_cut(p_ptr->cut + damroll(5, 8));
4797 if (!p_ptr->resist_sound)
4799 (void)set_stun(p_ptr->stun + randint1(15));
4802 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4804 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4814 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4816 if (p_ptr->mimic_form)
4818 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4819 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4824 switch (p_ptr->prace)
4826 /* Some races are immune */
4840 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4852 if (CHECK_MULTISHADOW())
4854 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4856 else if (p_ptr->csp)
4860 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4862 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4865 if (dam >= p_ptr->csp)
4869 p_ptr->csp_frac = 0;
4878 learn_spell(monspell);
4879 p_ptr->redraw |= (PR_MANA);
4880 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4884 /* Heal the monster */
4885 if (m_ptr->hp < m_ptr->maxhp)
4889 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4891 /* Redraw (later) if needed */
4892 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4893 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4895 /* Special message */
4898 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4911 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4913 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4914 learn_spell(monspell);
4918 if (!CHECK_MULTISHADOW())
4920 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4922 if (!p_ptr->resist_conf)
4924 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4927 if (!p_ptr->resist_chaos && one_in_(3))
4929 (void)set_image(p_ptr->image + randint0(250) + 150);
4936 p_ptr->csp_frac = 0;
4938 p_ptr->redraw |= PR_MANA;
4941 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4947 case GF_BRAIN_SMASH:
4949 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
4951 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
4952 learn_spell(monspell);
4956 if (!CHECK_MULTISHADOW())
4958 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
4964 p_ptr->csp_frac = 0;
4966 p_ptr->redraw |= PR_MANA;
4969 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4970 if (!CHECK_MULTISHADOW())
4972 if (!p_ptr->resist_blind)
4974 (void)set_blind(p_ptr->blind + 8 + randint0(8));
4976 if (!p_ptr->resist_conf)
4978 (void)set_confused(p_ptr->confused + randint0(4) + 4);
4980 if (!p_ptr->free_act)
4982 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
4984 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4986 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4987 (void)do_dec_stat(A_INT);
4988 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
4989 (void)do_dec_stat(A_WIS);
4991 if (!p_ptr->resist_chaos)
4993 (void)set_image(p_ptr->image + randint0(250) + 150);
5003 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5005 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5006 learn_spell(monspell);
5010 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
5011 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5019 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5021 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5022 learn_spell(monspell);
5026 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
5027 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5035 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5037 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5038 learn_spell(monspell);
5042 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5043 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5051 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5053 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5054 learn_spell(monspell);
5058 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5059 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5067 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5069 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5070 learn_spell(monspell);
5074 if (!CHECK_MULTISHADOW())
5076 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5077 curse_equipment(40, 20);
5080 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5082 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
5097 /* Hex - revenge damage stored */
5098 revenge_store(get_damage);
5100 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5101 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5103 GAME_TEXT m_name_self[80];
5106 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5108 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5109 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5110 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5113 if (p_ptr->riding && dam > 0)
5115 rakubadam_p = (dam > 200) ? 200 : dam;
5119 disturb(TRUE, TRUE);
5122 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5124 (void)kawarimi(FALSE);
5127 /* Return "Anything seen?" */
5133 * Find the distance from (x, y) to a line.
5135 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5137 /* Vector from (x, y) to (x1, y1) */
5138 POSITION py = y1 - y;
5139 POSITION px = x1 - x;
5142 POSITION ny = x2 - x1;
5143 POSITION nx = y1 - y2;
5146 POSITION pd = distance(y1, x1, y, x);
5147 POSITION nd = distance(y1, x1, y2, x2);
5149 if (pd > nd) return distance(y, x, y2, x2);
5151 /* Component of P on N */
5152 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5154 /* Absolute value */
5155 return((nd >= 0) ? nd : 0 - nd);
5162 * Modified version of los() for calculation of disintegration balls.
5163 * Disintegration effects are stopped by permanent walls.
5165 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5167 POSITION dx, dy; /* Delta */
5168 POSITION ax, ay; /* Absolute */
5169 POSITION sx, sy; /* Signs */
5170 POSITION qx, qy; /* Fractions */
5171 POSITION tx, ty; /* Scanners */
5172 POSITION f1, f2; /* Scale factors */
5173 POSITION m; /* Slope, or 1/Slope, of LOS */
5175 /* Extract the offset */
5179 /* Extract the absolute offset */
5183 /* Handle adjacent (or identical) grids */
5184 if ((ax < 2) && (ay < 2)) return (TRUE);
5186 /* Paranoia -- require "safe" origin */
5187 /* if (!in_bounds(y1, x1)) return (FALSE); */
5189 /* Directly South/North */
5192 /* South -- check for walls */
5195 for (ty = y1 + 1; ty < y2; ty++)
5197 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5201 /* North -- check for walls */
5204 for (ty = y1 - 1; ty > y2; ty--)
5206 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5214 /* Directly East/West */
5217 /* East -- check for walls */
5220 for (tx = x1 + 1; tx < x2; tx++)
5222 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5226 /* West -- check for walls */
5229 for (tx = x1 - 1; tx > x2; tx--)
5231 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5239 /* Extract some signs */
5240 sx = (dx < 0) ? -1 : 1;
5241 sy = (dy < 0) ? -1 : 1;
5243 /* Vertical "knights" */
5248 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5252 /* Horizontal "knights" */
5257 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5261 /* Calculate scale factor div 2 */
5264 /* Calculate scale factor */
5268 /* Travel horizontally */
5271 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5277 /* Consider the special case where slope == 1. */
5288 /* Note (below) the case (qy == f2), where */
5289 /* the LOS exactly meets the corner of a tile. */
5292 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5303 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5316 /* Travel vertically */
5319 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5335 /* Note (below) the case (qx == f2), where */
5336 /* the LOS exactly meets the corner of a tile. */
5339 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5350 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5371 void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, EFFECT_ID typ)
5376 int brev = rad * rad / dist;
5380 int mdis = distance(y1, x1, y2, x2) + rad;
5382 while (bdis <= mdis)
5386 if ((0 < dist) && (path_n < dist))
5388 POSITION ny = GRID_Y(path_g[path_n]);
5389 POSITION nx = GRID_X(path_g[path_n]);
5390 POSITION nd = distance(ny, nx, y1, x1);
5392 /* Get next base point */
5401 /* Travel from center outward */
5402 for (cdis = 0; cdis <= brad; cdis++)
5404 /* Scan the maximal blast area of radius "cdis" */
5405 for (y = by - cdis; y <= by + cdis; y++)
5407 for (x = bx - cdis; x <= bx + cdis; x++)
5409 /* Ignore "illegal" locations */
5410 if (!in_bounds(y, x)) continue;
5412 /* Enforce a circular "ripple" */
5413 if (distance(y1, x1, y, x) != bdis) continue;
5415 /* Enforce an arc */
5416 if (distance(by, bx, y, x) != cdis) continue;
5422 /* Lights are stopped by opaque terrains */
5423 if (!los(by, bx, y, x)) continue;
5425 case GF_DISINTEGRATE:
5426 /* Disintegration are stopped only by perma-walls */
5427 if (!in_disintegration_range(by, bx, y, x)) continue;
5430 /* Ball explosions are stopped by walls */
5431 if (!projectable(by, bx, y, x)) continue;
5435 /* Save this grid */
5443 /* Encode some more "radius" info */
5444 gm[bdis + 1] = *pgrids;
5446 /* Increase the size */
5447 brad = rad * (path_n + brev) / (dist + brev);
5449 /* Find the next ripple */
5453 /* Store the effect size */
5459 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5460 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5461 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5462 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5463 * @param x 目標X座標 / Target x location (or location to travel "towards")
5464 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5465 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5466 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5467 * @param monspell 効果元のモンスター魔法ID
5468 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5471 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5472 * towards a given location (optionally passing over the heads of interposing
5473 * monsters), and have it do a given amount of damage to the monsters (and
5474 * optionally objects) within the given radius of the final location.
5476 * A "bolt" travels from source to target and affects only the target grid.
5477 * A "beam" travels from source to target, affecting all grids passed through.
5478 * A "ball" travels from source to the target, exploding at the target, and
5479 * affecting everything within the given radius of the target location.
5481 * Traditionally, a "bolt" does not affect anything on the ground, and does
5482 * not pass over the heads of interposing monsters, much like a traditional
5483 * missile, and will "stop" abruptly at the "target" even if no monster is
5484 * positioned there, while a "ball", on the other hand, passes over the heads
5485 * of monsters between the source and target, and affects everything except
5486 * the source monster which lies within the final radius, while a "beam"
5487 * affects every monster between the source and target, except for the casting
5488 * monster (or player), and rarely affects things on the ground.
5490 * Two special flags allow us to use this function in special ways, the
5491 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5492 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5493 * actually projecting from the source monster (or player).
5495 * The player will only get "experience" for monsters killed by himself
5496 * Unique monsters can only be destroyed by attacks from the player
5498 * Only 256 grids can be affected per projection, limiting the effective
5499 * "radius" of standard ball attacks to nine units (diameter nineteen).
5501 * One can project in a given "direction" by combining PROJECT_THRU with small
5502 * offsets to the initial location (see "line_spell()"), or by calculating
5503 * "virtual targets" far away from the player.
5505 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5506 * continuing until it actually hits somethings (useful for "stone to mud").
5508 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5510 * Balls must explode BEFORE hitting walls, or they would affect monsters
5511 * on both sides of a wall. Some bug reports indicate that this is still
5512 * happening in 2.7.8 for Windows, though it appears to be impossible.
5514 * We "pre-calculate" the blast area only in part for efficiency.
5515 * More importantly, this lets us do "explosions" from the "inside" out.
5516 * This results in a more logical distribution of "blast" treasure.
5517 * It also produces a better (in my opinion) animation of the explosion.
5518 * It could be (but is not) used to have the treasure dropped by monsters
5519 * in the middle of the explosion fall "outwards", and then be damaged by
5520 * the blast as it spreads outwards towards the treasure drop location.
5522 * Walls and doors are included in the blast area, so that they can be
5523 * "burned" or "melted" in later versions.
5525 * This algorithm is intended to maximize simplicity, not necessarily
5526 * efficiency, since this function is not a bottleneck in the code.
5528 * We apply the blast effect from ground zero outwards, in several passes,
5529 * first affecting features, then objects, then monsters, then the player.
5530 * This allows walls to be removed before checking the object or monster
5531 * in the wall, and protects objects which are dropped by monsters killed
5532 * in the blast, and allows the player to see all affects before he is
5533 * killed or teleported away. The semantics of this method are open to
5534 * various interpretations, but they seem to work well in practice.
5536 * We process the blast area from ground-zero outwards to allow for better
5537 * distribution of treasure dropped by monsters, and because it provides a
5538 * pleasing visual effect at low cost.
5540 * Note that the damage done by "ball" explosions decreases with distance.
5541 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5543 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5544 * the target, and then the damage "flows" along this beam of destruction.
5545 * The damage at every grid is the same as at the "center" of a "ball"
5546 * explosion, since the "beam" grids are treated as if they ARE at the
5547 * center of a "ball" explosion.
5549 * Currently, specifying "beam" plus "ball" means that locations which are
5550 * covered by the initial "beam", and also covered by the final "ball", except
5551 * for the final grid (the epicenter of the ball), will be "hit twice", once
5552 * by the initial beam, and once by the exploding ball. For the grid right
5553 * next to the epicenter, this results in 150% damage being done. The center
5554 * does not have this problem, for the same reason the final grid in a "beam"
5555 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5556 * grids which are covered by the "ball" will NOT work, as then they will
5557 * receive LESS damage than they should. Do not combine "beam" with "ball".
5559 * The array "gy[],gx[]" with current size "grids" is used to hold the
5560 * collected locations of all grids in the "blast area" plus "beam path".
5562 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5563 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5564 * first blast grid (see above) with radius "N" from the blast center. Note
5565 * that only the first gm[1] grids in the blast area thus take full damage.
5566 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5567 * number of blast grids.
5569 * Note that once the projection is complete, (y2,x2) holds the final location
5570 * of bolts/beams, and the "epicenter" of balls.
5572 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5573 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5574 * implementation of the "distance" function. Also, a bolt can be properly
5575 * viewed as a "ball" with a "rad" of "zero".
5577 * Note that if no "target" is reached before the beam/bolt/ball travels the
5578 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5579 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5581 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5582 * to move from point A to point B, even if the player cannot see part of the
5583 * projection path. Note that in general, the player will *always* see part
5584 * of the path, since it either starts at the player or ends on the player.
5586 * Hack -- we assume that every "projection" is "self-illuminating".
5588 * Hack -- when only a single monster is affected, we automatically track
5589 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5591 * Note that all projections now "explode" at their final destination, even
5592 * if they were being projected at a more distant destination. This means
5593 * that "ball" spells will *always* explode.
5595 * Note that we must call "handle_stuff()" after affecting terrain features
5596 * in the blast radius, in case the "illumination" of the grid was changed,
5597 * and "update_view()" and "update_monsters()" need to be called.
5600 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5610 POSITION y_saver, x_saver; /* For reflecting monsters */
5612 int msec = delay_factor * delay_factor * delay_factor;
5614 /* Assume the player sees nothing */
5615 bool notice = FALSE;
5617 /* Assume the player has seen nothing */
5618 bool visual = FALSE;
5620 /* Assume the player has seen no blast grids */
5623 /* Assume to be a normal ball spell */
5624 bool breath = FALSE;
5626 /* Is the player blind? */
5627 bool blind = (p_ptr->blind ? TRUE : FALSE);
5629 bool old_hide = FALSE;
5631 /* Number of grids in the "path" */
5634 /* Actual grids in the "path" */
5637 /* Number of grids in the "blast area" (including the "beam" path) */
5640 /* Coordinates of the affected grids */
5641 POSITION gx[1024], gy[1024];
5643 /* Encoded "radius" info (see above) */
5646 /* Actual radius encoded in gm[] */
5647 POSITION gm_rad = rad;
5651 /* Attacker's name (prepared before polymorph)*/
5652 GAME_TEXT who_name[MAX_NLEN];
5654 /* Can the player see the source of this effect? */
5655 bool see_s_msg = TRUE;
5657 /* Initialize by null string */
5663 /* Default target of monsterspell is player */
5664 monster_target_y = p_ptr->y;
5665 monster_target_x = p_ptr->x;
5667 /* Hack -- Jump to target */
5668 if (flg & (PROJECT_JUMP))
5673 /* Clear the flag */
5674 flg &= ~(PROJECT_JUMP);
5679 /* Start at player */
5686 /* Start at monster */
5689 x1 = m_list[who].fx;
5690 y1 = m_list[who].fy;
5691 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5703 /* Default "destination" */
5708 /* Hack -- verify stuff */
5709 if (flg & (PROJECT_THRU))
5711 if ((x1 == x2) && (y1 == y2))
5713 flg &= ~(PROJECT_THRU);
5717 /* Handle a breath attack */
5722 if (flg & PROJECT_HIDE) old_hide = TRUE;
5723 flg |= PROJECT_HIDE;
5727 /* Hack -- Assume there will be no blast (max radius 32) */
5728 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5736 /* Collect beam grids */
5737 if (flg & (PROJECT_BEAM))
5748 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5750 case GF_DISINTEGRATE:
5751 flg |= (PROJECT_GRID);
5752 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5756 /* Calculate the projection path */
5758 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5761 /* Giga-Hack SEEKER & SUPER_RAY */
5763 if( typ == GF_SEEKER )
5773 for (i = 0; i < path_n; ++i)
5778 POSITION ny = GRID_Y(path_g[i]);
5779 POSITION nx = GRID_X(path_g[i]);
5790 /* Only do visuals if requested */
5791 if (!blind && !(flg & (PROJECT_HIDE)))
5793 /* Only do visuals if the player can "see" the bolt */
5794 if (panel_contains(y, x) && player_has_los_bold(y, x))
5801 /* Obtain the bolt pict */
5802 p = bolt_pict(oy, ox, y, x, typ);
5804 /* Extract attr/char */
5808 /* Visual effects */
5809 print_rel(c, a, y, x);
5810 move_cursor_relative(y, x);
5811 /*if (fresh_before)*/ Term_fresh();
5812 Term_xtra(TERM_XTRA_DELAY, msec);
5814 /*if (fresh_before)*/ Term_fresh();
5816 /* Display "beam" grids */
5817 if (flg & (PROJECT_BEAM))
5819 /* Obtain the explosion pict */
5820 p = bolt_pict(y, x, y, x, typ);
5822 /* Extract attr/char */
5826 /* Visual effects */
5827 print_rel(c, a, y, x);
5830 /* Hack -- Activate delay */
5834 /* Hack -- delay anyway for consistency */
5837 /* Delay for consistency */
5838 Term_xtra(TERM_XTRA_DELAY, msec);
5841 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5842 if (is_mirror_grid(&grid_array[y][x]))
5844 /* The target of monsterspell becomes tha mirror(broken) */
5845 monster_target_y = y;
5846 monster_target_x = x;
5848 remove_mirror(y, x);
5849 next_mirror(&oy, &ox, y, x);
5851 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5852 for (j = last_i; j <= i; j++)
5854 y = GRID_Y(path_g[j]);
5855 x = GRID_X(path_g[j]);
5856 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5857 if (!who && (project_m_n == 1) && !jump) {
5858 if (grid_array[project_m_y][project_m_x].m_idx > 0) {
5859 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
5863 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5864 health_track(grid_array[project_m_y][project_m_x].m_idx);
5868 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5873 for(i = last_i ; i < path_n ; i++)
5876 py = GRID_Y(path_g[i]);
5877 px = GRID_X(path_g[i]);
5878 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5880 if (!who && (project_m_n == 1) && !jump) {
5881 if (grid_array[project_m_y][project_m_x].m_idx > 0)
5883 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
5887 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5888 health_track(grid_array[project_m_y][project_m_x].m_idx);
5892 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5896 else if(typ == GF_SUPER_RAY){
5898 int second_step = 0;
5905 for (i = 0; i < path_n; ++i)
5910 POSITION ny = GRID_Y(path_g[i]);
5911 POSITION nx = GRID_X(path_g[i]);
5922 /* Only do visuals if requested */
5923 if (!blind && !(flg & (PROJECT_HIDE)))
5925 /* Only do visuals if the player can "see" the bolt */
5926 if (panel_contains(y, x) && player_has_los_bold(y, x))
5933 /* Obtain the bolt pict */
5934 p = bolt_pict(oy, ox, y, x, typ);
5936 /* Extract attr/char */
5940 /* Visual effects */
5941 print_rel(c, a, y, x);
5942 move_cursor_relative(y, x);
5943 /*if (fresh_before)*/ Term_fresh();
5944 Term_xtra(TERM_XTRA_DELAY, msec);
5946 /*if (fresh_before)*/ Term_fresh();
5948 /* Display "beam" grids */
5949 if (flg & (PROJECT_BEAM))
5951 /* Obtain the explosion pict */
5952 p = bolt_pict(y, x, y, x, typ);
5954 /* Extract attr/char */
5958 /* Visual effects */
5959 print_rel(c, a, y, x);
5962 /* Hack -- Activate delay */
5966 /* Hack -- delay anyway for consistency */
5969 /* Delay for consistency */
5970 Term_xtra(TERM_XTRA_DELAY, msec);
5973 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
5974 if (!cave_have_flag_bold(y, x, FF_PROJECT))
5976 if( second_step )continue;
5979 if( is_mirror_grid(&grid_array[y][x]) && !second_step )
5981 /* The target of monsterspell becomes tha mirror(broken) */
5982 monster_target_y = y;
5983 monster_target_x = x;
5986 for( j = 0; j <=i ; j++ )
5988 y = GRID_Y(path_g[j]);
5989 x = GRID_X(path_g[j]);
5990 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
5994 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
5995 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
5996 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
5997 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
5998 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
5999 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
6000 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
6001 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
6004 for( i = 0; i < path_n ; i++ )
6007 py = GRID_Y(path_g[i]);
6008 px = GRID_X(path_g[i]);
6009 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
6010 if(!who && (project_m_n == 1) && !jump){
6011 if(grid_array[project_m_y][project_m_x].m_idx >0 ){
6012 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6016 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6017 health_track(grid_array[project_m_y][project_m_x].m_idx);
6021 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
6026 /* Project along the path */
6027 for (i = 0; i < path_n; ++i)
6032 POSITION ny = GRID_Y(path_g[i]);
6033 POSITION nx = GRID_X(path_g[i]);
6035 if (flg & PROJECT_DISI)
6037 /* Hack -- Balls explode before reaching walls */
6038 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
6040 else if (flg & PROJECT_LOS)
6042 /* Hack -- Balls explode before reaching walls */
6043 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6047 /* Hack -- Balls explode before reaching walls */
6048 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6055 /* Collect beam grids */
6056 if (flg & (PROJECT_BEAM))
6063 /* Only do visuals if requested */
6064 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6066 /* Only do visuals if the player can "see" the bolt */
6067 if (panel_contains(y, x) && player_has_los_bold(y, x))
6074 /* Obtain the bolt pict */
6075 p = bolt_pict(oy, ox, y, x, typ);
6077 /* Extract attr/char */
6081 /* Visual effects */
6082 print_rel(c, a, y, x);
6083 move_cursor_relative(y, x);
6084 /*if (fresh_before)*/ Term_fresh();
6085 Term_xtra(TERM_XTRA_DELAY, msec);
6087 /*if (fresh_before)*/ Term_fresh();
6089 /* Display "beam" grids */
6090 if (flg & (PROJECT_BEAM))
6092 /* Obtain the explosion pict */
6093 p = bolt_pict(y, x, y, x, typ);
6095 /* Extract attr/char */
6099 /* Visual effects */
6100 print_rel(c, a, y, x);
6103 /* Hack -- Activate delay */
6107 /* Hack -- delay anyway for consistency */
6110 /* Delay for consistency */
6111 Term_xtra(TERM_XTRA_DELAY, msec);
6118 /* Save the "blast epicenter" */
6122 if (breath && !path_n)
6128 flg &= ~(PROJECT_HIDE);
6132 /* Start the "explosion" */
6135 /* Hack -- make sure beams get to "explode" */
6143 /* If we found a "target", explode there */
6144 if (dist <= MAX_RANGE)
6146 /* Mega-Hack -- remove the final "beam" grid */
6147 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6150 * Create a conical breath attack
6161 flg &= ~(PROJECT_HIDE);
6163 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6167 /* Determine the blast area, work from the inside out */
6168 for (dist = 0; dist <= rad; dist++)
6170 /* Scan the maximal blast area of radius "dist" */
6171 for (y = by - dist; y <= by + dist; y++)
6173 for (x = bx - dist; x <= bx + dist; x++)
6175 /* Ignore "illegal" locations */
6176 if (!in_bounds2(y, x)) continue;
6178 /* Enforce a "circular" explosion */
6179 if (distance(by, bx, y, x) != dist) continue;
6185 /* Lights are stopped by opaque terrains */
6186 if (!los(by, bx, y, x)) continue;
6188 case GF_DISINTEGRATE:
6189 /* Disintegration are stopped only by perma-walls */
6190 if (!in_disintegration_range(by, bx, y, x)) continue;
6193 /* Ball explosions are stopped by walls */
6194 if (!projectable(by, bx, y, x)) continue;
6198 /* Save this grid */
6205 /* Encode some more "radius" info */
6211 /* Speed -- ignore "non-explosions" */
6212 if (!grids) return (FALSE);
6215 /* Display the "blast area" if requested */
6216 if (!blind && !(flg & (PROJECT_HIDE)))
6218 /* Then do the "blast", from inside out */
6219 for (t = 0; t <= gm_rad; t++)
6221 /* Dump everything with this radius */
6222 for (i = gm[t]; i < gm[t+1]; i++)
6224 /* Extract the location */
6228 /* Only do visuals if the player can "see" the blast */
6229 if (panel_contains(y, x) && player_has_los_bold(y, x))
6238 /* Obtain the explosion pict */
6239 p = bolt_pict(y, x, y, x, typ);
6241 /* Extract attr/char */
6245 /* Visual effects -- Display */
6246 print_rel(c, a, y, x);
6250 /* Hack -- center the cursor */
6251 move_cursor_relative(by, bx);
6253 /* Flush each "radius" seperately */
6254 /*if (fresh_before)*/ Term_fresh();
6256 /* Delay (efficiently) */
6257 if (visual || drawn)
6259 Term_xtra(TERM_XTRA_DELAY, msec);
6263 /* Flush the erasing */
6266 /* Erase the explosion drawn above */
6267 for (i = 0; i < grids; i++)
6269 /* Extract the location */
6273 /* Hack -- Erase if needed */
6274 if (panel_contains(y, x) && player_has_los_bold(y, x))
6280 /* Hack -- center the cursor */
6281 move_cursor_relative(by, bx);
6283 /* Flush the explosion */
6284 /*if (fresh_before)*/ Term_fresh();
6288 update_creature(p_ptr);
6290 if (flg & PROJECT_KILL)
6292 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
6293 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6297 /* Check features */
6298 if (flg & (PROJECT_GRID))
6300 /* Start with "dist" of zero */
6303 /* Scan for features */
6304 for (i = 0; i < grids; i++)
6306 /* Hack -- Notice new "dist" values */
6307 if (gm[dist+1] == i) dist++;
6309 /* Get the grid location */
6313 /* Find the closest point in the blast */
6316 int d = dist_to_line(y, x, y1, x1, by, bx);
6318 /* Affect the grid */
6319 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6323 /* Affect the grid */
6324 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6329 update_creature(p_ptr);
6332 if (flg & (PROJECT_ITEM))
6334 /* Start with "dist" of zero */
6337 /* Scan for objects */
6338 for (i = 0; i < grids; i++)
6340 /* Hack -- Notice new "dist" values */
6341 if (gm[dist+1] == i) dist++;
6343 /* Get the grid location */
6347 /* Find the closest point in the blast */
6350 int d = dist_to_line(y, x, y1, x1, by, bx);
6352 /* Affect the object in the grid */
6353 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6357 /* Affect the object in the grid */
6358 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6364 /* Check monsters */
6365 if (flg & (PROJECT_KILL))
6372 /* Start with "dist" of zero */
6375 /* Scan for monsters */
6376 for (i = 0; i < grids; i++)
6380 /* Hack -- Notice new "dist" values */
6381 if (gm[dist + 1] == i) dist++;
6383 /* Get the grid location */
6387 /* A single bolt may be reflected */
6390 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6391 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6393 if ((flg & PROJECT_REFLECTABLE) && grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6394 ((grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6395 (!who || dist_hack > 1) && !one_in_(10))
6398 int max_attempts = 10;
6400 /* Choose 'new' target */
6403 t_y = y_saver - 1 + randint1(3);
6404 t_x = x_saver - 1 + randint1(3);
6407 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6409 if (max_attempts < 1)
6415 sound(SOUND_REFLECT);
6418 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6419 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6420 else if (m_ptr->r_idx == MON_DIO)
6421 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6423 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6425 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6427 /* Reflected bolts randomly target either one */
6428 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6429 else flg |= PROJECT_PLAYER;
6431 /* The bolt is reflected */
6432 project(grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6434 /* Don't affect the monster any longer */
6440 /* Find the closest point in the blast */
6443 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6447 effective_dist = dist;
6451 /* There is the riding player on this monster */
6452 if (p_ptr->riding && player_bold(y, x))
6454 /* Aimed on the player */
6455 if (flg & PROJECT_PLAYER)
6457 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6460 * A beam or bolt is well aimed
6462 * So don't affects the mount.
6469 * The spell is not well aimed,
6470 * So partly affect the mount too.
6477 * This grid is the original target.
6478 * Or aimed on your horse.
6480 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6482 /* Hit the mount with full damage */
6486 * Otherwise this grid is not the
6487 * original target, it means that line
6488 * of fire is obstructed by this
6492 * A beam or bolt will hit either
6493 * player or mount. Choose randomly.
6495 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6499 /* Hit the mount with full damage */
6503 /* Hit the player later */
6504 flg |= PROJECT_PLAYER;
6506 /* Don't affect the mount */
6512 * The spell is not well aimed, so
6513 * partly affect both player and
6522 /* Affect the monster in the grid */
6523 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6527 /* Player affected one monster (without "jumping") */
6528 if (!who && (project_m_n == 1) && !jump)
6533 /* Track if possible */
6534 if (grid_array[y][x].m_idx > 0)
6536 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6540 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6541 health_track(grid_array[y][x].m_idx);
6549 if (flg & (PROJECT_KILL))
6551 /* Start with "dist" of zero */
6554 /* Scan for player */
6555 for (i = 0; i < grids; i++)
6559 /* Hack -- Notice new "dist" values */
6560 if (gm[dist+1] == i) dist++;
6562 /* Get the grid location */
6566 /* Affect the player? */
6567 if (!player_bold(y, x)) continue;
6569 /* Find the closest point in the blast */
6572 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6576 effective_dist = dist;
6579 /* Target may be your horse */
6582 /* Aimed on the player */
6583 if (flg & PROJECT_PLAYER)
6585 /* Hit the player with full damage */
6589 * Hack -- When this grid was not the
6590 * original target, a beam or bolt
6591 * would hit either player or mount,
6592 * and should be choosen randomly.
6594 * But already choosen to hit the
6595 * mount at this point.
6597 * Or aimed on your horse.
6599 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6602 * A beam or bolt is well aimed
6604 * So don't affects the player.
6611 * The spell is not well aimed,
6612 * So partly affect the player too.
6618 /* Affect the player */
6619 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6625 GAME_TEXT m_name[MAX_NLEN];
6627 monster_desc(m_name, &m_list[p_ptr->riding], 0);
6629 if (rakubadam_m > 0)
6631 if (rakuba(rakubadam_m, FALSE))
6633 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6636 if (p_ptr->riding && rakubadam_p > 0)
6638 if(rakuba(rakubadam_p, FALSE))
6640 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6645 /* Return "something was noticed" */
6650 * @brief 鏡魔法「封魔結界」の効果処理
6652 * @return 効果があったらTRUEを返す
6654 bool binding_field(HIT_POINT dam)
6656 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6657 int mirror_num = 0; /* 鏡の数 */
6659 POSITION centersign;
6660 POSITION x1, x2, y1, y2;
6662 int msec = delay_factor*delay_factor*delay_factor;
6665 POSITION point_x[3];
6666 POSITION point_y[3];
6668 /* Default target of monsterspell is player */
6669 monster_target_y = p_ptr->y;
6670 monster_target_x = p_ptr->x;
6672 for (x = 0; x < cur_wid; x++)
6674 for (y = 0; y < cur_hgt; y++)
6676 if (is_mirror_grid(&grid_array[y][x]) &&
6677 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6678 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6679 player_has_los_bold(y, x) &&
6680 projectable(p_ptr->y, p_ptr->x, y, x)
6682 mirror_y[mirror_num] = y;
6683 mirror_x[mirror_num] = x;
6689 if (mirror_num < 2)return FALSE;
6691 point_x[0] = randint0(mirror_num);
6693 point_x[1] = randint0(mirror_num);
6694 } while (point_x[0] == point_x[1]);
6696 point_y[0] = mirror_y[point_x[0]];
6697 point_x[0] = mirror_x[point_x[0]];
6698 point_y[1] = mirror_y[point_x[1]];
6699 point_x[1] = mirror_x[point_x[1]];
6700 point_y[2] = p_ptr->y;
6701 point_x[2] = p_ptr->x;
6703 x = point_x[0] + point_x[1] + point_x[2];
6704 y = point_y[0] + point_y[1] + point_y[2];
6706 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6707 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6708 if (centersign == 0)return FALSE;
6710 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6711 x1 = x1 < point_x[2] ? x1 : point_x[2];
6712 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6713 y1 = y1 < point_y[2] ? y1 : point_y[2];
6715 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6716 x2 = x2 > point_x[2] ? x2 : point_x[2];
6717 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6718 y2 = y2 > point_y[2] ? y2 : point_y[2];
6720 for (y = y1; y <= y2; y++) {
6721 for (x = x1; x <= x2; x++) {
6722 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6723 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6724 centersign*((point_x[1] - x)*(point_y[2] - y)
6725 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6726 centersign*((point_x[2] - x)*(point_y[0] - y)
6727 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6729 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6730 /* Visual effects */
6732 && panel_contains(y, x)) {
6733 p = bolt_pict(y, x, y, x, GF_MANA);
6734 print_rel(PICT_C(p), PICT_A(p), y, x);
6735 move_cursor_relative(y, x);
6736 /*if (fresh_before)*/ Term_fresh();
6737 Term_xtra(TERM_XTRA_DELAY, msec);
6743 for (y = y1; y <= y2; y++) {
6744 for (x = x1; x <= x2; x++) {
6745 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6746 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6747 centersign*((point_x[1] - x)*(point_y[2] - y)
6748 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6749 centersign*((point_x[2] - x)*(point_y[0] - y)
6750 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6752 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6753 (void)project_f(0, 0, y, x, dam, GF_MANA);
6758 for (y = y1; y <= y2; y++) {
6759 for (x = x1; x <= x2; x++) {
6760 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6761 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6762 centersign*((point_x[1] - x)*(point_y[2] - y)
6763 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6764 centersign*((point_x[2] - x)*(point_y[0] - y)
6765 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6767 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6768 (void)project_o(0, 0, y, x, dam, GF_MANA);
6773 for (y = y1; y <= y2; y++) {
6774 for (x = x1; x <= x2; x++) {
6775 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6776 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6777 centersign*((point_x[1] - x)*(point_y[2] - y)
6778 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6779 centersign*((point_x[2] - x)*(point_y[0] - y)
6780 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6782 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6783 (void)project_m(0, 0, y, x, dam, GF_MANA,
6784 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6790 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6791 remove_mirror(point_y[0], point_x[0]);
6798 * @brief 鏡魔法「鏡の封印」の効果処理
6800 * @return 効果があったらTRUEを返す
6802 void seal_of_mirror(HIT_POINT dam)
6806 for (x = 0; x < cur_wid; x++)
6808 for (y = 0; y < cur_hgt; y++)
6810 if (is_mirror_grid(&grid_array[y][x]))
6812 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6813 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6815 if (!grid_array[y][x].m_idx)
6817 remove_mirror(y, x);
6829 * @brief 領域魔法に応じて技能の名称を返す。
6830 * @param tval 魔法書のtval
6831 * @return 領域魔法の技能名称を保管した文字列ポインタ
6833 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6837 case TV_HISSATSU_BOOK:
6838 return _("必殺技", "art");
6840 return _("祈り", "prayer");
6842 return _("歌", "song");
6844 return _("呪文", "spell");