3 * @brief 魔法効果の実装/ Spell code (part 2)
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 "monster-hook.h"
21 * @brief プレイヤー周辺の地形を感知する
24 * @param known 地形から危険フラグを外すならTRUE
25 * @return 効力があった場合TRUEを返す
27 static bool detect_feat_flag(POSITION range, int flag, bool known)
33 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
35 /* Scan the current panel */
36 for (y = 1; y < cur_hgt - 1; y++)
38 for (x = 1; x <= cur_wid - 1; x++)
40 int dist = distance(p_ptr->y, p_ptr->x, y, x);
41 if (dist > range) continue;
47 /* Mark as detected */
48 if (dist <= range && known)
50 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
52 c_ptr->info &= ~(CAVE_UNSAFE);
59 if (cave_have_flag_grid(c_ptr, flag))
64 /* Hack -- Memorize */
65 c_ptr->info |= (CAVE_MARK);
78 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
80 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
81 * @return 効力があった場合TRUEを返す
83 bool detect_traps(POSITION range, bool known)
85 bool detect = detect_feat_flag(range, FF_TRAP, known);
87 if (known) p_ptr->dtrap = TRUE;
89 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
92 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
99 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
101 * @return 効力があった場合TRUEを返す
103 bool detect_doors(POSITION range)
105 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
107 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
110 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
117 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
119 * @return 効力があった場合TRUEを返す
121 bool detect_stairs(POSITION range)
123 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
125 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
128 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
135 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
137 * @return 効力があった場合TRUEを返す
139 bool detect_treasure(POSITION range)
141 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
143 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
146 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
153 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
155 * @return 効力があった場合TRUEを返す
157 bool detect_objects_gold(POSITION range)
161 POSITION range2 = range;
165 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
168 for (i = 1; i < o_max; i++)
170 object_type *o_ptr = &o_list[i];
172 /* Skip dead objects */
173 if (!o_ptr->k_idx) continue;
175 /* Skip held objects */
176 if (o_ptr->held_m_idx) continue;
181 /* Only detect nearby objects */
182 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
184 /* Detect "gold" objects */
185 if (o_ptr->tval == TV_GOLD)
187 o_ptr->marked |= OM_FOUND;
193 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
196 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
199 if (detect_monsters_string(range, "$"))
208 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
210 * @return 効力があった場合TRUEを返す
212 bool detect_objects_normal(POSITION range)
216 POSITION range2 = range;
220 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
223 for (i = 1; i < o_max; i++)
225 object_type *o_ptr = &o_list[i];
227 /* Skip dead objects */
228 if (!o_ptr->k_idx) continue;
230 /* Skip held objects */
231 if (o_ptr->held_m_idx) continue;
236 /* Only detect nearby objects */
237 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
239 /* Detect "real" objects */
240 if (o_ptr->tval != TV_GOLD)
242 o_ptr->marked |= OM_FOUND;
248 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
251 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
254 if (detect_monsters_string(range, "!=?|/`"))
263 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
265 * @return 効力があった場合TRUEを返す
268 * This will light up all spaces with "magic" items, including artifacts,
269 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
270 * and "enchanted" items of the "good" variety.
272 * It can probably be argued that this function is now too powerful.
275 bool detect_objects_magic(POSITION range)
277 OBJECT_TYPE_VALUE tv;
283 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
285 /* Scan all objects */
286 for (i = 1; i < o_max; i++)
288 object_type *o_ptr = &o_list[i];
290 /* Skip dead objects */
291 if (!o_ptr->k_idx) continue;
293 /* Skip held objects */
294 if (o_ptr->held_m_idx) continue;
299 /* Only detect nearby objects */
300 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
302 /* Examine the tval */
305 /* Artifacts, misc magic items, or enchanted wearables */
306 if (object_is_artifact(o_ptr) ||
307 object_is_ego(o_ptr) ||
308 (tv == TV_WHISTLE) ||
316 (tv == TV_LIFE_BOOK) ||
317 (tv == TV_SORCERY_BOOK) ||
318 (tv == TV_NATURE_BOOK) ||
319 (tv == TV_CHAOS_BOOK) ||
320 (tv == TV_DEATH_BOOK) ||
321 (tv == TV_TRUMP_BOOK) ||
322 (tv == TV_ARCANE_BOOK) ||
323 (tv == TV_CRAFT_BOOK) ||
324 (tv == TV_DAEMON_BOOK) ||
325 (tv == TV_CRUSADE_BOOK) ||
326 (tv == TV_MUSIC_BOOK) ||
327 (tv == TV_HISSATSU_BOOK) ||
328 (tv == TV_HEX_BOOK) ||
329 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
331 /* Memorize the item */
332 o_ptr->marked |= OM_FOUND;
339 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
348 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
350 * @return 効力があった場合TRUEを返す
352 bool detect_monsters_normal(POSITION range)
359 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
362 for (i = 1; i < m_max; i++)
364 monster_type *m_ptr = &m_list[i];
365 monster_race *r_ptr = &r_info[m_ptr->r_idx];
367 /* Skip dead monsters */
368 if (!m_ptr->r_idx) continue;
373 /* Only detect nearby monsters */
374 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
376 /* Detect all non-invisible monsters */
377 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
379 /* Repair visibility later */
380 repair_monsters = TRUE;
382 /* Hack -- Detect monster */
383 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
384 update_monster(i, FALSE);
389 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
392 /* Describe result */
393 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
400 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
402 * @return 効力があった場合TRUEを返す
404 bool detect_monsters_invis(POSITION range)
410 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
413 for (i = 1; i < m_max; i++)
415 monster_type *m_ptr = &m_list[i];
416 monster_race *r_ptr = &r_info[m_ptr->r_idx];
418 /* Skip dead monsters */
419 if (!m_ptr->r_idx) continue;
424 /* Only detect nearby monsters */
425 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
427 /* Detect invisible monsters */
428 if (r_ptr->flags2 & RF2_INVISIBLE)
430 /* Update monster recall window */
431 if (p_ptr->monster_race_idx == m_ptr->r_idx)
433 p_ptr->window |= (PW_MONSTER);
436 /* Repair visibility later */
437 repair_monsters = TRUE;
439 /* Hack -- Detect monster */
440 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
441 update_monster(i, FALSE);
446 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
449 /* Describe result */
450 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
456 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
458 * @return 効力があった場合TRUEを返す
460 bool detect_monsters_evil(POSITION range)
466 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
469 for (i = 1; i < m_max; i++)
471 monster_type *m_ptr = &m_list[i];
472 monster_race *r_ptr = &r_info[m_ptr->r_idx];
474 /* Skip dead monsters */
475 if (!m_ptr->r_idx) continue;
480 /* Only detect nearby monsters */
481 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
483 /* Detect evil monsters */
484 if (r_ptr->flags3 & RF3_EVIL)
486 if (is_original_ap(m_ptr))
488 /* Take note that they are evil */
489 r_ptr->r_flags3 |= (RF3_EVIL);
491 /* Update monster recall window */
492 if (p_ptr->monster_race_idx == m_ptr->r_idx)
494 p_ptr->window |= (PW_MONSTER);
498 /* Repair visibility later */
499 repair_monsters = TRUE;
501 /* Hack -- Detect monster */
502 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
503 update_monster(i, FALSE);
509 /* Describe result */
510 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
516 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
518 * @return 効力があった場合TRUEを返す
520 bool detect_monsters_nonliving(POSITION range)
526 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
529 for (i = 1; i < m_max; i++)
531 monster_type *m_ptr = &m_list[i];
532 monster_race *r_ptr = &r_info[m_ptr->r_idx];
534 /* Skip dead monsters */
535 if (!m_ptr->r_idx) continue;
540 /* Only detect nearby monsters */
541 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
543 /* Detect non-living monsters */
544 if (!monster_living(r_ptr))
546 /* Update monster recall window */
547 if (p_ptr->monster_race_idx == m_ptr->r_idx)
549 p_ptr->window |= (PW_MONSTER);
552 /* Repair visibility later */
553 repair_monsters = TRUE;
555 /* Hack -- Detect monster */
556 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
557 update_monster(i, FALSE);
563 /* Describe result */
564 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
570 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
572 * @return 効力があった場合TRUEを返す
574 bool detect_monsters_mind(POSITION range)
580 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
583 for (i = 1; i < m_max; i++)
585 monster_type *m_ptr = &m_list[i];
586 monster_race *r_ptr = &r_info[m_ptr->r_idx];
588 /* Skip dead monsters */
589 if (!m_ptr->r_idx) continue;
594 /* Only detect nearby monsters */
595 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
597 /* Detect non-living monsters */
598 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
600 /* Update monster recall window */
601 if (p_ptr->monster_race_idx == m_ptr->r_idx)
603 p_ptr->window |= (PW_MONSTER);
606 /* Repair visibility later */
607 repair_monsters = TRUE;
609 /* Hack -- Detect monster */
610 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
611 update_monster(i, FALSE);
617 /* Describe result */
618 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
625 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
627 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
628 * @return 効力があった場合TRUEを返す
630 bool detect_monsters_string(POSITION range, cptr Match)
636 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
639 for (i = 1; i < m_max; i++)
641 monster_type *m_ptr = &m_list[i];
642 monster_race *r_ptr = &r_info[m_ptr->r_idx];
644 /* Skip dead monsters */
645 if (!m_ptr->r_idx) continue;
650 /* Only detect nearby monsters */
651 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
653 /* Detect monsters with the same symbol */
654 if (my_strchr(Match, r_ptr->d_char))
656 /* Update monster recall window */
657 if (p_ptr->monster_race_idx == m_ptr->r_idx)
659 p_ptr->window |= (PW_MONSTER);
662 /* Repair visibility later */
663 repair_monsters = TRUE;
665 /* Hack -- Detect monster */
666 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
667 update_monster(i, FALSE);
672 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
675 /* Describe result */
676 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
682 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
684 * @param match_flag 感知フラグ
685 * @return 効力があった場合TRUEを返す
687 bool detect_monsters_xxx(POSITION range, u32b match_flag)
692 cptr desc_monsters = _("変なモンスター", "weird monsters");
694 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
697 for (i = 1; i < m_max; i++)
699 monster_type *m_ptr = &m_list[i];
700 monster_race *r_ptr = &r_info[m_ptr->r_idx];
702 /* Skip dead monsters */
703 if (!m_ptr->r_idx) continue;
708 /* Only detect nearby monsters */
709 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
711 /* Detect evil monsters */
712 if (r_ptr->flags3 & (match_flag))
714 if (is_original_ap(m_ptr))
716 /* Take note that they are something */
717 r_ptr->r_flags3 |= (match_flag);
719 /* Update monster recall window */
720 if (p_ptr->monster_race_idx == m_ptr->r_idx)
722 p_ptr->window |= (PW_MONSTER);
726 /* Repair visibility later */
727 repair_monsters = TRUE;
729 /* Hack -- Detect monster */
730 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
731 update_monster(i, FALSE);
740 desc_monsters = _("デーモン", "demons");
743 desc_monsters = _("アンデッド", "the undead");
747 /* Describe result */
748 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
756 * @brief 全感知処理 / Detect everything
758 * @return 効力があった場合TRUEを返す
760 bool detect_all(POSITION range)
764 /* Detect everything */
765 if (detect_traps(range, TRUE)) detect = TRUE;
766 if (detect_doors(range)) detect = TRUE;
767 if (detect_stairs(range)) detect = TRUE;
769 /* There are too many hidden treasure. So... */
770 /* if (detect_treasure(range)) detect = TRUE; */
772 if (detect_objects_gold(range)) detect = TRUE;
773 if (detect_objects_normal(range)) detect = TRUE;
774 if (detect_monsters_invis(range)) detect = TRUE;
775 if (detect_monsters_normal(range)) detect = TRUE;
781 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
784 * @return 効力があった場合TRUEを返す
787 * Note that affected monsters are NOT auto-tracked by this usage.
789 * To avoid misbehavior when monster deaths have side-effects,
790 * this is done in two passes. -- JDL
793 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
797 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
798 bool obvious = FALSE;
801 /* Mark all (nearby) monsters */
802 for (i = 1; i < m_max; i++)
804 monster_type *m_ptr = &m_list[i];
806 /* Paranoia -- Skip dead monsters */
807 if (!m_ptr->r_idx) continue;
812 /* Require line of sight */
813 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
815 /* Mark the monster */
816 m_ptr->mflag |= (MFLAG_TEMP);
819 /* Affect all marked monsters */
820 for (i = 1; i < m_max; i++)
822 monster_type *m_ptr = &m_list[i];
824 /* Skip unmarked monsters */
825 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
828 m_ptr->mflag &= ~(MFLAG_TEMP);
833 /* Jump directly to the target monster */
834 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
841 * @brief 視界内モンスターを加速する処理 / Speed monsters
842 * @return 効力があった場合TRUEを返す
844 bool speed_monsters(void)
846 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
850 * @brief 視界内モンスターを加速する処理 / Slow monsters
851 * @return 効力があった場合TRUEを返す
853 bool slow_monsters(int power)
855 return (project_hack(GF_OLD_SLOW, power));
859 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
860 * @return 効力があった場合TRUEを返す
862 bool sleep_monsters(int power)
864 return (project_hack(GF_OLD_SLEEP, power));
868 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
869 * @return 効力があった場合TRUEを返す
871 bool banish_evil(int dist)
873 return (project_hack(GF_AWAY_EVIL, dist));
877 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
878 * @return 効力があった場合TRUEを返す
880 bool turn_undead(void)
882 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
884 chg_virtue(V_UNLIFE, -1);
889 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
890 * @return 効力があった場合TRUEを返す
892 bool dispel_undead(HIT_POINT dam)
894 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
896 chg_virtue(V_UNLIFE, -2);
901 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
902 * @return 効力があった場合TRUEを返す
904 bool dispel_evil(HIT_POINT dam)
906 return (project_hack(GF_DISP_EVIL, dam));
910 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
911 * @return 効力があった場合TRUEを返す
913 bool dispel_good(HIT_POINT dam)
915 return (project_hack(GF_DISP_GOOD, dam));
919 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
920 * @return 効力があった場合TRUEを返す
922 bool dispel_monsters(HIT_POINT dam)
924 return (project_hack(GF_DISP_ALL, dam));
928 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
929 * @return 効力があった場合TRUEを返す
931 bool dispel_living(HIT_POINT dam)
933 return (project_hack(GF_DISP_LIVING, dam));
937 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
938 * @return 効力があった場合TRUEを返す
940 bool dispel_demons(HIT_POINT dam)
942 return (project_hack(GF_DISP_DEMON, dam));
946 * @brief 視界内のモンスターに「聖戦」効果を与える処理
947 * @return 効力があった場合TRUEを返す
951 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
955 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
956 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
959 void aggravate_monsters(MONSTER_IDX who)
965 /* Aggravate everyone nearby */
966 for (i = 1; i < m_max; i++)
968 monster_type *m_ptr = &m_list[i];
970 /* Paranoia -- Skip dead monsters */
971 if (!m_ptr->r_idx) continue;
973 /* Skip aggravating monster (or player) */
974 if (i == who) continue;
976 /* Wake up nearby sleeping monsters */
977 if (m_ptr->cdis < MAX_SIGHT * 2)
980 if (MON_CSLEEP(m_ptr))
982 (void)set_monster_csleep(i, 0);
985 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
988 /* Speed up monsters in line of sight */
989 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
993 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
999 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1000 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1001 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1006 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1007 * @param m_idx 抹殺するモンスターID
1008 * @param power 抹殺の威力
1009 * @param player_cast プレイヤーの魔法によるものならば TRUE
1010 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1011 * @param spell_name 抹殺効果を起こした魔法の名前
1012 * @return 効力があった場合TRUEを返す
1014 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1016 int msec = delay_factor * delay_factor * delay_factor;
1017 monster_type *m_ptr = &m_list[m_idx];
1018 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1019 bool resist = FALSE;
1021 if (is_pet(m_ptr) && !player_cast) return FALSE;
1023 /* Hack -- Skip Unique Monsters or Quest Monsters */
1024 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1025 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1026 else if (m_idx == p_ptr->riding) resist = TRUE;
1027 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1028 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1029 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1034 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1038 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1039 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1042 delete_monster_idx(m_idx);
1045 if (resist && player_cast)
1047 bool see_m = is_seen(m_ptr);
1050 monster_desc(m_name, m_ptr, 0);
1053 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1055 if (MON_CSLEEP(m_ptr))
1057 (void)set_monster_csleep(m_idx, 0);
1060 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1063 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1067 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1071 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1076 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1079 /* Visual feedback */
1080 move_cursor_relative(p_ptr->y, p_ptr->x);
1082 p_ptr->redraw |= (PR_HP);
1083 p_ptr->window |= (PW_PLAYER);
1089 Term_xtra(TERM_XTRA_DELAY, msec);
1096 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1097 * @param power 抹殺の威力
1098 * @param player_cast プレイヤーの魔法によるものならば TRUE
1099 * @return 効力があった場合TRUEを返す
1101 bool symbol_genocide(int power, bool player_cast)
1105 bool result = FALSE;
1107 /* Prevent genocide in quest levels */
1108 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1113 /* Mega-Hack -- Get a monster symbol */
1114 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1116 /* Delete the monsters of that "type" */
1117 for (i = 1; i < m_max; i++)
1119 monster_type *m_ptr = &m_list[i];
1120 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1122 /* Paranoia -- Skip dead monsters */
1123 if (!m_ptr->r_idx) continue;
1125 /* Skip "wrong" monsters */
1126 if (r_ptr->d_char != typ) continue;
1129 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1134 chg_virtue(V_VITALITY, -2);
1135 chg_virtue(V_CHANCE, -1);
1143 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1144 * @param power 抹殺の威力
1145 * @param player_cast プレイヤーの魔法によるものならば TRUE
1146 * @return 効力があった場合TRUEを返す
1148 bool mass_genocide(int power, bool player_cast)
1151 bool result = FALSE;
1153 /* Prevent mass genocide in quest levels */
1154 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1159 /* Delete the (nearby) monsters */
1160 for (i = 1; i < m_max; i++)
1162 monster_type *m_ptr = &m_list[i];
1164 /* Paranoia -- Skip dead monsters */
1165 if (!m_ptr->r_idx) continue;
1167 /* Skip distant monsters */
1168 if (m_ptr->cdis > MAX_SIGHT) continue;
1171 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1176 chg_virtue(V_VITALITY, -2);
1177 chg_virtue(V_CHANCE, -1);
1185 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1186 * @param power 抹殺の威力
1187 * @param player_cast プレイヤーの魔法によるものならば TRUE
1188 * @return 効力があった場合TRUEを返す
1190 bool mass_genocide_undead(int power, bool player_cast)
1193 bool result = FALSE;
1195 /* Prevent mass genocide in quest levels */
1196 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1201 /* Delete the (nearby) monsters */
1202 for (i = 1; i < m_max; i++)
1204 monster_type *m_ptr = &m_list[i];
1205 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1207 /* Paranoia -- Skip dead monsters */
1208 if (!m_ptr->r_idx) continue;
1210 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1212 /* Skip distant monsters */
1213 if (m_ptr->cdis > MAX_SIGHT) continue;
1216 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1221 chg_virtue(V_UNLIFE, -2);
1222 chg_virtue(V_CHANCE, -1);
1230 * @brief 周辺モンスターを調査する / Probe nearby monsters
1231 * @return 効力があった場合TRUEを返す
1247 /* Probe all (nearby) monsters */
1248 for (i = 1; i < m_max; i++)
1250 monster_type *m_ptr = &m_list[i];
1251 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1253 /* Paranoia -- Skip dead monsters */
1254 if (!m_ptr->r_idx) continue;
1256 /* Require line of sight */
1257 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1259 /* Probe visible monsters */
1264 /* Start the message */
1267 msg_print(_("調査中...", "Probing..."));
1272 if (!is_original_ap(m_ptr))
1274 if (m_ptr->mflag2 & MFLAG2_KAGE)
1275 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1277 m_ptr->ap_r_idx = m_ptr->r_idx;
1278 lite_spot(m_ptr->fy, m_ptr->fx);
1280 /* Get "the monster" or "something" */
1281 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1283 speed = m_ptr->mspeed - 110;
1284 if (MON_FAST(m_ptr)) speed += 10;
1285 if (MON_SLOW(m_ptr)) speed -= 10;
1286 if (ironman_nightmare) speed += 5;
1288 /* Get the monster's alignment */
1289 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1290 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1291 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1292 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1293 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1294 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1295 else align = _("中立", "neutral");
1297 /* Describe the monster */
1298 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1299 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1301 if (r_ptr->next_r_idx)
1303 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1307 strcat(buf, "xxx ");
1310 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1311 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1312 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1313 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1314 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1315 buf[strlen(buf)-1] = '\0';
1318 /* HACK : Add the line to message buffer */
1320 p_ptr->window |= (PW_MESSAGE);
1323 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1326 Term_erase(0, 0, 255);
1328 /* Learn everything about this monster */
1329 if (lore_do_probe(m_ptr->r_idx))
1331 /* Get base name of monster */
1332 strcpy(buf, (r_name + r_ptr->name));
1335 /* Note that we learnt some new flags -Mogami- */
1336 msg_format("%sについてさらに詳しくなった気がする。", buf);
1341 /* Note that we learnt some new flags -Mogami- */
1342 msg_format("You now know more about %s.", buf);
1344 /* Clear -more- prompt */
1359 chg_virtue(V_KNOWLEDGE, 1);
1360 msg_print(_("これで全部です。", "That's all."));
1368 * @brief *破壊*処理を行う / The spell of destruction
1369 * @param y1 破壊の中心Y座標
1370 * @param x1 破壊の中心X座標
1372 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1373 * @return 効力があった場合TRUEを返す
1376 * This spell "deletes" monsters (instead of "killing" them).
1378 * Later we may use one function for both "destruction" and
1379 * "earthquake" by using the "full" to select "destruction".
1382 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1389 /* Prevent destruction of quest levels and town */
1390 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1395 /* Lose monster light */
1396 if (!in_generate) clear_mon_lite();
1398 /* Big area of affect */
1399 for (y = (y1 - r); y <= (y1 + r); y++)
1401 for (x = (x1 - r); x <= (x1 + r); x++)
1403 /* Skip illegal grids */
1404 if (!in_bounds(y, x)) continue;
1406 /* Extract the distance */
1407 k = distance(y1, x1, y, x);
1409 /* Stay in the circle of death */
1410 if (k > r) continue;
1411 c_ptr = &cave[y][x];
1413 /* Lose room and vault */
1414 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1416 /* Lose light and knowledge */
1417 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1419 if (!in_generate) /* Normal */
1422 c_ptr->info &= ~(CAVE_UNSAFE);
1424 /* Hack -- Notice player affect */
1425 if (player_bold(y, x))
1427 /* Hurt the player later */
1430 /* Do not hurt this grid */
1435 /* Hack -- Skip the epicenter */
1436 if ((y == y1) && (x == x1)) continue;
1440 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1441 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1443 if (in_generate) /* In generation */
1445 /* Delete the monster (if any) */
1446 delete_monster(y, x);
1448 else if (r_ptr->flags1 & RF1_QUESTOR)
1450 /* Heal the monster */
1451 m_ptr->hp = m_ptr->maxhp;
1453 /* Try to teleport away quest monsters */
1454 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1458 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1462 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1463 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1466 /* Delete the monster (if any) */
1467 delete_monster(y, x);
1471 /* During generation, destroyed artifacts are "preserved" */
1472 if (preserve_mode || in_generate)
1474 OBJECT_IDX this_o_idx, next_o_idx = 0;
1476 /* Scan all objects in the grid */
1477 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1480 o_ptr = &o_list[this_o_idx];
1482 /* Acquire next object */
1483 next_o_idx = o_ptr->next_o_idx;
1485 /* Hack -- Preserve unknown artifacts */
1486 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1488 /* Mega-Hack -- Preserve the artifact */
1489 a_info[o_ptr->name1].cur_num = 0;
1491 if (in_generate && cheat_peek)
1493 char o_name[MAX_NLEN];
1494 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1495 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1498 else if (in_generate && cheat_peek && o_ptr->art_name)
1500 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1501 "One of the random artifacts was *destroyed* during generation."));
1506 /* Delete objects */
1507 delete_object(y, x);
1509 /* Destroy "non-permanent" grids */
1510 if (!cave_perma_grid(c_ptr))
1512 /* Wall (or floor) type */
1515 if (!in_generate) /* Normal */
1519 /* Create granite wall */
1520 cave_set_feat(y, x, feat_granite);
1524 /* Create quartz vein */
1525 cave_set_feat(y, x, feat_quartz_vein);
1529 /* Create magma vein */
1530 cave_set_feat(y, x, feat_magma_vein);
1535 cave_set_feat(y, x, floor_type[randint0(100)]);
1538 else /* In generation */
1542 /* Create granite wall */
1543 place_extra_grid(c_ptr);
1547 /* Create quartz vein */
1548 c_ptr->feat = feat_quartz_vein;
1552 /* Create magma vein */
1553 c_ptr->feat = feat_magma_vein;
1558 place_floor_grid(c_ptr);
1561 /* Clear garbage of hidden trap or door */
1570 /* Process "re-glowing" */
1571 for (y = (y1 - r); y <= (y1 + r); y++)
1573 for (x = (x1 - r); x <= (x1 + r); x++)
1575 /* Skip illegal grids */
1576 if (!in_bounds(y, x)) continue;
1578 /* Extract the distance */
1579 k = distance(y1, x1, y, x);
1581 /* Stay in the circle of death */
1582 if (k > r) continue;
1583 c_ptr = &cave[y][x];
1585 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1586 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1591 for (i = 0; i < 9; i++)
1593 yy = y + ddy_ddd[i];
1594 xx = x + ddx_ddd[i];
1595 if (!in_bounds2(yy, xx)) continue;
1596 cc_ptr = &cave[yy][xx];
1597 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1599 c_ptr->info |= CAVE_GLOW;
1607 /* Hack -- Affect player */
1610 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1612 /* Blind the player */
1613 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1616 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1622 /* Mega-Hack -- Forget the view and lite */
1623 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1625 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1627 p_ptr->redraw |= (PR_MAP);
1629 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1631 if (p_ptr->special_defense & NINJA_S_STEALTH)
1633 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1643 * @brief 地震処理(サブルーチン) /
1644 * Induce an "earthquake" of the given radius at the given location.
1645 * @return 効力があった場合TRUEを返す
1649 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1653 * This will turn some walls into floors and some floors into walls.
1655 * The player will take damage and "jump" into a safe grid if possible,
1656 * otherwise, he will "tunnel" through the rubble instantaneously.
1658 * Monsters will take damage, and "jump" into a safe grid if possible,
1659 * otherwise they will be "buried" in the rubble, disappearing from
1660 * the level in the same way that they do when genocided.
1662 * Note that thus the player and monsters (except eaters of walls and
1663 * passers through walls) will never occupy the same grid as a wall.
1664 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1665 * for a single turn, unless that monster can pass_walls or kill_walls.
1666 * This has allowed massive simplification of the "monster" code.
1669 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1673 POSITION y, x, yy, xx, dy, dx;
1676 POSITION sy = 0, sx = 0;
1682 /* Prevent destruction of quest levels and town */
1683 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1688 /* Paranoia -- Enforce maximum range */
1691 /* Clear the "maximal blast" area */
1692 for (y = 0; y < 32; y++)
1694 for (x = 0; x < 32; x++)
1700 /* Check around the epicenter */
1701 for (dy = -r; dy <= r; dy++)
1703 for (dx = -r; dx <= r; dx++)
1705 /* Extract the location */
1709 /* Skip illegal grids */
1710 if (!in_bounds(yy, xx)) continue;
1712 /* Skip distant grids */
1713 if (distance(cy, cx, yy, xx) > r) continue;
1714 c_ptr = &cave[yy][xx];
1716 /* Lose room and vault */
1717 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1719 /* Lose light and knowledge */
1720 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1722 /* Skip the epicenter */
1723 if (!dx && !dy) continue;
1725 /* Skip most grids */
1726 if (randint0(100) < 85) continue;
1728 /* Damage this grid */
1729 map[16+yy-cy][16+xx-cx] = TRUE;
1731 /* Hack -- Take note of player damage */
1732 if (player_bold(yy, xx)) hurt = TRUE;
1736 /* First, affect the player (if necessary) */
1737 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1739 /* Check around the player */
1740 for (i = 0; i < 8; i++)
1742 /* Access the location */
1743 y = p_ptr->y + ddy_ddd[i];
1744 x = p_ptr->x + ddx_ddd[i];
1746 /* Skip non-empty grids */
1747 if (!cave_empty_bold(y, x)) continue;
1749 /* Important -- Skip "quake" grids */
1750 if (map[16+y-cy][16+x-cx]) continue;
1752 if (cave[y][x].m_idx) continue;
1754 /* Count "safe" grids */
1757 /* Randomize choice */
1758 if (randint0(sn) > 0) continue;
1760 /* Save the safe location */
1764 /* Random message */
1765 switch (randint1(3))
1769 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1774 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1779 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1784 /* Hurt the player a lot */
1787 /* Message and damage */
1788 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1792 /* Destroy the grid, and push the player to safety */
1795 /* Calculate results */
1796 switch (randint1(3))
1800 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1806 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1807 damage = damroll(10, 4);
1808 (void)set_stun(p_ptr->stun + randint1(50));
1813 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1814 damage = damroll(10, 4);
1815 (void)set_stun(p_ptr->stun + randint1(50));
1820 /* Move the player to the safe location */
1821 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1824 /* Important -- no wall on player */
1825 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1834 monster_type *m_ptr = &m_list[m_idx];
1836 /* Get the monster's real name */
1837 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1839 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1843 killer = _("地震", "an earthquake");
1846 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1850 /* Examine the quaked region */
1851 for (dy = -r; dy <= r; dy++)
1853 for (dx = -r; dx <= r; dx++)
1855 /* Extract the location */
1859 /* Skip unaffected grids */
1860 if (!map[16+yy-cy][16+xx-cx]) continue;
1861 c_ptr = &cave[yy][xx];
1863 if (c_ptr->m_idx == p_ptr->riding) continue;
1865 /* Process monsters */
1868 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1869 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1871 /* Quest monsters */
1872 if (r_ptr->flags1 & RF1_QUESTOR)
1874 /* No wall on quest monsters */
1875 map[16+yy-cy][16+xx-cx] = FALSE;
1880 /* Most monsters cannot co-exist with rock */
1881 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1882 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1886 /* Assume not safe */
1889 /* Monster can move to escape the wall */
1890 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1892 /* Look for safety */
1893 for (i = 0; i < 8; i++)
1895 y = yy + ddy_ddd[i];
1896 x = xx + ddx_ddd[i];
1898 /* Skip non-empty grids */
1899 if (!cave_empty_bold(y, x)) continue;
1901 /* Hack -- no safety on glyph of warding */
1902 if (is_glyph_grid(&cave[y][x])) continue;
1903 if (is_explosive_rune_grid(&cave[y][x])) continue;
1905 /* ... nor on the Pattern */
1906 if (pattern_tile(y, x)) continue;
1908 /* Important -- Skip "quake" grids */
1909 if (map[16+y-cy][16+x-cx]) continue;
1911 if (cave[y][x].m_idx) continue;
1912 if (player_bold(y, x)) continue;
1914 /* Count "safe" grids */
1917 /* Randomize choice */
1918 if (randint0(sn) > 0) continue;
1920 /* Save the safe grid */
1925 /* Describe the monster */
1926 monster_desc(m_name, m_ptr, 0);
1928 /* Scream in pain */
1929 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1931 /* Take damage from the quake */
1932 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1934 /* Monster is certainly awake */
1935 (void)set_monster_csleep(c_ptr->m_idx, 0);
1937 /* Apply damage directly */
1938 m_ptr->hp -= damage;
1940 /* Delete (not kill) "dead" monsters */
1943 if (!ignore_unview || is_seen(m_ptr))
1944 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1948 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1952 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1953 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1958 delete_monster(yy, xx);
1960 /* No longer safe */
1964 /* Hack -- Escape from the rock */
1967 IDX m_idx_aux = cave[yy][xx].m_idx;
1969 /* Update the old location */
1970 cave[yy][xx].m_idx = 0;
1972 /* Update the new location */
1973 cave[sy][sx].m_idx = m_idx_aux;
1975 /* Move the monster */
1979 /* Update the monster (new location) */
1980 update_monster(m_idx, TRUE);
1982 /* Redraw the old grid */
1985 /* Redraw the new grid */
1993 /* Lose monster light */
1996 /* Examine the quaked region */
1997 for (dy = -r; dy <= r; dy++)
1999 for (dx = -r; dx <= r; dx++)
2001 /* Extract the location */
2005 /* Skip unaffected grids */
2006 if (!map[16+yy-cy][16+xx-cx]) continue;
2008 /* Access the cave grid */
2009 c_ptr = &cave[yy][xx];
2011 /* Paranoia -- never affect player */
2012 /* if (player_bold(yy, xx)) continue; */
2014 /* Destroy location (if valid) */
2015 if (cave_valid_bold(yy, xx))
2017 /* Delete objects */
2018 delete_object(yy, xx);
2020 /* Wall (or floor) type */
2021 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2026 /* Create granite wall */
2027 cave_set_feat(yy, xx, feat_granite);
2033 /* Create quartz vein */
2034 cave_set_feat(yy, xx, feat_quartz_vein);
2040 /* Create magma vein */
2041 cave_set_feat(yy, xx, feat_magma_vein);
2048 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2055 /* Process "re-glowing" */
2056 for (dy = -r; dy <= r; dy++)
2058 for (dx = -r; dx <= r; dx++)
2060 /* Extract the location */
2064 /* Skip illegal grids */
2065 if (!in_bounds(yy, xx)) continue;
2067 /* Skip distant grids */
2068 if (distance(cy, cx, yy, xx) > r) continue;
2069 c_ptr = &cave[yy][xx];
2071 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2072 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2077 for (ii = 0; ii < 9; ii++)
2079 yyy = yy + ddy_ddd[ii];
2080 xxx = xx + ddx_ddd[ii];
2081 if (!in_bounds2(yyy, xxx)) continue;
2082 cc_ptr = &cave[yyy][xxx];
2083 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2085 c_ptr->info |= CAVE_GLOW;
2094 /* Mega-Hack -- Forget the view and lite */
2095 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2097 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2099 /* Update the health bar */
2100 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2102 p_ptr->redraw |= (PR_MAP);
2104 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2106 if (p_ptr->special_defense & NINJA_S_STEALTH)
2108 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2116 * @brief 地震処理(プレイヤーの中心発動) /
2117 * Induce an "earthquake" of the given radius at the given location.
2118 * @return 効力があった場合TRUEを返す
2123 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2125 return earthquake_aux(cy, cx, r, 0);
2132 void discharge_minion(void)
2137 for (i = 1; i < m_max; i++)
2139 monster_type *m_ptr = &m_list[i];
2140 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2141 if (m_ptr->nickname) okay = FALSE;
2143 if (!okay || p_ptr->riding)
2145 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2148 for (i = 1; i < m_max; i++)
2151 monster_type *m_ptr = &m_list[i];
2152 monster_race *r_ptr;
2154 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2155 r_ptr = &r_info[m_ptr->r_idx];
2157 /* Uniques resist discharging */
2158 if (r_ptr->flags1 & RF1_UNIQUE)
2161 monster_desc(m_name, m_ptr, 0x00);
2162 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2163 delete_monster_idx(i);
2166 dam = m_ptr->maxhp / 2;
2167 if (dam > 100) dam = (dam-100)/2 + 100;
2168 if (dam > 400) dam = (dam-400)/2 + 400;
2169 if (dam > 800) dam = 800;
2170 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2171 m_ptr->fx, dam, GF_PLASMA,
2172 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2174 if (record_named_pet && m_ptr->nickname)
2178 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2179 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2182 delete_monster_idx(i);
2188 * @brief 部屋全体を照らすサブルーチン
2192 * This routine clears the entire "temp" set.
2193 * This routine will Perma-Lite all "temp" grids.
2194 * This routine is used (only) by "lite_room()"
2195 * Dark grids are illuminated.
2196 * Also, process all affected monsters.
2198 * SMART monsters always wake up when illuminated
2199 * NORMAL monsters wake up 1/4 the time when illuminated
2200 * STUPID monsters wake up 1/10 the time when illuminated
2203 static void cave_temp_room_lite(void)
2207 /* Clear them all */
2208 for (i = 0; i < temp_n; i++)
2210 POSITION y = temp_y[i];
2211 POSITION x = temp_x[i];
2213 cave_type *c_ptr = &cave[y][x];
2215 /* No longer in the array */
2216 c_ptr->info &= ~(CAVE_TEMP);
2218 /* Update only non-CAVE_GLOW grids */
2219 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2222 c_ptr->info |= (CAVE_GLOW);
2224 /* Process affected monsters */
2229 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2231 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2232 update_monster(c_ptr->m_idx, FALSE);
2234 /* Stupid monsters rarely wake up */
2235 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2237 /* Smart monsters always wake up */
2238 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2240 /* Sometimes monsters wake up */
2241 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2244 (void)set_monster_csleep(c_ptr->m_idx, 0);
2246 /* Notice the "waking up" */
2251 /* Acquire the monster name */
2252 monster_desc(m_name, m_ptr, 0);
2254 /* Dump a message */
2255 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2265 update_local_illumination(y, x);
2275 * @brief 部屋全体を暗くするサブルーチン
2279 * This routine clears the entire "temp" set.
2280 * This routine will "darken" all "temp" grids.
2281 * In addition, some of these grids will be "unmarked".
2282 * This routine is used (only) by "unlite_room()"
2283 * Also, process all affected monsters
2286 static void cave_temp_room_unlite(void)
2290 /* Clear them all */
2291 for (i = 0; i < temp_n; i++)
2293 POSITION y = temp_y[i];
2294 POSITION x = temp_x[i];
2297 cave_type *c_ptr = &cave[y][x];
2298 bool do_dark = !is_mirror_grid(c_ptr);
2300 /* No longer in the array */
2301 c_ptr->info &= ~(CAVE_TEMP);
2303 /* Darken the grid */
2306 if (dun_level || !is_daytime())
2308 for (j = 0; j < 9; j++)
2310 int by = y + ddy_ddd[j];
2311 int bx = x + ddx_ddd[j];
2313 if (in_bounds2(by, bx))
2315 cave_type *cc_ptr = &cave[by][bx];
2317 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2325 if (!do_dark) continue;
2328 c_ptr->info &= ~(CAVE_GLOW);
2330 /* Hack -- Forget "boring" grids */
2331 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2333 /* Forget the grid */
2334 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2339 /* Process affected monsters */
2342 update_monster(c_ptr->m_idx, FALSE);
2347 update_local_illumination(y, x);
2357 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2360 * @param pass_bold 地形条件を返す関数ポインタ
2363 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2370 for (i = 0; i < 16; i++)
2372 y = cy + ddy_cdd[i % 8];
2373 x = cx + ddx_cdd[i % 8];
2375 /* Found a wall, break the length */
2376 if (!pass_bold(y, x))
2378 /* Track best length */
2392 return (MAX(len, blen));
2396 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2399 * @param pass_bold 地形条件を返す関数ポインタ
2402 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2408 for (i = 0; i < 8; i++)
2410 y = cy + ddy_ddd[i];
2411 x = cx + ddx_ddd[i];
2413 if (!pass_bold(y, x)) c++;
2421 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2422 * @param y 部屋内のy座標1点
2423 * @param x 部屋内のx座標1点
2424 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2425 * @param pass_bold 地形条件を返す関数ポインタ
2428 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2433 c_ptr = &cave[y][x];
2435 /* Avoid infinite recursion */
2436 if (c_ptr->info & (CAVE_TEMP)) return;
2438 /* Do not "leave" the current room */
2439 if (!(c_ptr->info & (CAVE_ROOM)))
2441 if (only_room) return;
2444 if (!in_bounds2(y, x)) return;
2446 /* Do not exceed the maximum spell range */
2447 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2449 /* Verify this grid */
2451 * The reason why it is ==6 instead of >5 is that 8 is impossible
2452 * due to the check for cave_bold above.
2453 * 7 lights dead-end corridors (you need to do this for the
2454 * checkboard interesting rooms, so that the boundary is lit
2456 * This leaves only a check for 6 bounding walls!
2458 if (in_bounds(y, x) && pass_bold(y, x) &&
2459 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2462 /* Paranoia -- verify space */
2463 if (temp_n == TEMP_MAX) return;
2465 /* Mark the grid as "seen" */
2466 c_ptr->info |= (CAVE_TEMP);
2468 /* Add it to the "seen" set */
2475 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2478 * @return 光を通すならばtrueを返す。
2480 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2482 return cave_los_bold(y, x);
2486 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2491 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2493 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2497 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2500 * @return 射線を通すならばtrueを返す。
2502 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2504 return cave_have_flag_bold(y, x, FF_PROJECT);
2509 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2514 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2516 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2521 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2526 void lite_room(POSITION y1, POSITION x1)
2531 /* Add the initial grid */
2532 cave_temp_lite_room_aux(y1, x1);
2534 /* While grids are in the queue, add their neighbors */
2535 for (i = 0; i < temp_n; i++)
2537 x = temp_x[i], y = temp_y[i];
2539 /* Walls get lit, but stop light */
2540 if (!cave_pass_lite_bold(y, x)) continue;
2542 /* Spread adjacent */
2543 cave_temp_lite_room_aux(y + 1, x);
2544 cave_temp_lite_room_aux(y - 1, x);
2545 cave_temp_lite_room_aux(y, x + 1);
2546 cave_temp_lite_room_aux(y, x - 1);
2548 /* Spread diagonal */
2549 cave_temp_lite_room_aux(y + 1, x + 1);
2550 cave_temp_lite_room_aux(y - 1, x - 1);
2551 cave_temp_lite_room_aux(y - 1, x + 1);
2552 cave_temp_lite_room_aux(y + 1, x - 1);
2555 /* Now, lite them all up at once */
2556 cave_temp_room_lite();
2558 if (p_ptr->special_defense & NINJA_S_STEALTH)
2560 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2566 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2571 void unlite_room(POSITION y1, POSITION x1)
2576 /* Add the initial grid */
2577 cave_temp_unlite_room_aux(y1, x1);
2579 /* Spread, breadth first */
2580 for (i = 0; i < temp_n; i++)
2582 x = temp_x[i], y = temp_y[i];
2584 /* Walls get dark, but stop darkness */
2585 if (!cave_pass_dark_bold(y, x)) continue;
2587 /* Spread adjacent */
2588 cave_temp_unlite_room_aux(y + 1, x);
2589 cave_temp_unlite_room_aux(y - 1, x);
2590 cave_temp_unlite_room_aux(y, x + 1);
2591 cave_temp_unlite_room_aux(y, x - 1);
2593 /* Spread diagonal */
2594 cave_temp_unlite_room_aux(y + 1, x + 1);
2595 cave_temp_unlite_room_aux(y - 1, x - 1);
2596 cave_temp_unlite_room_aux(y - 1, x + 1);
2597 cave_temp_unlite_room_aux(y + 1, x - 1);
2600 /* Now, darken them all at once */
2601 cave_temp_room_unlite();
2607 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2610 * @return 作用が実際にあった場合TRUEを返す
2612 bool lite_area(HIT_POINT dam, POSITION rad)
2614 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2616 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2618 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2622 /* Hack -- Message */
2625 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2628 /* Hook into the "project()" function */
2629 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2631 /* Lite up the room */
2632 lite_room(p_ptr->y, p_ptr->x);
2640 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2643 * @return 作用が実際にあった場合TRUEを返す
2645 bool unlite_area(HIT_POINT dam, POSITION rad)
2647 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2649 /* Hack -- Message */
2652 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2655 /* Hook into the "project()" function */
2656 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2658 /* Lite up the room */
2659 unlite_room(p_ptr->y, p_ptr->x);
2668 * @brief ボール系スペルの発動 / Cast a ball spell
2670 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2673 * @return 作用が実際にあった場合TRUEを返す
2676 * Stop if we hit a monster, act as a "ball"
2677 * Allow "target" mode to pass over monsters
2678 * Affect grids, objects, and monsters
2681 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2685 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2687 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2688 /* Use the given direction */
2689 tx = p_ptr->x + 99 * ddx[dir];
2690 ty = p_ptr->y + 99 * ddy[dir];
2692 /* Hack -- Use an actual "target" */
2693 if ((dir == 5) && target_okay())
2695 flg &= ~(PROJECT_STOP);
2700 /* Analyze the "dir" and the "target". Hurt items on floor. */
2701 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2705 * @brief ブレス系スペルの発動 / Cast a breath spell
2707 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2710 * @return 作用が実際にあった場合TRUEを返す
2713 * Stop if we hit a monster, act as a "ball"
2714 * Allow "target" mode to pass over monsters
2715 * Affect grids, objects, and monsters
2718 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2720 return fire_ball(typ, dir, dam, -rad);
2725 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2727 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2730 * @return 作用が実際にあった場合TRUEを返す
2733 * Stop if we hit a monster, act as a "ball"
2734 * Allow "target" mode to pass over monsters
2735 * Affect grids, objects, and monsters
2738 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2741 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2743 /* Use the given direction */
2744 tx = p_ptr->x + 99 * ddx[dir];
2745 ty = p_ptr->y + 99 * ddy[dir];
2747 /* Hack -- Use an actual "target" */
2748 if ((dir == 5) && target_okay())
2754 /* Analyze the "dir" and the "target". Hurt items on floor. */
2755 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2760 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2762 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2765 * @return 作用が実際にあった場合TRUEを返す
2768 * Stop if we hit a monster, act as a "ball"
2769 * Allow "target" mode to pass over monsters
2770 * Affect grids, objects, and monsters
2773 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2776 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2778 /* Use the given direction */
2779 tx = p_ptr->x + 99 * ddx[dir];
2780 ty = p_ptr->y + 99 * ddy[dir];
2782 /* Hack -- Use an actual "target" */
2783 if ((dir == 5) && target_okay())
2785 flg &= ~(PROJECT_STOP);
2790 /* Analyze the "dir" and the "target". Hurt items on floor. */
2791 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2796 * @brief メテオ系スペルの発動 / Cast a meteor spell
2797 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2803 * @return 作用が実際にあった場合TRUEを返す
2806 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2807 * player, or outside source, that starts out at an arbitrary location, and
2808 * leaving no trail from the "caster" to the target. This function is
2809 * especially useful for bombardments and similar. -LM-
2810 * Option to hurt the player.
2813 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2815 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2817 /* Analyze the "target" and the caster. */
2818 return (project(who, rad, y, x, dam, typ, flg, -1));
2823 * @brief ブラスト系スペルの発動 / Cast a blast spell
2825 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2830 * @return 作用が実際にあった場合TRUEを返す
2832 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2836 POSITION ty, tx, y, x;
2839 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2844 /* Use the given direction */
2847 ly = ty = p_ptr->y + 20 * ddy[dir];
2848 lx = tx = p_ptr->x + 20 * ddx[dir];
2851 /* Use an actual "target" */
2852 else /* if (dir == 5) */
2857 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2858 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2861 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2864 for (i = 0; i < num; i++)
2868 /* Get targets for some bolts */
2869 y = rand_spread(ly, ld * dev / 20);
2870 x = rand_spread(lx, ld * dev / 20);
2872 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2875 /* Analyze the "dir" and the "target". */
2876 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2887 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2888 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2889 * @return 作用が実際にあった場合TRUEを返す
2891 bool teleport_swap(DIRECTION dir)
2895 monster_type* m_ptr;
2896 monster_race* r_ptr;
2898 if ((dir == 5) && target_okay())
2905 tx = p_ptr->x + ddx[dir];
2906 ty = p_ptr->y + ddy[dir];
2908 c_ptr = &cave[ty][tx];
2910 if (p_ptr->anti_tele)
2912 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2916 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2918 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2924 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2926 msg_print(_("失敗した。", "Failed to swap."));
2932 m_ptr = &m_list[c_ptr->m_idx];
2933 r_ptr = &r_info[m_ptr->r_idx];
2935 (void)set_monster_csleep(c_ptr->m_idx, 0);
2937 if (r_ptr->flagsr & RFR_RES_TELE)
2939 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2941 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2947 sound(SOUND_TELEPORT);
2949 /* Swap the player and monster */
2950 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2958 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2960 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2963 * @return 作用が実際にあった場合TRUEを返す
2965 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2969 /* Pass through the target if needed */
2970 flg |= (PROJECT_THRU);
2972 /* Use the given direction */
2973 tx = p_ptr->x + ddx[dir];
2974 ty = p_ptr->y + ddy[dir];
2976 /* Hack -- Use an actual "target" */
2977 if ((dir == 5) && target_okay())
2983 /* Analyze the "dir" and the "target", do NOT explode */
2984 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2989 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2991 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2993 * @return 作用が実際にあった場合TRUEを返す
2996 * Stop if we hit a monster, as a "bolt".
2997 * Affect monsters and grids (not objects).
3000 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3002 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3003 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3004 return (project_hook(typ, dir, dam, flg));
3009 * @brief ビーム系スペルの発動 / Cast a beam spell.
3011 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3013 * @return 作用が実際にあった場合TRUEを返す
3016 * Pass through monsters, as a "beam".
3017 * Affect monsters, grids and objects.
3020 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3022 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3023 return (project_hook(typ, dir, dam, flg));
3028 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3029 * @param prob ビーム化する確率(%)
3031 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3033 * @return 作用が実際にあった場合TRUEを返す
3036 * Pass through monsters, as a "beam".
3037 * Affect monsters, grids and objects.
3040 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3042 if (randint0(100) < prob)
3044 return (fire_beam(typ, dir, dam));
3048 return (fire_bolt(typ, dir, dam));
3053 * @brief LITE_WEAK属性による光源ビーム処理
3054 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3056 * @return 作用が実際にあった場合TRUEを返す
3058 bool lite_line(DIRECTION dir, HIT_POINT dam)
3060 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3061 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3066 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3068 * @return 作用が実際にあった場合TRUEを返す
3070 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3072 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3073 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3078 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3080 * @return 作用が実際にあった場合TRUEを返す
3082 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3084 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3085 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3090 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3091 * @return 作用が実際にあった場合TRUEを返す
3093 bool wizard_lock(DIRECTION dir)
3095 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3096 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3101 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3102 * @return 作用が実際にあった場合TRUEを返す
3104 bool destroy_door(DIRECTION dir)
3106 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3107 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3112 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3113 * @return 作用が実際にあった場合TRUEを返す
3115 bool disarm_trap(DIRECTION dir)
3117 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3118 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3123 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3125 * @return 作用が実際にあった場合TRUEを返す
3127 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3129 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3130 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3135 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3137 * @return 作用が実際にあった場合TRUEを返す
3139 bool speed_monster(DIRECTION dir, int power)
3141 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3142 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3147 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3149 * @return 作用が実際にあった場合TRUEを返す
3151 bool slow_monster(DIRECTION dir, int power)
3153 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3154 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3159 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3161 * @return 作用が実際にあった場合TRUEを返す
3163 bool sleep_monster(DIRECTION dir, int power)
3165 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3166 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3170 * @brief モンスター拘束(STASIS)処理
3171 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3172 * @return 作用が実際にあった場合TRUEを返す
3173 * @details 威力はプレイヤーレベル*2に固定
3175 bool stasis_monster(DIRECTION dir)
3177 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3181 * @brief 邪悪なモンスター拘束(STASIS)処理
3182 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3183 * @return 作用が実際にあった場合TRUEを返す
3184 * @details 威力はプレイヤーレベル*2に固定
3186 bool stasis_evil(DIRECTION dir)
3188 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3193 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3194 * @param plev プレイヤーレベル(=効力)
3195 * @return 作用が実際にあった場合TRUEを返す
3197 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3199 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3200 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3205 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3206 * @param plev プレイヤーレベル(=効力)
3207 * @return 作用が実際にあった場合TRUEを返す
3209 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3211 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3212 return (project_hook(GF_STUN, dir, plev, flg));
3216 * @brief チェンジモンスター処理
3217 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3219 * @return 作用が実際にあった場合TRUEを返す
3221 bool poly_monster(DIRECTION dir, int power)
3223 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3224 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3226 chg_virtue(V_CHANCE, 1);
3231 * @brief クローンモンスター処理
3232 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3233 * @return 作用が実際にあった場合TRUEを返す
3235 bool clone_monster(DIRECTION dir)
3237 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3238 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3243 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3244 * @param plev プレイヤーレベル(=効力)
3245 * @return 作用が実際にあった場合TRUEを返す
3247 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3249 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3250 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3255 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3256 * @param plev プレイヤーレベル(効力はplev*200)
3257 * @return 作用が実際にあった場合TRUEを返す
3259 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3261 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3262 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3266 * @brief モンスター用テレポート処理
3267 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3268 * @param distance 移動距離
3269 * @return 作用が実際にあった場合TRUEを返す
3271 bool teleport_monster(DIRECTION dir, int distance)
3273 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3274 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3278 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3279 * @return 作用が実際にあった場合TRUEを返す
3281 bool door_creation(void)
3283 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3284 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3288 * @brief トラップ生成処理(起点から周囲1マス)
3291 * @return 作用が実際にあった場合TRUEを返す
3293 bool trap_creation(POSITION y, POSITION x)
3295 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3296 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3300 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3301 * @return 作用が実際にあった場合TRUEを返す
3303 bool tree_creation(void)
3305 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3306 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3310 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3311 * @return 作用が実際にあった場合TRUEを返す
3313 bool glyph_creation(void)
3315 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3316 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3320 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3321 * @return 作用が実際にあった場合TRUEを返す
3323 bool wall_stone(void)
3325 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3327 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3329 p_ptr->update |= (PU_FLOW);
3331 p_ptr->redraw |= (PR_MAP);
3337 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3338 * @return 作用が実際にあった場合TRUEを返す
3340 bool destroy_doors_touch(void)
3342 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3343 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3347 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3348 * @return 作用が実際にあった場合TRUEを返す
3350 bool disarm_traps_touch(void)
3352 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3353 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3357 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3358 * @return 作用が実際にあった場合TRUEを返す
3360 bool sleep_monsters_touch(void)
3362 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3363 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3368 * @brief 死者復活処理(起点より周囲5マス)
3369 * @param who 術者モンスターID(0ならばプレイヤー)
3372 * @return 作用が実際にあった場合TRUEを返す
3374 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3376 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3377 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3382 * @return 作用が実際にあった場合TRUEを返す
3384 void call_chaos(void)
3386 int Chaos_type, dummy, dir;
3387 PLAYER_LEVEL plev = p_ptr->lev;
3388 bool line_chaos = FALSE;
3390 int hurt_types[31] =
3392 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3393 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3394 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3395 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3396 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3397 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3398 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3399 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3402 Chaos_type = hurt_types[randint0(31)];
3403 if (one_in_(4)) line_chaos = TRUE;
3407 for (dummy = 1; dummy < 10; dummy++)
3412 fire_beam(Chaos_type, dummy, 150);
3414 fire_ball(Chaos_type, dummy, 150, 2);
3418 else if (one_in_(3))
3420 fire_ball(Chaos_type, 0, 500, 8);
3424 if (!get_aim_dir(&dir)) return;
3426 fire_beam(Chaos_type, dir, 250);
3428 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3433 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3434 * @param stop_ty 再帰処理停止フラグ
3436 * @return 作用が実際にあった場合TRUEを返す
3439 * rr9: Stop the nasty things when a Cyberdemon is summoned
3440 * or the player gets paralyzed.
3443 bool activate_ty_curse(bool stop_ty, int *count)
3447 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3451 switch (randint1(34))
3456 msg_print(_("地面が揺れた...", "The ground trembles..."));
3457 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3458 if (!one_in_(6)) break;
3463 HIT_POINT dam = damroll(10, 10);
3464 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3465 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3466 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3467 if (!one_in_(6)) break;
3472 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3473 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3474 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3475 if (!one_in_(6)) break;
3478 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3482 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3483 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3485 if (!one_in_(6)) break;
3486 case 1: case 2: case 3: case 16: case 17:
3487 aggravate_monsters(0);
3488 if (!one_in_(6)) break;
3489 case 4: case 5: case 6:
3490 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3491 if (!one_in_(6)) break;
3492 case 7: case 8: case 9: case 18:
3493 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3494 if (!one_in_(6)) break;
3495 case 10: case 11: case 12:
3496 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3497 lose_exp(p_ptr->exp / 16);
3498 if (!one_in_(6)) break;
3499 case 13: case 14: case 15: case 19: case 20:
3500 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3506 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3507 if (p_ptr->free_act)
3508 set_paralyzed(p_ptr->paralyzed + randint1(3));
3510 set_paralyzed(p_ptr->paralyzed + randint1(13));
3513 if (!one_in_(6)) break;
3514 case 21: case 22: case 23:
3515 (void)do_dec_stat(randint0(6));
3516 if (!one_in_(6)) break;
3518 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3520 if (!one_in_(6)) break;
3523 * Only summon Cyberdemons deep in the dungeon.
3525 if ((dun_level > 65) && !stop_ty)
3527 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3531 if (!one_in_(6)) break;
3537 (void)do_dec_stat(i);
3545 while (one_in_(3) && !stop_ty);
3551 * @brief HI_SUMMON(上級召喚)処理発動
3554 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3555 * @return 作用が実際にあった場合TRUEを返す
3557 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3562 BIT_FLAGS mode = PM_ALLOW_GROUP;
3569 mode |= PM_FORCE_FRIENDLY;
3573 mode |= PM_FORCE_PET;
3578 if (!pet) mode |= PM_NO_PET;
3580 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3582 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3584 switch (randint1(25) + (dun_level / 20))
3587 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3590 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3593 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3596 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3599 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3602 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3605 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3608 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3612 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3616 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3619 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3620 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3623 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3624 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3627 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3630 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3631 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3640 * @brief サイバーデーモンの召喚
3641 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3644 * @return 作用が実際にあった場合TRUEを返す
3646 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3649 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3651 BIT_FLAGS mode = PM_ALLOW_GROUP;
3653 /* Summoned by a monster */
3656 monster_type *m_ptr = &m_list[who];
3657 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3660 if (max_cyber > 4) max_cyber = 4;
3662 for (i = 0; i < max_cyber; i++)
3664 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3671 * @brief 周辺破壊効果(プレイヤー中心)
3672 * @return 作用が実際にあった場合TRUEを返す
3674 void wall_breaker(void)
3677 POSITION y = 0, x = 0;
3678 int attempts = 1000;
3680 if (randint1(80 + p_ptr->lev) < 70)
3684 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3686 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3688 if (!player_bold(y, x)) break;
3691 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3692 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3694 else if (randint1(100) > 30)
3696 earthquake(p_ptr->y, p_ptr->x, 1);
3700 int num = damroll(5, 3);
3702 for (i = 0; i < num; i++)
3706 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3708 if (!player_bold(y, x)) break;
3711 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3712 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3719 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3721 * @return 作用が実際にあった場合TRUEを返す
3723 bool confuse_monsters(HIT_POINT dam)
3725 return (project_hack(GF_OLD_CONF, dam));
3730 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3732 * @return 作用が実際にあった場合TRUEを返す
3734 bool charm_monsters(HIT_POINT dam)
3736 return (project_hack(GF_CHARM, dam));
3741 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3743 * @return 作用が実際にあった場合TRUEを返す
3745 bool charm_animals(HIT_POINT dam)
3747 return (project_hack(GF_CONTROL_ANIMAL, dam));
3752 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3754 * @return 作用が実際にあった場合TRUEを返す
3756 bool stun_monsters(HIT_POINT dam)
3758 return (project_hack(GF_STUN, dam));
3763 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3765 * @return 作用が実際にあった場合TRUEを返す
3767 bool stasis_monsters(HIT_POINT dam)
3769 return (project_hack(GF_STASIS, dam));
3774 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3776 * @return 作用が実際にあった場合TRUEを返す
3778 bool mindblast_monsters(HIT_POINT dam)
3780 return (project_hack(GF_PSI, dam));
3785 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3786 * @param dist 効力(距離)
3787 * @return 作用が実際にあった場合TRUEを返す
3789 bool banish_monsters(int dist)
3791 return (project_hack(GF_AWAY_ALL, dist));
3796 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3798 * @return 作用が実際にあった場合TRUEを返す
3800 bool turn_evil(HIT_POINT dam)
3802 return (project_hack(GF_TURN_EVIL, dam));
3807 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3809 * @return 作用が実際にあった場合TRUEを返す
3811 bool turn_monsters(HIT_POINT dam)
3813 return (project_hack(GF_TURN_ALL, dam));
3818 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3819 * @return 作用が実際にあった場合TRUEを返す
3821 bool deathray_monsters(void)
3823 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3827 * @brief チャーム・モンスター(1体)
3828 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3830 * @return 作用が実際にあった場合TRUEを返す
3832 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3834 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3835 return (project_hook(GF_CHARM, dir, plev, flg));
3839 * @brief アンデッド支配(1体)
3840 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3842 * @return 作用が実際にあった場合TRUEを返す
3844 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3846 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3847 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3852 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3854 * @return 作用が実際にあった場合TRUEを返す
3856 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3858 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3859 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3864 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3866 * @return 作用が実際にあった場合TRUEを返す
3868 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3870 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3871 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3877 * @param success 判定成功上の処理ならばTRUE
3878 * @return 作用が実際にあった場合TRUEを返す
3880 bool kawarimi(bool success)
3883 object_type *q_ptr = &forge;
3886 if (p_ptr->is_dead) return FALSE;
3887 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3888 if (randint0(200) < p_ptr->stun) return FALSE;
3890 if (!success && one_in_(3))
3892 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3893 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3894 p_ptr->redraw |= (PR_STATUS);
3901 teleport_player(10 + randint1(90), 0L);
3905 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3907 q_ptr->pval = MON_NINJA;
3909 /* Drop it in the dungeon */
3910 (void)drop_near(q_ptr, -1, y, x);
3913 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3914 else msg_print("失敗!攻撃を受けてしまった。");
3916 if (success) msg_print("You have turned around just before the attack hit you.");
3917 else msg_print("Failed! You are hit by the attack.");
3920 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3921 p_ptr->redraw |= (PR_STATUS);
3929 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3930 * @param mdeath 目標モンスターが死亡したかを返す
3931 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3933 bool rush_attack(bool *mdeath)
3940 bool tmp_mdeath = FALSE;
3943 if (mdeath) *mdeath = FALSE;
3946 if (!get_aim_dir(&dir)) return FALSE;
3948 /* Use the given direction */
3949 tx = p_ptr->x + project_length * ddx[dir];
3950 ty = p_ptr->y + project_length * ddy[dir];
3952 /* Hack -- Use an actual "target" */
3953 if ((dir == 5) && target_okay())
3959 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3961 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3964 /* No need to move */
3965 if (!path_n) return TRUE;
3967 /* Use ty and tx as to-move point */
3971 /* Project along the path */
3972 for (i = 0; i < path_n; i++)
3974 monster_type *m_ptr;
3976 int ny = GRID_Y(path_g[i]);
3977 int nx = GRID_X(path_g[i]);
3979 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3984 /* Go to next grid */
3988 if (!cave[ny][nx].m_idx)
3992 msg_print(_("失敗!", "Failed!"));
3996 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4003 /* Move player before updating the monster */
4004 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4005 update_monster(cave[ny][nx].m_idx, TRUE);
4007 /* Found a monster */
4008 m_ptr = &m_list[cave[ny][nx].m_idx];
4010 if (tm_idx != cave[ny][nx].m_idx)
4013 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4014 m_ptr->ml ? "モンスター" : "何か");
4016 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4019 else if (!player_bold(ty, tx))
4021 /* Hold the monster name */
4024 /* Get the monster name (BEFORE polymorphing) */
4025 monster_desc(m_name, m_ptr, 0);
4026 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4029 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4031 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4036 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4038 if (mdeath) *mdeath = tmp_mdeath;
4044 * @brief 全鏡の消去 / Remove all mirrors in this floor
4045 * @param explode 爆発処理を伴うならばTRUE
4048 void remove_all_mirrors(bool explode)
4052 for (x = 0; x < cur_wid; x++)
4054 for (y = 0; y < cur_hgt; y++)
4056 if (is_mirror_grid(&cave[y][x]))
4058 remove_mirror(y, x);
4060 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4061 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4068 * @brief 『一つの指輪』の効果処理 /
4069 * Hack -- activate the ring of power
4070 * @param dir 発動の方向ID
4073 void ring_of_power(DIRECTION dir)
4075 /* Pick a random effect */
4076 switch (randint1(10))
4081 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4084 /* Decrease all stats (permanently) */
4085 (void)dec_stat(A_STR, 50, TRUE);
4086 (void)dec_stat(A_INT, 50, TRUE);
4087 (void)dec_stat(A_WIS, 50, TRUE);
4088 (void)dec_stat(A_DEX, 50, TRUE);
4089 (void)dec_stat(A_CON, 50, TRUE);
4090 (void)dec_stat(A_CHR, 50, TRUE);
4092 /* Lose some experience (permanently) */
4093 p_ptr->exp -= (p_ptr->exp / 4);
4094 p_ptr->max_exp -= (p_ptr->exp / 4);
4102 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4104 /* Dispel monsters */
4105 dispel_monsters(1000);
4115 fire_ball(GF_MANA, dir, 600, 3);
4126 fire_bolt(GF_MANA, dir, 500);
4134 * @brief 運命の輪、並びにカオス的な効果の発動
4135 * @param spell ランダムな効果を選択するための基準ID
4138 void wild_magic(int spell)
4141 int type = SUMMON_MOLD + randint0(6);
4143 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4144 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4146 switch (randint1(spell) + randint1(8) + 1)
4151 teleport_player(10, TELEPORT_PASSIVE);
4156 teleport_player(100, TELEPORT_PASSIVE);
4160 teleport_player(200, TELEPORT_PASSIVE);
4170 lite_area(damroll(2, 3), 2);
4173 destroy_doors_touch();
4178 sleep_monsters_touch();
4182 trap_creation(p_ptr->y, p_ptr->x);
4191 aggravate_monsters(0);
4194 earthquake(p_ptr->y, p_ptr->x, 5);
4198 (void)gain_random_mutation(0);
4202 apply_disenchant(1);
4208 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4215 while (counter++ < 8)
4217 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4222 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4225 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4230 (void)activate_ty_curse(FALSE, &count);
4239 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4240 * / Drop 10+1d10 meteor ball at random places near the player
4245 void cast_meteor(HIT_POINT dam, POSITION rad)
4248 int b = 10 + randint1(10);
4250 for (i = 0; i < b; i++)
4252 POSITION y = 0, x = 0;
4255 for (count = 0; count <= 20; count++)
4259 x = p_ptr->x - 8 + randint0(17);
4260 y = p_ptr->y - 8 + randint0(17);
4262 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4263 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4265 /* Approximate distance */
4266 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4268 if (d >= 9) continue;
4270 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4271 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4273 /* Valid position */
4277 if (count > 20) continue;
4279 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4285 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4288 * @return ターゲットを指定し、実行したならばTRUEを返す。
4290 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4292 POSITION x, y, tx, ty;
4296 int b = 10 + randint1(10);
4298 if (!get_aim_dir(&dir)) return FALSE;
4300 /* Use the given direction */
4301 tx = p_ptr->x + 99 * ddx[dir];
4302 ty = p_ptr->y + 99 * ddy[dir];
4304 /* Hack -- Use an actual "target" */
4305 if ((dir == 5) && target_okay())
4316 /* Hack -- Stop at the target */
4317 if ((y == ty) && (x == tx)) break;
4321 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4323 /* Stop at maximum range */
4324 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4326 /* Stopped by walls/doors */
4327 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4329 /* Stopped by monsters */
4330 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4332 /* Save the new location */
4339 for (i = 0; i < b; i++)
4341 int count = 20, d = 0;
4347 x = tx - 5 + randint0(11);
4348 y = ty - 5 + randint0(11);
4350 dx = (tx > x) ? (tx - x) : (x - tx);
4351 dy = (ty > y) ? (ty - y) : (y - ty);
4353 /* Approximate distance */
4354 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4355 /* Within the radius */
4359 if (count < 0) continue;
4361 /* Cannot penetrate perm walls */
4362 if (!in_bounds(y, x) ||
4363 cave_stop_disintegration(y, x) ||
4364 !in_disintegration_range(ty, tx, y, x))
4367 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4374 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4378 * This spell should become more useful (more controlled) as the\n
4379 * player gains experience levels. Thus, add 1/5 of the player's\n
4380 * level to the die roll. This eliminates the worst effects later on,\n
4381 * while keeping the results quite random. It also allows some potent\n
4382 * effects only at high level.
4384 void cast_wonder(DIRECTION dir)
4386 PLAYER_LEVEL plev = p_ptr->lev;
4387 int die = randint1(100) + plev / 5;
4388 int vir = virtue_number(V_CHANCE);
4392 if (p_ptr->virtues[vir - 1] > 0)
4394 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4398 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4403 chg_virtue(V_CHANCE, 1);
4407 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4410 if (die < 8) clone_monster(dir);
4411 else if (die < 14) speed_monster(dir, plev);
4412 else if (die < 26) heal_monster(dir, damroll(4, 6));
4413 else if (die < 31) poly_monster(dir, plev);
4415 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4416 damroll(3 + ((plev - 1) / 5), 4));
4417 else if (die < 41) confuse_monster(dir, plev);
4418 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4419 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4421 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4422 damroll(3 + ((plev - 5) / 4), 8));
4424 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4425 damroll(5 + ((plev - 5) / 4), 8));
4427 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4428 damroll(6 + ((plev - 5) / 4), 8));
4430 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4431 damroll(8 + ((plev - 5) / 4), 8));
4432 else if (die < 76) hypodynamic_bolt(dir, 75);
4433 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4434 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4435 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4436 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4437 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4440 earthquake(p_ptr->y, p_ptr->x, 12);
4444 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4448 symbol_genocide(plev + 50, TRUE);
4450 else if (die < 110) dispel_monsters(120);
4453 dispel_monsters(150);
4454 slow_monsters(plev);
4455 sleep_monsters(plev);
4462 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4466 void cast_invoke_spirits(DIRECTION dir)
4468 PLAYER_LEVEL plev = p_ptr->lev;
4469 int die = randint1(100) + plev / 5;
4470 int vir = virtue_number(V_CHANCE);
4474 if (p_ptr->virtues[vir - 1] > 0)
4476 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4480 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4484 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4486 chg_virtue(V_CHANCE, 1);
4490 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4495 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4496 "Oh no! Mouldering forms rise from the earth around you!"));
4498 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4499 chg_virtue(V_UNLIFE, 1);
4503 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4505 set_afraid(p_ptr->afraid + randint1(4) + 4);
4509 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4510 "Your head is invaded by a horde of gibbering spectral voices..."));
4512 set_confused(p_ptr->confused + randint1(4) + 4);
4516 poly_monster(dir, plev);
4520 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4521 damroll(3 + ((plev - 1) / 5), 4));
4525 confuse_monster(dir, plev);
4529 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4533 (void)lite_line(dir, damroll(6, 8));
4537 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4538 damroll(3 + ((plev - 5) / 4), 8));
4542 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4543 damroll(5 + ((plev - 5) / 4), 8));
4547 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4548 damroll(6 + ((plev - 5) / 4), 8));
4552 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4553 damroll(8 + ((plev - 5) / 4), 8));
4557 hypodynamic_bolt(dir, 75);
4561 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4565 fire_ball(GF_ACID, dir, 40 + plev, 2);
4569 fire_ball(GF_ICE, dir, 70 + plev, 3);
4573 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4577 hypodynamic_bolt(dir, 100 + plev);
4581 earthquake(p_ptr->y, p_ptr->x, 12);
4585 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4589 symbol_genocide(plev + 50, TRUE);
4593 dispel_monsters(120);
4597 dispel_monsters(150);
4598 slow_monsters(plev);
4599 sleep_monsters(plev);
4605 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4606 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4611 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4614 void cast_shuffle(void)
4616 PLAYER_LEVEL plev = p_ptr->lev;
4619 int vir = virtue_number(V_CHANCE);
4622 /* Card sharks and high mages get a level bonus */
4623 if ((p_ptr->pclass == CLASS_ROGUE) ||
4624 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4625 (p_ptr->pclass == CLASS_SORCERER))
4626 die = (randint1(110)) + plev / 5;
4628 die = randint1(120);
4633 if (p_ptr->virtues[vir - 1] > 0)
4635 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4639 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4643 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4646 chg_virtue(V_CHANCE, 1);
4650 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4652 for (i = 0; i < randint1(3); i++)
4653 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4657 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4658 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4663 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4664 activate_ty_curse(FALSE, &count);
4668 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4669 aggravate_monsters(0);
4673 msg_print(_("《愚者》だ。", "It's the Fool."));
4679 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4680 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4684 msg_print(_("《月》だ。", "It's the Moon."));
4689 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4690 wild_magic(randint0(32));
4694 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4695 teleport_player(10, TELEPORT_PASSIVE);
4699 msg_print(_("《正義》だ。", "It's Justice."));
4700 set_blessed(p_ptr->lev, FALSE);
4704 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4705 teleport_player(100, TELEPORT_PASSIVE);
4709 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4710 teleport_player(200, TELEPORT_PASSIVE);
4714 msg_print(_("《塔》だ。", "It's the Tower."));
4719 msg_print(_("《節制》だ。", "It's Temperance."));
4720 sleep_monsters_touch();
4724 msg_print(_("《塔》だ。", "It's the Tower."));
4726 earthquake(p_ptr->y, p_ptr->x, 5);
4730 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4731 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4735 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4736 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4740 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4741 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4745 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4746 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4750 msg_print(_("《恋人》だ。", "It's the Lovers."));
4752 if (get_aim_dir(&dir))
4753 charm_monster(dir, MIN(p_ptr->lev, 20));
4757 msg_print(_("《隠者》だ。", "It's the Hermit."));
4762 msg_print(_("《審判》だ。", "It's the Judgement."));
4763 do_cmd_rerate(FALSE);
4764 lose_all_mutations();
4768 msg_print(_("《太陽》だ。", "It's the Sun."));
4769 chg_virtue(V_KNOWLEDGE, 1);
4770 chg_virtue(V_ENLIGHTEN, 1);
4775 msg_print(_("《世界》だ。", "It's the World."));
4776 if (p_ptr->exp < PY_MAX_EXP)
4778 s32b ee = (p_ptr->exp / 25) + 1;
4779 if (ee > 5000) ee = 5000;
4780 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4786 bool_hack life_stream(bool_hack message, bool_hack virtue)
4790 chg_virtue(V_VITALITY, 1);
4791 chg_virtue(V_UNLIFE, -5);
4795 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4798 (void)set_poisoned(0);
4800 (void)set_confused(0);
4804 (void)restore_all_status();
4805 (void)set_shero(0, TRUE);
4812 bool_hack heroism(int base)
4814 bool_hack ident = FALSE;
4815 if(set_afraid(0)) ident = TRUE;
4816 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4817 if(hp_player(10)) ident = TRUE;
4821 bool_hack berserk(int base)
4823 bool_hack ident = FALSE;
4824 if (set_afraid(0)) ident = TRUE;
4825 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4826 if (hp_player(30)) ident = TRUE;
4830 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4832 bool_hack ident = FALSE;
4833 if (hp_player(damroll(dice, sides))) ident = TRUE;
4834 if (set_blind(0)) ident = TRUE;
4835 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4836 if (set_shero(0, TRUE)) ident = TRUE;
4840 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4842 bool_hack ident = FALSE;
4843 if (hp_player(damroll(dice, sides))) ident = TRUE;
4844 if (set_blind(0)) ident = TRUE;
4845 if (set_confused(0)) ident = TRUE;
4846 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4847 if (set_shero(0, TRUE)) ident = TRUE;
4851 bool_hack cure_critical_wounds(HIT_POINT pow)
4853 bool_hack ident = FALSE;
4854 if (hp_player(pow)) ident = TRUE;
4855 if (set_blind(0)) ident = TRUE;
4856 if (set_confused(0)) ident = TRUE;
4857 if (set_poisoned(0)) ident = TRUE;
4858 if (set_stun(0)) ident = TRUE;
4859 if (set_cut(0)) ident = TRUE;
4860 if (set_shero(0, TRUE)) ident = TRUE;
4864 bool_hack true_healing(HIT_POINT pow)
4866 bool_hack ident = FALSE;
4867 if (hp_player(pow)) ident = TRUE;
4868 if (set_blind(0)) ident = TRUE;
4869 if (set_confused(0)) ident = TRUE;
4870 if (set_poisoned(0)) ident = TRUE;
4871 if (set_stun(0)) ident = TRUE;
4872 if (set_cut(0)) ident = TRUE;
4873 if (set_image(0)) ident = TRUE;
4877 bool_hack restore_mana(bool_hack magic_eater)
4879 bool_hack ident = FALSE;
4881 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4884 for (i = 0; i < EATER_EXT * 2; i++)
4886 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4887 if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
4889 for (; i < EATER_EXT * 3; i++)
4891 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4892 p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
4893 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4895 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4896 p_ptr->window |= (PW_PLAYER);
4899 else if (p_ptr->csp < p_ptr->msp)
4901 p_ptr->csp = p_ptr->msp;
4902 p_ptr->csp_frac = 0;
4903 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4904 p_ptr->redraw |= (PR_MANA);
4905 p_ptr->window |= (PW_PLAYER);
4906 p_ptr->window |= (PW_SPELL);
4913 bool restore_all_status(void)
4916 if (do_res_stat(A_STR)) ident = TRUE;
4917 if (do_res_stat(A_INT)) ident = TRUE;
4918 if (do_res_stat(A_WIS)) ident = TRUE;
4919 if (do_res_stat(A_DEX)) ident = TRUE;
4920 if (do_res_stat(A_CON)) ident = TRUE;
4921 if (do_res_stat(A_CHR)) ident = TRUE;
4926 * @brief 口を使う継続的な処理を中断する
4929 void stop_mouth(void)
4931 if (music_singing_any()) stop_singing();
4932 if (hex_spelling_any()) stop_hex_spell_all();
4936 bool_hack vampirism(void)
4943 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4945 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4949 /* Only works on adjacent monsters */
4950 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4951 y = p_ptr->y + ddy[dir];
4952 x = p_ptr->x + ddx[dir];
4953 c_ptr = &cave[y][x];
4957 if (!(c_ptr->m_idx))
4959 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4963 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4965 dummy = p_ptr->lev * 2;
4967 if (hypodynamic_bolt(dir, dummy))
4969 if (p_ptr->food < PY_FOOD_FULL)
4970 /* No heal if we are "full" */
4971 (void)hp_player(dummy);
4973 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4975 /* Gain nutritional sustenance: 150/hp drained */
4976 /* A Food ration gives 5000 food points (by contrast) */
4977 /* Don't ever get more than "Full" this way */
4978 /* But if we ARE Gorged, it won't cure us */
4979 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4980 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4981 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4984 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4988 bool panic_hit(void)
4993 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4994 y = p_ptr->y + ddy[dir];
4995 x = p_ptr->x + ddx[dir];
4996 if (cave[y][x].m_idx)
4999 if (randint0(p_ptr->skill_dis) < 7)
5000 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5002 teleport_player(30, 0L);
5007 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5015 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5018 * currently this function allows pseudo-id of any object,
5019 * including silly ones like potions & scrolls, which always
5020 * get '{average}'. This should be changed, either to stop such
5021 * items from being pseudo-id'd, or to allow psychometry to
5022 * detect whether the unidentified potion/scroll/etc is
5023 * good (Cure Light Wounds, Restore Strength, etc) or
5024 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5026 bool psychometry(void)
5030 char o_name[MAX_NLEN];
5035 item_tester_no_ryoute = TRUE;
5036 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5037 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5039 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5041 /* Get the item (in the pack) */
5044 o_ptr = &inventory[item];
5047 /* Get the item (on the floor) */
5050 o_ptr = &o_list[0 - item];
5053 /* It is fully known, no information needed */
5054 if (object_is_known(o_ptr))
5056 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5060 /* Check for a feeling */
5061 feel = value_check_aux1(o_ptr);
5063 /* Get an object description */
5064 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5066 /* Skip non-feelings */
5069 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5074 msg_format("%sは%sという感じがする...",
5075 o_name, game_inscriptions[feel]);
5077 msg_format("You feel that the %s %s %s...",
5078 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5079 game_inscriptions[feel]);
5083 /* We have "felt" it */
5084 o_ptr->ident |= (IDENT_SENSE);
5087 o_ptr->feeling = feel;
5089 /* Player touches it */
5090 o_ptr->marked |= OM_TOUCHED;
5092 /* Combine / Reorder the pack (later) */
5093 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5095 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5097 /* Valid "tval" codes */
5098 switch (o_ptr->tval)
5126 /* Auto-inscription/destroy */
5127 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5129 /* Something happened */