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 POSITION ty = m_ptr->fy;
1244 POSITION tx = m_ptr->fx;
1246 DEPTH caster_lev = (who > 0) ? r_info[caster_ptr->r_idx].level : (p_ptr->lev * 2);
1249 if (!g_ptr->m_idx) return (FALSE);
1251 /* Never affect projector */
1252 if (who && (g_ptr->m_idx == who)) return (FALSE);
1253 if ((g_ptr->m_idx == p_ptr->riding) && !who && !(typ == GF_OLD_HEAL) && !(typ == GF_OLD_SPEED) && !(typ == GF_STAR_HEAL)) return (FALSE);
1254 if (sukekaku && ((m_ptr->r_idx == MON_SUKE) || (m_ptr->r_idx == MON_KAKU))) return FALSE;
1256 /* Don't affect already death monsters */
1257 /* Prevents problems with chain reactions of exploding monsters */
1258 if (m_ptr->hp < 0) return (FALSE);
1260 /* Reduce damage by distance */
1261 dam = (dam + r) / (r + 1);
1264 /* Get the monster name (BEFORE polymorphing) */
1265 monster_desc(m_name, m_ptr, 0);
1267 /* Get the monster possessive ("his"/"her"/"its") */
1268 monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
1270 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) disturb(TRUE, TRUE);
1272 if (r_ptr->flagsr & RFR_RES_ALL &&
1273 typ != GF_OLD_CLONE && typ != GF_STAR_HEAL && typ != GF_OLD_HEAL
1274 && typ != GF_OLD_SPEED && typ != GF_CAPTURE && typ != GF_PHOTO)
1276 note = _("には完全な耐性がある!", " is immune.");
1278 if(is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
1279 if(typ == GF_LITE_WEAK || typ == GF_KILL_WALL) skipped = TRUE;
1283 /* Analyze the damage type */
1286 /* Magic Missile -- pure damage */
1289 if (seen) obvious = TRUE;
1296 if (seen) obvious = TRUE;
1297 if (r_ptr->flagsr & RFR_IM_ACID)
1299 note = _("にはかなり耐性がある!", " resists a lot.");
1301 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ACID);
1309 if (seen) obvious = TRUE;
1310 if (r_ptr->flagsr & RFR_IM_ELEC)
1312 note = _("にはかなり耐性がある!", " resists a lot.");
1314 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_ELEC);
1322 if (seen) obvious = TRUE;
1323 if (r_ptr->flagsr & RFR_IM_FIRE)
1325 note = _("にはかなり耐性がある!", " resists a lot.");
1327 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_FIRE);
1329 else if (r_ptr->flags3 & (RF3_HURT_FIRE))
1331 note = _("はひどい痛手をうけた。", " is hit hard.");
1333 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_FIRE);
1341 if (seen) obvious = TRUE;
1342 if (r_ptr->flagsr & RFR_IM_COLD)
1344 note = _("にはかなり耐性がある!", " resists a lot.");
1346 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
1348 else if (r_ptr->flags3 & (RF3_HURT_COLD))
1350 note = _("はひどい痛手をうけた。", " is hit hard.");
1352 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
1360 if (seen) obvious = TRUE;
1361 if (r_ptr->flagsr & RFR_IM_POIS)
1363 note = _("にはかなり耐性がある!", " resists a lot.");
1365 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1373 if (seen) obvious = TRUE;
1374 if (r_ptr->flagsr & RFR_IM_POIS)
1376 note = _("には耐性がある。", " resists.");
1377 dam *= 3; dam /= randint1(6) + 6;
1378 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_POIS);
1380 else if (one_in_(3)) do_poly = TRUE;
1384 /* Hellfire -- hurts Evil */
1387 if (seen) obvious = TRUE;
1388 if (r_ptr->flags3 & RF3_GOOD)
1390 note = _("はひどい痛手をうけた。", " is hit hard.");
1392 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
1397 /* Holy Fire -- hurts Evil, Good are immune, others _resist_ */
1400 if (seen) obvious = TRUE;
1401 if (r_ptr->flags3 & RF3_EVIL)
1404 note = _("はひどい痛手をうけた。", " is hit hard.");
1405 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
1409 note = _("には耐性がある。", " resists.");
1410 dam *= 3; dam /= randint1(6) + 6;
1415 /* Arrow -- XXX no defense */
1418 if (seen) obvious = TRUE;
1422 /* Plasma -- XXX perhaps check ELEC or FIRE */
1425 if (seen) obvious = TRUE;
1426 if (r_ptr->flagsr & RFR_RES_PLAS)
1428 note = _("には耐性がある。", " resists.");
1429 dam *= 3; dam /= randint1(6) + 6;
1430 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_PLAS);
1435 /* Nether -- see above */
1438 if (seen) obvious = TRUE;
1439 if (r_ptr->flagsr & RFR_RES_NETH)
1441 if (r_ptr->flags3 & RF3_UNDEAD)
1443 note = _("には完全な耐性がある!", " is immune.");
1445 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
1449 note = _("には耐性がある。", " resists.");
1450 dam *= 3; dam /= randint1(6) + 6;
1452 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NETH);
1454 else if (r_ptr->flags3 & RF3_EVIL)
1456 note = _("はいくらか耐性を示した。", " resists somewhat.");
1458 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
1463 /* Water (acid) damage -- Water spirits/elementals are immune */
1466 if (seen) obvious = TRUE;
1467 if (r_ptr->flagsr & RFR_RES_WATE)
1469 if ((m_ptr->r_idx == MON_WATER_ELEM) || (m_ptr->r_idx == MON_UNMAKER))
1471 note = _("には完全な耐性がある!", " is immune.");
1476 note = _("には耐性がある。", " resists.");
1477 dam *= 3; dam /= randint1(6) + 6;
1479 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WATE);
1484 /* Chaos -- Chaos breathers resist */
1487 if (seen) obvious = TRUE;
1488 if (r_ptr->flagsr & RFR_RES_CHAO)
1490 note = _("には耐性がある。", " resists.");
1491 dam *= 3; dam /= randint1(6) + 6;
1492 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_CHAO);
1494 else if ((r_ptr->flags3 & RF3_DEMON) && one_in_(3))
1496 note = _("はいくらか耐性を示した。", " resists somewhat.");
1497 dam *= 3; dam /= randint1(6) + 6;
1498 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
1503 do_conf = (5 + randint1(11) + r) / (r + 1);
1508 /* Shards -- Shard breathers resist */
1511 if (seen) obvious = TRUE;
1512 if (r_ptr->flagsr & RFR_RES_SHAR)
1514 note = _("には耐性がある。", " resists.");
1515 dam *= 3; dam /= randint1(6) + 6;
1516 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1521 /* Rocket: Shard resistance helps */
1524 if (seen) obvious = TRUE;
1525 if (r_ptr->flagsr & RFR_RES_SHAR)
1527 note = _("はいくらか耐性を示した。", " resists somewhat.");
1529 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SHAR);
1535 /* Sound -- Sound breathers resist */
1538 if (seen) obvious = TRUE;
1539 if (r_ptr->flagsr & RFR_RES_SOUN)
1541 note = _("には耐性がある。", " resists.");
1542 dam *= 2; dam /= randint1(6) + 6;
1543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_SOUN);
1545 else do_stun = (10 + randint1(15) + r) / (r + 1);
1552 if (seen) obvious = TRUE;
1553 if (r_ptr->flags3 & RF3_NO_CONF)
1555 note = _("には耐性がある。", " resists.");
1556 dam *= 3; dam /= randint1(6) + 6;
1557 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1559 else do_conf = (10 + randint1(15) + r) / (r + 1);
1563 /* Disenchantment -- Breathers and Disenchanters resist */
1566 if (seen) obvious = TRUE;
1567 if (r_ptr->flagsr & RFR_RES_DISE)
1569 note = _("には耐性がある。", " resists.");
1570 dam *= 3; dam /= randint1(6) + 6;
1571 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DISE);
1576 /* Nexus -- Breathers and Existers resist */
1579 if (seen) obvious = TRUE;
1580 if (r_ptr->flagsr & RFR_RES_NEXU)
1582 note = _("には耐性がある。", " resists.");
1583 dam *= 3; dam /= randint1(6) + 6;
1584 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_NEXU);
1592 if (seen) obvious = TRUE;
1593 if (r_ptr->flagsr & RFR_RES_WALL)
1595 note = _("には耐性がある。", " resists.");
1596 dam *= 3; dam /= randint1(6) + 6;
1597 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_WALL);
1599 else do_stun = (randint1(15) + r) / (r + 1);
1603 /* Inertia -- breathers resist */
1606 if (seen) obvious = TRUE;
1607 if (r_ptr->flagsr & RFR_RES_INER)
1609 note = _("には耐性がある。", " resists.");
1610 dam *= 3; dam /= randint1(6) + 6;
1611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_INER);
1615 /* Powerful monsters can resist */
1616 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1617 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1621 /* Normal monsters slow down */
1624 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1626 note = _("の動きが遅くなった。", " starts moving slower.");
1633 /* Time -- breathers resist */
1636 if (seen) obvious = TRUE;
1637 if (r_ptr->flagsr & RFR_RES_TIME)
1639 note = _("には耐性がある。", " resists.");
1640 dam *= 3; dam /= randint1(6) + 6;
1641 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_TIME);
1643 else do_time = (dam + 1) / 2;
1647 /* Gravity -- breathers resist */
1650 bool resist_tele = FALSE;
1652 if (seen) obvious = TRUE;
1653 if (r_ptr->flagsr & RFR_RES_TELE)
1655 if (r_ptr->flags1 & (RF1_UNIQUE))
1657 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1658 note = _("には効果がなかった。", " is unaffected!");
1661 else if (r_ptr->level > randint1(100))
1663 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1664 note = _("には耐性がある!", " resists!");
1669 if (!resist_tele) do_dist = 10;
1671 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1673 if (r_ptr->flagsr & RFR_RES_GRAV)
1675 note = _("には耐性がある!", " resists!");
1676 dam *= 3; dam /= randint1(6) + 6;
1678 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_GRAV);
1683 /* Powerful monsters can resist */
1684 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1685 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1689 /* Normal monsters slow down */
1692 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
1694 note = _("の動きが遅くなった。", " starts moving slower.");
1699 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
1701 /* Attempt a saving throw */
1702 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
1703 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1707 /* No obvious effect */
1708 note = _("には効果がなかった。", " is unaffected!");
1720 if (seen) obvious = TRUE;
1726 case GF_DISINTEGRATE:
1728 if (seen) obvious = TRUE;
1729 if (r_ptr->flags3 & RF3_HURT_ROCK)
1731 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
1732 note = _("の皮膚がただれた!", " loses some skin!");
1733 note_dies = _("は蒸発した!", " evaporates!");
1741 if (seen) obvious = TRUE;
1743 /* PSI only works if the monster can see you! -- RG */
1744 if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
1747 msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
1751 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1754 note = _("には完全な耐性がある!", " is immune.");
1755 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
1758 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1759 (r_ptr->flags3 & RF3_ANIMAL) ||
1760 (r_ptr->level > randint1(3 * dam)))
1762 note = _("には耐性がある!", " resists!");
1766 * Powerful demons & undead can turn a mindcrafter's
1767 * attacks back on them
1769 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1770 (r_ptr->level > p_ptr->lev / 2) &&
1774 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1775 (seen ? "%^s's corrupted mind backlashes your attack!" :
1776 "%^ss corrupted mind backlashes your attack!")), m_name);
1779 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1781 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1785 /* Injure +/- confusion */
1786 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1787 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1788 if (one_in_(4) && !CHECK_MULTISHADOW())
1790 switch (randint1(4))
1793 set_confused(p_ptr->confused + 3 + randint1(dam));
1796 set_stun(p_ptr->stun + randint1(dam));
1800 if (r_ptr->flags3 & RF3_NO_FEAR)
1801 note = _("には効果がなかった。", " is unaffected.");
1803 set_afraid(p_ptr->afraid + 3 + randint1(dam));
1807 if (!p_ptr->free_act)
1808 (void)set_paralyzed(p_ptr->paralyzed + randint1(dam));
1817 if ((dam > 0) && one_in_(4))
1819 switch (randint1(4))
1822 do_conf = 3 + randint1(dam);
1825 do_stun = 3 + randint1(dam);
1828 do_fear = 3 + randint1(dam);
1831 note = _("は眠り込んでしまった!", " falls asleep!");
1832 do_sleep = 3 + randint1(dam);
1837 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1843 if (seen) obvious = TRUE;
1844 if (r_ptr->flags2 & RF2_EMPTY_MIND)
1847 note = _("には完全な耐性がある!", " is immune.");
1849 else if ((r_ptr->flags2 & (RF2_STUPID | RF2_WEIRD_MIND)) ||
1850 (r_ptr->flags3 & RF3_ANIMAL) ||
1851 (r_ptr->level > randint1(3 * dam)))
1853 note = _("には耐性がある!", " resists!");
1857 * Powerful demons & undead can turn a mindcrafter's
1858 * attacks back on them
1860 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1861 (r_ptr->level > p_ptr->lev / 2) &&
1865 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1866 (seen ? "%^s's corrupted mind backlashes your attack!" :
1867 "%^ss corrupted mind backlashes your attack!")), m_name);
1869 if ((randint0(100 + r_ptr->level / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
1871 msg_print(_("あなたは効力を跳ね返した!", "You resist the effects!"));
1875 /* Injure + mana drain */
1876 monster_desc(killer, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1877 if (!CHECK_MULTISHADOW())
1879 msg_print(_("超能力パワーを吸いとられた!", "Your psychic energy is drained!"));
1880 p_ptr->csp -= damroll(5, dam) / 2;
1881 if (p_ptr->csp < 0) p_ptr->csp = 0;
1882 p_ptr->redraw |= PR_MANA;
1883 p_ptr->window |= (PW_SPELL);
1885 take_hit(DAMAGE_ATTACK, dam, killer, -1); /* has already been /3 */
1892 int b = damroll(5, dam) / 4;
1893 concptr str = (p_ptr->pclass == CLASS_MINDCRAFTER) ? _("超能力パワー", "psychic energy") : _("魔力", "mana");
1894 concptr msg = _("あなたは%sの苦痛を%sに変換した!",
1895 (seen ? "You convert %s's pain into %s!" :
1896 "You convert %ss pain into %s!"));
1897 msg_format(msg, m_name, str);
1899 b = MIN(p_ptr->msp, p_ptr->csp + b);
1901 p_ptr->redraw |= PR_MANA;
1902 p_ptr->window |= (PW_SPELL);
1904 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
1908 case GF_TELEKINESIS:
1910 if (seen) obvious = TRUE;
1913 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_dist = 0;
1918 do_stun = damroll((caster_lev / 20) + 3 , dam) + 1;
1920 /* Attempt a saving throw */
1921 if ((r_ptr->flags1 & RF1_UNIQUE) ||
1922 (r_ptr->level > 5 + randint1(dam)))
1926 /* No obvious effect */
1932 /* Psycho-spear -- powerful magic missile */
1935 if (seen) obvious = TRUE;
1939 /* Meteor -- powerful magic missile */
1942 if (seen) obvious = TRUE;
1948 if (!is_hostile(m_ptr)) break;
1949 if (seen) obvious = TRUE;
1950 /* Attempt a saving throw */
1951 if ((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
1952 (r_ptr->flags3 & RF3_NO_CONF) ||
1953 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
1955 /* Memorize a flag */
1956 if (r_ptr->flags3 & RF3_NO_CONF)
1958 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
1965 * Powerful demons & undead can turn a mindcrafter's
1966 * attacks back on them
1968 if ((r_ptr->flags3 & (RF3_UNDEAD | RF3_DEMON)) &&
1969 (r_ptr->level > p_ptr->lev / 2) &&
1973 msg_format(_("%^sの堕落した精神は攻撃を跳ね返した!",
1974 (seen ? "%^s's corrupted mind backlashes your attack!" :
1975 "%^ss corrupted mind backlashes your attack!")), m_name);
1978 if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1980 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
1984 /* Confuse, stun, terrify */
1985 switch (randint1(4))
1988 set_stun(p_ptr->stun + dam / 2);
1991 set_confused(p_ptr->confused + dam / 2);
1995 if (r_ptr->flags3 & RF3_NO_FEAR)
1996 note = _("には効果がなかった。", " is unaffected.");
1998 set_afraid(p_ptr->afraid + dam);
2005 /* No obvious effect */
2006 note = _("には効果がなかった。", " is unaffected.");
2012 if (!common_saving_throw_charm(p_ptr, dam, m_ptr))
2014 note = _("があなたに隷属した。", " is in your thrall!");
2019 switch (randint1(4))
2033 /* No "real" damage */
2038 /* Ice -- Cold + Cuts + Stun */
2041 if (seen) obvious = TRUE;
2042 do_stun = (randint1(15) + 1) / (r + 1);
2043 if (r_ptr->flagsr & RFR_IM_COLD)
2045 note = _("にはかなり耐性がある!", " resists a lot.");
2047 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_IM_COLD);
2049 else if (r_ptr->flags3 & (RF3_HURT_COLD))
2051 note = _("はひどい痛手をうけた。", " is hit hard.");
2053 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_COLD);
2060 case GF_HYPODYNAMIA:
2062 if (seen) obvious = TRUE;
2063 if (!monster_living(m_ptr->r_idx))
2065 if (is_original_ap_and_seen(m_ptr))
2067 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2068 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2069 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2071 note = _("には効果がなかった。", " is unaffected.");
2075 else do_time = (dam+7)/8;
2083 if (seen) obvious = TRUE;
2084 if (!monster_living(m_ptr->r_idx))
2086 if (is_original_ap_and_seen(m_ptr))
2088 if (r_ptr->flags3 & RF3_DEMON) r_ptr->r_flags3 |= (RF3_DEMON);
2089 if (r_ptr->flags3 & RF3_UNDEAD) r_ptr->r_flags3 |= (RF3_UNDEAD);
2090 if (r_ptr->flags3 & RF3_NONLIVING) r_ptr->r_flags3 |= (RF3_NONLIVING);
2092 note = _("には完全な耐性がある!", " is immune.");
2096 else if (((r_ptr->flags1 & RF1_UNIQUE) &&
2097 (randint1(888) != 666)) ||
2098 (((r_ptr->level + randint1(20)) > randint1((caster_lev / 2) + randint1(10))) &&
2099 randint1(100) != 66))
2101 note = _("には耐性がある!", " resists!");
2109 /* Polymorph monster (Use "dam" as "power") */
2112 if (seen) obvious = TRUE;
2113 /* Attempt to polymorph (see below) */
2116 /* Powerful monsters can resist */
2117 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2118 (r_ptr->flags1 & RF1_QUESTOR) ||
2119 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2121 note = _("には効果がなかった。", " is unaffected.");
2126 /* No "real" damage */
2133 /* Clone monsters (Ignore "dam") */
2136 if (seen) obvious = TRUE;
2138 if ((p_ptr->inside_arena) || is_pet(m_ptr) || (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)))
2140 note = _("には効果がなかった。", " is unaffected.");
2145 m_ptr->hp = m_ptr->maxhp;
2147 /* Attempt to clone. */
2148 if (multiply_monster(g_ptr->m_idx, TRUE, 0L))
2150 note = _("が分裂した!", " spawns!");
2154 /* No "real" damage */
2161 /* Heal Monster (use "dam" as amount of healing) */
2164 if (seen) obvious = TRUE;
2167 (void)set_monster_csleep(g_ptr->m_idx, 0);
2169 if (m_ptr->maxhp < m_ptr->max_maxhp)
2171 if (seen_msg) msg_format(_("%^sの強さが戻った。", "%^s recovers %s vitality."), m_name, m_poss);
2172 m_ptr->maxhp = m_ptr->max_maxhp;
2177 /* Redraw (later) if needed */
2178 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2179 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2187 if (seen) obvious = TRUE;
2190 (void)set_monster_csleep(g_ptr->m_idx, 0);
2191 if (MON_STUNNED(m_ptr))
2193 if (seen_msg) msg_format(_("%^sは朦朧状態から立ち直った。", "%^s is no longer stunned."), m_name);
2194 (void)set_monster_stunned(g_ptr->m_idx, 0);
2196 if (MON_CONFUSED(m_ptr))
2198 if (seen_msg) msg_format(_("%^sは混乱から立ち直った。", "%^s is no longer confused."), m_name);
2199 (void)set_monster_confused(g_ptr->m_idx, 0);
2201 if (MON_MONFEAR(m_ptr))
2203 if (seen_msg) msg_format(_("%^sは勇気を取り戻した。", "%^s recovers %s courage."), m_name);
2204 (void)set_monster_monfear(g_ptr->m_idx, 0);
2208 if (m_ptr->hp < 30000) m_ptr->hp += dam;
2211 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2215 chg_virtue(V_VITALITY, 1);
2217 if (r_ptr->flags1 & RF1_UNIQUE)
2218 chg_virtue(V_INDIVIDUALISM, 1);
2220 if (is_friendly(m_ptr))
2221 chg_virtue(V_HONOUR, 1);
2222 else if (!(r_ptr->flags3 & RF3_EVIL))
2224 if (r_ptr->flags3 & RF3_GOOD)
2225 chg_virtue(V_COMPASSION, 2);
2227 chg_virtue(V_COMPASSION, 1);
2230 if (r_ptr->flags3 & RF3_ANIMAL)
2231 chg_virtue(V_NATURE, 1);
2234 if (m_ptr->r_idx == MON_LEPER)
2237 if (!who) chg_virtue(V_COMPASSION, 5);
2240 /* Redraw (later) if needed */
2241 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
2242 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
2244 note = _("は体力を回復したようだ。", " looks healthier.");
2246 /* No "real" damage */
2252 /* Speed Monster (Ignore "dam") */
2255 if (seen) obvious = TRUE;
2258 if (set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100))
2260 note = _("の動きが速くなった。", " starts moving faster.");
2265 if (r_ptr->flags1 & RF1_UNIQUE)
2266 chg_virtue(V_INDIVIDUALISM, 1);
2267 if (is_friendly(m_ptr))
2268 chg_virtue(V_HONOUR, 1);
2271 /* No "real" damage */
2277 /* Slow Monster (Use "dam" as "power") */
2280 if (seen) obvious = TRUE;
2282 /* Powerful monsters can resist */
2283 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2284 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2286 note = _("には効果がなかった。", " is unaffected.");
2290 /* Normal monsters slow down */
2293 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
2295 note = _("の動きが遅くなった。", " starts moving slower.");
2299 /* No "real" damage */
2305 /* Sleep (Use "dam" as "power") */
2308 if (seen) obvious = TRUE;
2310 /* Attempt a saving throw */
2311 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2312 (r_ptr->flags3 & RF3_NO_SLEEP) ||
2313 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2315 /* Memorize a flag */
2316 if (r_ptr->flags3 & RF3_NO_SLEEP)
2318 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
2320 /* No obvious effect */
2321 note = _("には効果がなかった。", " is unaffected.");
2326 /* Go to sleep (much) later */
2327 note = _("は眠り込んでしまった!", " falls asleep!");
2331 /* No "real" damage */
2337 /* Sleep (Use "dam" as "power") */
2338 case GF_STASIS_EVIL:
2340 if (seen) obvious = TRUE;
2342 /* Attempt a saving throw */
2343 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2344 !(r_ptr->flags3 & RF3_EVIL) ||
2345 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2347 note = _("には効果がなかった。", " is unaffected.");
2352 /* Go to sleep (much) later */
2353 note = _("は動けなくなった!", " is suspended!");
2357 /* No "real" damage */
2362 /* Sleep (Use "dam" as "power") */
2365 if (seen) obvious = TRUE;
2367 /* Attempt a saving throw */
2368 if ((r_ptr->flags1 & RF1_UNIQUE) ||
2369 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2371 note = _("には効果がなかった。", " is unaffected.");
2376 /* Go to sleep (much) later */
2377 note = _("は動けなくなった!", " is suspended!");
2381 /* No "real" damage */
2390 vir = virtue_number(V_HARMONY);
2393 dam += p_ptr->virtues[vir-1]/10;
2396 vir = virtue_number(V_INDIVIDUALISM);
2399 dam -= p_ptr->virtues[vir-1]/20;
2402 if (seen) obvious = TRUE;
2404 /* Attempt a saving throw */
2405 if (common_saving_throw_charm(p_ptr, dam, m_ptr))
2409 /* No obvious effect */
2410 note = _("には効果がなかった。", " is unaffected.");
2413 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2415 else if (p_ptr->cursed & TRC_AGGRAVATE)
2417 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2418 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2422 note = _("は突然友好的になったようだ!", " suddenly seems friendly!");
2425 chg_virtue(V_INDIVIDUALISM, -1);
2426 if (r_ptr->flags3 & RF3_ANIMAL)
2427 chg_virtue(V_NATURE, 1);
2430 /* No "real" damage */
2435 /* Control undead */
2436 case GF_CONTROL_UNDEAD:
2439 if (seen) obvious = TRUE;
2441 vir = virtue_number(V_UNLIFE);
2444 dam += p_ptr->virtues[vir-1]/10;
2447 vir = virtue_number(V_INDIVIDUALISM);
2450 dam -= p_ptr->virtues[vir-1]/20;
2453 /* Attempt a saving throw */
2454 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2455 !(r_ptr->flags3 & RF3_UNDEAD))
2457 /* No obvious effect */
2458 note = _("には効果がなかった。", " is unaffected.");
2460 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2462 else if (p_ptr->cursed & TRC_AGGRAVATE)
2464 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2465 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2469 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2473 /* No "real" damage */
2479 case GF_CONTROL_DEMON:
2482 if (seen) obvious = TRUE;
2484 vir = virtue_number(V_UNLIFE);
2487 dam += p_ptr->virtues[vir-1]/10;
2490 vir = virtue_number(V_INDIVIDUALISM);
2493 dam -= p_ptr->virtues[vir-1]/20;
2496 /* Attempt a saving throw */
2497 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2498 !(r_ptr->flags3 & RF3_DEMON))
2500 /* No obvious effect */
2501 note = _("には効果がなかった。", " is unaffected.");
2503 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2505 else if (p_ptr->cursed & TRC_AGGRAVATE)
2507 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2508 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2512 note = _("は既にあなたの奴隷だ!", " is in your thrall!");
2516 /* No "real" damage */
2522 case GF_CONTROL_ANIMAL:
2525 if (seen) obvious = TRUE;
2527 vir = virtue_number(V_NATURE);
2530 dam += p_ptr->virtues[vir-1]/10;
2533 vir = virtue_number(V_INDIVIDUALISM);
2536 dam -= p_ptr->virtues[vir-1]/20;
2539 /* Attempt a saving throw */
2540 if (common_saving_throw_control(p_ptr, dam, m_ptr) ||
2541 !(r_ptr->flags3 & RF3_ANIMAL))
2544 /* No obvious effect */
2545 note = _("には効果がなかった。", " is unaffected.");
2547 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2549 else if (p_ptr->cursed & TRC_AGGRAVATE)
2551 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2552 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2556 note = _("はなついた。", " is tamed!");
2558 if (r_ptr->flags3 & RF3_ANIMAL)
2559 chg_virtue(V_NATURE, 1);
2562 /* No "real" damage */
2568 case GF_CHARM_LIVING:
2572 vir = virtue_number(V_UNLIFE);
2573 if (seen) obvious = TRUE;
2575 vir = virtue_number(V_UNLIFE);
2578 dam -= p_ptr->virtues[vir-1]/10;
2581 vir = virtue_number(V_INDIVIDUALISM);
2584 dam -= p_ptr->virtues[vir-1]/20;
2587 msg_format(_("%sを見つめた。", "You stare into %s."), m_name);
2589 /* Attempt a saving throw */
2590 if (common_saving_throw_charm(p_ptr, dam, m_ptr) ||
2591 !monster_living(m_ptr->r_idx))
2594 /* No obvious effect */
2595 note = _("には効果がなかった。", " is unaffected.");
2597 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2599 else if (p_ptr->cursed & TRC_AGGRAVATE)
2601 note = _("はあなたに敵意を抱いている!", " hates you too much!");
2602 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
2606 note = _("を支配した。", " is tamed!");
2608 if (r_ptr->flags3 & RF3_ANIMAL)
2609 chg_virtue(V_NATURE, 1);
2612 /* No "real" damage */
2617 /* Confusion (Use "dam" as "power") */
2620 if (seen) obvious = TRUE;
2622 /* Get confused later */
2623 do_conf = damroll(3, (dam / 2)) + 1;
2625 /* Attempt a saving throw */
2626 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2627 (r_ptr->flags3 & (RF3_NO_CONF)) ||
2628 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2630 /* Memorize a flag */
2631 if (r_ptr->flags3 & (RF3_NO_CONF))
2633 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
2639 /* No obvious effect */
2640 note = _("には効果がなかった。", " is unaffected.");
2644 /* No "real" damage */
2651 if (seen) obvious = TRUE;
2653 do_stun = damroll((caster_lev / 20) + 3 , (dam)) + 1;
2655 /* Attempt a saving throw */
2656 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2657 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2662 /* No obvious effect */
2663 note = _("には効果がなかった。", " is unaffected.");
2667 /* No "real" damage */
2672 /* Lite, but only hurts susceptible creatures */
2681 if (r_ptr->flags3 & (RF3_HURT_LITE))
2683 /* Obvious effect */
2684 if (seen) obvious = TRUE;
2686 /* Memorize the effects */
2687 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2689 /* Special effect */
2690 note = _("は光に身をすくめた!", " cringes from the light!");
2691 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2694 /* Normally no damage */
2706 /* Lite -- opposite of Dark */
2709 if (seen) obvious = TRUE;
2711 if (r_ptr->flagsr & RFR_RES_LITE)
2713 note = _("には耐性がある!", " resists!");
2714 dam *= 2; dam /= (randint1(6)+6);
2715 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_LITE);
2717 else if (r_ptr->flags3 & (RF3_HURT_LITE))
2719 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
2720 note = _("は光に身をすくめた!", " cringes from the light!");
2721 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
2728 /* Dark -- opposite of Lite */
2731 if (seen) obvious = TRUE;
2733 if (r_ptr->flagsr & RFR_RES_DARK)
2735 note = _("には耐性がある!", " resists!");
2736 dam *= 2; dam /= (randint1(6)+6);
2737 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_DARK);
2746 /* Hurt by rock remover */
2747 if (r_ptr->flags3 & (RF3_HURT_ROCK))
2750 if (seen) obvious = TRUE;
2752 /* Memorize the effects */
2753 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_ROCK);
2755 /* Cute little message */
2756 note = _("の皮膚がただれた!", " loses some skin!");
2757 note_dies = _("はドロドロに溶けた!", " dissolves!");
2760 /* Usually, ignore the effects */
2771 /* Teleport undead (Use "dam" as "power") */
2772 case GF_AWAY_UNDEAD:
2774 /* Only affect undead */
2775 if (r_ptr->flags3 & (RF3_UNDEAD))
2777 bool resists_tele = FALSE;
2779 if (r_ptr->flagsr & RFR_RES_TELE)
2781 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2783 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2784 note = _("には効果がなかった。", " is unaffected.");
2785 resists_tele = TRUE;
2787 else if (r_ptr->level > randint1(100))
2789 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2790 note = _("には耐性がある!", " resists!");
2791 resists_tele = TRUE;
2797 if (seen) obvious = TRUE;
2798 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2810 /* No "real" damage */
2816 /* Teleport evil (Use "dam" as "power") */
2819 /* Only affect evil */
2820 if (r_ptr->flags3 & (RF3_EVIL))
2822 bool resists_tele = FALSE;
2824 if (r_ptr->flagsr & RFR_RES_TELE)
2826 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2828 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2829 note = _("には効果がなかった。", " is unaffected.");
2830 resists_tele = TRUE;
2832 else if (r_ptr->level > randint1(100))
2834 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2835 note = _("には耐性がある!", " resists!");
2836 resists_tele = TRUE;
2842 if (seen) obvious = TRUE;
2843 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2855 /* No "real" damage */
2861 /* Teleport monster (Use "dam" as "power") */
2864 bool resists_tele = FALSE;
2865 if (r_ptr->flagsr & RFR_RES_TELE)
2867 if ((r_ptr->flags1 & (RF1_UNIQUE)) || (r_ptr->flagsr & RFR_RES_ALL))
2869 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2870 note = _("には効果がなかった。", " is unaffected.");
2871 resists_tele = TRUE;
2873 else if (r_ptr->level > randint1(100))
2875 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2876 note = _("には耐性がある!", " resists!");
2877 resists_tele = TRUE;
2883 if (seen) obvious = TRUE;
2885 /* Prepare to teleport */
2889 /* No "real" damage */
2895 /* Turn undead (Use "dam" as "power") */
2896 case GF_TURN_UNDEAD:
2898 /* Only affect undead */
2899 if (r_ptr->flags3 & (RF3_UNDEAD))
2901 if (seen) obvious = TRUE;
2903 /* Learn about type */
2904 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
2906 /* Apply some fear */
2907 do_fear = damroll(3, (dam / 2)) + 1;
2909 /* Attempt a saving throw */
2910 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2912 /* No obvious effect */
2913 note = _("には効果がなかった。", " is unaffected.");
2926 /* No "real" damage */
2932 /* Turn evil (Use "dam" as "power") */
2935 /* Only affect evil */
2936 if (r_ptr->flags3 & (RF3_EVIL))
2938 if (seen) obvious = TRUE;
2940 /* Learn about type */
2941 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
2943 /* Apply some fear */
2944 do_fear = damroll(3, (dam / 2)) + 1;
2946 /* Attempt a saving throw */
2947 if (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10)
2949 /* No obvious effect */
2950 note = _("には効果がなかった。", " is unaffected.");
2963 /* No "real" damage */
2969 /* Turn monster (Use "dam" as "power") */
2972 if (seen) obvious = TRUE;
2974 /* Apply some fear */
2975 do_fear = damroll(3, (dam / 2)) + 1;
2977 /* Attempt a saving throw */
2978 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
2979 (r_ptr->flags3 & (RF3_NO_FEAR)) ||
2980 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
2982 /* No obvious effect */
2983 note = _("には効果がなかった。", " is unaffected.");
2988 /* No "real" damage */
2995 case GF_DISP_UNDEAD:
2997 /* Only affect undead */
2998 if (r_ptr->flags3 & (RF3_UNDEAD))
3000 if (seen) obvious = TRUE;
3002 /* Learn about type */
3003 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_UNDEAD);
3005 note = _("は身震いした。", " shudders.");
3006 note_dies = _("はドロドロに溶けた!", " dissolves!");
3026 /* Only affect evil */
3027 if (r_ptr->flags3 & (RF3_EVIL))
3029 if (seen) obvious = TRUE;
3031 /* Learn about type */
3032 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_EVIL);
3034 note = _("は身震いした。", " shudders.");
3035 note_dies = _("はドロドロに溶けた!", " dissolves!");
3054 /* Only affect good */
3055 if (r_ptr->flags3 & (RF3_GOOD))
3057 if (seen) obvious = TRUE;
3059 /* Learn about type */
3060 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3062 note = _("は身震いした。", " shudders.");
3063 note_dies = _("はドロドロに溶けた!", " dissolves!");
3080 case GF_DISP_LIVING:
3082 /* Only affect non-undead */
3083 if (monster_living(m_ptr->r_idx))
3085 if (seen) obvious = TRUE;
3087 note = _("は身震いした。", " shudders.");
3088 note_dies = _("はドロドロに溶けた!", " dissolves!");
3107 /* Only affect demons */
3108 if (r_ptr->flags3 & (RF3_DEMON))
3110 if (seen) obvious = TRUE;
3112 /* Learn about type */
3113 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_DEMON);
3115 note = _("は身震いした。", " shudders.");
3116 note_dies = _("はドロドロに溶けた!", " dissolves!");
3132 /* Dispel monster */
3135 if (seen) obvious = TRUE;
3136 note = _("は身震いした。", " shudders.");
3137 note_dies = _("はドロドロに溶けた!", " dissolves!");
3144 if (seen) obvious = TRUE;
3145 if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
3149 /* Heal the monster */
3150 if (caster_ptr->hp < caster_ptr->maxhp)
3153 caster_ptr->hp += dam;
3154 if (caster_ptr->hp > caster_ptr->maxhp) caster_ptr->hp = caster_ptr->maxhp;
3156 /* Redraw (later) if needed */
3157 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
3158 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
3160 /* Special message */
3163 monster_desc(killer, caster_ptr, 0);
3164 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), killer);
3170 msg_format(_("%sから精神エネルギーを吸いとった。", "You draw psychic energy from %s."), m_name);
3171 (void)hp_player(dam);
3176 if (see_s_msg) msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3185 if (seen) obvious = TRUE;
3186 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3187 /* Attempt a saving throw */
3188 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3189 (r_ptr->flags3 & RF3_NO_CONF) ||
3190 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3192 /* Memorize a flag */
3193 if (r_ptr->flags3 & (RF3_NO_CONF))
3195 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3197 note = _("には効果がなかった。", " is unaffected.");
3200 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3202 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3203 note = _("には完全な耐性がある!", " is immune.");
3206 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3208 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3209 note = _("には耐性がある。", " resists.");
3214 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3215 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3217 if (who > 0) do_conf = randint0(4) + 4;
3218 else do_conf = randint0(8) + 8;
3224 case GF_BRAIN_SMASH:
3226 if (seen) obvious = TRUE;
3227 if (!who) msg_format(_("%sをじっと睨んだ。", "You gaze intently at %s."), m_name);
3229 /* Attempt a saving throw */
3230 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3231 (r_ptr->flags3 & RF3_NO_CONF) ||
3232 (r_ptr->level > randint1((caster_lev - 10) < 1 ? 1 : (caster_lev - 10)) + 10))
3234 /* Memorize a flag */
3235 if (r_ptr->flags3 & (RF3_NO_CONF))
3237 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_CONF);
3239 note = _("には効果がなかった。", " is unaffected.");
3242 else if (r_ptr->flags2 & RF2_EMPTY_MIND)
3244 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3245 note = _("には完全な耐性がある!", " is immune.");
3248 else if (r_ptr->flags2 & RF2_WEIRD_MIND)
3250 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_WEIRD_MIND);
3251 note = _("には耐性がある!", " resists!");
3256 note = _("は精神攻撃を食らった。", " is blasted by psionic energy.");
3257 note_dies = _("の精神は崩壊し、肉体は抜け殻となった。", " collapses, a mindless husk.");
3261 do_conf = randint0(4) + 4;
3262 do_stun = randint0(4) + 4;
3266 do_conf = randint0(8) + 8;
3267 do_stun = randint0(8) + 8;
3269 (void)set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 10);
3277 if (seen) obvious = TRUE;
3278 if (!who) msg_format(_("%sを指差して呪いをかけた。", "You point at %s and curse."), m_name);
3279 /* Attempt a saving throw */
3280 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3282 note = _("には効果がなかった。", " is unaffected.");
3291 if (seen) obvious = TRUE;
3292 if (!who) msg_format(_("%sを指差して恐ろしげに呪いをかけた。", "You point at %s and curse horribly."), m_name);
3293 /* Attempt a saving throw */
3294 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3296 note = _("には効果がなかった。", " is unaffected.");
3305 if (seen) obvious = TRUE;
3306 if (!who) msg_format(_("%sを指差し、恐ろしげに呪文を唱えた!", "You point at %s, incanting terribly!"), m_name);
3307 /* Attempt a saving throw */
3308 if (randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35))
3310 note = _("には効果がなかった。", " is unaffected.");
3319 if (seen) obvious = TRUE;
3321 msg_format(_("%sの秘孔を突いて、「お前は既に死んでいる」と叫んだ。",
3322 "You point at %s, screaming the word, 'DIE!'."), m_name);
3323 /* Attempt a saving throw */
3324 if ((randint0(100 + (caster_lev / 2)) < (r_ptr->level + 35)) && ((who <= 0) || (caster_ptr->r_idx != MON_KENSHIROU)))
3326 note = _("には効果がなかった。", " is unaffected.");
3335 if (seen) obvious = TRUE;
3336 if (r_ptr->flags1 & RF1_UNIQUE)
3338 note = _("には効果がなかった。", " is unaffected.");
3343 if ((who > 0) ? ((caster_lev + randint1(dam)) > (r_ptr->level + 10 + randint1(20))) :
3344 (((caster_lev / 2) + randint1(dam)) > (r_ptr->level + randint1(200))))
3346 dam = ((40 + randint1(20)) * m_ptr->hp) / 100;
3348 if (m_ptr->hp < dam) dam = m_ptr->hp - 1;
3352 note = _("は耐性を持っている!", "resists!");
3359 /* Capture monster */
3363 if ((p_ptr->inside_quest && (quest[p_ptr->inside_quest].type == QUEST_TYPE_KILL_ALL) && !is_pet(m_ptr)) ||
3364 (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)
3366 msg_format(_("%sには効果がなかった。", "%s is unaffected."), m_name);
3371 if (is_pet(m_ptr)) nokori_hp = m_ptr->maxhp * 4L;
3372 else if ((p_ptr->pclass == CLASS_BEASTMASTER) && monster_living(m_ptr->r_idx))
3373 nokori_hp = m_ptr->maxhp * 3 / 10;
3375 nokori_hp = m_ptr->maxhp * 3 / 20;
3377 if (m_ptr->hp >= nokori_hp)
3379 msg_format(_("もっと弱らせないと。", "You need to weaken %s more."), m_name);
3382 else if (m_ptr->hp < randint0(nokori_hp))
3384 if (m_ptr->mflag2 & MFLAG2_CHAMELEON) choose_new_monster(g_ptr->m_idx, FALSE, MON_CHAMELEON);
3385 msg_format(_("%sを捕えた!", "You capture %^s!"), m_name);
3386 cap_mon = m_ptr->r_idx;
3387 cap_mspeed = m_ptr->mspeed;
3389 cap_maxhp = m_ptr->max_maxhp;
3390 cap_nickname = m_ptr->nickname; /* Quark transfer */
3391 if (g_ptr->m_idx == p_ptr->riding)
3393 if (rakuba(-1, FALSE))
3395 msg_format(_("地面に落とされた。", "You have fallen from %s."), m_name);
3399 delete_monster_idx(g_ptr->m_idx);
3405 msg_format(_("うまく捕まえられなかった。", "You failed to capture %s."), m_name);
3411 /* Attack (Use "dam" as attack type) */
3414 /* Return this monster's death */
3415 return py_attack(y, x, dam);
3418 /* Sleep (Use "dam" as "power") */
3424 if (seen) obvious = TRUE;
3425 if (r_ptr->flags2 & RF2_EMPTY_MIND)
3427 note = _("には効果がなかった。", " is unaffected.");
3430 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags2 |= (RF2_EMPTY_MIND);
3433 if (MON_CSLEEP(m_ptr))
3435 note = _("には効果がなかった。", " is unaffected.");
3441 if (one_in_(5)) effect = 1;
3442 else if (one_in_(4)) effect = 2;
3443 else if (one_in_(3)) effect = 3;
3448 /* Powerful monsters can resist */
3449 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3450 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3452 note = _("には効果がなかった。", " is unaffected.");
3456 /* Normal monsters slow down */
3459 if (set_monster_slow(g_ptr->m_idx, MON_SLOW(m_ptr) + 50))
3461 note = _("の動きが遅くなった。", " starts moving slower.");
3466 else if (effect == 2)
3468 do_stun = damroll((p_ptr->lev / 10) + 3 , (dam)) + 1;
3470 /* Attempt a saving throw */
3471 if ((r_ptr->flags1 & (RF1_UNIQUE)) ||
3472 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3477 /* No obvious effect */
3478 note = _("には効果がなかった。", " is unaffected.");
3483 else if (effect == 3)
3485 /* Attempt a saving throw */
3486 if ((r_ptr->flags1 & RF1_UNIQUE) ||
3487 (r_ptr->flags3 & RF3_NO_SLEEP) ||
3488 (r_ptr->level > randint1((dam - 10) < 1 ? 1 : (dam - 10)) + 10))
3490 /* Memorize a flag */
3491 if (r_ptr->flags3 & RF3_NO_SLEEP)
3493 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_SLEEP);
3496 /* No obvious effect */
3497 note = _("には効果がなかった。", " is unaffected.");
3502 /* Go to sleep (much) later */
3503 note = _("は眠り込んでしまった!", " falls asleep!");
3510 note = _("には効果がなかった。", " is unaffected.");
3513 /* No "real" damage */
3521 if (seen) obvious = TRUE;
3522 if (genocide_aux(g_ptr->m_idx, dam, !who, (r_ptr->level + 1) / 2, _("モンスター消滅", "Genocide One")))
3524 if (seen_msg) msg_format(_("%sは消滅した!", "%^s disappered!"), m_name);
3525 chg_virtue(V_VITALITY, -1);
3535 if (!who) msg_format(_("%sを写真に撮った。", "You take a photograph of %s."), m_name);
3537 if (r_ptr->flags3 & (RF3_HURT_LITE))
3539 /* Obvious effect */
3540 if (seen) obvious = TRUE;
3542 /* Memorize the effects */
3543 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_HURT_LITE);
3545 /* Special effect */
3546 note = _("は光に身をすくめた!", " cringes from the light!");
3547 note_dies = _("は光を受けてしぼんでしまった!", " shrivels away in the light!");
3550 /* Normally no damage */
3557 photo = m_ptr->r_idx;
3564 case GF_BLOOD_CURSE:
3566 if (seen) obvious = TRUE;
3572 bool success = FALSE;
3573 if (seen) obvious = TRUE;
3575 if ((r_ptr->flags3 & (RF3_GOOD)) && !p_ptr->inside_arena)
3577 if (r_ptr->flags3 & (RF3_NO_CONF)) dam -= 50;
3578 if (dam < 1) dam = 1;
3580 /* No need to tame your pet */
3583 note = _("の動きが速くなった。", " starts moving faster.");
3584 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3588 /* Attempt a saving throw */
3589 else if ((r_ptr->flags1 & (RF1_QUESTOR)) ||
3590 (r_ptr->flags1 & (RF1_UNIQUE)) ||
3591 (m_ptr->mflag2 & MFLAG2_NOPET) ||
3592 (p_ptr->cursed & TRC_AGGRAVATE) ||
3593 ((r_ptr->level+10) > randint1(dam)))
3596 if (one_in_(4)) m_ptr->mflag2 |= MFLAG2_NOPET;
3600 note = _("を支配した。", " is tamed!");
3602 (void)set_monster_fast(g_ptr->m_idx, MON_FAST(m_ptr) + 100);
3604 /* Learn about type */
3605 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_GOOD);
3612 if (!(r_ptr->flags3 & RF3_NO_FEAR))
3614 do_fear = randint1(90)+10;
3616 else if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= (RF3_NO_FEAR);
3619 /* No "real" damage */
3626 if (seen) obvious = TRUE;
3627 /* Attempt a saving throw */
3628 if (randint0(100 + dam) < (r_ptr->level + 50))
3630 note = _("には効果がなかった。", " is unaffected.");
3650 /* Absolutely no effect */
3651 if (skipped) return (FALSE);
3653 /* "Unique" monsters cannot be polymorphed */
3654 if (r_ptr->flags1 & (RF1_UNIQUE)) do_poly = FALSE;
3656 /* Quest monsters cannot be polymorphed */
3657 if (r_ptr->flags1 & RF1_QUESTOR) do_poly = FALSE;
3659 if (p_ptr->riding && (g_ptr->m_idx == p_ptr->riding)) do_poly = FALSE;
3661 /* "Unique" and "quest" monsters can only be "killed" by the player. */
3662 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) || (r_ptr->flags7 & RF7_NAZGUL)) && !p_ptr->inside_battle)
3664 if (who && (dam > m_ptr->hp)) dam = m_ptr->hp;
3669 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
3670 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
3673 /* Modify the damage */
3675 dam = mon_damage_mod(m_ptr, dam, (bool)(typ == GF_PSY_SPEAR));
3676 if ((tmp > 0) && (dam == 0)) note = _("はダメージを受けていない。", " is unharmed.");
3678 /* Check for death */
3679 if (dam > m_ptr->hp)
3681 /* Extract method of death */
3686 /* Sound and Impact resisters never stun */
3688 !(r_ptr->flagsr & (RFR_RES_SOUN | RFR_RES_WALL)) &&
3689 !(r_ptr->flags3 & RF3_NO_STUN))
3691 if (seen) obvious = TRUE;
3694 if (MON_STUNNED(m_ptr))
3696 note = _("はひどくもうろうとした。", " is more dazed.");
3697 tmp = MON_STUNNED(m_ptr) + (do_stun / 2);
3701 note = _("はもうろうとした。", " is dazed.");
3706 (void)set_monster_stunned(g_ptr->m_idx, tmp);
3712 /* Confusion and Chaos resisters (and sleepers) never confuse */
3714 !(r_ptr->flags3 & RF3_NO_CONF) &&
3715 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
3717 if (seen) obvious = TRUE;
3719 /* Already partially confused */
3720 if (MON_CONFUSED(m_ptr))
3722 note = _("はさらに混乱したようだ。", " looks more confused.");
3723 tmp = MON_CONFUSED(m_ptr) + (do_conf / 2);
3726 /* Was not confused */
3729 note = _("は混乱したようだ。", " looks confused.");
3733 /* Apply confusion */
3734 (void)set_monster_confused(g_ptr->m_idx, tmp);
3742 if (seen) obvious = TRUE;
3744 if (do_time >= m_ptr->maxhp) do_time = m_ptr->maxhp - 1;
3748 note = _("は弱くなったようだ。", " seems weakened.");
3749 m_ptr->maxhp -= do_time;
3750 if ((m_ptr->hp - dam) > m_ptr->maxhp) dam = m_ptr->hp - m_ptr->maxhp;
3755 /* Mega-Hack -- Handle "polymorph" -- monsters get a saving throw */
3756 if (do_poly && (randint1(90) > r_ptr->level))
3758 if (polymorph_monster(y, x))
3760 if (seen) obvious = TRUE;
3762 /* Monster polymorphs */
3763 note = _("が変身した!", " changes!");
3765 /* Turn off the damage */
3771 note = _("には効果がなかった。", " is unaffected.");
3774 /* Hack -- Get new monster */
3775 m_ptr = &m_list[g_ptr->m_idx];
3777 /* Hack -- Get new race */
3778 r_ptr = &r_info[m_ptr->r_idx];
3781 /* Handle "teleport" */
3784 if (seen) obvious = TRUE;
3786 note = _("が消え去った!", " disappears!");
3788 if (!who) chg_virtue(V_VALOUR, -1);
3791 teleport_away(g_ptr->m_idx, do_dist,
3792 (!who ? TELEPORT_DEC_VALOUR : 0L) | TELEPORT_PASSIVE);
3794 /* Hack -- get new location */
3798 /* Hack -- get new grid */
3799 g_ptr = &grid_array[y][x];
3806 (void)set_monster_monfear(g_ptr->m_idx, MON_MONFEAR(m_ptr) + do_fear);
3813 if (typ == GF_DRAIN_MANA)
3815 /* Drain mana does nothing */
3818 /* If another monster did the damage, hurt the monster by hand */
3821 /* Redraw (later) if needed */
3822 if (p_ptr->health_who == g_ptr->m_idx) p_ptr->redraw |= (PR_HEALTH);
3823 if (p_ptr->riding == g_ptr->m_idx) p_ptr->redraw |= (PR_UHEALTH);
3825 /* Wake the monster up */
3826 (void)set_monster_csleep(g_ptr->m_idx, 0);
3828 /* Hurt the monster */
3836 if (is_pet(m_ptr) && !(m_ptr->ml))
3839 /* Give detailed messages if destroyed */
3842 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
3845 msg_format("%^s%s", m_name, note);
3853 if (who > 0) monster_gain_exp(who, m_ptr->r_idx);
3855 /* Generate treasure, etc */
3856 monster_death(g_ptr->m_idx, FALSE);
3859 delete_monster_idx(g_ptr->m_idx);
3863 msg_print(_("少し悲しい気分がした。", "You feel sad for a moment."));
3867 /* Damaged monster */
3870 /* Give detailed messages if visible or destroyed */
3871 if (note && seen_msg) msg_format("%^s%s", m_name, note);
3873 /* Hack -- Pain message */
3876 message_pain(g_ptr->m_idx, dam);
3883 /* Hack -- handle sleep */
3884 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3888 else if (heal_leper)
3890 if (seen_msg) msg_print(_("不潔な病人は病気が治った!", "The Mangy looking leper is healed!"));
3892 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
3894 char m2_name[MAX_NLEN];
3896 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
3897 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_HEAL_LEPER, m2_name);
3900 delete_monster_idx(g_ptr->m_idx);
3903 /* If the player did it, give him experience, check fear */
3908 /* Hurt the monster, check for fear and death */
3909 if (mon_take_hit(g_ptr->m_idx, dam, &fear, note_dies))
3914 /* Damaged monster */
3917 /* HACK - anger the monster before showing the sleep message */
3918 if (do_sleep) anger_monster(m_ptr);
3920 /* Give detailed messages if visible or destroyed */
3921 if (note && seen_msg)
3922 msg_format(_("%s%s", "%^s%s"), m_name, note);
3924 /* Hack -- Pain message */
3925 else if (known && (dam || !do_fear))
3927 message_pain(g_ptr->m_idx, dam);
3930 /* Anger monsters */
3931 if (((dam > 0) || get_angry) && !do_sleep)
3932 anger_monster(m_ptr);
3934 if ((fear || do_fear) && seen)
3937 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
3940 /* Hack -- handle sleep */
3941 if (do_sleep) (void)set_monster_csleep(g_ptr->m_idx, do_sleep);
3945 if ((typ == GF_BLOOD_CURSE) && one_in_(4))
3947 int curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3951 switch (randint1(28))
3956 msg_print(_("地面が揺れた...", "The ground trembles..."));
3957 earthquake(ty, tx, 4 + randint0(4));
3958 if (!one_in_(6)) break;
3960 case 3: case 4: case 5: case 6:
3963 int extra_dam = damroll(10, 10);
3964 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3966 project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
3967 if (!one_in_(6)) break;
3972 msg_print(_("空間が歪んだ!", "Space warps about you!"));
3974 if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
3975 if (one_in_(13)) count += activate_hi_summon(ty, tx, TRUE);
3976 if (!one_in_(6)) break;
3978 case 9: case 10: case 11:
3979 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3980 project(0, 7, ty, tx, 50, GF_DISINTEGRATE, curse_flg, -1);
3981 if (!one_in_(6)) break;
3982 case 12: case 13: case 14: case 15: case 16:
3983 aggravate_monsters(0);
3984 if (!one_in_(6)) break;
3986 count += activate_hi_summon(ty, tx, TRUE);
3987 if (!one_in_(6)) break;
3988 case 19: case 20: case 21: case 22:
3990 bool pet = !one_in_(3);
3991 BIT_FLAGS mode = PM_ALLOW_GROUP;
3993 if (pet) mode |= PM_FORCE_PET;
3994 else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
3996 count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode, '\0');
3997 if (!one_in_(6)) break;
3999 case 23: case 24: case 25:
4000 if (p_ptr->hold_exp && (randint0(100) < 75)) break;
4001 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
4003 if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
4004 else lose_exp(p_ptr->exp / 16);
4005 if (!one_in_(6)) break;
4006 case 26: case 27: case 28:
4015 (void)do_dec_stat(i);
4024 (void)do_dec_stat(randint0(6));
4033 if (p_ptr->inside_battle)
4035 p_ptr->health_who = g_ptr->m_idx;
4036 p_ptr->redraw |= (PR_HEALTH);
4040 /* Verify this code */
4041 if (m_ptr->r_idx) update_monster(g_ptr->m_idx, FALSE);
4043 /* Redraw the monster grid */
4047 /* Update monster recall window */
4048 if ((p_ptr->monster_race_idx == m_ptr->r_idx) && (seen || !m_ptr->r_idx))
4050 p_ptr->window |= (PW_MONSTER);
4053 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr))
4057 if (!(flg & PROJECT_NO_HANGEKI))
4059 set_target(m_ptr, monster_target_y, monster_target_x);
4062 else if ((who > 0) && is_pet(caster_ptr) && !player_bold(m_ptr->target_y, m_ptr->target_x))
4064 set_target(m_ptr, caster_ptr->fy, caster_ptr->fx);
4068 if (p_ptr->riding && (p_ptr->riding == g_ptr->m_idx) && (dam > 0))
4070 if (m_ptr->hp > m_ptr->maxhp/3) dam = (dam + 1) / 2;
4071 rakubadam_m = (dam > 200) ? 200 : dam;
4081 /* Prepare to make a Blade of Chaos */
4082 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_PHOTO));
4084 q_ptr->pval = photo;
4086 /* Mark the item as fully known */
4087 q_ptr->ident |= (IDENT_MENTAL);
4088 (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
4096 /* Return "Anything seen?" */
4101 * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
4102 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
4103 * @param who_name 効果を起こしたモンスターの名前
4104 * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
4105 * @param y 目標Y座標 / Target y location (or location to travel "towards")
4106 * @param x 目標X座標 / Target x location (or location to travel "towards")
4107 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
4108 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
4110 * @param monspell 効果元のモンスター魔法ID
4111 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
4113 * Handle a beam/bolt/ball causing damage to the player.
4114 * This routine takes a "source monster" (by index), a "distance", a default
4115 * "damage", and a "damage type". See "project_m()" above.
4116 * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
4117 * is reduced (see "project_m()" above). This can happen if a monster breathes
4118 * at the player and hits a wall instead.
4119 * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
4120 * to know if this is actually a ball or a bolt spell
4121 * We return "TRUE" if any "obvious" effects were observed. XXX XXX Actually,
4122 * we just assume that the effects were obvious, for historical reasons.
4124 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)
4129 /* Hack -- assume obvious */
4130 bool obvious = TRUE;
4132 /* Player blind-ness */
4133 bool blind = (p_ptr->blind ? TRUE : FALSE);
4135 /* Player needs a "description" (he is blind) */
4138 /* Source monster */
4139 monster_type *m_ptr = NULL;
4141 /* Monster name (for attacks) */
4142 GAME_TEXT m_name[MAX_NLEN];
4144 /* Monster name (for damage) */
4147 /* Hack -- messages */
4153 /* Player is not here */
4154 if (!player_bold(y, x)) return (FALSE);
4156 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && (randint0(55) < (p_ptr->lev*3/5+20)) && who && (who != p_ptr->riding))
4158 if (kawarimi(TRUE)) return FALSE;
4161 /* Player cannot hurt himself */
4162 if (!who) return (FALSE);
4163 if (who == p_ptr->riding) return (FALSE);
4165 if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
4168 int max_attempts = 10;
4169 sound(SOUND_REFLECT);
4172 msg_print(_("何かが跳ね返った!", "Something bounces!"));
4173 else if (p_ptr->special_defense & KATA_FUUJIN)
4174 msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
4176 msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
4179 /* Choose 'new' target */
4184 t_y = m_list[who].fy - 1 + randint1(3);
4185 t_x = m_list[who].fx - 1 + randint1(3);
4188 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
4190 if (max_attempts < 1)
4192 t_y = m_list[who].fy;
4193 t_x = m_list[who].fx;
4198 t_y = p_ptr->y - 1 + randint1(3);
4199 t_x = p_ptr->x - 1 + randint1(3);
4202 project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
4204 disturb(TRUE, TRUE);
4208 /* Limit maximum damage */
4209 if (dam > 1600) dam = 1600;
4211 /* Reduce damage by distance */
4212 dam = (dam + r) / (r + 1);
4215 /* If the player is blind, be more descriptive */
4216 if (blind) fuzzy = TRUE;
4221 m_ptr = &m_list[who];
4222 rlev = (((&r_info[m_ptr->r_idx])->level >= 1) ? (&r_info[m_ptr->r_idx])->level : 1);
4223 monster_desc(m_name, m_ptr, 0);
4225 /* Get the monster's real name (gotten before polymorph!) */
4226 strcpy(killer, who_name);
4232 case PROJECT_WHO_UNCTRL_POWER:
4233 strcpy(killer, _("制御できない力の氾流", "uncontrollable power storm"));
4236 case PROJECT_WHO_GLASS_SHARDS:
4237 strcpy(killer, _("ガラスの破片", "shards of glass"));
4241 strcpy(killer, _("罠", "a trap"));
4246 strcpy(m_name, killer);
4249 /* Analyze the damage */
4252 /* Standard damage -- hurts inventory too */
4255 if (fuzzy) msg_print(_("酸で攻撃された!", "You are hit by acid!"));
4256 get_damage = acid_dam(dam, killer, monspell, FALSE);
4260 /* Standard damage -- hurts inventory too */
4263 if (fuzzy) msg_print(_("火炎で攻撃された!", "You are hit by fire!"));
4264 get_damage = fire_dam(dam, killer, monspell, FALSE);
4268 /* Standard damage -- hurts inventory too */
4271 if (fuzzy) msg_print(_("冷気で攻撃された!", "You are hit by cold!"));
4272 get_damage = cold_dam(dam, killer, monspell, FALSE);
4276 /* Standard damage -- hurts inventory too */
4279 if (fuzzy) msg_print(_("電撃で攻撃された!", "You are hit by lightning!"));
4280 get_damage = elec_dam(dam, killer, monspell, FALSE);
4284 /* Standard damage -- also poisons player */
4287 bool double_resist = IS_OPPOSE_POIS();
4288 if (fuzzy) msg_print(_("毒で攻撃された!", "You are hit by poison!"));
4290 if (p_ptr->resist_pois) dam = (dam + 2) / 3;
4291 if (double_resist) dam = (dam + 2) / 3;
4293 if ((!(double_resist || p_ptr->resist_pois)) && one_in_(HURT_CHANCE) && !CHECK_MULTISHADOW())
4298 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4300 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4302 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4307 /* Standard damage -- also poisons / mutates player */
4310 bool double_resist = IS_OPPOSE_POIS();
4311 if (fuzzy) msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
4313 if (p_ptr->resist_pois) dam = (2 * dam + 2) / 5;
4314 if (double_resist) dam = (2 * dam + 2) / 5;
4315 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4316 if (!(double_resist || p_ptr->resist_pois) && !CHECK_MULTISHADOW())
4318 set_poisoned(p_ptr->poisoned + randint0(dam) + 10);
4320 if (one_in_(5)) /* 6 */
4322 msg_print(_("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
4323 if (one_in_(4)) /* 4 */
4331 inven_damage(set_acid_destroy, 2);
4337 /* Standard damage */
4340 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4341 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4345 /* Holy Orb -- Player only takes partial damage */
4348 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4349 if (p_ptr->align > 10)
4351 else if (p_ptr->align < -10)
4353 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4359 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4360 if (p_ptr->align > 10)
4362 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4366 /* Arrow -- XXX no dodging */
4371 msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4373 else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
4375 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
4378 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4382 /* Plasma -- XXX No resist */
4385 if (fuzzy) msg_print(_("何かとても熱いもので攻撃された!", "You are hit by something *HOT*!"));
4386 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4388 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4390 int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
4391 (void)set_stun(p_ptr->stun + plus_stun);
4394 if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire))
4396 inven_damage(set_acid_destroy, 3);
4402 /* Nether -- drain experience */
4405 if (fuzzy) msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
4406 if (p_ptr->resist_neth)
4408 if (!prace_is_(RACE_SPECTRE))
4410 dam *= 6; dam /= (randint1(4) + 7);
4413 else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
4415 if (prace_is_(RACE_SPECTRE) && !CHECK_MULTISHADOW())
4417 msg_print(_("気分がよくなった。", "You feel invigorated!"));
4419 learn_spell(monspell);
4423 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4429 /* Water -- stun/confuse */
4432 if (fuzzy) msg_print(_("何か湿ったもので攻撃された!", "You are hit by something wet!"));
4433 if (!CHECK_MULTISHADOW())
4435 if (!p_ptr->resist_sound && !p_ptr->resist_water)
4437 set_stun(p_ptr->stun + randint1(40));
4439 if (!p_ptr->resist_conf && !p_ptr->resist_water)
4441 set_confused(p_ptr->confused + randint1(5) + 5);
4444 if (one_in_(5) && !p_ptr->resist_water)
4446 inven_damage(set_cold_destroy, 3);
4449 if (p_ptr->resist_water) get_damage /= 4;
4452 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4456 /* Chaos -- many effects */
4459 if (fuzzy) msg_print(_("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
4460 if (p_ptr->resist_chaos)
4462 dam *= 6; dam /= (randint1(4) + 7);
4465 if (!CHECK_MULTISHADOW())
4467 if (!p_ptr->resist_conf)
4469 (void)set_confused(p_ptr->confused + randint0(20) + 10);
4471 if (!p_ptr->resist_chaos)
4473 (void)set_image(p_ptr->image + randint1(10));
4476 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!", "Your body is twisted by chaos!"));
4477 (void)gain_random_mutation(0);
4480 if (!p_ptr->resist_neth && !p_ptr->resist_chaos)
4482 drain_exp(5000 + (p_ptr->exp / 100), 500 + (p_ptr->exp / 1000), 75);
4485 if (!p_ptr->resist_chaos || one_in_(9))
4487 inven_damage(set_elec_destroy, 2);
4488 inven_damage(set_fire_destroy, 2);
4492 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4496 /* Shards -- mostly cutting */
4499 if (fuzzy) msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
4500 if (p_ptr->resist_shard)
4502 dam *= 6; dam /= (randint1(4) + 7);
4504 else if (!CHECK_MULTISHADOW())
4506 (void)set_cut(p_ptr->cut + dam);
4509 if (!p_ptr->resist_shard || one_in_(13))
4511 inven_damage(set_cold_destroy, 2);
4514 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4518 /* Sound -- mostly stunning */
4521 if (fuzzy) msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
4522 if (p_ptr->resist_sound)
4524 dam *= 5; dam /= (randint1(4) + 7);
4526 else if (!CHECK_MULTISHADOW())
4528 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4529 (void)set_stun(p_ptr->stun + plus_stun);
4532 if (!p_ptr->resist_sound || one_in_(13))
4534 inven_damage(set_cold_destroy, 2);
4537 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4541 /* Pure confusion */
4544 if (fuzzy) msg_print(_("何か混乱するもので攻撃された!", "You are hit by something puzzling!"));
4545 if (p_ptr->resist_conf)
4547 dam *= 5; dam /= (randint1(4) + 7);
4549 else if (!CHECK_MULTISHADOW())
4551 (void)set_confused(p_ptr->confused + randint1(20) + 10);
4553 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4557 /* Disenchantment -- see above */
4560 if (fuzzy) msg_print(_("何かさえないもので攻撃された!", "You are hit by something static!"));
4561 if (p_ptr->resist_disen)
4563 dam *= 6; dam /= (randint1(4) + 7);
4565 else if (!CHECK_MULTISHADOW())
4567 (void)apply_disenchant(0);
4569 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4573 /* Nexus -- see above */
4576 if (fuzzy) msg_print(_("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
4577 if (p_ptr->resist_nexus)
4579 dam *= 6; dam /= (randint1(4) + 7);
4581 else if (!CHECK_MULTISHADOW())
4585 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4589 /* Force -- mostly stun */
4592 if (fuzzy) msg_print(_("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
4593 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4595 (void)set_stun(p_ptr->stun + randint1(20));
4597 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4602 /* Rocket -- stun, cut */
4605 if (fuzzy) msg_print(_("爆発があった!", "There is an explosion!"));
4606 if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
4608 (void)set_stun(p_ptr->stun + randint1(20));
4611 if (p_ptr->resist_shard)
4615 else if (!CHECK_MULTISHADOW())
4617 (void)set_cut(p_ptr->cut + (dam / 2));
4620 if (!p_ptr->resist_shard || one_in_(12))
4622 inven_damage(set_cold_destroy, 3);
4625 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4629 /* Inertia -- slowness */
4632 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4633 if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4634 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4638 /* Lite -- blinding */
4641 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4642 if (p_ptr->resist_lite)
4644 dam *= 4; dam /= (randint1(4) + 7);
4646 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4648 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4651 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
4653 if (!CHECK_MULTISHADOW()) msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
4656 else if (prace_is_(RACE_S_FAIRY))
4661 if (p_ptr->wraith_form) dam *= 2;
4662 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4664 if (p_ptr->wraith_form && !CHECK_MULTISHADOW())
4666 p_ptr->wraith_form = 0;
4667 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
4668 "The light forces you out of your incorporeal shadow form."));
4670 p_ptr->redraw |= (PR_MAP | PR_STATUS);
4671 p_ptr->update |= (PU_MONSTERS);
4672 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
4678 /* Dark -- blinding */
4681 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4682 if (p_ptr->resist_dark)
4684 dam *= 4; dam /= (randint1(4) + 7);
4686 if (prace_is_(RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE) || p_ptr->wraith_form) dam = 0;
4688 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
4690 (void)set_blind(p_ptr->blind + randint1(5) + 2);
4692 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4696 /* Time -- bolt fewer effects XXX */
4699 if (fuzzy) msg_print(_("過去からの衝撃に攻撃された!", "You are hit by a blast from the past!"));
4700 if (p_ptr->resist_time)
4703 dam /= (randint1(4) + 7);
4704 msg_print(_("時間が通り過ぎていく気がする。", "You feel as if time is passing you by."));
4706 else if (!CHECK_MULTISHADOW())
4708 switch (randint1(10))
4710 case 1: case 2: case 3: case 4: case 5:
4712 if (p_ptr->prace == RACE_ANDROID) break;
4713 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
4714 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
4718 case 6: case 7: case 8: case 9:
4720 switch (randint1(6))
4722 case 1: k = A_STR; act = _("強く", "strong"); break;
4723 case 2: k = A_INT; act = _("聡明で", "bright"); break;
4724 case 3: k = A_WIS; act = _("賢明で", "wise"); break;
4725 case 4: k = A_DEX; act = _("器用で", "agile"); break;
4726 case 5: k = A_CON; act = _("健康で", "hale"); break;
4727 case 6: k = A_CHR; act = _("美しく", "beautiful"); break;
4730 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
4731 "You're not as %s as you used to be..."), act);
4733 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 3) / 4;
4734 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4735 p_ptr->update |= (PU_BONUS);
4741 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
4742 "You're not as powerful as you used to be..."));
4744 for (k = 0; k < A_MAX; k++)
4746 p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
4747 if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
4749 p_ptr->update |= (PU_BONUS);
4755 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4759 /* Gravity -- stun plus slowness plus teleport */
4762 if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
4763 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
4765 if (!CHECK_MULTISHADOW())
4767 teleport_player(5, TELEPORT_PASSIVE);
4768 if (!p_ptr->levitation)
4769 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4770 if (!(p_ptr->resist_sound || p_ptr->levitation))
4772 int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
4773 (void)set_stun(p_ptr->stun + plus_stun);
4776 if (p_ptr->levitation)
4778 dam = (dam * 2) / 3;
4781 if (!p_ptr->levitation || one_in_(13))
4783 inven_damage(set_cold_destroy, 2);
4786 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4790 /* Standard damage */
4791 case GF_DISINTEGRATE:
4793 if (fuzzy) msg_print(_("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
4795 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4801 if (fuzzy) msg_print(_("何らかの攻撃によって気分がよくなった。", "You are hit by something invigorating!"));
4803 (void)hp_player(dam);
4810 if (fuzzy) msg_print(_("何かで攻撃された!", "You are hit by something!"));
4811 (void)set_fast(p_ptr->fast + randint1(5), FALSE);
4818 if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
4819 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
4825 if (p_ptr->free_act) break;
4826 if (fuzzy) msg_print(_("眠ってしまった!", "You fall asleep!"));
4828 if (ironman_nightmare)
4830 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
4831 /* Have some nightmares */
4832 sanity_blast(NULL, FALSE);
4835 set_paralyzed(p_ptr->paralyzed + dam);
4845 if (fuzzy) msg_print(_("魔法のオーラで攻撃された!", "You are hit by an aura of magic!"));
4846 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4853 if (fuzzy) msg_print(_("エネルギーの塊で攻撃された!", "You are hit by an energy!"));
4854 get_damage = take_hit(DAMAGE_FORCE, dam, killer, monspell);
4861 if (fuzzy) msg_print(_("何かが空からあなたの頭上に落ちてきた!", "Something falls from the sky on you!"));
4863 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4864 if (!p_ptr->resist_shard || one_in_(13))
4866 if (!p_ptr->immune_fire) inven_damage(set_fire_destroy, 2);
4867 inven_damage(set_cold_destroy, 2);
4873 /* Ice -- cold plus stun plus cuts */
4876 if (fuzzy) msg_print(_("何か鋭く冷たいもので攻撃された!", "You are hit by something sharp and cold!"));
4877 get_damage = cold_dam(dam, killer, monspell, FALSE);
4878 if (!CHECK_MULTISHADOW())
4880 if (!p_ptr->resist_shard)
4882 (void)set_cut(p_ptr->cut + damroll(5, 8));
4884 if (!p_ptr->resist_sound)
4886 (void)set_stun(p_ptr->stun + randint1(15));
4889 if ((!(p_ptr->resist_cold || IS_OPPOSE_COLD())) || one_in_(12))
4891 if (!p_ptr->immune_cold) inven_damage(set_cold_destroy, 3);
4901 if (fuzzy) msg_print(_("何か非常に冷たいもので攻撃された!", "You are hit by something extremely cold!"));
4903 if (p_ptr->mimic_form)
4905 if (!(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
4906 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4911 switch (p_ptr->prace)
4913 /* Some races are immune */
4927 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
4939 if (CHECK_MULTISHADOW())
4941 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
4943 else if (p_ptr->csp)
4947 msg_format(_("%^sに精神エネルギーを吸い取られてしまった!", "%^s draws psychic energy from you!"), m_name);
4949 msg_print(_("精神エネルギーを吸い取られてしまった!", "Your psychic energy is drawn!"));
4952 if (dam >= p_ptr->csp)
4956 p_ptr->csp_frac = 0;
4965 learn_spell(monspell);
4966 p_ptr->redraw |= (PR_MANA);
4967 p_ptr->window |= (PW_PLAYER | PW_SPELL);
4971 /* Heal the monster */
4972 if (m_ptr->hp < m_ptr->maxhp)
4976 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4978 /* Redraw (later) if needed */
4979 if (p_ptr->health_who == who) p_ptr->redraw |= (PR_HEALTH);
4980 if (p_ptr->riding == who) p_ptr->redraw |= (PR_UHEALTH);
4982 /* Special message */
4985 msg_format(_("%^sは気分が良さそうだ。", "%^s appears healthier."), m_name);
4998 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5000 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5001 learn_spell(monspell);
5005 if (!CHECK_MULTISHADOW())
5007 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5009 if (!p_ptr->resist_conf)
5011 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5014 if (!p_ptr->resist_chaos && one_in_(3))
5016 (void)set_image(p_ptr->image + randint0(250) + 150);
5023 p_ptr->csp_frac = 0;
5025 p_ptr->redraw |= PR_MANA;
5028 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5034 case GF_BRAIN_SMASH:
5036 if ((randint0(100 + rlev / 2) < MAX(5, p_ptr->skill_sav)) && !CHECK_MULTISHADOW())
5038 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5039 learn_spell(monspell);
5043 if (!CHECK_MULTISHADOW())
5045 msg_print(_("霊的エネルギーで精神が攻撃された。", "Your mind is blasted by psyonic energy."));
5051 p_ptr->csp_frac = 0;
5053 p_ptr->redraw |= PR_MANA;
5056 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5057 if (!CHECK_MULTISHADOW())
5059 if (!p_ptr->resist_blind)
5061 (void)set_blind(p_ptr->blind + 8 + randint0(8));
5063 if (!p_ptr->resist_conf)
5065 (void)set_confused(p_ptr->confused + randint0(4) + 4);
5067 if (!p_ptr->free_act)
5069 (void)set_paralyzed(p_ptr->paralyzed + randint0(4) + 4);
5071 (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
5073 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5074 (void)do_dec_stat(A_INT);
5075 while (randint0(100 + rlev / 2) > (MAX(5, p_ptr->skill_sav)))
5076 (void)do_dec_stat(A_WIS);
5078 if (!p_ptr->resist_chaos)
5080 (void)set_image(p_ptr->image + randint0(250) + 150);
5090 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5092 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5093 learn_spell(monspell);
5097 if (!CHECK_MULTISHADOW()) curse_equipment(15, 0);
5098 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5106 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5108 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5109 learn_spell(monspell);
5113 if (!CHECK_MULTISHADOW()) curse_equipment(25, MIN(rlev / 2 - 15, 5));
5114 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5122 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5124 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5125 learn_spell(monspell);
5129 if (!CHECK_MULTISHADOW()) curse_equipment(33, MIN(rlev / 2 - 15, 15));
5130 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5138 if ((randint0(100 + rlev / 2) < p_ptr->skill_sav) && !(m_ptr->r_idx == MON_KENSHIROU) && !CHECK_MULTISHADOW())
5140 msg_print(_("しかし秘孔を跳ね返した!", "You resist the effects!"));
5141 learn_spell(monspell);
5145 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
5146 if (!CHECK_MULTISHADOW()) (void)set_cut(p_ptr->cut + damroll(10, 10));
5154 if ((randint0(100 + rlev/2) < p_ptr->skill_sav) && !CHECK_MULTISHADOW())
5156 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
5157 learn_spell(monspell);
5161 if (!CHECK_MULTISHADOW())
5163 msg_print(_("あなたは命が薄まっていくように感じた!", "You feel your life fade away!"));
5164 curse_equipment(40, 20);
5167 get_damage = take_hit(DAMAGE_ATTACK, dam, m_name, monspell);
5169 if (p_ptr->chp < 1) p_ptr->chp = 1; /* Paranoia */
5184 /* Hex - revenge damage stored */
5185 revenge_store(get_damage);
5187 if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
5188 && (get_damage > 0) && !p_ptr->is_dead && (who > 0))
5190 GAME_TEXT m_name_self[80];
5193 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
5195 msg_format(_("攻撃が%s自身を傷つけた!", "The attack of %s has wounded %s!"), m_name, m_name_self);
5196 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
5197 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
5200 if (p_ptr->riding && dam > 0)
5202 rakubadam_p = (dam > 200) ? 200 : dam;
5206 disturb(TRUE, TRUE);
5209 if ((p_ptr->special_defense & NINJA_KAWARIMI) && dam && who && (who != p_ptr->riding))
5211 (void)kawarimi(FALSE);
5214 /* Return "Anything seen?" */
5220 * Find the distance from (x, y) to a line.
5222 POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5224 /* Vector from (x, y) to (x1, y1) */
5225 POSITION py = y1 - y;
5226 POSITION px = x1 - x;
5229 POSITION ny = x2 - x1;
5230 POSITION nx = y1 - y2;
5233 POSITION pd = distance(y1, x1, y, x);
5234 POSITION nd = distance(y1, x1, y2, x2);
5236 if (pd > nd) return distance(y, x, y2, x2);
5238 /* Component of P on N */
5239 nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
5241 /* Absolute value */
5242 return((nd >= 0) ? nd : 0 - nd);
5249 * Modified version of los() for calculation of disintegration balls.
5250 * Disintegration effects are stopped by permanent walls.
5252 bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
5254 POSITION dx, dy; /* Delta */
5255 POSITION ax, ay; /* Absolute */
5256 POSITION sx, sy; /* Signs */
5257 POSITION qx, qy; /* Fractions */
5258 POSITION tx, ty; /* Scanners */
5259 POSITION f1, f2; /* Scale factors */
5260 POSITION m; /* Slope, or 1/Slope, of LOS */
5262 /* Extract the offset */
5266 /* Extract the absolute offset */
5270 /* Handle adjacent (or identical) grids */
5271 if ((ax < 2) && (ay < 2)) return (TRUE);
5273 /* Paranoia -- require "safe" origin */
5274 /* if (!in_bounds(y1, x1)) return (FALSE); */
5276 /* Directly South/North */
5279 /* South -- check for walls */
5282 for (ty = y1 + 1; ty < y2; ty++)
5284 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5288 /* North -- check for walls */
5291 for (ty = y1 - 1; ty > y2; ty--)
5293 if (cave_stop_disintegration(ty, x1)) return (FALSE);
5301 /* Directly East/West */
5304 /* East -- check for walls */
5307 for (tx = x1 + 1; tx < x2; tx++)
5309 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5313 /* West -- check for walls */
5316 for (tx = x1 - 1; tx > x2; tx--)
5318 if (cave_stop_disintegration(y1, tx)) return (FALSE);
5326 /* Extract some signs */
5327 sx = (dx < 0) ? -1 : 1;
5328 sy = (dy < 0) ? -1 : 1;
5330 /* Vertical "knights" */
5335 if (!cave_stop_disintegration(y1 + sy, x1)) return (TRUE);
5339 /* Horizontal "knights" */
5344 if (!cave_stop_disintegration(y1, x1 + sx)) return (TRUE);
5348 /* Calculate scale factor div 2 */
5351 /* Calculate scale factor */
5355 /* Travel horizontally */
5358 /* Let m = dy / dx * 2 * (dy * dx) = 2 * dy * dy */
5364 /* Consider the special case where slope == 1. */
5375 /* Note (below) the case (qy == f2), where */
5376 /* the LOS exactly meets the corner of a tile. */
5379 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5390 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5403 /* Travel vertically */
5406 /* Let m = dx / dy * 2 * (dx * dy) = 2 * dx * dx */
5422 /* Note (below) the case (qx == f2), where */
5423 /* the LOS exactly meets the corner of a tile. */
5426 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5437 if (cave_stop_disintegration(ty, tx)) return (FALSE);
5458 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)
5463 int brev = rad * rad / dist;
5467 int mdis = distance(y1, x1, y2, x2) + rad;
5469 while (bdis <= mdis)
5473 if ((0 < dist) && (path_n < dist))
5475 POSITION ny = GRID_Y(path_g[path_n]);
5476 POSITION nx = GRID_X(path_g[path_n]);
5477 POSITION nd = distance(ny, nx, y1, x1);
5479 /* Get next base point */
5488 /* Travel from center outward */
5489 for (cdis = 0; cdis <= brad; cdis++)
5491 /* Scan the maximal blast area of radius "cdis" */
5492 for (y = by - cdis; y <= by + cdis; y++)
5494 for (x = bx - cdis; x <= bx + cdis; x++)
5496 /* Ignore "illegal" locations */
5497 if (!in_bounds(y, x)) continue;
5499 /* Enforce a circular "ripple" */
5500 if (distance(y1, x1, y, x) != bdis) continue;
5502 /* Enforce an arc */
5503 if (distance(by, bx, y, x) != cdis) continue;
5509 /* Lights are stopped by opaque terrains */
5510 if (!los(by, bx, y, x)) continue;
5512 case GF_DISINTEGRATE:
5513 /* Disintegration are stopped only by perma-walls */
5514 if (!in_disintegration_range(by, bx, y, x)) continue;
5517 /* Ball explosions are stopped by walls */
5518 if (!projectable(by, bx, y, x)) continue;
5522 /* Save this grid */
5530 /* Encode some more "radius" info */
5531 gm[bdis + 1] = *pgrids;
5533 /* Increase the size */
5534 brad = rad * (path_n + brev) / (dist + brev);
5536 /* Find the next ripple */
5540 /* Store the effect size */
5546 * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
5547 * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
5548 * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
5549 * @param y 目標Y座標 / Target y location (or location to travel "towards")
5550 * @param x 目標X座標 / Target x location (or location to travel "towards")
5551 * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
5552 * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
5553 * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
5554 * @param monspell 効果元のモンスター魔法ID
5555 * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
5558 * Allows a monster (or player) to project a beam/bolt/ball of a given kind
5559 * towards a given location (optionally passing over the heads of interposing
5560 * monsters), and have it do a given amount of damage to the monsters (and
5561 * optionally objects) within the given radius of the final location.
5563 * A "bolt" travels from source to target and affects only the target grid.
5564 * A "beam" travels from source to target, affecting all grids passed through.
5565 * A "ball" travels from source to the target, exploding at the target, and
5566 * affecting everything within the given radius of the target location.
5568 * Traditionally, a "bolt" does not affect anything on the ground, and does
5569 * not pass over the heads of interposing monsters, much like a traditional
5570 * missile, and will "stop" abruptly at the "target" even if no monster is
5571 * positioned there, while a "ball", on the other hand, passes over the heads
5572 * of monsters between the source and target, and affects everything except
5573 * the source monster which lies within the final radius, while a "beam"
5574 * affects every monster between the source and target, except for the casting
5575 * monster (or player), and rarely affects things on the ground.
5577 * Two special flags allow us to use this function in special ways, the
5578 * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while
5579 * the "PROJECT_JUMP" flag allows us to affect a specific grid, without
5580 * actually projecting from the source monster (or player).
5582 * The player will only get "experience" for monsters killed by himself
5583 * Unique monsters can only be destroyed by attacks from the player
5585 * Only 256 grids can be affected per projection, limiting the effective
5586 * "radius" of standard ball attacks to nine units (diameter nineteen).
5588 * One can project in a given "direction" by combining PROJECT_THRU with small
5589 * offsets to the initial location (see "line_spell()"), or by calculating
5590 * "virtual targets" far away from the player.
5592 * One can also use PROJECT_THRU to send a beam/bolt along an angled path,
5593 * continuing until it actually hits somethings (useful for "stone to mud").
5595 * Bolts and Beams explode INSIDE walls, so that they can destroy doors.
5597 * Balls must explode BEFORE hitting walls, or they would affect monsters
5598 * on both sides of a wall. Some bug reports indicate that this is still
5599 * happening in 2.7.8 for Windows, though it appears to be impossible.
5601 * We "pre-calculate" the blast area only in part for efficiency.
5602 * More importantly, this lets us do "explosions" from the "inside" out.
5603 * This results in a more logical distribution of "blast" treasure.
5604 * It also produces a better (in my opinion) animation of the explosion.
5605 * It could be (but is not) used to have the treasure dropped by monsters
5606 * in the middle of the explosion fall "outwards", and then be damaged by
5607 * the blast as it spreads outwards towards the treasure drop location.
5609 * Walls and doors are included in the blast area, so that they can be
5610 * "burned" or "melted" in later versions.
5612 * This algorithm is intended to maximize simplicity, not necessarily
5613 * efficiency, since this function is not a bottleneck in the code.
5615 * We apply the blast effect from ground zero outwards, in several passes,
5616 * first affecting features, then objects, then monsters, then the player.
5617 * This allows walls to be removed before checking the object or monster
5618 * in the wall, and protects objects which are dropped by monsters killed
5619 * in the blast, and allows the player to see all affects before he is
5620 * killed or teleported away. The semantics of this method are open to
5621 * various interpretations, but they seem to work well in practice.
5623 * We process the blast area from ground-zero outwards to allow for better
5624 * distribution of treasure dropped by monsters, and because it provides a
5625 * pleasing visual effect at low cost.
5627 * Note that the damage done by "ball" explosions decreases with distance.
5628 * This decrease is rapid, grids at radius "dist" take "1/dist" damage.
5630 * Notice the "napalm" effect of "beam" weapons. First they "project" to
5631 * the target, and then the damage "flows" along this beam of destruction.
5632 * The damage at every grid is the same as at the "center" of a "ball"
5633 * explosion, since the "beam" grids are treated as if they ARE at the
5634 * center of a "ball" explosion.
5636 * Currently, specifying "beam" plus "ball" means that locations which are
5637 * covered by the initial "beam", and also covered by the final "ball", except
5638 * for the final grid (the epicenter of the ball), will be "hit twice", once
5639 * by the initial beam, and once by the exploding ball. For the grid right
5640 * next to the epicenter, this results in 150% damage being done. The center
5641 * does not have this problem, for the same reason the final grid in a "beam"
5642 * plus "bolt" does not -- it is explicitly removed. Simply removing "beam"
5643 * grids which are covered by the "ball" will NOT work, as then they will
5644 * receive LESS damage than they should. Do not combine "beam" with "ball".
5646 * The array "gy[],gx[]" with current size "grids" is used to hold the
5647 * collected locations of all grids in the "blast area" plus "beam path".
5649 * Note the rather complex usage of the "gm[]" array. First, gm[0] is always
5650 * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the
5651 * first blast grid (see above) with radius "N" from the blast center. Note
5652 * that only the first gm[1] grids in the blast area thus take full damage.
5653 * Also, note that gm[rad+1] is always equal to "grids", which is the total
5654 * number of blast grids.
5656 * Note that once the projection is complete, (y2,x2) holds the final location
5657 * of bolts/beams, and the "epicenter" of balls.
5659 * Note also that "rad" specifies the "inclusive" radius of projection blast,
5660 * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the
5661 * implementation of the "distance" function. Also, a bolt can be properly
5662 * viewed as a "ball" with a "rad" of "zero".
5664 * Note that if no "target" is reached before the beam/bolt/ball travels the
5665 * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This
5666 * may be relevant even for bolts, since they have a "1x1" mini-blast.
5668 * Note that for consistency, we "pretend" that the bolt actually takes "time"
5669 * to move from point A to point B, even if the player cannot see part of the
5670 * projection path. Note that in general, the player will *always* see part
5671 * of the path, since it either starts at the player or ends on the player.
5673 * Hack -- we assume that every "projection" is "self-illuminating".
5675 * Hack -- when only a single monster is affected, we automatically track
5676 * (and recall) that monster, unless "PROJECT_JUMP" is used.
5678 * Note that all projections now "explode" at their final destination, even
5679 * if they were being projected at a more distant destination. This means
5680 * that "ball" spells will *always* explode.
5682 * Note that we must call "handle_stuff()" after affecting terrain features
5683 * in the blast radius, in case the "illumination" of the grid was changed,
5684 * and "update_view()" and "update_monsters()" need to be called.
5687 bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, EFFECT_ID typ, BIT_FLAGS flg, int monspell)
5697 POSITION y_saver, x_saver; /* For reflecting monsters */
5699 int msec = delay_factor * delay_factor * delay_factor;
5701 /* Assume the player sees nothing */
5702 bool notice = FALSE;
5704 /* Assume the player has seen nothing */
5705 bool visual = FALSE;
5707 /* Assume the player has seen no blast grids */
5710 /* Assume to be a normal ball spell */
5711 bool breath = FALSE;
5713 /* Is the player blind? */
5714 bool blind = (p_ptr->blind ? TRUE : FALSE);
5716 bool old_hide = FALSE;
5718 /* Number of grids in the "path" */
5721 /* Actual grids in the "path" */
5724 /* Number of grids in the "blast area" (including the "beam" path) */
5727 /* Coordinates of the affected grids */
5728 POSITION gx[1024], gy[1024];
5730 /* Encoded "radius" info (see above) */
5733 /* Actual radius encoded in gm[] */
5734 POSITION gm_rad = rad;
5738 /* Attacker's name (prepared before polymorph)*/
5739 GAME_TEXT who_name[MAX_NLEN];
5741 /* Can the player see the source of this effect? */
5742 bool see_s_msg = TRUE;
5744 /* Initialize by null string */
5750 /* Default target of monsterspell is player */
5751 monster_target_y = p_ptr->y;
5752 monster_target_x = p_ptr->x;
5754 /* Hack -- Jump to target */
5755 if (flg & (PROJECT_JUMP))
5760 /* Clear the flag */
5761 flg &= ~(PROJECT_JUMP);
5766 /* Start at player */
5773 /* Start at monster */
5776 x1 = m_list[who].fx;
5777 y1 = m_list[who].fy;
5778 monster_desc(who_name, &m_list[who], MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
5790 /* Default "destination" */
5795 /* Hack -- verify stuff */
5796 if (flg & (PROJECT_THRU))
5798 if ((x1 == x2) && (y1 == y2))
5800 flg &= ~(PROJECT_THRU);
5804 /* Handle a breath attack */
5809 if (flg & PROJECT_HIDE) old_hide = TRUE;
5810 flg |= PROJECT_HIDE;
5814 /* Hack -- Assume there will be no blast (max radius 32) */
5815 for (dist = 0; dist < 32; dist++) gm[dist] = 0;
5823 /* Collect beam grids */
5824 if (flg & (PROJECT_BEAM))
5835 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS);
5837 case GF_DISINTEGRATE:
5838 flg |= (PROJECT_GRID);
5839 if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI);
5843 /* Calculate the projection path */
5845 path_n = project_path(path_g, (project_length ? project_length : MAX_RANGE), y1, x1, y2, x2, flg);
5848 /* Giga-Hack SEEKER & SUPER_RAY */
5850 if( typ == GF_SEEKER )
5860 for (i = 0; i < path_n; ++i)
5865 POSITION ny = GRID_Y(path_g[i]);
5866 POSITION nx = GRID_X(path_g[i]);
5877 /* Only do visuals if requested */
5878 if (!blind && !(flg & (PROJECT_HIDE)))
5880 /* Only do visuals if the player can "see" the bolt */
5881 if (panel_contains(y, x) && player_has_los_bold(y, x))
5888 /* Obtain the bolt pict */
5889 p = bolt_pict(oy, ox, y, x, typ);
5891 /* Extract attr/char */
5895 /* Visual effects */
5896 print_rel(c, a, y, x);
5897 move_cursor_relative(y, x);
5898 /*if (fresh_before)*/ Term_fresh();
5899 Term_xtra(TERM_XTRA_DELAY, msec);
5901 /*if (fresh_before)*/ Term_fresh();
5903 /* Display "beam" grids */
5904 if (flg & (PROJECT_BEAM))
5906 /* Obtain the explosion pict */
5907 p = bolt_pict(y, x, y, x, typ);
5909 /* Extract attr/char */
5913 /* Visual effects */
5914 print_rel(c, a, y, x);
5917 /* Hack -- Activate delay */
5921 /* Hack -- delay anyway for consistency */
5924 /* Delay for consistency */
5925 Term_xtra(TERM_XTRA_DELAY, msec);
5928 if (project_o(0, 0, y, x, dam, GF_SEEKER))notice = TRUE;
5929 if (is_mirror_grid(&grid_array[y][x]))
5931 /* The target of monsterspell becomes tha mirror(broken) */
5932 monster_target_y = y;
5933 monster_target_x = x;
5935 remove_mirror(y, x);
5936 next_mirror(&oy, &ox, y, x);
5938 path_n = i + project_path(&(path_g[i + 1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
5939 for (j = last_i; j <= i; j++)
5941 y = GRID_Y(path_g[j]);
5942 x = GRID_X(path_g[j]);
5943 if (project_m(0, 0, y, x, dam, GF_SEEKER, flg, TRUE)) notice = TRUE;
5944 if (!who && (project_m_n == 1) && !jump) {
5945 if (grid_array[project_m_y][project_m_x].m_idx > 0) {
5946 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
5950 /* Hack -- auto-recall */
5951 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5953 /* Hack - auto-track */
5954 health_track(grid_array[project_m_y][project_m_x].m_idx);
5958 (void)project_f(0, 0, y, x, dam, GF_SEEKER);
5963 for(i = last_i ; i < path_n ; i++)
5966 py = GRID_Y(path_g[i]);
5967 px = GRID_X(path_g[i]);
5968 if (project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
5970 if (!who && (project_m_n == 1) && !jump) {
5971 if (grid_array[project_m_y][project_m_x].m_idx > 0)
5973 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
5977 /* Hack -- auto-recall */
5978 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
5980 /* Hack - auto-track */
5981 health_track(grid_array[project_m_y][project_m_x].m_idx);
5985 (void)project_f(0, 0, py, px, dam, GF_SEEKER);
5989 else if(typ == GF_SUPER_RAY){
5991 int second_step = 0;
5998 for (i = 0; i < path_n; ++i)
6003 POSITION ny = GRID_Y(path_g[i]);
6004 POSITION nx = GRID_X(path_g[i]);
6015 /* Only do visuals if requested */
6016 if (!blind && !(flg & (PROJECT_HIDE)))
6018 /* Only do visuals if the player can "see" the bolt */
6019 if (panel_contains(y, x) && player_has_los_bold(y, x))
6026 /* Obtain the bolt pict */
6027 p = bolt_pict(oy, ox, y, x, typ);
6029 /* Extract attr/char */
6033 /* Visual effects */
6034 print_rel(c, a, y, x);
6035 move_cursor_relative(y, x);
6036 /*if (fresh_before)*/ Term_fresh();
6037 Term_xtra(TERM_XTRA_DELAY, msec);
6039 /*if (fresh_before)*/ Term_fresh();
6041 /* Display "beam" grids */
6042 if (flg & (PROJECT_BEAM))
6044 /* Obtain the explosion pict */
6045 p = bolt_pict(y, x, y, x, typ);
6047 /* Extract attr/char */
6051 /* Visual effects */
6052 print_rel(c, a, y, x);
6055 /* Hack -- Activate delay */
6059 /* Hack -- delay anyway for consistency */
6062 /* Delay for consistency */
6063 Term_xtra(TERM_XTRA_DELAY, msec);
6066 if(project_o(0,0,y,x,dam,GF_SUPER_RAY) )notice=TRUE;
6067 if (!cave_have_flag_bold(y, x, FF_PROJECT))
6069 if( second_step )continue;
6072 if( is_mirror_grid(&grid_array[y][x]) && !second_step )
6074 /* The target of monsterspell becomes tha mirror(broken) */
6075 monster_target_y=(s16b)y;
6076 monster_target_x=(s16b)x;
6079 for( j = 0; j <=i ; j++ )
6081 y = GRID_Y(path_g[j]);
6082 x = GRID_X(path_g[j]);
6083 (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
6087 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x-1, flg);
6088 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x , flg);
6089 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y-1, x+1, flg);
6090 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x-1, flg);
6091 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y , x+1, flg);
6092 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x-1, flg);
6093 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x , flg);
6094 path_n += project_path(&(path_g[path_n+1]), (project_length ? project_length : MAX_RANGE), y, x, y+1, x+1, flg);
6097 for( i = 0; i < path_n ; i++ )
6100 py = GRID_Y(path_g[i]);
6101 px = GRID_X(path_g[i]);
6102 (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
6103 if(!who && (project_m_n == 1) && !jump){
6104 if(grid_array[project_m_y][project_m_x].m_idx >0 ){
6105 monster_type *m_ptr = &m_list[grid_array[project_m_y][project_m_x].m_idx];
6109 /* Hack -- auto-recall */
6110 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6112 /* Hack - auto-track */
6113 health_track(grid_array[project_m_y][project_m_x].m_idx);
6117 (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
6122 /* Project along the path */
6123 for (i = 0; i < path_n; ++i)
6128 POSITION ny = GRID_Y(path_g[i]);
6129 POSITION nx = GRID_X(path_g[i]);
6131 if (flg & PROJECT_DISI)
6133 /* Hack -- Balls explode before reaching walls */
6134 if (cave_stop_disintegration(ny, nx) && (rad > 0)) break;
6136 else if (flg & PROJECT_LOS)
6138 /* Hack -- Balls explode before reaching walls */
6139 if (!cave_los_bold(ny, nx) && (rad > 0)) break;
6143 /* Hack -- Balls explode before reaching walls */
6144 if (!cave_have_flag_bold(ny, nx, FF_PROJECT) && (rad > 0)) break;
6151 /* Collect beam grids */
6152 if (flg & (PROJECT_BEAM))
6159 /* Only do visuals if requested */
6160 if (!blind && !(flg & (PROJECT_HIDE | PROJECT_FAST)))
6162 /* Only do visuals if the player can "see" the bolt */
6163 if (panel_contains(y, x) && player_has_los_bold(y, x))
6170 /* Obtain the bolt pict */
6171 p = bolt_pict(oy, ox, y, x, typ);
6173 /* Extract attr/char */
6177 /* Visual effects */
6178 print_rel(c, a, y, x);
6179 move_cursor_relative(y, x);
6180 /*if (fresh_before)*/ Term_fresh();
6181 Term_xtra(TERM_XTRA_DELAY, msec);
6183 /*if (fresh_before)*/ Term_fresh();
6185 /* Display "beam" grids */
6186 if (flg & (PROJECT_BEAM))
6188 /* Obtain the explosion pict */
6189 p = bolt_pict(y, x, y, x, typ);
6191 /* Extract attr/char */
6195 /* Visual effects */
6196 print_rel(c, a, y, x);
6199 /* Hack -- Activate delay */
6203 /* Hack -- delay anyway for consistency */
6206 /* Delay for consistency */
6207 Term_xtra(TERM_XTRA_DELAY, msec);
6214 /* Save the "blast epicenter" */
6218 if (breath && !path_n)
6224 flg &= ~(PROJECT_HIDE);
6228 /* Start the "explosion" */
6231 /* Hack -- make sure beams get to "explode" */
6239 /* If we found a "target", explode there */
6240 if (dist <= MAX_RANGE)
6242 /* Mega-Hack -- remove the final "beam" grid */
6243 if ((flg & (PROJECT_BEAM)) && (grids > 0)) grids--;
6246 * Create a conical breath attack
6257 flg &= ~(PROJECT_HIDE);
6259 breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ);
6263 /* Determine the blast area, work from the inside out */
6264 for (dist = 0; dist <= rad; dist++)
6266 /* Scan the maximal blast area of radius "dist" */
6267 for (y = by - dist; y <= by + dist; y++)
6269 for (x = bx - dist; x <= bx + dist; x++)
6271 /* Ignore "illegal" locations */
6272 if (!in_bounds2(y, x)) continue;
6274 /* Enforce a "circular" explosion */
6275 if (distance(by, bx, y, x) != dist) continue;
6281 /* Lights are stopped by opaque terrains */
6282 if (!los(by, bx, y, x)) continue;
6284 case GF_DISINTEGRATE:
6285 /* Disintegration are stopped only by perma-walls */
6286 if (!in_disintegration_range(by, bx, y, x)) continue;
6289 /* Ball explosions are stopped by walls */
6290 if (!projectable(by, bx, y, x)) continue;
6294 /* Save this grid */
6301 /* Encode some more "radius" info */
6307 /* Speed -- ignore "non-explosions" */
6308 if (!grids) return (FALSE);
6311 /* Display the "blast area" if requested */
6312 if (!blind && !(flg & (PROJECT_HIDE)))
6314 /* Then do the "blast", from inside out */
6315 for (t = 0; t <= gm_rad; t++)
6317 /* Dump everything with this radius */
6318 for (i = gm[t]; i < gm[t+1]; i++)
6320 /* Extract the location */
6324 /* Only do visuals if the player can "see" the blast */
6325 if (panel_contains(y, x) && player_has_los_bold(y, x))
6334 /* Obtain the explosion pict */
6335 p = bolt_pict(y, x, y, x, typ);
6337 /* Extract attr/char */
6341 /* Visual effects -- Display */
6342 print_rel(c, a, y, x);
6346 /* Hack -- center the cursor */
6347 move_cursor_relative(by, bx);
6349 /* Flush each "radius" seperately */
6350 /*if (fresh_before)*/ Term_fresh();
6352 /* Delay (efficiently) */
6353 if (visual || drawn)
6355 Term_xtra(TERM_XTRA_DELAY, msec);
6359 /* Flush the erasing */
6362 /* Erase the explosion drawn above */
6363 for (i = 0; i < grids; i++)
6365 /* Extract the location */
6369 /* Hack -- Erase if needed */
6370 if (panel_contains(y, x) && player_has_los_bold(y, x))
6376 /* Hack -- center the cursor */
6377 move_cursor_relative(by, bx);
6379 /* Flush the explosion */
6380 /*if (fresh_before)*/ Term_fresh();
6384 update_creature(p_ptr);
6386 if (flg & PROJECT_KILL)
6388 see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
6389 (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
6393 /* Check features */
6394 if (flg & (PROJECT_GRID))
6396 /* Start with "dist" of zero */
6399 /* Scan for features */
6400 for (i = 0; i < grids; i++)
6402 /* Hack -- Notice new "dist" values */
6403 if (gm[dist+1] == i) dist++;
6405 /* Get the grid location */
6409 /* Find the closest point in the blast */
6412 int d = dist_to_line(y, x, y1, x1, by, bx);
6414 /* Affect the grid */
6415 if (project_f(who, d, y, x, dam, typ)) notice = TRUE;
6419 /* Affect the grid */
6420 if (project_f(who, dist, y, x, dam, typ)) notice = TRUE;
6425 update_creature(p_ptr);
6428 if (flg & (PROJECT_ITEM))
6430 /* Start with "dist" of zero */
6433 /* Scan for objects */
6434 for (i = 0; i < grids; i++)
6436 /* Hack -- Notice new "dist" values */
6437 if (gm[dist+1] == i) dist++;
6439 /* Get the grid location */
6443 /* Find the closest point in the blast */
6446 int d = dist_to_line(y, x, y1, x1, by, bx);
6448 /* Affect the object in the grid */
6449 if (project_o(who, d, y, x, dam, typ)) notice = TRUE;
6453 /* Affect the object in the grid */
6454 if (project_o(who, dist, y, x, dam, typ)) notice = TRUE;
6460 /* Check monsters */
6461 if (flg & (PROJECT_KILL))
6468 /* Start with "dist" of zero */
6471 /* Scan for monsters */
6472 for (i = 0; i < grids; i++)
6476 /* Hack -- Notice new "dist" values */
6477 if (gm[dist + 1] == i) dist++;
6479 /* Get the grid location */
6483 /* A single bolt may be reflected */
6486 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6487 monster_race *ref_ptr = &r_info[m_ptr->r_idx];
6489 if ((flg & PROJECT_REFLECTABLE) && grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) &&
6490 ((grid_array[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
6491 (!who || dist_hack > 1) && !one_in_(10))
6494 int max_attempts = 10;
6496 /* Choose 'new' target */
6499 t_y = y_saver - 1 + randint1(3);
6500 t_x = x_saver - 1 + randint1(3);
6503 while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(y, x, t_y, t_x));
6505 if (max_attempts < 1)
6511 sound(SOUND_REFLECT);
6514 if ((m_ptr->r_idx == MON_KENSHIROU) || (m_ptr->r_idx == MON_RAOU))
6515 msg_print(_("「北斗神拳奥義・二指真空把!」", "The attack bounces!"));
6516 else if (m_ptr->r_idx == MON_DIO)
6517 msg_print(_("ディオ・ブランドーは指一本で攻撃を弾き返した!", "The attack bounces!"));
6519 msg_print(_("攻撃は跳ね返った!", "The attack bounces!"));
6521 if (is_original_ap_and_seen(m_ptr)) ref_ptr->r_flags2 |= RF2_REFLECTING;
6523 /* Reflected bolts randomly target either one */
6524 if (player_bold(y, x) || one_in_(2)) flg &= ~(PROJECT_PLAYER);
6525 else flg |= PROJECT_PLAYER;
6527 /* The bolt is reflected */
6528 project(grid_array[y][x].m_idx, 0, t_y, t_x, dam, typ, flg, monspell);
6530 /* Don't affect the monster any longer */
6536 /* Find the closest point in the blast */
6539 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6543 effective_dist = dist;
6547 /* There is the riding player on this monster */
6548 if (p_ptr->riding && player_bold(y, x))
6550 /* Aimed on the player */
6551 if (flg & PROJECT_PLAYER)
6553 if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6556 * A beam or bolt is well aimed
6558 * So don't affects the mount.
6565 * The spell is not well aimed,
6566 * So partly affect the mount too.
6573 * This grid is the original target.
6574 * Or aimed on your horse.
6576 else if (((y == y2) && (x == x2)) || (flg & PROJECT_AIMED))
6578 /* Hit the mount with full damage */
6582 * Otherwise this grid is not the
6583 * original target, it means that line
6584 * of fire is obstructed by this
6588 * A beam or bolt will hit either
6589 * player or mount. Choose randomly.
6591 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE))
6595 /* Hit the mount with full damage */
6599 /* Hit the player later */
6600 flg |= PROJECT_PLAYER;
6602 /* Don't affect the mount */
6608 * The spell is not well aimed, so
6609 * partly affect both player and
6618 /* Affect the monster in the grid */
6619 if (project_m(who, effective_dist, y, x, dam, typ, flg, see_s_msg)) notice = TRUE;
6623 /* Player affected one monster (without "jumping") */
6624 if (!who && (project_m_n == 1) && !jump)
6629 /* Track if possible */
6630 if (grid_array[y][x].m_idx > 0)
6632 monster_type *m_ptr = &m_list[grid_array[y][x].m_idx];
6636 /* Hack -- auto-recall */
6637 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
6639 /* Hack - auto-track */
6640 if (m_ptr->ml) health_track(grid_array[y][x].m_idx);
6648 if (flg & (PROJECT_KILL))
6650 /* Start with "dist" of zero */
6653 /* Scan for player */
6654 for (i = 0; i < grids; i++)
6658 /* Hack -- Notice new "dist" values */
6659 if (gm[dist+1] == i) dist++;
6661 /* Get the grid location */
6665 /* Affect the player? */
6666 if (!player_bold(y, x)) continue;
6668 /* Find the closest point in the blast */
6671 effective_dist = dist_to_line(y, x, y1, x1, by, bx);
6675 effective_dist = dist;
6678 /* Target may be your horse */
6681 /* Aimed on the player */
6682 if (flg & PROJECT_PLAYER)
6684 /* Hit the player with full damage */
6688 * Hack -- When this grid was not the
6689 * original target, a beam or bolt
6690 * would hit either player or mount,
6691 * and should be choosen randomly.
6693 * But already choosen to hit the
6694 * mount at this point.
6696 * Or aimed on your horse.
6698 else if (flg & (PROJECT_BEAM | PROJECT_REFLECTABLE | PROJECT_AIMED))
6701 * A beam or bolt is well aimed
6703 * So don't affects the player.
6710 * The spell is not well aimed,
6711 * So partly affect the player too.
6717 /* Affect the player */
6718 if (project_p(who, who_name, effective_dist, y, x, dam, typ, flg, monspell)) notice = TRUE;
6724 GAME_TEXT m_name[MAX_NLEN];
6726 monster_desc(m_name, &m_list[p_ptr->riding], 0);
6728 if (rakubadam_m > 0)
6730 if (rakuba(rakubadam_m, FALSE))
6732 msg_format(_("%^sに振り落とされた!", "%^s has thrown you off!"), m_name);
6735 if (p_ptr->riding && rakubadam_p > 0)
6737 if(rakuba(rakubadam_p, FALSE))
6739 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_name);
6744 /* Return "something was noticed" */
6749 * @brief 鏡魔法「封魔結界」の効果処理
6751 * @return 効果があったらTRUEを返す
6753 bool binding_field(HIT_POINT dam)
6755 POSITION mirror_x[10], mirror_y[10]; /* 鏡はもっと少ない */
6756 int mirror_num = 0; /* 鏡の数 */
6758 POSITION centersign;
6759 POSITION x1, x2, y1, y2;
6761 int msec = delay_factor*delay_factor*delay_factor;
6764 POSITION point_x[3];
6765 POSITION point_y[3];
6767 /* Default target of monsterspell is player */
6768 monster_target_y = p_ptr->y;
6769 monster_target_x = p_ptr->x;
6771 for (x = 0; x < cur_wid; x++)
6773 for (y = 0; y < cur_hgt; y++)
6775 if (is_mirror_grid(&grid_array[y][x]) &&
6776 distance(p_ptr->y, p_ptr->x, y, x) <= MAX_RANGE &&
6777 distance(p_ptr->y, p_ptr->x, y, x) != 0 &&
6778 player_has_los_bold(y, x) &&
6779 projectable(p_ptr->y, p_ptr->x, y, x)
6781 mirror_y[mirror_num] = y;
6782 mirror_x[mirror_num] = x;
6788 if (mirror_num < 2)return FALSE;
6790 point_x[0] = randint0(mirror_num);
6792 point_x[1] = randint0(mirror_num);
6793 } while (point_x[0] == point_x[1]);
6795 point_y[0] = mirror_y[point_x[0]];
6796 point_x[0] = mirror_x[point_x[0]];
6797 point_y[1] = mirror_y[point_x[1]];
6798 point_x[1] = mirror_x[point_x[1]];
6799 point_y[2] = p_ptr->y;
6800 point_x[2] = p_ptr->x;
6802 x = point_x[0] + point_x[1] + point_x[2];
6803 y = point_y[0] + point_y[1] + point_y[2];
6805 centersign = (point_x[0] * 3 - x)*(point_y[1] * 3 - y)
6806 - (point_y[0] * 3 - y)*(point_x[1] * 3 - x);
6807 if (centersign == 0)return FALSE;
6809 x1 = point_x[0] < point_x[1] ? point_x[0] : point_x[1];
6810 x1 = x1 < point_x[2] ? x1 : point_x[2];
6811 y1 = point_y[0] < point_y[1] ? point_y[0] : point_y[1];
6812 y1 = y1 < point_y[2] ? y1 : point_y[2];
6814 x2 = point_x[0] > point_x[1] ? point_x[0] : point_x[1];
6815 x2 = x2 > point_x[2] ? x2 : point_x[2];
6816 y2 = point_y[0] > point_y[1] ? point_y[0] : point_y[1];
6817 y2 = y2 > point_y[2] ? y2 : point_y[2];
6819 for (y = y1; y <= y2; y++) {
6820 for (x = x1; x <= x2; x++) {
6821 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6822 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6823 centersign*((point_x[1] - x)*(point_y[2] - y)
6824 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6825 centersign*((point_x[2] - x)*(point_y[0] - y)
6826 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6828 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6829 /* Visual effects */
6831 && panel_contains(y, x)) {
6832 p = bolt_pict(y, x, y, x, GF_MANA);
6833 print_rel(PICT_C(p), PICT_A(p), y, x);
6834 move_cursor_relative(y, x);
6835 /*if (fresh_before)*/ Term_fresh();
6836 Term_xtra(TERM_XTRA_DELAY, msec);
6842 for (y = y1; y <= y2; y++) {
6843 for (x = x1; x <= x2; x++) {
6844 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6845 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6846 centersign*((point_x[1] - x)*(point_y[2] - y)
6847 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6848 centersign*((point_x[2] - x)*(point_y[0] - y)
6849 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6851 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6852 (void)project_f(0, 0, y, x, dam, GF_MANA);
6857 for (y = y1; y <= y2; y++) {
6858 for (x = x1; x <= x2; x++) {
6859 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6860 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6861 centersign*((point_x[1] - x)*(point_y[2] - y)
6862 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6863 centersign*((point_x[2] - x)*(point_y[0] - y)
6864 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6866 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6867 (void)project_o(0, 0, y, x, dam, GF_MANA);
6872 for (y = y1; y <= y2; y++) {
6873 for (x = x1; x <= x2; x++) {
6874 if (centersign*((point_x[0] - x)*(point_y[1] - y)
6875 - (point_y[0] - y)*(point_x[1] - x)) >= 0 &&
6876 centersign*((point_x[1] - x)*(point_y[2] - y)
6877 - (point_y[1] - y)*(point_x[2] - x)) >= 0 &&
6878 centersign*((point_x[2] - x)*(point_y[0] - y)
6879 - (point_y[2] - y)*(point_x[0] - x)) >= 0)
6881 if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
6882 (void)project_m(0, 0, y, x, dam, GF_MANA,
6883 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE);
6889 msg_print(_("鏡が結界に耐えきれず、壊れてしまった。", "The field broke a mirror"));
6890 remove_mirror(point_y[0], point_x[0]);
6897 * @brief 鏡魔法「鏡の封印」の効果処理
6899 * @return 効果があったらTRUEを返す
6901 void seal_of_mirror(HIT_POINT dam)
6905 for (x = 0; x < cur_wid; x++)
6907 for (y = 0; y < cur_hgt; y++)
6909 if (is_mirror_grid(&grid_array[y][x]))
6911 if (project_m(0, 0, y, x, dam, GF_GENOCIDE,
6912 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP), TRUE))
6914 if (!grid_array[y][x].m_idx)
6916 remove_mirror(y, x);
6928 * @brief 領域魔法に応じて技能の名称を返す。
6929 * @param tval 魔法書のtval
6930 * @return 領域魔法の技能名称を保管した文字列ポインタ
6932 concptr spell_category_name(OBJECT_TYPE_VALUE tval)
6936 case TV_HISSATSU_BOOK:
6937 return _("必殺技", "art");
6939 return _("祈り", "prayer");
6941 return _("歌", "song");
6943 return _("呪文", "spell");