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.
20 * @brief プレイヤー周辺の地形を感知する
23 * @param known 地形から危険フラグを外すならTRUE
24 * @return 効力があった場合TRUEを返す
26 static bool detect_feat_flag(POSITION range, int flag, bool known)
32 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
34 /* Scan the current panel */
35 for (y = 1; y < cur_hgt - 1; y++)
37 for (x = 1; x <= cur_wid - 1; x++)
39 int dist = distance(p_ptr->y, p_ptr->x, y, x);
40 if (dist > range) continue;
48 /* Mark as detected */
49 if (dist <= range && known)
51 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
53 c_ptr->info &= ~(CAVE_UNSAFE);
61 if (cave_have_flag_grid(c_ptr, flag))
66 /* Hack -- Memorize */
67 c_ptr->info |= (CAVE_MARK);
84 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
86 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
87 * @return 効力があった場合TRUEを返す
89 bool detect_traps(POSITION range, bool known)
91 bool detect = detect_feat_flag(range, FF_TRAP, known);
93 if (known) p_ptr->dtrap = TRUE;
95 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
100 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
109 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
111 * @return 効力があった場合TRUEを返す
113 bool detect_doors(POSITION range)
115 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
117 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
122 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
131 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
133 * @return 効力があった場合TRUEを返す
135 bool detect_stairs(POSITION range)
137 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
139 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
144 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
153 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
155 * @return 効力があった場合TRUEを返す
157 bool detect_treasure(POSITION range)
159 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
161 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
166 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
175 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
177 * @return 効力があった場合TRUEを返す
179 bool detect_objects_gold(POSITION range)
182 POSITION range2 = range;
186 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
189 for (i = 1; i < o_max; i++)
191 object_type *o_ptr = &o_list[i];
193 /* Skip dead objects */
194 if (!o_ptr->k_idx) continue;
196 /* Skip held objects */
197 if (o_ptr->held_m_idx) continue;
202 /* Only detect nearby objects */
203 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
205 /* Detect "gold" objects */
206 if (o_ptr->tval == TV_GOLD)
208 /* Hack -- memorize it */
209 o_ptr->marked |= OM_FOUND;
219 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
224 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
227 if (detect_monsters_string(range, "$"))
238 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
240 * @return 効力があった場合TRUEを返す
242 bool detect_objects_normal(POSITION range)
245 POSITION range2 = range;
249 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
252 for (i = 1; i < o_max; i++)
254 object_type *o_ptr = &o_list[i];
256 /* Skip dead objects */
257 if (!o_ptr->k_idx) continue;
259 /* Skip held objects */
260 if (o_ptr->held_m_idx) continue;
265 /* Only detect nearby objects */
266 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
268 /* Detect "real" objects */
269 if (o_ptr->tval != TV_GOLD)
271 /* Hack -- memorize it */
272 o_ptr->marked |= OM_FOUND;
282 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
287 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
290 if (detect_monsters_string(range, "!=?|/`"))
301 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
303 * @return 効力があった場合TRUEを返す
306 * This will light up all spaces with "magic" items, including artifacts,
307 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
308 * and "enchanted" items of the "good" variety.
310 * It can probably be argued that this function is now too powerful.
313 bool detect_objects_magic(POSITION range)
319 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
321 /* Scan all objects */
322 for (i = 1; i < o_max; i++)
324 object_type *o_ptr = &o_list[i];
326 /* Skip dead objects */
327 if (!o_ptr->k_idx) continue;
329 /* Skip held objects */
330 if (o_ptr->held_m_idx) continue;
335 /* Only detect nearby objects */
336 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
338 /* Examine the tval */
341 /* Artifacts, misc magic items, or enchanted wearables */
342 if (object_is_artifact(o_ptr) ||
343 object_is_ego(o_ptr) ||
344 (tv == TV_WHISTLE) ||
352 (tv == TV_LIFE_BOOK) ||
353 (tv == TV_SORCERY_BOOK) ||
354 (tv == TV_NATURE_BOOK) ||
355 (tv == TV_CHAOS_BOOK) ||
356 (tv == TV_DEATH_BOOK) ||
357 (tv == TV_TRUMP_BOOK) ||
358 (tv == TV_ARCANE_BOOK) ||
359 (tv == TV_CRAFT_BOOK) ||
360 (tv == TV_DAEMON_BOOK) ||
361 (tv == TV_CRUSADE_BOOK) ||
362 (tv == TV_MUSIC_BOOK) ||
363 (tv == TV_HISSATSU_BOOK) ||
364 (tv == TV_HEX_BOOK) ||
365 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
367 /* Memorize the item */
368 o_ptr->marked |= OM_FOUND;
381 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
390 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
392 * @return 効力があった場合TRUEを返す
394 bool detect_monsters_normal(POSITION range)
401 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
404 for (i = 1; i < m_max; i++)
406 monster_type *m_ptr = &m_list[i];
407 monster_race *r_ptr = &r_info[m_ptr->r_idx];
409 /* Skip dead monsters */
410 if (!m_ptr->r_idx) continue;
415 /* Only detect nearby monsters */
416 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
418 /* Detect all non-invisible monsters */
419 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
421 /* Repair visibility later */
422 repair_monsters = TRUE;
424 /* Hack -- Detect monster */
425 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
427 /* Update the monster */
428 update_mon(i, FALSE);
435 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
440 /* Describe result */
441 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
450 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
452 * @return 効力があった場合TRUEを返す
454 bool detect_monsters_invis(POSITION range)
460 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
463 for (i = 1; i < m_max; i++)
465 monster_type *m_ptr = &m_list[i];
466 monster_race *r_ptr = &r_info[m_ptr->r_idx];
468 /* Skip dead monsters */
469 if (!m_ptr->r_idx) continue;
474 /* Only detect nearby monsters */
475 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
477 /* Detect invisible monsters */
478 if (r_ptr->flags2 & RF2_INVISIBLE)
480 /* Update monster recall window */
481 if (p_ptr->monster_race_idx == m_ptr->r_idx)
483 p_ptr->window |= (PW_MONSTER);
486 /* Repair visibility later */
487 repair_monsters = TRUE;
489 /* Hack -- Detect monster */
490 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
492 /* Update the monster */
493 update_mon(i, FALSE);
500 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
505 /* Describe result */
506 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
514 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
516 * @return 効力があった場合TRUEを返す
518 bool detect_monsters_evil(POSITION range)
524 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
527 for (i = 1; i < m_max; i++)
529 monster_type *m_ptr = &m_list[i];
530 monster_race *r_ptr = &r_info[m_ptr->r_idx];
532 /* Skip dead monsters */
533 if (!m_ptr->r_idx) continue;
538 /* Only detect nearby monsters */
539 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
541 /* Detect evil monsters */
542 if (r_ptr->flags3 & RF3_EVIL)
544 if (is_original_ap(m_ptr))
546 /* Take note that they are evil */
547 r_ptr->r_flags3 |= (RF3_EVIL);
549 /* Update monster recall window */
550 if (p_ptr->monster_race_idx == m_ptr->r_idx)
552 p_ptr->window |= (PW_MONSTER);
556 /* Repair visibility later */
557 repair_monsters = TRUE;
559 /* Hack -- Detect monster */
560 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
562 /* Update the monster */
563 update_mon(i, FALSE);
573 /* Describe result */
574 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
582 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
584 * @return 効力があった場合TRUEを返す
586 bool detect_monsters_nonliving(POSITION range)
592 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
595 for (i = 1; i < m_max; i++)
597 monster_type *m_ptr = &m_list[i];
598 monster_race *r_ptr = &r_info[m_ptr->r_idx];
600 /* Skip dead monsters */
601 if (!m_ptr->r_idx) continue;
606 /* Only detect nearby monsters */
607 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
609 /* Detect non-living monsters */
610 if (!monster_living(r_ptr))
612 /* Update monster recall window */
613 if (p_ptr->monster_race_idx == m_ptr->r_idx)
615 p_ptr->window |= (PW_MONSTER);
618 /* Repair visibility later */
619 repair_monsters = TRUE;
621 /* Hack -- Detect monster */
622 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
624 /* Update the monster */
625 update_mon(i, FALSE);
635 /* Describe result */
636 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
644 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
646 * @return 効力があった場合TRUEを返す
648 bool detect_monsters_mind(POSITION range)
654 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
657 for (i = 1; i < m_max; i++)
659 monster_type *m_ptr = &m_list[i];
660 monster_race *r_ptr = &r_info[m_ptr->r_idx];
662 /* Skip dead monsters */
663 if (!m_ptr->r_idx) continue;
668 /* Only detect nearby monsters */
669 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
671 /* Detect non-living monsters */
672 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
674 /* Update monster recall window */
675 if (p_ptr->monster_race_idx == m_ptr->r_idx)
677 p_ptr->window |= (PW_MONSTER);
680 /* Repair visibility later */
681 repair_monsters = TRUE;
683 /* Hack -- Detect monster */
684 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
686 /* Update the monster */
687 update_mon(i, FALSE);
697 /* Describe result */
698 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
707 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
709 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
710 * @return 効力があった場合TRUEを返す
712 bool detect_monsters_string(POSITION range, cptr Match)
718 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
721 for (i = 1; i < m_max; i++)
723 monster_type *m_ptr = &m_list[i];
724 monster_race *r_ptr = &r_info[m_ptr->r_idx];
726 /* Skip dead monsters */
727 if (!m_ptr->r_idx) continue;
732 /* Only detect nearby monsters */
733 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
735 /* Detect monsters with the same symbol */
736 if (my_strchr(Match, r_ptr->d_char))
738 /* Update monster recall window */
739 if (p_ptr->monster_race_idx == m_ptr->r_idx)
741 p_ptr->window |= (PW_MONSTER);
744 /* Repair visibility later */
745 repair_monsters = TRUE;
747 /* Hack -- Detect monster */
748 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
750 /* Update the monster */
751 update_mon(i, FALSE);
758 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
763 /* Describe result */
764 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
772 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
774 * @param match_flag 感知フラグ
775 * @return 効力があった場合TRUEを返す
777 bool detect_monsters_xxx(POSITION range, u32b match_flag)
782 cptr desc_monsters = _("変なモンスター", "weird monsters");
784 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
787 for (i = 1; i < m_max; i++)
789 monster_type *m_ptr = &m_list[i];
790 monster_race *r_ptr = &r_info[m_ptr->r_idx];
792 /* Skip dead monsters */
793 if (!m_ptr->r_idx) continue;
798 /* Only detect nearby monsters */
799 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
801 /* Detect evil monsters */
802 if (r_ptr->flags3 & (match_flag))
804 if (is_original_ap(m_ptr))
806 /* Take note that they are something */
807 r_ptr->r_flags3 |= (match_flag);
809 /* Update monster recall window */
810 if (p_ptr->monster_race_idx == m_ptr->r_idx)
812 p_ptr->window |= (PW_MONSTER);
816 /* Repair visibility later */
817 repair_monsters = TRUE;
819 /* Hack -- Detect monster */
820 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
822 /* Update the monster */
823 update_mon(i, FALSE);
836 desc_monsters = _("デーモン", "demons");
839 desc_monsters = _("アンデッド", "the undead");
843 /* Describe result */
844 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
854 * @brief 全感知処理 / Detect everything
856 * @return 効力があった場合TRUEを返す
858 bool detect_all(POSITION range)
862 /* Detect everything */
863 if (detect_traps(range, TRUE)) detect = TRUE;
864 if (detect_doors(range)) detect = TRUE;
865 if (detect_stairs(range)) detect = TRUE;
867 /* There are too many hidden treasure. So... */
868 /* if (detect_treasure(range)) detect = TRUE; */
870 if (detect_objects_gold(range)) detect = TRUE;
871 if (detect_objects_normal(range)) detect = TRUE;
872 if (detect_monsters_invis(range)) detect = TRUE;
873 if (detect_monsters_normal(range)) detect = TRUE;
881 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
884 * @return 効力があった場合TRUEを返す
887 * Note that affected monsters are NOT auto-tracked by this usage.
889 * To avoid misbehavior when monster deaths have side-effects,
890 * this is done in two passes. -- JDL
893 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
897 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
898 bool obvious = FALSE;
901 /* Mark all (nearby) monsters */
902 for (i = 1; i < m_max; i++)
904 monster_type *m_ptr = &m_list[i];
906 /* Paranoia -- Skip dead monsters */
907 if (!m_ptr->r_idx) continue;
912 /* Require line of sight */
913 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
915 /* Mark the monster */
916 m_ptr->mflag |= (MFLAG_TEMP);
919 /* Affect all marked monsters */
920 for (i = 1; i < m_max; i++)
922 monster_type *m_ptr = &m_list[i];
924 /* Skip unmarked monsters */
925 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
928 m_ptr->mflag &= ~(MFLAG_TEMP);
933 /* Jump directly to the target monster */
934 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
943 * @brief 視界内モンスターを加速する処理 / Speed monsters
944 * @return 効力があった場合TRUEを返す
946 bool speed_monsters(void)
948 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
952 * @brief 視界内モンスターを加速する処理 / Slow monsters
953 * @return 効力があった場合TRUEを返す
955 bool slow_monsters(int power)
957 return (project_hack(GF_OLD_SLOW, power));
961 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
962 * @return 効力があった場合TRUEを返す
964 bool sleep_monsters(int power)
966 return (project_hack(GF_OLD_SLEEP, power));
970 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
971 * @return 効力があった場合TRUEを返す
973 bool banish_evil(int dist)
975 return (project_hack(GF_AWAY_EVIL, dist));
979 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
980 * @return 効力があった場合TRUEを返す
982 bool turn_undead(void)
984 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
986 chg_virtue(V_UNLIFE, -1);
991 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
992 * @return 効力があった場合TRUEを返す
994 bool dispel_undead(HIT_POINT dam)
996 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
998 chg_virtue(V_UNLIFE, -2);
1003 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
1004 * @return 効力があった場合TRUEを返す
1006 bool dispel_evil(HIT_POINT dam)
1008 return (project_hack(GF_DISP_EVIL, dam));
1012 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
1013 * @return 効力があった場合TRUEを返す
1015 bool dispel_good(HIT_POINT dam)
1017 return (project_hack(GF_DISP_GOOD, dam));
1021 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
1022 * @return 効力があった場合TRUEを返す
1024 bool dispel_monsters(HIT_POINT dam)
1026 return (project_hack(GF_DISP_ALL, dam));
1030 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
1031 * @return 効力があった場合TRUEを返す
1033 bool dispel_living(HIT_POINT dam)
1035 return (project_hack(GF_DISP_LIVING, dam));
1039 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
1040 * @return 効力があった場合TRUEを返す
1042 bool dispel_demons(HIT_POINT dam)
1044 return (project_hack(GF_DISP_DEMON, dam));
1048 * @brief 視界内のモンスターに「聖戦」効果を与える処理
1049 * @return 効力があった場合TRUEを返す
1053 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
1057 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
1058 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
1061 void aggravate_monsters(MONSTER_IDX who)
1067 /* Aggravate everyone nearby */
1068 for (i = 1; i < m_max; i++)
1070 monster_type *m_ptr = &m_list[i];
1071 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
1073 /* Paranoia -- Skip dead monsters */
1074 if (!m_ptr->r_idx) continue;
1076 /* Skip aggravating monster (or player) */
1077 if (i == who) continue;
1079 /* Wake up nearby sleeping monsters */
1080 if (m_ptr->cdis < MAX_SIGHT * 2)
1083 if (MON_CSLEEP(m_ptr))
1085 (void)set_monster_csleep(i, 0);
1088 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1091 /* Speed up monsters in line of sight */
1092 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1096 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1102 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1103 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1104 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1109 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1110 * @param m_idx 抹殺するモンスターID
1111 * @param power 抹殺の威力
1112 * @param player_cast プレイヤーの魔法によるものならば TRUE
1113 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1114 * @param spell_name 抹殺効果を起こした魔法の名前
1115 * @return 効力があった場合TRUEを返す
1117 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1119 int msec = delay_factor * delay_factor * delay_factor;
1120 monster_type *m_ptr = &m_list[m_idx];
1121 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1122 bool resist = FALSE;
1124 if (is_pet(m_ptr) && !player_cast) return FALSE;
1126 /* Hack -- Skip Unique Monsters or Quest Monsters */
1127 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1128 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1129 else if (m_idx == p_ptr->riding) resist = TRUE;
1130 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1131 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1132 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1137 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1141 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1142 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1145 delete_monster_idx(m_idx);
1148 if (resist && player_cast)
1150 bool see_m = is_seen(m_ptr);
1153 monster_desc(m_name, m_ptr, 0);
1156 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1158 if (MON_CSLEEP(m_ptr))
1160 (void)set_monster_csleep(m_idx, 0);
1163 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1166 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1170 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1174 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1180 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1183 /* Visual feedback */
1184 move_cursor_relative(p_ptr->y, p_ptr->x);
1187 p_ptr->redraw |= (PR_HP);
1189 p_ptr->window |= (PW_PLAYER);
1198 Term_xtra(TERM_XTRA_DELAY, msec);
1205 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1206 * @param power 抹殺の威力
1207 * @param player_cast プレイヤーの魔法によるものならば TRUE
1208 * @return 効力があった場合TRUEを返す
1210 bool symbol_genocide(int power, bool player_cast)
1214 bool result = FALSE;
1216 /* Prevent genocide in quest levels */
1217 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1222 /* Mega-Hack -- Get a monster symbol */
1223 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1225 /* Delete the monsters of that "type" */
1226 for (i = 1; i < m_max; i++)
1228 monster_type *m_ptr = &m_list[i];
1229 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1231 /* Paranoia -- Skip dead monsters */
1232 if (!m_ptr->r_idx) continue;
1234 /* Skip "wrong" monsters */
1235 if (r_ptr->d_char != typ) continue;
1238 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1243 chg_virtue(V_VITALITY, -2);
1244 chg_virtue(V_CHANCE, -1);
1252 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1253 * @param power 抹殺の威力
1254 * @param player_cast プレイヤーの魔法によるものならば TRUE
1255 * @return 効力があった場合TRUEを返す
1257 bool mass_genocide(int power, bool player_cast)
1260 bool result = FALSE;
1262 /* Prevent mass genocide in quest levels */
1263 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1268 /* Delete the (nearby) monsters */
1269 for (i = 1; i < m_max; i++)
1271 monster_type *m_ptr = &m_list[i];
1273 /* Paranoia -- Skip dead monsters */
1274 if (!m_ptr->r_idx) continue;
1276 /* Skip distant monsters */
1277 if (m_ptr->cdis > MAX_SIGHT) continue;
1280 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1285 chg_virtue(V_VITALITY, -2);
1286 chg_virtue(V_CHANCE, -1);
1294 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1295 * @param power 抹殺の威力
1296 * @param player_cast プレイヤーの魔法によるものならば TRUE
1297 * @return 効力があった場合TRUEを返す
1299 bool mass_genocide_undead(int power, bool player_cast)
1302 bool result = FALSE;
1304 /* Prevent mass genocide in quest levels */
1305 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1310 /* Delete the (nearby) monsters */
1311 for (i = 1; i < m_max; i++)
1313 monster_type *m_ptr = &m_list[i];
1314 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1316 /* Paranoia -- Skip dead monsters */
1317 if (!m_ptr->r_idx) continue;
1319 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1321 /* Skip distant monsters */
1322 if (m_ptr->cdis > MAX_SIGHT) continue;
1325 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1330 chg_virtue(V_UNLIFE, -2);
1331 chg_virtue(V_CHANCE, -1);
1339 * @brief 周辺モンスターを調査する / Probe nearby monsters
1340 * @return 効力があった場合TRUEを返す
1355 /* Probe all (nearby) monsters */
1356 for (i = 1; i < m_max; i++)
1358 monster_type *m_ptr = &m_list[i];
1359 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1361 /* Paranoia -- Skip dead monsters */
1362 if (!m_ptr->r_idx) continue;
1364 /* Require line of sight */
1365 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1367 /* Probe visible monsters */
1372 /* Start the message */
1375 msg_print(_("調査中...", "Probing..."));
1380 if (!is_original_ap(m_ptr))
1382 if (m_ptr->mflag2 & MFLAG2_KAGE)
1383 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1385 m_ptr->ap_r_idx = m_ptr->r_idx;
1386 lite_spot(m_ptr->fy, m_ptr->fx);
1388 /* Get "the monster" or "something" */
1389 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1391 speed = m_ptr->mspeed - 110;
1392 if (MON_FAST(m_ptr)) speed += 10;
1393 if (MON_SLOW(m_ptr)) speed -= 10;
1394 if (ironman_nightmare) speed += 5;
1396 /* Get the monster's alignment */
1397 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1398 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1399 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1400 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1401 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1402 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1403 else align = _("中立", "neutral");
1405 /* Describe the monster */
1406 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1407 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1409 if (r_ptr->next_r_idx)
1411 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1415 strcat(buf, "xxx ");
1418 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1419 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1420 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1421 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1422 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1423 buf[strlen(buf)-1] = '\0';
1426 /* HACK : Add the line to message buffer */
1428 p_ptr->window |= (PW_MESSAGE);
1431 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1434 Term_erase(0, 0, 255);
1436 /* Learn everything about this monster */
1437 if (lore_do_probe(m_ptr->r_idx))
1439 /* Get base name of monster */
1440 strcpy(buf, (r_name + r_ptr->name));
1443 /* Note that we learnt some new flags -Mogami- */
1444 msg_format("%sについてさらに詳しくなった気がする。", buf);
1449 /* Note that we learnt some new flags -Mogami- */
1450 msg_format("You now know more about %s.", buf);
1452 /* Clear -more- prompt */
1467 chg_virtue(V_KNOWLEDGE, 1);
1468 msg_print(_("これで全部です。", "That's all."));
1478 * @brief *破壊*処理を行う / The spell of destruction
1479 * @param y1 破壊の中心Y座標
1480 * @param x1 破壊の中心X座標
1482 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1483 * @return 効力があった場合TRUEを返す
1486 * This spell "deletes" monsters (instead of "killing" them).
1488 * Later we may use one function for both "destruction" and
1489 * "earthquake" by using the "full" to select "destruction".
1492 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1499 /* Prevent destruction of quest levels and town */
1500 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1505 /* Lose monster light */
1506 if (!in_generate) clear_mon_lite();
1508 /* Big area of affect */
1509 for (y = (y1 - r); y <= (y1 + r); y++)
1511 for (x = (x1 - r); x <= (x1 + r); x++)
1513 /* Skip illegal grids */
1514 if (!in_bounds(y, x)) continue;
1516 /* Extract the distance */
1517 k = distance(y1, x1, y, x);
1519 /* Stay in the circle of death */
1520 if (k > r) continue;
1522 /* Access the grid */
1523 c_ptr = &cave[y][x];
1525 /* Lose room and vault */
1526 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1528 /* Lose light and knowledge */
1529 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1531 if (!in_generate) /* Normal */
1534 c_ptr->info &= ~(CAVE_UNSAFE);
1536 /* Hack -- Notice player affect */
1537 if (player_bold(y, x))
1539 /* Hurt the player later */
1542 /* Do not hurt this grid */
1547 /* Hack -- Skip the epicenter */
1548 if ((y == y1) && (x == x1)) continue;
1552 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1553 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1555 if (in_generate) /* In generation */
1557 /* Delete the monster (if any) */
1558 delete_monster(y, x);
1560 else if (r_ptr->flags1 & RF1_QUESTOR)
1562 /* Heal the monster */
1563 m_ptr->hp = m_ptr->maxhp;
1565 /* Try to teleport away quest monsters */
1566 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1570 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1574 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1575 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1578 /* Delete the monster (if any) */
1579 delete_monster(y, x);
1583 /* During generation, destroyed artifacts are "preserved" */
1584 if (preserve_mode || in_generate)
1586 OBJECT_IDX this_o_idx, next_o_idx = 0;
1588 /* Scan all objects in the grid */
1589 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1593 /* Acquire object */
1594 o_ptr = &o_list[this_o_idx];
1596 /* Acquire next object */
1597 next_o_idx = o_ptr->next_o_idx;
1599 /* Hack -- Preserve unknown artifacts */
1600 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1602 /* Mega-Hack -- Preserve the artifact */
1603 a_info[o_ptr->name1].cur_num = 0;
1605 if (in_generate && cheat_peek)
1607 char o_name[MAX_NLEN];
1608 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1609 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1612 else if (in_generate && cheat_peek && o_ptr->art_name)
1614 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1615 "One of the random artifacts was *destroyed* during generation."));
1620 /* Delete objects */
1621 delete_object(y, x);
1623 /* Destroy "non-permanent" grids */
1624 if (!cave_perma_grid(c_ptr))
1626 /* Wall (or floor) type */
1629 if (!in_generate) /* Normal */
1633 /* Create granite wall */
1634 cave_set_feat(y, x, feat_granite);
1638 /* Create quartz vein */
1639 cave_set_feat(y, x, feat_quartz_vein);
1643 /* Create magma vein */
1644 cave_set_feat(y, x, feat_magma_vein);
1649 cave_set_feat(y, x, floor_type[randint0(100)]);
1652 else /* In generation */
1656 /* Create granite wall */
1657 place_extra_grid(c_ptr);
1661 /* Create quartz vein */
1662 c_ptr->feat = feat_quartz_vein;
1666 /* Create magma vein */
1667 c_ptr->feat = feat_magma_vein;
1672 place_floor_grid(c_ptr);
1675 /* Clear garbage of hidden trap or door */
1684 /* Process "re-glowing" */
1685 for (y = (y1 - r); y <= (y1 + r); y++)
1687 for (x = (x1 - r); x <= (x1 + r); x++)
1689 /* Skip illegal grids */
1690 if (!in_bounds(y, x)) continue;
1692 /* Extract the distance */
1693 k = distance(y1, x1, y, x);
1695 /* Stay in the circle of death */
1696 if (k > r) continue;
1698 /* Access the grid */
1699 c_ptr = &cave[y][x];
1701 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1702 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1707 for (i = 0; i < 9; i++)
1709 yy = y + ddy_ddd[i];
1710 xx = x + ddx_ddd[i];
1711 if (!in_bounds2(yy, xx)) continue;
1712 cc_ptr = &cave[yy][xx];
1713 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1715 c_ptr->info |= CAVE_GLOW;
1723 /* Hack -- Affect player */
1726 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1728 /* Blind the player */
1729 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1732 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1738 /* Mega-Hack -- Forget the view and lite */
1739 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1741 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1744 p_ptr->redraw |= (PR_MAP);
1746 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1748 if (p_ptr->special_defense & NINJA_S_STEALTH)
1750 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1760 * @brief 地震処理(サブルーチン) /
1761 * Induce an "earthquake" of the given radius at the given location.
1762 * @return 効力があった場合TRUEを返す
1766 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1770 * This will turn some walls into floors and some floors into walls.
1772 * The player will take damage and "jump" into a safe grid if possible,
1773 * otherwise, he will "tunnel" through the rubble instantaneously.
1775 * Monsters will take damage, and "jump" into a safe grid if possible,
1776 * otherwise they will be "buried" in the rubble, disappearing from
1777 * the level in the same way that they do when genocided.
1779 * Note that thus the player and monsters (except eaters of walls and
1780 * passers through walls) will never occupy the same grid as a wall.
1781 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1782 * for a single turn, unless that monster can pass_walls or kill_walls.
1783 * This has allowed massive simplification of the "monster" code.
1786 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1790 POSITION y, x, yy, xx, dy, dx;
1793 POSITION sy = 0, sx = 0;
1799 /* Prevent destruction of quest levels and town */
1800 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1805 /* Paranoia -- Enforce maximum range */
1808 /* Clear the "maximal blast" area */
1809 for (y = 0; y < 32; y++)
1811 for (x = 0; x < 32; x++)
1817 /* Check around the epicenter */
1818 for (dy = -r; dy <= r; dy++)
1820 for (dx = -r; dx <= r; dx++)
1822 /* Extract the location */
1826 /* Skip illegal grids */
1827 if (!in_bounds(yy, xx)) continue;
1829 /* Skip distant grids */
1830 if (distance(cy, cx, yy, xx) > r) continue;
1832 /* Access the grid */
1833 c_ptr = &cave[yy][xx];
1835 /* Lose room and vault */
1836 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1838 /* Lose light and knowledge */
1839 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1841 /* Skip the epicenter */
1842 if (!dx && !dy) continue;
1844 /* Skip most grids */
1845 if (randint0(100) < 85) continue;
1847 /* Damage this grid */
1848 map[16+yy-cy][16+xx-cx] = TRUE;
1850 /* Hack -- Take note of player damage */
1851 if (player_bold(yy, xx)) hurt = TRUE;
1855 /* First, affect the player (if necessary) */
1856 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1858 /* Check around the player */
1859 for (i = 0; i < 8; i++)
1861 /* Access the location */
1862 y = p_ptr->y + ddy_ddd[i];
1863 x = p_ptr->x + ddx_ddd[i];
1865 /* Skip non-empty grids */
1866 if (!cave_empty_bold(y, x)) continue;
1868 /* Important -- Skip "quake" grids */
1869 if (map[16+y-cy][16+x-cx]) continue;
1871 if (cave[y][x].m_idx) continue;
1873 /* Count "safe" grids */
1876 /* Randomize choice */
1877 if (randint0(sn) > 0) continue;
1879 /* Save the safe location */
1883 /* Random message */
1884 switch (randint1(3))
1888 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1893 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1898 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1903 /* Hurt the player a lot */
1906 /* Message and damage */
1907 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1911 /* Destroy the grid, and push the player to safety */
1914 /* Calculate results */
1915 switch (randint1(3))
1919 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1925 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1926 damage = damroll(10, 4);
1927 (void)set_stun(p_ptr->stun + randint1(50));
1932 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1933 damage = damroll(10, 4);
1934 (void)set_stun(p_ptr->stun + randint1(50));
1939 /* Move the player to the safe location */
1940 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1943 /* Important -- no wall on player */
1944 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1946 /* Take some damage */
1954 monster_type *m_ptr = &m_list[m_idx];
1956 /* Get the monster's real name */
1957 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1959 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1963 killer = _("地震", "an earthquake");
1966 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1970 /* Examine the quaked region */
1971 for (dy = -r; dy <= r; dy++)
1973 for (dx = -r; dx <= r; dx++)
1975 /* Extract the location */
1979 /* Skip unaffected grids */
1980 if (!map[16+yy-cy][16+xx-cx]) continue;
1982 /* Access the grid */
1983 c_ptr = &cave[yy][xx];
1985 if (c_ptr->m_idx == p_ptr->riding) continue;
1987 /* Process monsters */
1990 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1991 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1993 /* Quest monsters */
1994 if (r_ptr->flags1 & RF1_QUESTOR)
1996 /* No wall on quest monsters */
1997 map[16+yy-cy][16+xx-cx] = FALSE;
2002 /* Most monsters cannot co-exist with rock */
2003 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
2004 !(r_ptr->flags2 & (RF2_PASS_WALL)))
2008 /* Assume not safe */
2011 /* Monster can move to escape the wall */
2012 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
2014 /* Look for safety */
2015 for (i = 0; i < 8; i++)
2017 /* Access the grid */
2018 y = yy + ddy_ddd[i];
2019 x = xx + ddx_ddd[i];
2021 /* Skip non-empty grids */
2022 if (!cave_empty_bold(y, x)) continue;
2024 /* Hack -- no safety on glyph of warding */
2025 if (is_glyph_grid(&cave[y][x])) continue;
2026 if (is_explosive_rune_grid(&cave[y][x])) continue;
2028 /* ... nor on the Pattern */
2029 if (pattern_tile(y, x)) continue;
2031 /* Important -- Skip "quake" grids */
2032 if (map[16+y-cy][16+x-cx]) continue;
2034 if (cave[y][x].m_idx) continue;
2035 if (player_bold(y, x)) continue;
2037 /* Count "safe" grids */
2040 /* Randomize choice */
2041 if (randint0(sn) > 0) continue;
2043 /* Save the safe grid */
2048 /* Describe the monster */
2049 monster_desc(m_name, m_ptr, 0);
2051 /* Scream in pain */
2052 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
2054 /* Take damage from the quake */
2055 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
2057 /* Monster is certainly awake */
2058 (void)set_monster_csleep(c_ptr->m_idx, 0);
2060 /* Apply damage directly */
2061 m_ptr->hp -= damage;
2063 /* Delete (not kill) "dead" monsters */
2066 if (!ignore_unview || is_seen(m_ptr))
2067 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
2071 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
2075 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
2076 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
2081 delete_monster(yy, xx);
2083 /* No longer safe */
2087 /* Hack -- Escape from the rock */
2090 IDX m_idx_aux = cave[yy][xx].m_idx;
2092 /* Update the old location */
2093 cave[yy][xx].m_idx = 0;
2095 /* Update the new location */
2096 cave[sy][sx].m_idx = m_idx_aux;
2098 /* Move the monster */
2102 /* Update the monster (new location) */
2103 update_mon(m_idx, TRUE);
2105 /* Redraw the old grid */
2108 /* Redraw the new grid */
2116 /* Lose monster light */
2119 /* Examine the quaked region */
2120 for (dy = -r; dy <= r; dy++)
2122 for (dx = -r; dx <= r; dx++)
2124 /* Extract the location */
2128 /* Skip unaffected grids */
2129 if (!map[16+yy-cy][16+xx-cx]) continue;
2131 /* Access the cave grid */
2132 c_ptr = &cave[yy][xx];
2134 /* Paranoia -- never affect player */
2135 /* if (player_bold(yy, xx)) continue; */
2137 /* Destroy location (if valid) */
2138 if (cave_valid_bold(yy, xx))
2140 /* Delete objects */
2141 delete_object(yy, xx);
2143 /* Wall (or floor) type */
2144 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2149 /* Create granite wall */
2150 cave_set_feat(yy, xx, feat_granite);
2156 /* Create quartz vein */
2157 cave_set_feat(yy, xx, feat_quartz_vein);
2163 /* Create magma vein */
2164 cave_set_feat(yy, xx, feat_magma_vein);
2171 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2178 /* Process "re-glowing" */
2179 for (dy = -r; dy <= r; dy++)
2181 for (dx = -r; dx <= r; dx++)
2183 /* Extract the location */
2187 /* Skip illegal grids */
2188 if (!in_bounds(yy, xx)) continue;
2190 /* Skip distant grids */
2191 if (distance(cy, cx, yy, xx) > r) continue;
2193 /* Access the grid */
2194 c_ptr = &cave[yy][xx];
2196 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2197 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2202 for (ii = 0; ii < 9; ii++)
2204 yyy = yy + ddy_ddd[ii];
2205 xxx = xx + ddx_ddd[ii];
2206 if (!in_bounds2(yyy, xxx)) continue;
2207 cc_ptr = &cave[yyy][xxx];
2208 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2210 c_ptr->info |= CAVE_GLOW;
2219 /* Mega-Hack -- Forget the view and lite */
2220 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2222 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2224 /* Update the health bar */
2225 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2228 p_ptr->redraw |= (PR_MAP);
2230 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2232 if (p_ptr->special_defense & NINJA_S_STEALTH)
2234 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2242 * @brief 地震処理(プレイヤーの中心発動) /
2243 * Induce an "earthquake" of the given radius at the given location.
2244 * @return 効力があった場合TRUEを返す
2249 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2251 return earthquake_aux(cy, cx, r, 0);
2258 void discharge_minion(void)
2263 for (i = 1; i < m_max; i++)
2265 monster_type *m_ptr = &m_list[i];
2266 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2267 if (m_ptr->nickname) okay = FALSE;
2269 if (!okay || p_ptr->riding)
2271 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2274 for (i = 1; i < m_max; i++)
2277 monster_type *m_ptr = &m_list[i];
2278 monster_race *r_ptr;
2280 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2281 r_ptr = &r_info[m_ptr->r_idx];
2283 /* Uniques resist discharging */
2284 if (r_ptr->flags1 & RF1_UNIQUE)
2287 monster_desc(m_name, m_ptr, 0x00);
2288 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2289 delete_monster_idx(i);
2292 dam = m_ptr->maxhp / 2;
2293 if (dam > 100) dam = (dam-100)/2 + 100;
2294 if (dam > 400) dam = (dam-400)/2 + 400;
2295 if (dam > 800) dam = 800;
2296 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2297 m_ptr->fx, dam, GF_PLASMA,
2298 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2300 if (record_named_pet && m_ptr->nickname)
2304 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2305 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2308 delete_monster_idx(i);
2314 * @brief 部屋全体を照らすサブルーチン
2318 * This routine clears the entire "temp" set.
2319 * This routine will Perma-Lite all "temp" grids.
2320 * This routine is used (only) by "lite_room()"
2321 * Dark grids are illuminated.
2322 * Also, process all affected monsters.
2324 * SMART monsters always wake up when illuminated
2325 * NORMAL monsters wake up 1/4 the time when illuminated
2326 * STUPID monsters wake up 1/10 the time when illuminated
2329 static void cave_temp_room_lite(void)
2333 /* Clear them all */
2334 for (i = 0; i < temp_n; i++)
2336 POSITION y = temp_y[i];
2337 POSITION x = temp_x[i];
2339 cave_type *c_ptr = &cave[y][x];
2341 /* No longer in the array */
2342 c_ptr->info &= ~(CAVE_TEMP);
2344 /* Update only non-CAVE_GLOW grids */
2345 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2348 c_ptr->info |= (CAVE_GLOW);
2350 /* Process affected monsters */
2355 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2357 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2359 /* Update the monster */
2360 update_mon(c_ptr->m_idx, FALSE);
2362 /* Stupid monsters rarely wake up */
2363 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2365 /* Smart monsters always wake up */
2366 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2368 /* Sometimes monsters wake up */
2369 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2372 (void)set_monster_csleep(c_ptr->m_idx, 0);
2374 /* Notice the "waking up" */
2379 /* Acquire the monster name */
2380 monster_desc(m_name, m_ptr, 0);
2382 /* Dump a message */
2383 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2394 update_local_illumination(y, x);
2404 * @brief 部屋全体を暗くするサブルーチン
2408 * This routine clears the entire "temp" set.
2409 * This routine will "darken" all "temp" grids.
2410 * In addition, some of these grids will be "unmarked".
2411 * This routine is used (only) by "unlite_room()"
2412 * Also, process all affected monsters
2415 static void cave_temp_room_unlite(void)
2419 /* Clear them all */
2420 for (i = 0; i < temp_n; i++)
2422 POSITION y = temp_y[i];
2423 POSITION x = temp_x[i];
2426 cave_type *c_ptr = &cave[y][x];
2427 bool do_dark = !is_mirror_grid(c_ptr);
2429 /* No longer in the array */
2430 c_ptr->info &= ~(CAVE_TEMP);
2432 /* Darken the grid */
2435 if (dun_level || !is_daytime())
2437 for (j = 0; j < 9; j++)
2439 int by = y + ddy_ddd[j];
2440 int bx = x + ddx_ddd[j];
2442 if (in_bounds2(by, bx))
2444 cave_type *cc_ptr = &cave[by][bx];
2446 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2454 if (!do_dark) continue;
2457 c_ptr->info &= ~(CAVE_GLOW);
2459 /* Hack -- Forget "boring" grids */
2460 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2462 /* Forget the grid */
2463 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2469 /* Process affected monsters */
2472 /* Update the monster */
2473 update_mon(c_ptr->m_idx, FALSE);
2479 update_local_illumination(y, x);
2489 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2492 * @param pass_bold 地形条件を返す関数ポインタ
2495 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2502 for (i = 0; i < 16; i++)
2504 y = cy + ddy_cdd[i % 8];
2505 x = cx + ddx_cdd[i % 8];
2507 /* Found a wall, break the length */
2508 if (!pass_bold(y, x))
2510 /* Track best length */
2524 return (MAX(len, blen));
2528 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2531 * @param pass_bold 地形条件を返す関数ポインタ
2534 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2540 for (i = 0; i < 8; i++)
2542 y = cy + ddy_ddd[i];
2543 x = cx + ddx_ddd[i];
2545 if (!pass_bold(y, x)) c++;
2553 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2554 * @param y 部屋内のy座標1点
2555 * @param x 部屋内のx座標1点
2556 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2557 * @param pass_bold 地形条件を返す関数ポインタ
2560 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2565 c_ptr = &cave[y][x];
2567 /* Avoid infinite recursion */
2568 if (c_ptr->info & (CAVE_TEMP)) return;
2570 /* Do not "leave" the current room */
2571 if (!(c_ptr->info & (CAVE_ROOM)))
2573 if (only_room) return;
2576 if (!in_bounds2(y, x)) return;
2578 /* Do not exceed the maximum spell range */
2579 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2581 /* Verify this grid */
2583 * The reason why it is ==6 instead of >5 is that 8 is impossible
2584 * due to the check for cave_bold above.
2585 * 7 lights dead-end corridors (you need to do this for the
2586 * checkboard interesting rooms, so that the boundary is lit
2588 * This leaves only a check for 6 bounding walls!
2590 if (in_bounds(y, x) && pass_bold(y, x) &&
2591 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2594 /* Paranoia -- verify space */
2595 if (temp_n == TEMP_MAX) return;
2597 /* Mark the grid as "seen" */
2598 c_ptr->info |= (CAVE_TEMP);
2600 /* Add it to the "seen" set */
2607 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2610 * @return 光を通すならばtrueを返す。
2612 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2614 return cave_los_bold(y, x);
2618 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2623 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2625 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2629 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2632 * @return 射線を通すならばtrueを返す。
2634 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2636 return cave_have_flag_bold(y, x, FF_PROJECT);
2641 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2646 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2648 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2653 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2658 void lite_room(POSITION y1, POSITION x1)
2663 /* Add the initial grid */
2664 cave_temp_lite_room_aux(y1, x1);
2666 /* While grids are in the queue, add their neighbors */
2667 for (i = 0; i < temp_n; i++)
2669 x = temp_x[i], y = temp_y[i];
2671 /* Walls get lit, but stop light */
2672 if (!cave_pass_lite_bold(y, x)) continue;
2674 /* Spread adjacent */
2675 cave_temp_lite_room_aux(y + 1, x);
2676 cave_temp_lite_room_aux(y - 1, x);
2677 cave_temp_lite_room_aux(y, x + 1);
2678 cave_temp_lite_room_aux(y, x - 1);
2680 /* Spread diagonal */
2681 cave_temp_lite_room_aux(y + 1, x + 1);
2682 cave_temp_lite_room_aux(y - 1, x - 1);
2683 cave_temp_lite_room_aux(y - 1, x + 1);
2684 cave_temp_lite_room_aux(y + 1, x - 1);
2687 /* Now, lite them all up at once */
2688 cave_temp_room_lite();
2690 if (p_ptr->special_defense & NINJA_S_STEALTH)
2692 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2698 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2703 void unlite_room(POSITION y1, POSITION x1)
2708 /* Add the initial grid */
2709 cave_temp_unlite_room_aux(y1, x1);
2711 /* Spread, breadth first */
2712 for (i = 0; i < temp_n; i++)
2714 x = temp_x[i], y = temp_y[i];
2716 /* Walls get dark, but stop darkness */
2717 if (!cave_pass_dark_bold(y, x)) continue;
2719 /* Spread adjacent */
2720 cave_temp_unlite_room_aux(y + 1, x);
2721 cave_temp_unlite_room_aux(y - 1, x);
2722 cave_temp_unlite_room_aux(y, x + 1);
2723 cave_temp_unlite_room_aux(y, x - 1);
2725 /* Spread diagonal */
2726 cave_temp_unlite_room_aux(y + 1, x + 1);
2727 cave_temp_unlite_room_aux(y - 1, x - 1);
2728 cave_temp_unlite_room_aux(y - 1, x + 1);
2729 cave_temp_unlite_room_aux(y + 1, x - 1);
2732 /* Now, darken them all at once */
2733 cave_temp_room_unlite();
2739 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2742 * @return 作用が実際にあった場合TRUEを返す
2744 bool lite_area(HIT_POINT dam, POSITION rad)
2746 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2748 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2750 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2754 /* Hack -- Message */
2757 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2760 /* Hook into the "project()" function */
2761 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2763 /* Lite up the room */
2764 lite_room(p_ptr->y, p_ptr->x);
2772 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2775 * @return 作用が実際にあった場合TRUEを返す
2777 bool unlite_area(HIT_POINT dam, POSITION rad)
2779 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2781 /* Hack -- Message */
2784 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2787 /* Hook into the "project()" function */
2788 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2790 /* Lite up the room */
2791 unlite_room(p_ptr->y, p_ptr->x);
2800 * @brief ボール系スペルの発動 / Cast a ball spell
2802 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2805 * @return 作用が実際にあった場合TRUEを返す
2808 * Stop if we hit a monster, act as a "ball"
2809 * Allow "target" mode to pass over monsters
2810 * Affect grids, objects, and monsters
2813 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2817 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2819 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2820 /* Use the given direction */
2821 tx = p_ptr->x + 99 * ddx[dir];
2822 ty = p_ptr->y + 99 * ddy[dir];
2824 /* Hack -- Use an actual "target" */
2825 if ((dir == 5) && target_okay())
2827 flg &= ~(PROJECT_STOP);
2832 /* Analyze the "dir" and the "target". Hurt items on floor. */
2833 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2837 * @brief ブレス系スペルの発動 / Cast a breath spell
2839 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2842 * @return 作用が実際にあった場合TRUEを返す
2845 * Stop if we hit a monster, act as a "ball"
2846 * Allow "target" mode to pass over monsters
2847 * Affect grids, objects, and monsters
2850 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2852 return fire_ball(typ, dir, dam, -rad);
2857 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2859 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2862 * @return 作用が実際にあった場合TRUEを返す
2865 * Stop if we hit a monster, act as a "ball"
2866 * Allow "target" mode to pass over monsters
2867 * Affect grids, objects, and monsters
2870 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2873 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2875 /* Use the given direction */
2876 tx = p_ptr->x + 99 * ddx[dir];
2877 ty = p_ptr->y + 99 * ddy[dir];
2879 /* Hack -- Use an actual "target" */
2880 if ((dir == 5) && target_okay())
2886 /* Analyze the "dir" and the "target". Hurt items on floor. */
2887 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2892 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2894 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2897 * @return 作用が実際にあった場合TRUEを返す
2900 * Stop if we hit a monster, act as a "ball"
2901 * Allow "target" mode to pass over monsters
2902 * Affect grids, objects, and monsters
2905 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2908 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2910 /* Use the given direction */
2911 tx = p_ptr->x + 99 * ddx[dir];
2912 ty = p_ptr->y + 99 * ddy[dir];
2914 /* Hack -- Use an actual "target" */
2915 if ((dir == 5) && target_okay())
2917 flg &= ~(PROJECT_STOP);
2922 /* Analyze the "dir" and the "target". Hurt items on floor. */
2923 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2928 * @brief メテオ系スペルの発動 / Cast a meteor spell
2929 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2935 * @return 作用が実際にあった場合TRUEを返す
2938 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2939 * player, or outside source, that starts out at an arbitrary location, and
2940 * leaving no trail from the "caster" to the target. This function is
2941 * especially useful for bombardments and similar. -LM-
2942 * Option to hurt the player.
2945 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2947 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2949 /* Analyze the "target" and the caster. */
2950 return (project(who, rad, y, x, dam, typ, flg, -1));
2955 * @brief ブラスト系スペルの発動 / Cast a blast spell
2957 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2962 * @return 作用が実際にあった場合TRUEを返す
2964 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2968 POSITION ty, tx, y, x;
2971 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2976 /* Use the given direction */
2979 ly = ty = p_ptr->y + 20 * ddy[dir];
2980 lx = tx = p_ptr->x + 20 * ddx[dir];
2983 /* Use an actual "target" */
2984 else /* if (dir == 5) */
2989 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2990 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2993 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2996 for (i = 0; i < num; i++)
3000 /* Get targets for some bolts */
3001 y = rand_spread(ly, ld * dev / 20);
3002 x = rand_spread(lx, ld * dev / 20);
3004 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
3007 /* Analyze the "dir" and the "target". */
3008 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
3019 * @brief モンスターとの位置交換処理 / Switch position with a monster.
3020 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3021 * @return 作用が実際にあった場合TRUEを返す
3023 bool teleport_swap(DIRECTION dir)
3027 monster_type* m_ptr;
3028 monster_race* r_ptr;
3030 if ((dir == 5) && target_okay())
3037 tx = p_ptr->x + ddx[dir];
3038 ty = p_ptr->y + ddy[dir];
3040 c_ptr = &cave[ty][tx];
3042 if (p_ptr->anti_tele)
3044 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
3048 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
3050 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
3056 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
3058 msg_print(_("失敗した。", "Failed to swap."));
3064 m_ptr = &m_list[c_ptr->m_idx];
3065 r_ptr = &r_info[m_ptr->r_idx];
3067 (void)set_monster_csleep(c_ptr->m_idx, 0);
3069 if (r_ptr->flagsr & RFR_RES_TELE)
3071 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
3073 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3079 sound(SOUND_TELEPORT);
3081 /* Swap the player and monster */
3082 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
3090 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
3092 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3095 * @return 作用が実際にあった場合TRUEを返す
3097 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
3101 /* Pass through the target if needed */
3102 flg |= (PROJECT_THRU);
3104 /* Use the given direction */
3105 tx = p_ptr->x + ddx[dir];
3106 ty = p_ptr->y + ddy[dir];
3108 /* Hack -- Use an actual "target" */
3109 if ((dir == 5) && target_okay())
3115 /* Analyze the "dir" and the "target", do NOT explode */
3116 return (project(0, 0, ty, tx, dam, typ, flg, -1));
3121 * @brief ボルト系スペルの発動 / Cast a bolt spell.
3123 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3125 * @return 作用が実際にあった場合TRUEを返す
3128 * Stop if we hit a monster, as a "bolt".
3129 * Affect monsters and grids (not objects).
3132 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3134 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3135 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3136 return (project_hook(typ, dir, dam, flg));
3141 * @brief ビーム系スペルの発動 / Cast a beam spell.
3143 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3145 * @return 作用が実際にあった場合TRUEを返す
3148 * Pass through monsters, as a "beam".
3149 * Affect monsters, grids and objects.
3152 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3154 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3155 return (project_hook(typ, dir, dam, flg));
3160 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3161 * @param prob ビーム化する確率(%)
3163 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3165 * @return 作用が実際にあった場合TRUEを返す
3168 * Pass through monsters, as a "beam".
3169 * Affect monsters, grids and objects.
3172 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3174 if (randint0(100) < prob)
3176 return (fire_beam(typ, dir, dam));
3180 return (fire_bolt(typ, dir, dam));
3185 * @brief LITE_WEAK属性による光源ビーム処理
3186 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3188 * @return 作用が実際にあった場合TRUEを返す
3190 bool lite_line(DIRECTION dir, HIT_POINT dam)
3192 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3193 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3198 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3200 * @return 作用が実際にあった場合TRUEを返す
3202 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3204 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3205 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3210 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3212 * @return 作用が実際にあった場合TRUEを返す
3214 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3216 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3217 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3222 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3223 * @return 作用が実際にあった場合TRUEを返す
3225 bool wizard_lock(DIRECTION dir)
3227 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3228 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3233 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3234 * @return 作用が実際にあった場合TRUEを返す
3236 bool destroy_door(DIRECTION dir)
3238 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3239 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3244 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3245 * @return 作用が実際にあった場合TRUEを返す
3247 bool disarm_trap(DIRECTION dir)
3249 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3250 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3255 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3257 * @return 作用が実際にあった場合TRUEを返す
3259 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3261 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3262 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3267 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3269 * @return 作用が実際にあった場合TRUEを返す
3271 bool speed_monster(DIRECTION dir, int power)
3273 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3274 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3279 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3281 * @return 作用が実際にあった場合TRUEを返す
3283 bool slow_monster(DIRECTION dir, int power)
3285 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3286 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3291 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3293 * @return 作用が実際にあった場合TRUEを返す
3295 bool sleep_monster(DIRECTION dir, int power)
3297 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3298 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3302 * @brief モンスター拘束(STASIS)処理
3303 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3304 * @return 作用が実際にあった場合TRUEを返す
3305 * @details 威力はプレイヤーレベル*2に固定
3307 bool stasis_monster(DIRECTION dir)
3309 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3313 * @brief 邪悪なモンスター拘束(STASIS)処理
3314 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3315 * @return 作用が実際にあった場合TRUEを返す
3316 * @details 威力はプレイヤーレベル*2に固定
3318 bool stasis_evil(DIRECTION dir)
3320 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3325 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3326 * @param plev プレイヤーレベル(=効力)
3327 * @return 作用が実際にあった場合TRUEを返す
3329 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3331 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3332 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3337 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3338 * @param plev プレイヤーレベル(=効力)
3339 * @return 作用が実際にあった場合TRUEを返す
3341 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3343 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3344 return (project_hook(GF_STUN, dir, plev, flg));
3348 * @brief チェンジモンスター処理
3349 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3351 * @return 作用が実際にあった場合TRUEを返す
3353 bool poly_monster(DIRECTION dir, int power)
3355 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3356 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3358 chg_virtue(V_CHANCE, 1);
3363 * @brief クローンモンスター処理
3364 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3365 * @return 作用が実際にあった場合TRUEを返す
3367 bool clone_monster(DIRECTION dir)
3369 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3370 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3375 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3376 * @param plev プレイヤーレベル(=効力)
3377 * @return 作用が実際にあった場合TRUEを返す
3379 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3381 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3382 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3387 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3388 * @param plev プレイヤーレベル(効力はplev*200)
3389 * @return 作用が実際にあった場合TRUEを返す
3391 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3393 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3394 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3398 * @brief モンスター用テレポート処理
3399 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3400 * @param distance 移動距離
3401 * @return 作用が実際にあった場合TRUEを返す
3403 bool teleport_monster(DIRECTION dir, int distance)
3405 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3406 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3410 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3411 * @return 作用が実際にあった場合TRUEを返す
3413 bool door_creation(void)
3415 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3416 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3420 * @brief トラップ生成処理(起点から周囲1マス)
3423 * @return 作用が実際にあった場合TRUEを返す
3425 bool trap_creation(POSITION y, POSITION x)
3427 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3428 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3432 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3433 * @return 作用が実際にあった場合TRUEを返す
3435 bool tree_creation(void)
3437 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3438 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3442 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3443 * @return 作用が実際にあった場合TRUEを返す
3445 bool glyph_creation(void)
3447 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3448 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3452 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3453 * @return 作用が実際にあった場合TRUEを返す
3455 bool wall_stone(void)
3457 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3459 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3461 p_ptr->update |= (PU_FLOW);
3464 p_ptr->redraw |= (PR_MAP);
3470 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3471 * @return 作用が実際にあった場合TRUEを返す
3473 bool destroy_doors_touch(void)
3475 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3476 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3480 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3481 * @return 作用が実際にあった場合TRUEを返す
3483 bool disarm_traps_touch(void)
3485 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3486 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3490 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3491 * @return 作用が実際にあった場合TRUEを返す
3493 bool sleep_monsters_touch(void)
3495 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3496 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3501 * @brief 死者復活処理(起点より周囲5マス)
3502 * @param who 術者モンスターID(0ならばプレイヤー)
3505 * @return 作用が実際にあった場合TRUEを返す
3507 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3509 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3510 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3515 * @return 作用が実際にあった場合TRUEを返す
3517 void call_chaos(void)
3519 int Chaos_type, dummy, dir;
3520 PLAYER_LEVEL plev = p_ptr->lev;
3521 bool line_chaos = FALSE;
3523 int hurt_types[31] =
3525 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3526 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3527 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3528 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3529 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3530 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3531 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3532 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3535 Chaos_type = hurt_types[randint0(31)];
3536 if (one_in_(4)) line_chaos = TRUE;
3540 for (dummy = 1; dummy < 10; dummy++)
3545 fire_beam(Chaos_type, dummy, 150);
3547 fire_ball(Chaos_type, dummy, 150, 2);
3551 else if (one_in_(3))
3553 fire_ball(Chaos_type, 0, 500, 8);
3557 if (!get_aim_dir(&dir)) return;
3559 fire_beam(Chaos_type, dir, 250);
3561 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3566 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3567 * @param stop_ty 再帰処理停止フラグ
3569 * @return 作用が実際にあった場合TRUEを返す
3572 * rr9: Stop the nasty things when a Cyberdemon is summoned
3573 * or the player gets paralyzed.
3576 bool activate_ty_curse(bool stop_ty, int *count)
3580 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3584 switch (randint1(34))
3589 msg_print(_("地面が揺れた...", "The ground trembles..."));
3590 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3591 if (!one_in_(6)) break;
3596 HIT_POINT dam = damroll(10, 10);
3597 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3598 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3599 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3600 if (!one_in_(6)) break;
3605 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3606 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3607 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3608 if (!one_in_(6)) break;
3611 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3615 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3616 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3618 if (!one_in_(6)) break;
3619 case 1: case 2: case 3: case 16: case 17:
3620 aggravate_monsters(0);
3621 if (!one_in_(6)) break;
3622 case 4: case 5: case 6:
3623 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3624 if (!one_in_(6)) break;
3625 case 7: case 8: case 9: case 18:
3626 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3627 if (!one_in_(6)) break;
3628 case 10: case 11: case 12:
3629 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3630 lose_exp(p_ptr->exp / 16);
3631 if (!one_in_(6)) break;
3632 case 13: case 14: case 15: case 19: case 20:
3633 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3639 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3640 if (p_ptr->free_act)
3641 set_paralyzed(p_ptr->paralyzed + randint1(3));
3643 set_paralyzed(p_ptr->paralyzed + randint1(13));
3646 if (!one_in_(6)) break;
3647 case 21: case 22: case 23:
3648 (void)do_dec_stat(randint0(6));
3649 if (!one_in_(6)) break;
3651 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3653 if (!one_in_(6)) break;
3656 * Only summon Cyberdemons deep in the dungeon.
3658 if ((dun_level > 65) && !stop_ty)
3660 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3664 if (!one_in_(6)) break;
3670 (void)do_dec_stat(i);
3678 while (one_in_(3) && !stop_ty);
3684 * @brief HI_SUMMON(上級召喚)処理発動
3687 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3688 * @return 作用が実際にあった場合TRUEを返す
3690 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3695 BIT_FLAGS mode = PM_ALLOW_GROUP;
3702 mode |= PM_FORCE_FRIENDLY;
3706 mode |= PM_FORCE_PET;
3711 if (!pet) mode |= PM_NO_PET;
3713 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3715 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3717 switch (randint1(25) + (dun_level / 20))
3720 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3723 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3726 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3729 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3732 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3735 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3738 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3741 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3745 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3749 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3752 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3753 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3756 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3757 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3760 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3763 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3764 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3773 * @brief サイバーデーモンの召喚
3774 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3777 * @return 作用が実際にあった場合TRUEを返す
3779 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3782 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3784 BIT_FLAGS mode = PM_ALLOW_GROUP;
3786 /* Summoned by a monster */
3789 monster_type *m_ptr = &m_list[who];
3790 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3793 if (max_cyber > 4) max_cyber = 4;
3795 for (i = 0; i < max_cyber; i++)
3797 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3804 * @brief 周辺破壊効果(プレイヤー中心)
3805 * @return 作用が実際にあった場合TRUEを返す
3807 void wall_breaker(void)
3810 POSITION y = 0, x = 0;
3811 int attempts = 1000;
3813 if (randint1(80 + p_ptr->lev) < 70)
3817 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3819 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3821 if (!player_bold(y, x)) break;
3824 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3825 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3827 else if (randint1(100) > 30)
3829 earthquake(p_ptr->y, p_ptr->x, 1);
3833 int num = damroll(5, 3);
3835 for (i = 0; i < num; i++)
3839 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3841 if (!player_bold(y, x)) break;
3844 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3845 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3852 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3854 * @return 作用が実際にあった場合TRUEを返す
3856 bool confuse_monsters(HIT_POINT dam)
3858 return (project_hack(GF_OLD_CONF, dam));
3863 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3865 * @return 作用が実際にあった場合TRUEを返す
3867 bool charm_monsters(HIT_POINT dam)
3869 return (project_hack(GF_CHARM, dam));
3874 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3876 * @return 作用が実際にあった場合TRUEを返す
3878 bool charm_animals(HIT_POINT dam)
3880 return (project_hack(GF_CONTROL_ANIMAL, dam));
3885 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3887 * @return 作用が実際にあった場合TRUEを返す
3889 bool stun_monsters(HIT_POINT dam)
3891 return (project_hack(GF_STUN, dam));
3896 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3898 * @return 作用が実際にあった場合TRUEを返す
3900 bool stasis_monsters(HIT_POINT dam)
3902 return (project_hack(GF_STASIS, dam));
3907 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3909 * @return 作用が実際にあった場合TRUEを返す
3911 bool mindblast_monsters(HIT_POINT dam)
3913 return (project_hack(GF_PSI, dam));
3918 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3919 * @param dist 効力(距離)
3920 * @return 作用が実際にあった場合TRUEを返す
3922 bool banish_monsters(int dist)
3924 return (project_hack(GF_AWAY_ALL, dist));
3929 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3931 * @return 作用が実際にあった場合TRUEを返す
3933 bool turn_evil(HIT_POINT dam)
3935 return (project_hack(GF_TURN_EVIL, dam));
3940 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3942 * @return 作用が実際にあった場合TRUEを返す
3944 bool turn_monsters(HIT_POINT dam)
3946 return (project_hack(GF_TURN_ALL, dam));
3951 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3952 * @return 作用が実際にあった場合TRUEを返す
3954 bool deathray_monsters(void)
3956 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3960 * @brief チャーム・モンスター(1体)
3961 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3963 * @return 作用が実際にあった場合TRUEを返す
3965 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3967 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3968 return (project_hook(GF_CHARM, dir, plev, flg));
3972 * @brief アンデッド支配(1体)
3973 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3975 * @return 作用が実際にあった場合TRUEを返す
3977 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3979 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3980 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3985 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3987 * @return 作用が実際にあった場合TRUEを返す
3989 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3991 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3992 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3997 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3999 * @return 作用が実際にあった場合TRUEを返す
4001 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
4003 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4004 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
4010 * @param success 判定成功上の処理ならばTRUE
4011 * @return 作用が実際にあった場合TRUEを返す
4013 bool kawarimi(bool success)
4016 object_type *q_ptr = &forge;
4019 if (p_ptr->is_dead) return FALSE;
4020 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
4021 if (randint0(200) < p_ptr->stun) return FALSE;
4023 if (!success && one_in_(3))
4025 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
4026 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4027 p_ptr->redraw |= (PR_STATUS);
4034 teleport_player(10 + randint1(90), 0L);
4038 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
4040 q_ptr->pval = MON_NINJA;
4042 /* Drop it in the dungeon */
4043 (void)drop_near(q_ptr, -1, y, x);
4046 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
4047 else msg_print("失敗!攻撃を受けてしまった。");
4049 if (success) msg_print("You have turned around just before the attack hit you.");
4050 else msg_print("Failed! You are hit by the attack.");
4053 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4054 p_ptr->redraw |= (PR_STATUS);
4062 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
4063 * @param mdeath 目標モンスターが死亡したかを返す
4064 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
4066 bool rush_attack(bool *mdeath)
4073 bool tmp_mdeath = FALSE;
4076 if (mdeath) *mdeath = FALSE;
4079 if (!get_aim_dir(&dir)) return FALSE;
4081 /* Use the given direction */
4082 tx = p_ptr->x + project_length * ddx[dir];
4083 ty = p_ptr->y + project_length * ddy[dir];
4085 /* Hack -- Use an actual "target" */
4086 if ((dir == 5) && target_okay())
4092 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
4094 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
4097 /* No need to move */
4098 if (!path_n) return TRUE;
4100 /* Use ty and tx as to-move point */
4104 /* Project along the path */
4105 for (i = 0; i < path_n; i++)
4107 monster_type *m_ptr;
4109 int ny = GRID_Y(path_g[i]);
4110 int nx = GRID_X(path_g[i]);
4112 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
4117 /* Go to next grid */
4121 if (!cave[ny][nx].m_idx)
4125 msg_print(_("失敗!", "Failed!"));
4129 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4136 /* Move player before updating the monster */
4137 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4139 /* Update the monster */
4140 update_mon(cave[ny][nx].m_idx, TRUE);
4142 /* Found a monster */
4143 m_ptr = &m_list[cave[ny][nx].m_idx];
4145 if (tm_idx != cave[ny][nx].m_idx)
4148 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4149 m_ptr->ml ? "モンスター" : "何か");
4151 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4154 else if (!player_bold(ty, tx))
4156 /* Hold the monster name */
4159 /* Get the monster name (BEFORE polymorphing) */
4160 monster_desc(m_name, m_ptr, 0);
4161 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4164 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4166 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4171 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4173 if (mdeath) *mdeath = tmp_mdeath;
4179 * @brief 全鏡の消去 / Remove all mirrors in this floor
4180 * @param explode 爆発処理を伴うならばTRUE
4183 void remove_all_mirrors(bool explode)
4187 for (x = 0; x < cur_wid; x++)
4189 for (y = 0; y < cur_hgt; y++)
4191 if (is_mirror_grid(&cave[y][x]))
4193 remove_mirror(y, x);
4195 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4196 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4203 * @brief 『一つの指輪』の効果処理 /
4204 * Hack -- activate the ring of power
4205 * @param dir 発動の方向ID
4208 void ring_of_power(DIRECTION dir)
4210 /* Pick a random effect */
4211 switch (randint1(10))
4216 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4219 /* Decrease all stats (permanently) */
4220 (void)dec_stat(A_STR, 50, TRUE);
4221 (void)dec_stat(A_INT, 50, TRUE);
4222 (void)dec_stat(A_WIS, 50, TRUE);
4223 (void)dec_stat(A_DEX, 50, TRUE);
4224 (void)dec_stat(A_CON, 50, TRUE);
4225 (void)dec_stat(A_CHR, 50, TRUE);
4227 /* Lose some experience (permanently) */
4228 p_ptr->exp -= (p_ptr->exp / 4);
4229 p_ptr->max_exp -= (p_ptr->exp / 4);
4237 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4239 /* Dispel monsters */
4240 dispel_monsters(1000);
4250 fire_ball(GF_MANA, dir, 600, 3);
4261 fire_bolt(GF_MANA, dir, 500);
4269 * @brief 運命の輪、並びにカオス的な効果の発動
4270 * @param spell ランダムな効果を選択するための基準ID
4273 void wild_magic(int spell)
4276 int type = SUMMON_MOLD + randint0(6);
4278 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4279 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4281 switch (randint1(spell) + randint1(8) + 1)
4286 teleport_player(10, TELEPORT_PASSIVE);
4291 teleport_player(100, TELEPORT_PASSIVE);
4295 teleport_player(200, TELEPORT_PASSIVE);
4305 lite_area(damroll(2, 3), 2);
4308 destroy_doors_touch();
4313 sleep_monsters_touch();
4317 trap_creation(p_ptr->y, p_ptr->x);
4326 aggravate_monsters(0);
4329 earthquake(p_ptr->y, p_ptr->x, 5);
4333 (void)gain_random_mutation(0);
4337 apply_disenchant(1);
4343 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4350 while (counter++ < 8)
4352 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4357 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4360 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4365 (void)activate_ty_curse(FALSE, &count);
4374 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4375 * / Drop 10+1d10 meteor ball at random places near the player
4380 void cast_meteor(HIT_POINT dam, POSITION rad)
4383 int b = 10 + randint1(10);
4385 for (i = 0; i < b; i++)
4387 POSITION y = 0, x = 0;
4390 for (count = 0; count <= 20; count++)
4394 x = p_ptr->x - 8 + randint0(17);
4395 y = p_ptr->y - 8 + randint0(17);
4397 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4398 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4400 /* Approximate distance */
4401 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4403 if (d >= 9) continue;
4405 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4406 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4408 /* Valid position */
4412 if (count > 20) continue;
4414 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4420 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4423 * @return ターゲットを指定し、実行したならばTRUEを返す。
4425 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4427 POSITION x, y, tx, ty;
4431 int b = 10 + randint1(10);
4433 if (!get_aim_dir(&dir)) return FALSE;
4435 /* Use the given direction */
4436 tx = p_ptr->x + 99 * ddx[dir];
4437 ty = p_ptr->y + 99 * ddy[dir];
4439 /* Hack -- Use an actual "target" */
4440 if ((dir == 5) && target_okay())
4451 /* Hack -- Stop at the target */
4452 if ((y == ty) && (x == tx)) break;
4456 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4458 /* Stop at maximum range */
4459 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4461 /* Stopped by walls/doors */
4462 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4464 /* Stopped by monsters */
4465 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4467 /* Save the new location */
4474 for (i = 0; i < b; i++)
4476 int count = 20, d = 0;
4482 x = tx - 5 + randint0(11);
4483 y = ty - 5 + randint0(11);
4485 dx = (tx > x) ? (tx - x) : (x - tx);
4486 dy = (ty > y) ? (ty - y) : (y - ty);
4488 /* Approximate distance */
4489 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4490 /* Within the radius */
4494 if (count < 0) continue;
4496 /* Cannot penetrate perm walls */
4497 if (!in_bounds(y, x) ||
4498 cave_stop_disintegration(y, x) ||
4499 !in_disintegration_range(ty, tx, y, x))
4502 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4509 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4513 * This spell should become more useful (more controlled) as the\n
4514 * player gains experience levels. Thus, add 1/5 of the player's\n
4515 * level to the die roll. This eliminates the worst effects later on,\n
4516 * while keeping the results quite random. It also allows some potent\n
4517 * effects only at high level.
4519 void cast_wonder(DIRECTION dir)
4521 PLAYER_LEVEL plev = p_ptr->lev;
4522 int die = randint1(100) + plev / 5;
4523 int vir = virtue_number(V_CHANCE);
4527 if (p_ptr->virtues[vir - 1] > 0)
4529 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4533 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4538 chg_virtue(V_CHANCE, 1);
4542 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4545 if (die < 8) clone_monster(dir);
4546 else if (die < 14) speed_monster(dir, plev);
4547 else if (die < 26) heal_monster(dir, damroll(4, 6));
4548 else if (die < 31) poly_monster(dir, plev);
4550 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4551 damroll(3 + ((plev - 1) / 5), 4));
4552 else if (die < 41) confuse_monster(dir, plev);
4553 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4554 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4556 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4557 damroll(3 + ((plev - 5) / 4), 8));
4559 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4560 damroll(5 + ((plev - 5) / 4), 8));
4562 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4563 damroll(6 + ((plev - 5) / 4), 8));
4565 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4566 damroll(8 + ((plev - 5) / 4), 8));
4567 else if (die < 76) hypodynamic_bolt(dir, 75);
4568 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4569 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4570 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4571 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4572 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4575 earthquake(p_ptr->y, p_ptr->x, 12);
4579 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4583 symbol_genocide(plev + 50, TRUE);
4585 else if (die < 110) dispel_monsters(120);
4588 dispel_monsters(150);
4589 slow_monsters(plev);
4590 sleep_monsters(plev);
4597 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4601 void cast_invoke_spirits(DIRECTION dir)
4603 PLAYER_LEVEL plev = p_ptr->lev;
4604 int die = randint1(100) + plev / 5;
4605 int vir = virtue_number(V_CHANCE);
4609 if (p_ptr->virtues[vir - 1] > 0)
4611 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4615 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4619 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4621 chg_virtue(V_CHANCE, 1);
4625 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4630 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4631 "Oh no! Mouldering forms rise from the earth around you!"));
4633 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4634 chg_virtue(V_UNLIFE, 1);
4638 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4640 set_afraid(p_ptr->afraid + randint1(4) + 4);
4644 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4645 "Your head is invaded by a horde of gibbering spectral voices..."));
4647 set_confused(p_ptr->confused + randint1(4) + 4);
4651 poly_monster(dir, plev);
4655 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4656 damroll(3 + ((plev - 1) / 5), 4));
4660 confuse_monster(dir, plev);
4664 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4668 (void)lite_line(dir, damroll(6, 8));
4672 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4673 damroll(3 + ((plev - 5) / 4), 8));
4677 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4678 damroll(5 + ((plev - 5) / 4), 8));
4682 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4683 damroll(6 + ((plev - 5) / 4), 8));
4687 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4688 damroll(8 + ((plev - 5) / 4), 8));
4692 hypodynamic_bolt(dir, 75);
4696 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4700 fire_ball(GF_ACID, dir, 40 + plev, 2);
4704 fire_ball(GF_ICE, dir, 70 + plev, 3);
4708 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4712 hypodynamic_bolt(dir, 100 + plev);
4716 earthquake(p_ptr->y, p_ptr->x, 12);
4720 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4724 symbol_genocide(plev + 50, TRUE);
4728 dispel_monsters(120);
4732 dispel_monsters(150);
4733 slow_monsters(plev);
4734 sleep_monsters(plev);
4740 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4741 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4746 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4749 void cast_shuffle(void)
4751 PLAYER_LEVEL plev = p_ptr->lev;
4754 int vir = virtue_number(V_CHANCE);
4757 /* Card sharks and high mages get a level bonus */
4758 if ((p_ptr->pclass == CLASS_ROGUE) ||
4759 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4760 (p_ptr->pclass == CLASS_SORCERER))
4761 die = (randint1(110)) + plev / 5;
4763 die = randint1(120);
4768 if (p_ptr->virtues[vir - 1] > 0)
4770 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4774 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4778 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4781 chg_virtue(V_CHANCE, 1);
4785 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4787 for (i = 0; i < randint1(3); i++)
4788 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4792 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4793 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4798 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4799 activate_ty_curse(FALSE, &count);
4803 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4804 aggravate_monsters(0);
4808 msg_print(_("《愚者》だ。", "It's the Fool."));
4814 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4815 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4819 msg_print(_("《月》だ。", "It's the Moon."));
4824 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4825 wild_magic(randint0(32));
4829 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4830 teleport_player(10, TELEPORT_PASSIVE);
4834 msg_print(_("《正義》だ。", "It's Justice."));
4835 set_blessed(p_ptr->lev, FALSE);
4839 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4840 teleport_player(100, TELEPORT_PASSIVE);
4844 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4845 teleport_player(200, TELEPORT_PASSIVE);
4849 msg_print(_("《塔》だ。", "It's the Tower."));
4854 msg_print(_("《節制》だ。", "It's Temperance."));
4855 sleep_monsters_touch();
4859 msg_print(_("《塔》だ。", "It's the Tower."));
4861 earthquake(p_ptr->y, p_ptr->x, 5);
4865 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4866 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4870 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4871 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4875 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4876 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4880 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4881 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4885 msg_print(_("《恋人》だ。", "It's the Lovers."));
4887 if (get_aim_dir(&dir))
4888 charm_monster(dir, MIN(p_ptr->lev, 20));
4892 msg_print(_("《隠者》だ。", "It's the Hermit."));
4897 msg_print(_("《審判》だ。", "It's the Judgement."));
4898 do_cmd_rerate(FALSE);
4899 lose_all_mutations();
4903 msg_print(_("《太陽》だ。", "It's the Sun."));
4904 chg_virtue(V_KNOWLEDGE, 1);
4905 chg_virtue(V_ENLIGHTEN, 1);
4910 msg_print(_("《世界》だ。", "It's the World."));
4911 if (p_ptr->exp < PY_MAX_EXP)
4913 s32b ee = (p_ptr->exp / 25) + 1;
4914 if (ee > 5000) ee = 5000;
4915 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4921 bool_hack life_stream(bool_hack message, bool_hack virtue)
4925 chg_virtue(V_VITALITY, 1);
4926 chg_virtue(V_UNLIFE, -5);
4930 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4933 (void)set_poisoned(0);
4935 (void)set_confused(0);
4939 (void)restore_all_status();
4940 (void)set_shero(0, TRUE);
4947 bool_hack heroism(int base)
4949 bool_hack ident = FALSE;
4950 if(set_afraid(0)) ident = TRUE;
4951 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4952 if(hp_player(10)) ident = TRUE;
4956 bool_hack berserk(int base)
4958 bool_hack ident = FALSE;
4959 if (set_afraid(0)) ident = TRUE;
4960 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4961 if (hp_player(30)) ident = TRUE;
4965 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4967 bool_hack ident = FALSE;
4968 if (hp_player(damroll(dice, sides))) ident = TRUE;
4969 if (set_blind(0)) ident = TRUE;
4970 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4971 if (set_shero(0, TRUE)) ident = TRUE;
4975 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4977 bool_hack ident = FALSE;
4978 if (hp_player(damroll(dice, sides))) ident = TRUE;
4979 if (set_blind(0)) ident = TRUE;
4980 if (set_confused(0)) ident = TRUE;
4981 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4982 if (set_shero(0, TRUE)) ident = TRUE;
4986 bool_hack cure_critical_wounds(HIT_POINT pow)
4988 bool_hack ident = FALSE;
4989 if (hp_player(pow)) ident = TRUE;
4990 if (set_blind(0)) ident = TRUE;
4991 if (set_confused(0)) ident = TRUE;
4992 if (set_poisoned(0)) ident = TRUE;
4993 if (set_stun(0)) ident = TRUE;
4994 if (set_cut(0)) ident = TRUE;
4995 if (set_shero(0, TRUE)) ident = TRUE;
4999 bool_hack true_healing(HIT_POINT pow)
5001 bool_hack ident = FALSE;
5002 if (hp_player(pow)) ident = TRUE;
5003 if (set_blind(0)) ident = TRUE;
5004 if (set_confused(0)) ident = TRUE;
5005 if (set_poisoned(0)) ident = TRUE;
5006 if (set_stun(0)) ident = TRUE;
5007 if (set_cut(0)) ident = TRUE;
5008 if (set_image(0)) ident = TRUE;
5012 bool_hack restore_mana(bool_hack magic_eater)
5014 bool_hack ident = FALSE;
5016 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
5019 for (i = 0; i < EATER_EXT * 2; i++)
5021 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
5022 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;
5024 for (; i < EATER_EXT * 3; i++)
5026 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
5027 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;
5028 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
5030 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5031 p_ptr->window |= (PW_PLAYER);
5034 else if (p_ptr->csp < p_ptr->msp)
5036 p_ptr->csp = p_ptr->msp;
5037 p_ptr->csp_frac = 0;
5038 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5039 p_ptr->redraw |= (PR_MANA);
5040 p_ptr->window |= (PW_PLAYER);
5041 p_ptr->window |= (PW_SPELL);
5048 bool restore_all_status(void)
5051 if (do_res_stat(A_STR)) ident = TRUE;
5052 if (do_res_stat(A_INT)) ident = TRUE;
5053 if (do_res_stat(A_WIS)) ident = TRUE;
5054 if (do_res_stat(A_DEX)) ident = TRUE;
5055 if (do_res_stat(A_CON)) ident = TRUE;
5056 if (do_res_stat(A_CHR)) ident = TRUE;
5061 * @brief 口を使う継続的な処理を中断する
5064 void stop_mouth(void)
5066 if (music_singing_any()) stop_singing();
5067 if (hex_spelling_any()) stop_hex_spell_all();
5071 bool_hack vampirism(void)
5078 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
5080 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
5084 /* Only works on adjacent monsters */
5085 if (!get_rep_dir2(&dir)) return FALSE;
5086 y = p_ptr->y + ddy[dir];
5087 x = p_ptr->x + ddx[dir];
5088 c_ptr = &cave[y][x];
5092 if (!(c_ptr->m_idx))
5094 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
5098 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
5100 dummy = p_ptr->lev * 2;
5102 if (hypodynamic_bolt(dir, dummy))
5104 if (p_ptr->food < PY_FOOD_FULL)
5105 /* No heal if we are "full" */
5106 (void)hp_player(dummy);
5108 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
5110 /* Gain nutritional sustenance: 150/hp drained */
5111 /* A Food ration gives 5000 food points (by contrast) */
5112 /* Don't ever get more than "Full" this way */
5113 /* But if we ARE Gorged, it won't cure us */
5114 dummy = p_ptr->food + MIN(5000, 100 * dummy);
5115 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
5116 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
5119 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
5123 bool panic_hit(void)
5128 if (!get_rep_dir2(&dir)) return FALSE;
5129 y = p_ptr->y + ddy[dir];
5130 x = p_ptr->x + ddx[dir];
5131 if (cave[y][x].m_idx)
5134 if (randint0(p_ptr->skill_dis) < 7)
5135 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5137 teleport_player(30, 0L);
5142 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5150 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5153 * currently this function allows pseudo-id of any object,
5154 * including silly ones like potions & scrolls, which always
5155 * get '{average}'. This should be changed, either to stop such
5156 * items from being pseudo-id'd, or to allow psychometry to
5157 * detect whether the unidentified potion/scroll/etc is
5158 * good (Cure Light Wounds, Restore Strength, etc) or
5159 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5161 bool psychometry(void)
5165 char o_name[MAX_NLEN];
5170 item_tester_no_ryoute = TRUE;
5171 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5172 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5174 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5176 /* Get the item (in the pack) */
5179 o_ptr = &inventory[item];
5182 /* Get the item (on the floor) */
5185 o_ptr = &o_list[0 - item];
5188 /* It is fully known, no information needed */
5189 if (object_is_known(o_ptr))
5191 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5195 /* Check for a feeling */
5196 feel = value_check_aux1(o_ptr);
5198 /* Get an object description */
5199 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5201 /* Skip non-feelings */
5204 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5209 msg_format("%sは%sという感じがする...",
5210 o_name, game_inscriptions[feel]);
5212 msg_format("You feel that the %s %s %s...",
5213 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5214 game_inscriptions[feel]);
5218 /* We have "felt" it */
5219 o_ptr->ident |= (IDENT_SENSE);
5222 o_ptr->feeling = feel;
5224 /* Player touches it */
5225 o_ptr->marked |= OM_TOUCHED;
5227 /* Combine / Reorder the pack (later) */
5228 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5230 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5232 /* Valid "tval" codes */
5233 switch (o_ptr->tval)
5261 /* Auto-inscription/destroy */
5262 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5264 /* Something happened */