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)
484 p_ptr->window |= (PW_MONSTER);
487 /* Repair visibility later */
488 repair_monsters = TRUE;
490 /* Hack -- Detect monster */
491 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
493 /* Update the monster */
494 update_mon(i, FALSE);
501 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
506 /* Describe result */
507 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
515 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
517 * @return 効力があった場合TRUEを返す
519 bool detect_monsters_evil(POSITION range)
525 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
528 for (i = 1; i < m_max; i++)
530 monster_type *m_ptr = &m_list[i];
531 monster_race *r_ptr = &r_info[m_ptr->r_idx];
533 /* Skip dead monsters */
534 if (!m_ptr->r_idx) continue;
539 /* Only detect nearby monsters */
540 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
542 /* Detect evil monsters */
543 if (r_ptr->flags3 & RF3_EVIL)
545 if (is_original_ap(m_ptr))
547 /* Take note that they are evil */
548 r_ptr->r_flags3 |= (RF3_EVIL);
550 /* Update monster recall window */
551 if (p_ptr->monster_race_idx == m_ptr->r_idx)
554 p_ptr->window |= (PW_MONSTER);
558 /* Repair visibility later */
559 repair_monsters = TRUE;
561 /* Hack -- Detect monster */
562 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
564 /* Update the monster */
565 update_mon(i, FALSE);
575 /* Describe result */
576 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
584 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
586 * @return 効力があった場合TRUEを返す
588 bool detect_monsters_nonliving(POSITION range)
594 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
597 for (i = 1; i < m_max; i++)
599 monster_type *m_ptr = &m_list[i];
600 monster_race *r_ptr = &r_info[m_ptr->r_idx];
602 /* Skip dead monsters */
603 if (!m_ptr->r_idx) continue;
608 /* Only detect nearby monsters */
609 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
611 /* Detect non-living monsters */
612 if (!monster_living(r_ptr))
614 /* Update monster recall window */
615 if (p_ptr->monster_race_idx == m_ptr->r_idx)
618 p_ptr->window |= (PW_MONSTER);
621 /* Repair visibility later */
622 repair_monsters = TRUE;
624 /* Hack -- Detect monster */
625 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
627 /* Update the monster */
628 update_mon(i, FALSE);
638 /* Describe result */
639 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
647 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
649 * @return 効力があった場合TRUEを返す
651 bool detect_monsters_mind(POSITION range)
657 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
660 for (i = 1; i < m_max; i++)
662 monster_type *m_ptr = &m_list[i];
663 monster_race *r_ptr = &r_info[m_ptr->r_idx];
665 /* Skip dead monsters */
666 if (!m_ptr->r_idx) continue;
671 /* Only detect nearby monsters */
672 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
674 /* Detect non-living monsters */
675 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
677 /* Update monster recall window */
678 if (p_ptr->monster_race_idx == m_ptr->r_idx)
681 p_ptr->window |= (PW_MONSTER);
684 /* Repair visibility later */
685 repair_monsters = TRUE;
687 /* Hack -- Detect monster */
688 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
690 /* Update the monster */
691 update_mon(i, FALSE);
701 /* Describe result */
702 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
711 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
713 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
714 * @return 効力があった場合TRUEを返す
716 bool detect_monsters_string(POSITION range, cptr Match)
722 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
725 for (i = 1; i < m_max; i++)
727 monster_type *m_ptr = &m_list[i];
728 monster_race *r_ptr = &r_info[m_ptr->r_idx];
730 /* Skip dead monsters */
731 if (!m_ptr->r_idx) continue;
736 /* Only detect nearby monsters */
737 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
739 /* Detect monsters with the same symbol */
740 if (my_strchr(Match, r_ptr->d_char))
742 /* Update monster recall window */
743 if (p_ptr->monster_race_idx == m_ptr->r_idx)
746 p_ptr->window |= (PW_MONSTER);
749 /* Repair visibility later */
750 repair_monsters = TRUE;
752 /* Hack -- Detect monster */
753 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
755 /* Update the monster */
756 update_mon(i, FALSE);
763 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
768 /* Describe result */
769 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
777 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
779 * @param match_flag 感知フラグ
780 * @return 効力があった場合TRUEを返す
782 bool detect_monsters_xxx(POSITION range, u32b match_flag)
787 cptr desc_monsters = _("変なモンスター", "weird monsters");
789 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
792 for (i = 1; i < m_max; i++)
794 monster_type *m_ptr = &m_list[i];
795 monster_race *r_ptr = &r_info[m_ptr->r_idx];
797 /* Skip dead monsters */
798 if (!m_ptr->r_idx) continue;
803 /* Only detect nearby monsters */
804 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
806 /* Detect evil monsters */
807 if (r_ptr->flags3 & (match_flag))
809 if (is_original_ap(m_ptr))
811 /* Take note that they are something */
812 r_ptr->r_flags3 |= (match_flag);
814 /* Update monster recall window */
815 if (p_ptr->monster_race_idx == m_ptr->r_idx)
818 p_ptr->window |= (PW_MONSTER);
822 /* Repair visibility later */
823 repair_monsters = TRUE;
825 /* Hack -- Detect monster */
826 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
828 /* Update the monster */
829 update_mon(i, FALSE);
842 desc_monsters = _("デーモン", "demons");
845 desc_monsters = _("アンデッド", "the undead");
849 /* Describe result */
850 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
860 * @brief 全感知処理 / Detect everything
862 * @return 効力があった場合TRUEを返す
864 bool detect_all(POSITION range)
868 /* Detect everything */
869 if (detect_traps(range, TRUE)) detect = TRUE;
870 if (detect_doors(range)) detect = TRUE;
871 if (detect_stairs(range)) detect = TRUE;
873 /* There are too many hidden treasure. So... */
874 /* if (detect_treasure(range)) detect = TRUE; */
876 if (detect_objects_gold(range)) detect = TRUE;
877 if (detect_objects_normal(range)) detect = TRUE;
878 if (detect_monsters_invis(range)) detect = TRUE;
879 if (detect_monsters_normal(range)) detect = TRUE;
887 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
890 * @return 効力があった場合TRUEを返す
893 * Note that affected monsters are NOT auto-tracked by this usage.
895 * To avoid misbehavior when monster deaths have side-effects,
896 * this is done in two passes. -- JDL
899 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
903 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
904 bool obvious = FALSE;
907 /* Mark all (nearby) monsters */
908 for (i = 1; i < m_max; i++)
910 monster_type *m_ptr = &m_list[i];
912 /* Paranoia -- Skip dead monsters */
913 if (!m_ptr->r_idx) continue;
918 /* Require line of sight */
919 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
921 /* Mark the monster */
922 m_ptr->mflag |= (MFLAG_TEMP);
925 /* Affect all marked monsters */
926 for (i = 1; i < m_max; i++)
928 monster_type *m_ptr = &m_list[i];
930 /* Skip unmarked monsters */
931 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
934 m_ptr->mflag &= ~(MFLAG_TEMP);
939 /* Jump directly to the target monster */
940 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
949 * @brief 視界内モンスターを加速する処理 / Speed monsters
950 * @return 効力があった場合TRUEを返す
952 bool speed_monsters(void)
954 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
958 * @brief 視界内モンスターを加速する処理 / Slow monsters
959 * @return 効力があった場合TRUEを返す
961 bool slow_monsters(int power)
963 return (project_hack(GF_OLD_SLOW, power));
967 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
968 * @return 効力があった場合TRUEを返す
970 bool sleep_monsters(int power)
972 return (project_hack(GF_OLD_SLEEP, power));
976 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
977 * @return 効力があった場合TRUEを返す
979 bool banish_evil(int dist)
981 return (project_hack(GF_AWAY_EVIL, dist));
985 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
986 * @return 効力があった場合TRUEを返す
988 bool turn_undead(void)
990 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
992 chg_virtue(V_UNLIFE, -1);
997 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
998 * @return 効力があった場合TRUEを返す
1000 bool dispel_undead(HIT_POINT dam)
1002 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
1004 chg_virtue(V_UNLIFE, -2);
1009 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
1010 * @return 効力があった場合TRUEを返す
1012 bool dispel_evil(HIT_POINT dam)
1014 return (project_hack(GF_DISP_EVIL, dam));
1018 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
1019 * @return 効力があった場合TRUEを返す
1021 bool dispel_good(HIT_POINT dam)
1023 return (project_hack(GF_DISP_GOOD, dam));
1027 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
1028 * @return 効力があった場合TRUEを返す
1030 bool dispel_monsters(HIT_POINT dam)
1032 return (project_hack(GF_DISP_ALL, dam));
1036 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
1037 * @return 効力があった場合TRUEを返す
1039 bool dispel_living(HIT_POINT dam)
1041 return (project_hack(GF_DISP_LIVING, dam));
1045 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
1046 * @return 効力があった場合TRUEを返す
1048 bool dispel_demons(HIT_POINT dam)
1050 return (project_hack(GF_DISP_DEMON, dam));
1054 * @brief 視界内のモンスターに「聖戦」効果を与える処理
1055 * @return 効力があった場合TRUEを返す
1059 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
1063 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
1064 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
1067 void aggravate_monsters(MONSTER_IDX who)
1073 /* Aggravate everyone nearby */
1074 for (i = 1; i < m_max; i++)
1076 monster_type *m_ptr = &m_list[i];
1077 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
1079 /* Paranoia -- Skip dead monsters */
1080 if (!m_ptr->r_idx) continue;
1082 /* Skip aggravating monster (or player) */
1083 if (i == who) continue;
1085 /* Wake up nearby sleeping monsters */
1086 if (m_ptr->cdis < MAX_SIGHT * 2)
1089 if (MON_CSLEEP(m_ptr))
1091 (void)set_monster_csleep(i, 0);
1094 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1097 /* Speed up monsters in line of sight */
1098 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1102 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1108 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1109 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1110 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1115 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1116 * @param m_idx 抹殺するモンスターID
1117 * @param power 抹殺の威力
1118 * @param player_cast プレイヤーの魔法によるものならば TRUE
1119 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1120 * @param spell_name 抹殺効果を起こした魔法の名前
1121 * @return 効力があった場合TRUEを返す
1123 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1125 int msec = delay_factor * delay_factor * delay_factor;
1126 monster_type *m_ptr = &m_list[m_idx];
1127 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1128 bool resist = FALSE;
1130 if (is_pet(m_ptr) && !player_cast) return FALSE;
1132 /* Hack -- Skip Unique Monsters or Quest Monsters */
1133 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1134 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1135 else if (m_idx == p_ptr->riding) resist = TRUE;
1136 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1137 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1138 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1140 /* Delete the monster */
1143 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1147 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1148 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1151 delete_monster_idx(m_idx);
1154 if (resist && player_cast)
1156 bool see_m = is_seen(m_ptr);
1159 monster_desc(m_name, m_ptr, 0);
1162 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1164 if (MON_CSLEEP(m_ptr))
1166 (void)set_monster_csleep(m_idx, 0);
1169 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1172 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1176 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1180 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1186 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1189 /* Visual feedback */
1190 move_cursor_relative(p_ptr->y, p_ptr->x);
1193 p_ptr->redraw |= (PR_HP);
1196 p_ptr->window |= (PW_PLAYER);
1205 Term_xtra(TERM_XTRA_DELAY, msec);
1212 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1213 * @param power 抹殺の威力
1214 * @param player_cast プレイヤーの魔法によるものならば TRUE
1215 * @return 効力があった場合TRUEを返す
1217 bool symbol_genocide(int power, bool player_cast)
1221 bool result = FALSE;
1223 /* Prevent genocide in quest levels */
1224 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1229 /* Mega-Hack -- Get a monster symbol */
1230 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1232 /* Delete the monsters of that "type" */
1233 for (i = 1; i < m_max; i++)
1235 monster_type *m_ptr = &m_list[i];
1236 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1238 /* Paranoia -- Skip dead monsters */
1239 if (!m_ptr->r_idx) continue;
1241 /* Skip "wrong" monsters */
1242 if (r_ptr->d_char != typ) continue;
1245 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1250 chg_virtue(V_VITALITY, -2);
1251 chg_virtue(V_CHANCE, -1);
1259 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1260 * @param power 抹殺の威力
1261 * @param player_cast プレイヤーの魔法によるものならば TRUE
1262 * @return 効力があった場合TRUEを返す
1264 bool mass_genocide(int power, bool player_cast)
1267 bool result = FALSE;
1269 /* Prevent mass genocide in quest levels */
1270 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1275 /* Delete the (nearby) monsters */
1276 for (i = 1; i < m_max; i++)
1278 monster_type *m_ptr = &m_list[i];
1280 /* Paranoia -- Skip dead monsters */
1281 if (!m_ptr->r_idx) continue;
1283 /* Skip distant monsters */
1284 if (m_ptr->cdis > MAX_SIGHT) continue;
1287 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1292 chg_virtue(V_VITALITY, -2);
1293 chg_virtue(V_CHANCE, -1);
1301 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1302 * @param power 抹殺の威力
1303 * @param player_cast プレイヤーの魔法によるものならば TRUE
1304 * @return 効力があった場合TRUEを返す
1306 bool mass_genocide_undead(int power, bool player_cast)
1309 bool result = FALSE;
1311 /* Prevent mass genocide in quest levels */
1312 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1317 /* Delete the (nearby) monsters */
1318 for (i = 1; i < m_max; i++)
1320 monster_type *m_ptr = &m_list[i];
1321 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1323 /* Paranoia -- Skip dead monsters */
1324 if (!m_ptr->r_idx) continue;
1326 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1328 /* Skip distant monsters */
1329 if (m_ptr->cdis > MAX_SIGHT) continue;
1332 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1337 chg_virtue(V_UNLIFE, -2);
1338 chg_virtue(V_CHANCE, -1);
1346 * @brief 周辺モンスターを調査する / Probe nearby monsters
1347 * @return 効力があった場合TRUEを返す
1362 /* Probe all (nearby) monsters */
1363 for (i = 1; i < m_max; i++)
1365 monster_type *m_ptr = &m_list[i];
1366 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1368 /* Paranoia -- Skip dead monsters */
1369 if (!m_ptr->r_idx) continue;
1371 /* Require line of sight */
1372 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1374 /* Probe visible monsters */
1379 /* Start the message */
1382 msg_print(_("調査中...", "Probing..."));
1387 if (!is_original_ap(m_ptr))
1389 if (m_ptr->mflag2 & MFLAG2_KAGE)
1390 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1392 m_ptr->ap_r_idx = m_ptr->r_idx;
1393 lite_spot(m_ptr->fy, m_ptr->fx);
1395 /* Get "the monster" or "something" */
1396 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1398 speed = m_ptr->mspeed - 110;
1399 if (MON_FAST(m_ptr)) speed += 10;
1400 if (MON_SLOW(m_ptr)) speed -= 10;
1401 if (ironman_nightmare) speed += 5;
1403 /* Get the monster's alignment */
1404 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1405 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1406 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1407 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1408 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1409 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1410 else align = _("中立", "neutral");
1412 /* Describe the monster */
1413 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1414 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1416 if (r_ptr->next_r_idx)
1418 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1422 strcat(buf, "xxx ");
1425 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1426 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1427 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1428 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1429 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1430 buf[strlen(buf)-1] = '\0';
1433 /* HACK : Add the line to message buffer */
1435 p_ptr->window |= (PW_MESSAGE);
1438 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1441 Term_erase(0, 0, 255);
1443 /* Learn everything about this monster */
1444 if (lore_do_probe(m_ptr->r_idx))
1446 /* Get base name of monster */
1447 strcpy(buf, (r_name + r_ptr->name));
1450 /* Note that we learnt some new flags -Mogami- */
1451 msg_format("%sについてさらに詳しくなった気がする。", buf);
1456 /* Note that we learnt some new flags -Mogami- */
1457 msg_format("You now know more about %s.", buf);
1459 /* Clear -more- prompt */
1474 chg_virtue(V_KNOWLEDGE, 1);
1475 msg_print(_("これで全部です。", "That's all."));
1485 * @brief *破壊*処理を行う / The spell of destruction
1486 * @param y1 破壊の中心Y座標
1487 * @param x1 破壊の中心X座標
1489 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1490 * @return 効力があった場合TRUEを返す
1493 * This spell "deletes" monsters (instead of "killing" them).
1495 * Later we may use one function for both "destruction" and
1496 * "earthquake" by using the "full" to select "destruction".
1499 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1506 /* Prevent destruction of quest levels and town */
1507 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1512 /* Lose monster light */
1513 if (!in_generate) clear_mon_lite();
1515 /* Big area of affect */
1516 for (y = (y1 - r); y <= (y1 + r); y++)
1518 for (x = (x1 - r); x <= (x1 + r); x++)
1520 /* Skip illegal grids */
1521 if (!in_bounds(y, x)) continue;
1523 /* Extract the distance */
1524 k = distance(y1, x1, y, x);
1526 /* Stay in the circle of death */
1527 if (k > r) continue;
1529 /* Access the grid */
1530 c_ptr = &cave[y][x];
1532 /* Lose room and vault */
1533 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1535 /* Lose light and knowledge */
1536 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1538 if (!in_generate) /* Normal */
1541 c_ptr->info &= ~(CAVE_UNSAFE);
1543 /* Hack -- Notice player affect */
1544 if (player_bold(y, x))
1546 /* Hurt the player later */
1549 /* Do not hurt this grid */
1554 /* Hack -- Skip the epicenter */
1555 if ((y == y1) && (x == x1)) continue;
1559 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1560 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1562 if (in_generate) /* In generation */
1564 /* Delete the monster (if any) */
1565 delete_monster(y, x);
1567 else if (r_ptr->flags1 & RF1_QUESTOR)
1569 /* Heal the monster */
1570 m_ptr->hp = m_ptr->maxhp;
1572 /* Try to teleport away quest monsters */
1573 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1577 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1581 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1582 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1585 /* Delete the monster (if any) */
1586 delete_monster(y, x);
1590 /* During generation, destroyed artifacts are "preserved" */
1591 if (preserve_mode || in_generate)
1593 OBJECT_IDX this_o_idx, next_o_idx = 0;
1595 /* Scan all objects in the grid */
1596 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1600 /* Acquire object */
1601 o_ptr = &o_list[this_o_idx];
1603 /* Acquire next object */
1604 next_o_idx = o_ptr->next_o_idx;
1606 /* Hack -- Preserve unknown artifacts */
1607 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1609 /* Mega-Hack -- Preserve the artifact */
1610 a_info[o_ptr->name1].cur_num = 0;
1612 if (in_generate && cheat_peek)
1614 char o_name[MAX_NLEN];
1615 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1616 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1619 else if (in_generate && cheat_peek && o_ptr->art_name)
1621 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1622 "One of the random artifacts was *destroyed* during generation."));
1627 /* Delete objects */
1628 delete_object(y, x);
1630 /* Destroy "non-permanent" grids */
1631 if (!cave_perma_grid(c_ptr))
1633 /* Wall (or floor) type */
1636 if (!in_generate) /* Normal */
1640 /* Create granite wall */
1641 cave_set_feat(y, x, feat_granite);
1645 /* Create quartz vein */
1646 cave_set_feat(y, x, feat_quartz_vein);
1650 /* Create magma vein */
1651 cave_set_feat(y, x, feat_magma_vein);
1656 cave_set_feat(y, x, floor_type[randint0(100)]);
1659 else /* In generation */
1663 /* Create granite wall */
1664 place_extra_grid(c_ptr);
1668 /* Create quartz vein */
1669 c_ptr->feat = feat_quartz_vein;
1673 /* Create magma vein */
1674 c_ptr->feat = feat_magma_vein;
1679 place_floor_grid(c_ptr);
1682 /* Clear garbage of hidden trap or door */
1691 /* Process "re-glowing" */
1692 for (y = (y1 - r); y <= (y1 + r); y++)
1694 for (x = (x1 - r); x <= (x1 + r); x++)
1696 /* Skip illegal grids */
1697 if (!in_bounds(y, x)) continue;
1699 /* Extract the distance */
1700 k = distance(y1, x1, y, x);
1702 /* Stay in the circle of death */
1703 if (k > r) continue;
1705 /* Access the grid */
1706 c_ptr = &cave[y][x];
1708 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1709 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1714 for (i = 0; i < 9; i++)
1716 yy = y + ddy_ddd[i];
1717 xx = x + ddx_ddd[i];
1718 if (!in_bounds2(yy, xx)) continue;
1719 cc_ptr = &cave[yy][xx];
1720 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1722 c_ptr->info |= CAVE_GLOW;
1730 /* Hack -- Affect player */
1733 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1735 /* Blind the player */
1736 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1739 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1745 /* Mega-Hack -- Forget the view and lite */
1746 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1748 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1751 p_ptr->redraw |= (PR_MAP);
1754 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1756 if (p_ptr->special_defense & NINJA_S_STEALTH)
1758 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1768 * @brief 地震処理(サブルーチン) /
1769 * Induce an "earthquake" of the given radius at the given location.
1770 * @return 効力があった場合TRUEを返す
1774 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1778 * This will turn some walls into floors and some floors into walls.
1780 * The player will take damage and "jump" into a safe grid if possible,
1781 * otherwise, he will "tunnel" through the rubble instantaneously.
1783 * Monsters will take damage, and "jump" into a safe grid if possible,
1784 * otherwise they will be "buried" in the rubble, disappearing from
1785 * the level in the same way that they do when genocided.
1787 * Note that thus the player and monsters (except eaters of walls and
1788 * passers through walls) will never occupy the same grid as a wall.
1789 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1790 * for a single turn, unless that monster can pass_walls or kill_walls.
1791 * This has allowed massive simplification of the "monster" code.
1794 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1798 POSITION y, x, yy, xx, dy, dx;
1801 POSITION sy = 0, sx = 0;
1807 /* Prevent destruction of quest levels and town */
1808 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1813 /* Paranoia -- Enforce maximum range */
1816 /* Clear the "maximal blast" area */
1817 for (y = 0; y < 32; y++)
1819 for (x = 0; x < 32; x++)
1825 /* Check around the epicenter */
1826 for (dy = -r; dy <= r; dy++)
1828 for (dx = -r; dx <= r; dx++)
1830 /* Extract the location */
1834 /* Skip illegal grids */
1835 if (!in_bounds(yy, xx)) continue;
1837 /* Skip distant grids */
1838 if (distance(cy, cx, yy, xx) > r) continue;
1840 /* Access the grid */
1841 c_ptr = &cave[yy][xx];
1843 /* Lose room and vault */
1844 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1846 /* Lose light and knowledge */
1847 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1849 /* Skip the epicenter */
1850 if (!dx && !dy) continue;
1852 /* Skip most grids */
1853 if (randint0(100) < 85) continue;
1855 /* Damage this grid */
1856 map[16+yy-cy][16+xx-cx] = TRUE;
1858 /* Hack -- Take note of player damage */
1859 if (player_bold(yy, xx)) hurt = TRUE;
1863 /* First, affect the player (if necessary) */
1864 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1866 /* Check around the player */
1867 for (i = 0; i < 8; i++)
1869 /* Access the location */
1870 y = p_ptr->y + ddy_ddd[i];
1871 x = p_ptr->x + ddx_ddd[i];
1873 /* Skip non-empty grids */
1874 if (!cave_empty_bold(y, x)) continue;
1876 /* Important -- Skip "quake" grids */
1877 if (map[16+y-cy][16+x-cx]) continue;
1879 if (cave[y][x].m_idx) continue;
1881 /* Count "safe" grids */
1884 /* Randomize choice */
1885 if (randint0(sn) > 0) continue;
1887 /* Save the safe location */
1891 /* Random message */
1892 switch (randint1(3))
1896 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1901 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1906 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1911 /* Hurt the player a lot */
1914 /* Message and damage */
1915 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1919 /* Destroy the grid, and push the player to safety */
1922 /* Calculate results */
1923 switch (randint1(3))
1927 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1933 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1934 damage = damroll(10, 4);
1935 (void)set_stun(p_ptr->stun + randint1(50));
1940 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1941 damage = damroll(10, 4);
1942 (void)set_stun(p_ptr->stun + randint1(50));
1947 /* Move the player to the safe location */
1948 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1951 /* Important -- no wall on player */
1952 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1954 /* Take some damage */
1962 monster_type *m_ptr = &m_list[m_idx];
1964 /* Get the monster's real name */
1965 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1967 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1971 killer = _("地震", "an earthquake");
1974 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1978 /* Examine the quaked region */
1979 for (dy = -r; dy <= r; dy++)
1981 for (dx = -r; dx <= r; dx++)
1983 /* Extract the location */
1987 /* Skip unaffected grids */
1988 if (!map[16+yy-cy][16+xx-cx]) continue;
1990 /* Access the grid */
1991 c_ptr = &cave[yy][xx];
1993 if (c_ptr->m_idx == p_ptr->riding) continue;
1995 /* Process monsters */
1998 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1999 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2001 /* Quest monsters */
2002 if (r_ptr->flags1 & RF1_QUESTOR)
2004 /* No wall on quest monsters */
2005 map[16+yy-cy][16+xx-cx] = FALSE;
2010 /* Most monsters cannot co-exist with rock */
2011 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
2012 !(r_ptr->flags2 & (RF2_PASS_WALL)))
2016 /* Assume not safe */
2019 /* Monster can move to escape the wall */
2020 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
2022 /* Look for safety */
2023 for (i = 0; i < 8; i++)
2025 /* Access the grid */
2026 y = yy + ddy_ddd[i];
2027 x = xx + ddx_ddd[i];
2029 /* Skip non-empty grids */
2030 if (!cave_empty_bold(y, x)) continue;
2032 /* Hack -- no safety on glyph of warding */
2033 if (is_glyph_grid(&cave[y][x])) continue;
2034 if (is_explosive_rune_grid(&cave[y][x])) continue;
2036 /* ... nor on the Pattern */
2037 if (pattern_tile(y, x)) continue;
2039 /* Important -- Skip "quake" grids */
2040 if (map[16+y-cy][16+x-cx]) continue;
2042 if (cave[y][x].m_idx) continue;
2043 if (player_bold(y, x)) continue;
2045 /* Count "safe" grids */
2048 /* Randomize choice */
2049 if (randint0(sn) > 0) continue;
2051 /* Save the safe grid */
2056 /* Describe the monster */
2057 monster_desc(m_name, m_ptr, 0);
2059 /* Scream in pain */
2060 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
2062 /* Take damage from the quake */
2063 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
2065 /* Monster is certainly awake */
2066 (void)set_monster_csleep(c_ptr->m_idx, 0);
2068 /* Apply damage directly */
2069 m_ptr->hp -= damage;
2071 /* Delete (not kill) "dead" monsters */
2074 if (!ignore_unview || is_seen(m_ptr))
2075 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
2079 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
2083 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
2084 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
2088 /* Delete the monster */
2089 delete_monster(yy, xx);
2091 /* No longer safe */
2095 /* Hack -- Escape from the rock */
2098 IDX m_idx_aux = cave[yy][xx].m_idx;
2100 /* Update the old location */
2101 cave[yy][xx].m_idx = 0;
2103 /* Update the new location */
2104 cave[sy][sx].m_idx = m_idx_aux;
2106 /* Move the monster */
2110 /* Update the monster (new location) */
2111 update_mon(m_idx, TRUE);
2113 /* Redraw the old grid */
2116 /* Redraw the new grid */
2124 /* Lose monster light */
2127 /* Examine the quaked region */
2128 for (dy = -r; dy <= r; dy++)
2130 for (dx = -r; dx <= r; dx++)
2132 /* Extract the location */
2136 /* Skip unaffected grids */
2137 if (!map[16+yy-cy][16+xx-cx]) continue;
2139 /* Access the cave grid */
2140 c_ptr = &cave[yy][xx];
2142 /* Paranoia -- never affect player */
2143 /* if (player_bold(yy, xx)) continue; */
2145 /* Destroy location (if valid) */
2146 if (cave_valid_bold(yy, xx))
2148 /* Delete objects */
2149 delete_object(yy, xx);
2151 /* Wall (or floor) type */
2152 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2157 /* Create granite wall */
2158 cave_set_feat(yy, xx, feat_granite);
2164 /* Create quartz vein */
2165 cave_set_feat(yy, xx, feat_quartz_vein);
2171 /* Create magma vein */
2172 cave_set_feat(yy, xx, feat_magma_vein);
2179 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2186 /* Process "re-glowing" */
2187 for (dy = -r; dy <= r; dy++)
2189 for (dx = -r; dx <= r; dx++)
2191 /* Extract the location */
2195 /* Skip illegal grids */
2196 if (!in_bounds(yy, xx)) continue;
2198 /* Skip distant grids */
2199 if (distance(cy, cx, yy, xx) > r) continue;
2201 /* Access the grid */
2202 c_ptr = &cave[yy][xx];
2204 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2205 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2210 for (ii = 0; ii < 9; ii++)
2212 yyy = yy + ddy_ddd[ii];
2213 xxx = xx + ddx_ddd[ii];
2214 if (!in_bounds2(yyy, xxx)) continue;
2215 cc_ptr = &cave[yyy][xxx];
2216 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2218 c_ptr->info |= CAVE_GLOW;
2227 /* Mega-Hack -- Forget the view and lite */
2228 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2230 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2232 /* Update the health bar */
2233 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2236 p_ptr->redraw |= (PR_MAP);
2239 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2241 if (p_ptr->special_defense & NINJA_S_STEALTH)
2243 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2251 * @brief 地震処理(プレイヤーの中心発動) /
2252 * Induce an "earthquake" of the given radius at the given location.
2253 * @return 効力があった場合TRUEを返す
2258 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2260 return earthquake_aux(cy, cx, r, 0);
2267 void discharge_minion(void)
2272 for (i = 1; i < m_max; i++)
2274 monster_type *m_ptr = &m_list[i];
2275 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2276 if (m_ptr->nickname) okay = FALSE;
2278 if (!okay || p_ptr->riding)
2280 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2283 for (i = 1; i < m_max; i++)
2286 monster_type *m_ptr = &m_list[i];
2287 monster_race *r_ptr;
2289 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2290 r_ptr = &r_info[m_ptr->r_idx];
2292 /* Uniques resist discharging */
2293 if (r_ptr->flags1 & RF1_UNIQUE)
2296 monster_desc(m_name, m_ptr, 0x00);
2297 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2298 delete_monster_idx(i);
2301 dam = m_ptr->maxhp / 2;
2302 if (dam > 100) dam = (dam-100)/2 + 100;
2303 if (dam > 400) dam = (dam-400)/2 + 400;
2304 if (dam > 800) dam = 800;
2305 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2306 m_ptr->fx, dam, GF_PLASMA,
2307 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2309 if (record_named_pet && m_ptr->nickname)
2313 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2314 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2317 delete_monster_idx(i);
2323 * @brief 部屋全体を照らすサブルーチン
2327 * This routine clears the entire "temp" set.
2328 * This routine will Perma-Lite all "temp" grids.
2329 * This routine is used (only) by "lite_room()"
2330 * Dark grids are illuminated.
2331 * Also, process all affected monsters.
2333 * SMART monsters always wake up when illuminated
2334 * NORMAL monsters wake up 1/4 the time when illuminated
2335 * STUPID monsters wake up 1/10 the time when illuminated
2338 static void cave_temp_room_lite(void)
2342 /* Clear them all */
2343 for (i = 0; i < temp_n; i++)
2345 POSITION y = temp_y[i];
2346 POSITION x = temp_x[i];
2348 cave_type *c_ptr = &cave[y][x];
2350 /* No longer in the array */
2351 c_ptr->info &= ~(CAVE_TEMP);
2353 /* Update only non-CAVE_GLOW grids */
2354 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2357 c_ptr->info |= (CAVE_GLOW);
2359 /* Process affected monsters */
2364 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2366 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2368 /* Update the monster */
2369 update_mon(c_ptr->m_idx, FALSE);
2371 /* Stupid monsters rarely wake up */
2372 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2374 /* Smart monsters always wake up */
2375 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2377 /* Sometimes monsters wake up */
2378 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2381 (void)set_monster_csleep(c_ptr->m_idx, 0);
2383 /* Notice the "waking up" */
2388 /* Acquire the monster name */
2389 monster_desc(m_name, m_ptr, 0);
2391 /* Dump a message */
2392 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2403 update_local_illumination(y, x);
2413 * @brief 部屋全体を暗くするサブルーチン
2417 * This routine clears the entire "temp" set.
2418 * This routine will "darken" all "temp" grids.
2419 * In addition, some of these grids will be "unmarked".
2420 * This routine is used (only) by "unlite_room()"
2421 * Also, process all affected monsters
2424 static void cave_temp_room_unlite(void)
2428 /* Clear them all */
2429 for (i = 0; i < temp_n; i++)
2431 POSITION y = temp_y[i];
2432 POSITION x = temp_x[i];
2435 cave_type *c_ptr = &cave[y][x];
2436 bool do_dark = !is_mirror_grid(c_ptr);
2438 /* No longer in the array */
2439 c_ptr->info &= ~(CAVE_TEMP);
2441 /* Darken the grid */
2444 if (dun_level || !is_daytime())
2446 for (j = 0; j < 9; j++)
2448 int by = y + ddy_ddd[j];
2449 int bx = x + ddx_ddd[j];
2451 if (in_bounds2(by, bx))
2453 cave_type *cc_ptr = &cave[by][bx];
2455 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2463 if (!do_dark) continue;
2466 c_ptr->info &= ~(CAVE_GLOW);
2468 /* Hack -- Forget "boring" grids */
2469 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2471 /* Forget the grid */
2472 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2478 /* Process affected monsters */
2481 /* Update the monster */
2482 update_mon(c_ptr->m_idx, FALSE);
2488 update_local_illumination(y, x);
2498 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2501 * @param pass_bold 地形条件を返す関数ポインタ
2504 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2511 for (i = 0; i < 16; i++)
2513 y = cy + ddy_cdd[i % 8];
2514 x = cx + ddx_cdd[i % 8];
2516 /* Found a wall, break the length */
2517 if (!pass_bold(y, x))
2519 /* Track best length */
2533 return (MAX(len, blen));
2537 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2540 * @param pass_bold 地形条件を返す関数ポインタ
2543 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2549 for (i = 0; i < 8; i++)
2551 y = cy + ddy_ddd[i];
2552 x = cx + ddx_ddd[i];
2554 if (!pass_bold(y, x)) c++;
2562 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2563 * @param y 部屋内のy座標1点
2564 * @param x 部屋内のx座標1点
2565 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2566 * @param pass_bold 地形条件を返す関数ポインタ
2569 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2574 c_ptr = &cave[y][x];
2576 /* Avoid infinite recursion */
2577 if (c_ptr->info & (CAVE_TEMP)) return;
2579 /* Do not "leave" the current room */
2580 if (!(c_ptr->info & (CAVE_ROOM)))
2582 if (only_room) return;
2585 if (!in_bounds2(y, x)) return;
2587 /* Do not exceed the maximum spell range */
2588 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2590 /* Verify this grid */
2592 * The reason why it is ==6 instead of >5 is that 8 is impossible
2593 * due to the check for cave_bold above.
2594 * 7 lights dead-end corridors (you need to do this for the
2595 * checkboard interesting rooms, so that the boundary is lit
2597 * This leaves only a check for 6 bounding walls!
2599 if (in_bounds(y, x) && pass_bold(y, x) &&
2600 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2603 /* Paranoia -- verify space */
2604 if (temp_n == TEMP_MAX) return;
2606 /* Mark the grid as "seen" */
2607 c_ptr->info |= (CAVE_TEMP);
2609 /* Add it to the "seen" set */
2616 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2619 * @return 光を通すならばtrueを返す。
2621 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2623 return cave_los_bold(y, x);
2627 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2632 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2634 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2638 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2641 * @return 射線を通すならばtrueを返す。
2643 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2645 return cave_have_flag_bold(y, x, FF_PROJECT);
2650 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2655 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2657 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2662 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2667 void lite_room(POSITION y1, POSITION x1)
2672 /* Add the initial grid */
2673 cave_temp_lite_room_aux(y1, x1);
2675 /* While grids are in the queue, add their neighbors */
2676 for (i = 0; i < temp_n; i++)
2678 x = temp_x[i], y = temp_y[i];
2680 /* Walls get lit, but stop light */
2681 if (!cave_pass_lite_bold(y, x)) continue;
2683 /* Spread adjacent */
2684 cave_temp_lite_room_aux(y + 1, x);
2685 cave_temp_lite_room_aux(y - 1, x);
2686 cave_temp_lite_room_aux(y, x + 1);
2687 cave_temp_lite_room_aux(y, x - 1);
2689 /* Spread diagonal */
2690 cave_temp_lite_room_aux(y + 1, x + 1);
2691 cave_temp_lite_room_aux(y - 1, x - 1);
2692 cave_temp_lite_room_aux(y - 1, x + 1);
2693 cave_temp_lite_room_aux(y + 1, x - 1);
2696 /* Now, lite them all up at once */
2697 cave_temp_room_lite();
2699 if (p_ptr->special_defense & NINJA_S_STEALTH)
2701 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2707 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2712 void unlite_room(POSITION y1, POSITION x1)
2717 /* Add the initial grid */
2718 cave_temp_unlite_room_aux(y1, x1);
2720 /* Spread, breadth first */
2721 for (i = 0; i < temp_n; i++)
2723 x = temp_x[i], y = temp_y[i];
2725 /* Walls get dark, but stop darkness */
2726 if (!cave_pass_dark_bold(y, x)) continue;
2728 /* Spread adjacent */
2729 cave_temp_unlite_room_aux(y + 1, x);
2730 cave_temp_unlite_room_aux(y - 1, x);
2731 cave_temp_unlite_room_aux(y, x + 1);
2732 cave_temp_unlite_room_aux(y, x - 1);
2734 /* Spread diagonal */
2735 cave_temp_unlite_room_aux(y + 1, x + 1);
2736 cave_temp_unlite_room_aux(y - 1, x - 1);
2737 cave_temp_unlite_room_aux(y - 1, x + 1);
2738 cave_temp_unlite_room_aux(y + 1, x - 1);
2741 /* Now, darken them all at once */
2742 cave_temp_room_unlite();
2748 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2751 * @return 作用が実際にあった場合TRUEを返す
2753 bool lite_area(HIT_POINT dam, POSITION rad)
2755 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2757 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2759 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2763 /* Hack -- Message */
2766 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2769 /* Hook into the "project()" function */
2770 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2772 /* Lite up the room */
2773 lite_room(p_ptr->y, p_ptr->x);
2781 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2784 * @return 作用が実際にあった場合TRUEを返す
2786 bool unlite_area(HIT_POINT dam, POSITION rad)
2788 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2790 /* Hack -- Message */
2793 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2796 /* Hook into the "project()" function */
2797 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2799 /* Lite up the room */
2800 unlite_room(p_ptr->y, p_ptr->x);
2809 * @brief ボール系スペルの発動 / Cast a ball spell
2811 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2814 * @return 作用が実際にあった場合TRUEを返す
2817 * Stop if we hit a monster, act as a "ball"
2818 * Allow "target" mode to pass over monsters
2819 * Affect grids, objects, and monsters
2822 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2826 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2828 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2829 /* Use the given direction */
2830 tx = p_ptr->x + 99 * ddx[dir];
2831 ty = p_ptr->y + 99 * ddy[dir];
2833 /* Hack -- Use an actual "target" */
2834 if ((dir == 5) && target_okay())
2836 flg &= ~(PROJECT_STOP);
2841 /* Analyze the "dir" and the "target". Hurt items on floor. */
2842 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2846 * @brief ブレス系スペルの発動 / Cast a breath spell
2848 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2851 * @return 作用が実際にあった場合TRUEを返す
2854 * Stop if we hit a monster, act as a "ball"
2855 * Allow "target" mode to pass over monsters
2856 * Affect grids, objects, and monsters
2859 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2861 return fire_ball(typ, dir, dam, -rad);
2866 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2868 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2871 * @return 作用が実際にあった場合TRUEを返す
2874 * Stop if we hit a monster, act as a "ball"
2875 * Allow "target" mode to pass over monsters
2876 * Affect grids, objects, and monsters
2879 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2882 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2884 /* Use the given direction */
2885 tx = p_ptr->x + 99 * ddx[dir];
2886 ty = p_ptr->y + 99 * ddy[dir];
2888 /* Hack -- Use an actual "target" */
2889 if ((dir == 5) && target_okay())
2895 /* Analyze the "dir" and the "target". Hurt items on floor. */
2896 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2901 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2903 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2906 * @return 作用が実際にあった場合TRUEを返す
2909 * Stop if we hit a monster, act as a "ball"
2910 * Allow "target" mode to pass over monsters
2911 * Affect grids, objects, and monsters
2914 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2917 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2919 /* Use the given direction */
2920 tx = p_ptr->x + 99 * ddx[dir];
2921 ty = p_ptr->y + 99 * ddy[dir];
2923 /* Hack -- Use an actual "target" */
2924 if ((dir == 5) && target_okay())
2926 flg &= ~(PROJECT_STOP);
2931 /* Analyze the "dir" and the "target". Hurt items on floor. */
2932 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2937 * @brief メテオ系スペルの発動 / Cast a meteor spell
2938 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2944 * @return 作用が実際にあった場合TRUEを返す
2947 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2948 * player, or outside source, that starts out at an arbitrary location, and
2949 * leaving no trail from the "caster" to the target. This function is
2950 * especially useful for bombardments and similar. -LM-
2951 * Option to hurt the player.
2954 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2956 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2958 /* Analyze the "target" and the caster. */
2959 return (project(who, rad, y, x, dam, typ, flg, -1));
2964 * @brief ブラスト系スペルの発動 / Cast a blast spell
2966 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2971 * @return 作用が実際にあった場合TRUEを返す
2973 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2977 POSITION ty, tx, y, x;
2980 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2985 /* Use the given direction */
2988 ly = ty = p_ptr->y + 20 * ddy[dir];
2989 lx = tx = p_ptr->x + 20 * ddx[dir];
2992 /* Use an actual "target" */
2993 else /* if (dir == 5) */
2998 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2999 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
3002 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
3005 for (i = 0; i < num; i++)
3009 /* Get targets for some bolts */
3010 y = rand_spread(ly, ld * dev / 20);
3011 x = rand_spread(lx, ld * dev / 20);
3013 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
3016 /* Analyze the "dir" and the "target". */
3017 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
3028 * @brief モンスターとの位置交換処理 / Switch position with a monster.
3029 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3030 * @return 作用が実際にあった場合TRUEを返す
3032 bool teleport_swap(DIRECTION dir)
3036 monster_type* m_ptr;
3037 monster_race* r_ptr;
3039 if ((dir == 5) && target_okay())
3046 tx = p_ptr->x + ddx[dir];
3047 ty = p_ptr->y + ddy[dir];
3049 c_ptr = &cave[ty][tx];
3051 if (p_ptr->anti_tele)
3053 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
3057 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
3059 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
3065 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
3067 msg_print(_("失敗した。", "Failed to swap."));
3073 m_ptr = &m_list[c_ptr->m_idx];
3074 r_ptr = &r_info[m_ptr->r_idx];
3076 (void)set_monster_csleep(c_ptr->m_idx, 0);
3078 if (r_ptr->flagsr & RFR_RES_TELE)
3080 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
3082 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3088 sound(SOUND_TELEPORT);
3090 /* Swap the player and monster */
3091 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
3099 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
3101 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3104 * @return 作用が実際にあった場合TRUEを返す
3106 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
3110 /* Pass through the target if needed */
3111 flg |= (PROJECT_THRU);
3113 /* Use the given direction */
3114 tx = p_ptr->x + ddx[dir];
3115 ty = p_ptr->y + ddy[dir];
3117 /* Hack -- Use an actual "target" */
3118 if ((dir == 5) && target_okay())
3124 /* Analyze the "dir" and the "target", do NOT explode */
3125 return (project(0, 0, ty, tx, dam, typ, flg, -1));
3130 * @brief ボルト系スペルの発動 / Cast a bolt spell.
3132 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3134 * @return 作用が実際にあった場合TRUEを返す
3137 * Stop if we hit a monster, as a "bolt".
3138 * Affect monsters and grids (not objects).
3141 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3143 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3144 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3145 return (project_hook(typ, dir, dam, flg));
3150 * @brief ビーム系スペルの発動 / Cast a beam spell.
3152 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3154 * @return 作用が実際にあった場合TRUEを返す
3157 * Pass through monsters, as a "beam".
3158 * Affect monsters, grids and objects.
3161 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3163 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3164 return (project_hook(typ, dir, dam, flg));
3169 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3170 * @param prob ビーム化する確率(%)
3172 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3174 * @return 作用が実際にあった場合TRUEを返す
3177 * Pass through monsters, as a "beam".
3178 * Affect monsters, grids and objects.
3181 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3183 if (randint0(100) < prob)
3185 return (fire_beam(typ, dir, dam));
3189 return (fire_bolt(typ, dir, dam));
3194 * @brief LITE_WEAK属性による光源ビーム処理
3195 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3197 * @return 作用が実際にあった場合TRUEを返す
3199 bool lite_line(DIRECTION dir, HIT_POINT dam)
3201 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3202 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3207 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3209 * @return 作用が実際にあった場合TRUEを返す
3211 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3213 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3214 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3219 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3221 * @return 作用が実際にあった場合TRUEを返す
3223 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3225 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3226 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3231 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3232 * @return 作用が実際にあった場合TRUEを返す
3234 bool wizard_lock(DIRECTION dir)
3236 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3237 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3242 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3243 * @return 作用が実際にあった場合TRUEを返す
3245 bool destroy_door(DIRECTION dir)
3247 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3248 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3253 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3254 * @return 作用が実際にあった場合TRUEを返す
3256 bool disarm_trap(DIRECTION dir)
3258 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3259 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3264 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3266 * @return 作用が実際にあった場合TRUEを返す
3268 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3270 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3271 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3276 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3278 * @return 作用が実際にあった場合TRUEを返す
3280 bool speed_monster(DIRECTION dir, int power)
3282 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3283 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3288 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3290 * @return 作用が実際にあった場合TRUEを返す
3292 bool slow_monster(DIRECTION dir, int power)
3294 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3295 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3300 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3302 * @return 作用が実際にあった場合TRUEを返す
3304 bool sleep_monster(DIRECTION dir, int power)
3306 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3307 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3311 * @brief モンスター拘束(STASIS)処理
3312 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3313 * @return 作用が実際にあった場合TRUEを返す
3314 * @details 威力はプレイヤーレベル*2に固定
3316 bool stasis_monster(DIRECTION dir)
3318 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3322 * @brief 邪悪なモンスター拘束(STASIS)処理
3323 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3324 * @return 作用が実際にあった場合TRUEを返す
3325 * @details 威力はプレイヤーレベル*2に固定
3327 bool stasis_evil(DIRECTION dir)
3329 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3334 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3335 * @param plev プレイヤーレベル(=効力)
3336 * @return 作用が実際にあった場合TRUEを返す
3338 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3340 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3341 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3346 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3347 * @param plev プレイヤーレベル(=効力)
3348 * @return 作用が実際にあった場合TRUEを返す
3350 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3352 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3353 return (project_hook(GF_STUN, dir, plev, flg));
3357 * @brief チェンジモンスター処理
3358 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3360 * @return 作用が実際にあった場合TRUEを返す
3362 bool poly_monster(DIRECTION dir, int power)
3364 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3365 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3367 chg_virtue(V_CHANCE, 1);
3372 * @brief クローンモンスター処理
3373 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3374 * @return 作用が実際にあった場合TRUEを返す
3376 bool clone_monster(DIRECTION dir)
3378 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3379 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3384 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3385 * @param plev プレイヤーレベル(=効力)
3386 * @return 作用が実際にあった場合TRUEを返す
3388 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3390 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3391 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3396 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3397 * @param plev プレイヤーレベル(効力はplev*200)
3398 * @return 作用が実際にあった場合TRUEを返す
3400 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3402 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3403 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3407 * @brief モンスター用テレポート処理
3408 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3409 * @param distance 移動距離
3410 * @return 作用が実際にあった場合TRUEを返す
3412 bool teleport_monster(DIRECTION dir, int distance)
3414 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3415 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3419 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3420 * @return 作用が実際にあった場合TRUEを返す
3422 bool door_creation(void)
3424 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3425 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3429 * @brief トラップ生成処理(起点から周囲1マス)
3432 * @return 作用が実際にあった場合TRUEを返す
3434 bool trap_creation(POSITION y, POSITION x)
3436 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3437 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3441 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3442 * @return 作用が実際にあった場合TRUEを返す
3444 bool tree_creation(void)
3446 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3447 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3451 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3452 * @return 作用が実際にあった場合TRUEを返す
3454 bool glyph_creation(void)
3456 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3457 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3461 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3462 * @return 作用が実際にあった場合TRUEを返す
3464 bool wall_stone(void)
3466 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3468 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3470 p_ptr->update |= (PU_FLOW);
3473 p_ptr->redraw |= (PR_MAP);
3479 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3480 * @return 作用が実際にあった場合TRUEを返す
3482 bool destroy_doors_touch(void)
3484 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3485 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3489 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3490 * @return 作用が実際にあった場合TRUEを返す
3492 bool disarm_traps_touch(void)
3494 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3495 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3499 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3500 * @return 作用が実際にあった場合TRUEを返す
3502 bool sleep_monsters_touch(void)
3504 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3505 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3510 * @brief 死者復活処理(起点より周囲5マス)
3511 * @param who 術者モンスターID(0ならばプレイヤー)
3514 * @return 作用が実際にあった場合TRUEを返す
3516 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3518 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3519 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3524 * @return 作用が実際にあった場合TRUEを返す
3526 void call_chaos(void)
3528 int Chaos_type, dummy, dir;
3529 PLAYER_LEVEL plev = p_ptr->lev;
3530 bool line_chaos = FALSE;
3532 int hurt_types[31] =
3534 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3535 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3536 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3537 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3538 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3539 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3540 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3541 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3544 Chaos_type = hurt_types[randint0(31)];
3545 if (one_in_(4)) line_chaos = TRUE;
3549 for (dummy = 1; dummy < 10; dummy++)
3554 fire_beam(Chaos_type, dummy, 150);
3556 fire_ball(Chaos_type, dummy, 150, 2);
3560 else if (one_in_(3))
3562 fire_ball(Chaos_type, 0, 500, 8);
3566 if (!get_aim_dir(&dir)) return;
3568 fire_beam(Chaos_type, dir, 250);
3570 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3575 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3576 * @param stop_ty 再帰処理停止フラグ
3578 * @return 作用が実際にあった場合TRUEを返す
3581 * rr9: Stop the nasty things when a Cyberdemon is summoned
3582 * or the player gets paralyzed.
3585 bool activate_ty_curse(bool stop_ty, int *count)
3589 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3593 switch (randint1(34))
3598 msg_print(_("地面が揺れた...", "The ground trembles..."));
3599 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3600 if (!one_in_(6)) break;
3605 HIT_POINT dam = damroll(10, 10);
3606 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3607 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3608 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3609 if (!one_in_(6)) break;
3614 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3615 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3616 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3617 if (!one_in_(6)) break;
3620 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3624 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3625 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3627 if (!one_in_(6)) break;
3628 case 1: case 2: case 3: case 16: case 17:
3629 aggravate_monsters(0);
3630 if (!one_in_(6)) break;
3631 case 4: case 5: case 6:
3632 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3633 if (!one_in_(6)) break;
3634 case 7: case 8: case 9: case 18:
3635 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3636 if (!one_in_(6)) break;
3637 case 10: case 11: case 12:
3638 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3639 lose_exp(p_ptr->exp / 16);
3640 if (!one_in_(6)) break;
3641 case 13: case 14: case 15: case 19: case 20:
3642 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3648 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3649 if (p_ptr->free_act)
3650 set_paralyzed(p_ptr->paralyzed + randint1(3));
3652 set_paralyzed(p_ptr->paralyzed + randint1(13));
3655 if (!one_in_(6)) break;
3656 case 21: case 22: case 23:
3657 (void)do_dec_stat(randint0(6));
3658 if (!one_in_(6)) break;
3660 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3662 if (!one_in_(6)) break;
3665 * Only summon Cyberdemons deep in the dungeon.
3667 if ((dun_level > 65) && !stop_ty)
3669 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3673 if (!one_in_(6)) break;
3679 (void)do_dec_stat(i);
3687 while (one_in_(3) && !stop_ty);
3693 * @brief HI_SUMMON(上級召喚)処理発動
3696 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3697 * @return 作用が実際にあった場合TRUEを返す
3699 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3704 BIT_FLAGS mode = PM_ALLOW_GROUP;
3711 mode |= PM_FORCE_FRIENDLY;
3715 mode |= PM_FORCE_PET;
3720 if (!pet) mode |= PM_NO_PET;
3722 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3724 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3726 switch (randint1(25) + (dun_level / 20))
3729 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3732 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3735 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3738 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3741 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3744 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3747 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3750 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3754 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3758 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3761 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3762 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3765 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3766 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3769 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3772 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3773 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3782 * @brief サイバーデーモンの召喚
3783 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3786 * @return 作用が実際にあった場合TRUEを返す
3788 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3791 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3793 BIT_FLAGS mode = PM_ALLOW_GROUP;
3795 /* Summoned by a monster */
3798 monster_type *m_ptr = &m_list[who];
3799 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3802 if (max_cyber > 4) max_cyber = 4;
3804 for (i = 0; i < max_cyber; i++)
3806 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3813 * @brief 周辺破壊効果(プレイヤー中心)
3814 * @return 作用が実際にあった場合TRUEを返す
3816 void wall_breaker(void)
3819 POSITION y = 0, x = 0;
3820 int attempts = 1000;
3822 if (randint1(80 + p_ptr->lev) < 70)
3826 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3828 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3830 if (!player_bold(y, x)) break;
3833 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3834 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3836 else if (randint1(100) > 30)
3838 earthquake(p_ptr->y, p_ptr->x, 1);
3842 int num = damroll(5, 3);
3844 for (i = 0; i < num; i++)
3848 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3850 if (!player_bold(y, x)) break;
3853 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3854 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3861 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3863 * @return 作用が実際にあった場合TRUEを返す
3865 bool confuse_monsters(HIT_POINT dam)
3867 return (project_hack(GF_OLD_CONF, dam));
3872 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3874 * @return 作用が実際にあった場合TRUEを返す
3876 bool charm_monsters(HIT_POINT dam)
3878 return (project_hack(GF_CHARM, dam));
3883 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3885 * @return 作用が実際にあった場合TRUEを返す
3887 bool charm_animals(HIT_POINT dam)
3889 return (project_hack(GF_CONTROL_ANIMAL, dam));
3894 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3896 * @return 作用が実際にあった場合TRUEを返す
3898 bool stun_monsters(HIT_POINT dam)
3900 return (project_hack(GF_STUN, dam));
3905 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3907 * @return 作用が実際にあった場合TRUEを返す
3909 bool stasis_monsters(HIT_POINT dam)
3911 return (project_hack(GF_STASIS, dam));
3916 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3918 * @return 作用が実際にあった場合TRUEを返す
3920 bool mindblast_monsters(HIT_POINT dam)
3922 return (project_hack(GF_PSI, dam));
3927 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3928 * @param dist 効力(距離)
3929 * @return 作用が実際にあった場合TRUEを返す
3931 bool banish_monsters(int dist)
3933 return (project_hack(GF_AWAY_ALL, dist));
3938 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3940 * @return 作用が実際にあった場合TRUEを返す
3942 bool turn_evil(HIT_POINT dam)
3944 return (project_hack(GF_TURN_EVIL, dam));
3949 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3951 * @return 作用が実際にあった場合TRUEを返す
3953 bool turn_monsters(HIT_POINT dam)
3955 return (project_hack(GF_TURN_ALL, dam));
3960 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3961 * @return 作用が実際にあった場合TRUEを返す
3963 bool deathray_monsters(void)
3965 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3969 * @brief チャーム・モンスター(1体)
3970 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3972 * @return 作用が実際にあった場合TRUEを返す
3974 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3976 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3977 return (project_hook(GF_CHARM, dir, plev, flg));
3981 * @brief アンデッド支配(1体)
3982 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3984 * @return 作用が実際にあった場合TRUEを返す
3986 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3988 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3989 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3994 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3996 * @return 作用が実際にあった場合TRUEを返す
3998 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
4000 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4001 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
4006 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
4008 * @return 作用が実際にあった場合TRUEを返す
4010 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
4012 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4013 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
4019 * @param success 判定成功上の処理ならばTRUE
4020 * @return 作用が実際にあった場合TRUEを返す
4022 bool kawarimi(bool success)
4025 object_type *q_ptr = &forge;
4028 if (p_ptr->is_dead) return FALSE;
4029 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
4030 if (randint0(200) < p_ptr->stun) return FALSE;
4032 if (!success && one_in_(3))
4034 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
4035 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4036 p_ptr->redraw |= (PR_STATUS);
4043 teleport_player(10 + randint1(90), 0L);
4047 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
4049 q_ptr->pval = MON_NINJA;
4051 /* Drop it in the dungeon */
4052 (void)drop_near(q_ptr, -1, y, x);
4055 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
4056 else msg_print("失敗!攻撃を受けてしまった。");
4058 if (success) msg_print("You have turned around just before the attack hit you.");
4059 else msg_print("Failed! You are hit by the attack.");
4062 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4063 p_ptr->redraw |= (PR_STATUS);
4071 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
4072 * @param mdeath 目標モンスターが死亡したかを返す
4073 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
4075 bool rush_attack(bool *mdeath)
4082 bool tmp_mdeath = FALSE;
4085 if (mdeath) *mdeath = FALSE;
4088 if (!get_aim_dir(&dir)) return FALSE;
4090 /* Use the given direction */
4091 tx = p_ptr->x + project_length * ddx[dir];
4092 ty = p_ptr->y + project_length * ddy[dir];
4094 /* Hack -- Use an actual "target" */
4095 if ((dir == 5) && target_okay())
4101 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
4103 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
4106 /* No need to move */
4107 if (!path_n) return TRUE;
4109 /* Use ty and tx as to-move point */
4113 /* Project along the path */
4114 for (i = 0; i < path_n; i++)
4116 monster_type *m_ptr;
4118 int ny = GRID_Y(path_g[i]);
4119 int nx = GRID_X(path_g[i]);
4121 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
4126 /* Go to next grid */
4130 if (!cave[ny][nx].m_idx)
4134 msg_print(_("失敗!", "Failed!"));
4138 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4145 /* Move player before updating the monster */
4146 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4148 /* Update the monster */
4149 update_mon(cave[ny][nx].m_idx, TRUE);
4151 /* Found a monster */
4152 m_ptr = &m_list[cave[ny][nx].m_idx];
4154 if (tm_idx != cave[ny][nx].m_idx)
4157 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4158 m_ptr->ml ? "モンスター" : "何か");
4160 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4163 else if (!player_bold(ty, tx))
4165 /* Hold the monster name */
4168 /* Get the monster name (BEFORE polymorphing) */
4169 monster_desc(m_name, m_ptr, 0);
4170 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4173 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4175 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4180 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4182 if (mdeath) *mdeath = tmp_mdeath;
4188 * @brief 全鏡の消去 / Remove all mirrors in this floor
4189 * @param explode 爆発処理を伴うならばTRUE
4192 void remove_all_mirrors(bool explode)
4196 for (x = 0; x < cur_wid; x++)
4198 for (y = 0; y < cur_hgt; y++)
4200 if (is_mirror_grid(&cave[y][x]))
4202 remove_mirror(y, x);
4204 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4205 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4212 * @brief 『一つの指輪』の効果処理 /
4213 * Hack -- activate the ring of power
4214 * @param dir 発動の方向ID
4217 void ring_of_power(DIRECTION dir)
4219 /* Pick a random effect */
4220 switch (randint1(10))
4225 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4228 /* Decrease all stats (permanently) */
4229 (void)dec_stat(A_STR, 50, TRUE);
4230 (void)dec_stat(A_INT, 50, TRUE);
4231 (void)dec_stat(A_WIS, 50, TRUE);
4232 (void)dec_stat(A_DEX, 50, TRUE);
4233 (void)dec_stat(A_CON, 50, TRUE);
4234 (void)dec_stat(A_CHR, 50, TRUE);
4236 /* Lose some experience (permanently) */
4237 p_ptr->exp -= (p_ptr->exp / 4);
4238 p_ptr->max_exp -= (p_ptr->exp / 4);
4246 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4248 /* Dispel monsters */
4249 dispel_monsters(1000);
4259 fire_ball(GF_MANA, dir, 600, 3);
4270 fire_bolt(GF_MANA, dir, 500);
4278 * @brief 運命の輪、並びにカオス的な効果の発動
4279 * @param spell ランダムな効果を選択するための基準ID
4282 void wild_magic(int spell)
4285 int type = SUMMON_MOLD + randint0(6);
4287 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4288 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4290 switch (randint1(spell) + randint1(8) + 1)
4295 teleport_player(10, TELEPORT_PASSIVE);
4300 teleport_player(100, TELEPORT_PASSIVE);
4304 teleport_player(200, TELEPORT_PASSIVE);
4314 lite_area(damroll(2, 3), 2);
4317 destroy_doors_touch();
4322 sleep_monsters_touch();
4326 trap_creation(p_ptr->y, p_ptr->x);
4335 aggravate_monsters(0);
4338 earthquake(p_ptr->y, p_ptr->x, 5);
4342 (void)gain_random_mutation(0);
4346 apply_disenchant(1);
4352 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4359 while (counter++ < 8)
4361 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4366 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4369 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4374 (void)activate_ty_curse(FALSE, &count);
4383 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4384 * / Drop 10+1d10 meteor ball at random places near the player
4389 void cast_meteor(HIT_POINT dam, POSITION rad)
4392 int b = 10 + randint1(10);
4394 for (i = 0; i < b; i++)
4396 POSITION y = 0, x = 0;
4399 for (count = 0; count <= 20; count++)
4403 x = p_ptr->x - 8 + randint0(17);
4404 y = p_ptr->y - 8 + randint0(17);
4406 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4407 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4409 /* Approximate distance */
4410 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4412 if (d >= 9) continue;
4414 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4415 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4417 /* Valid position */
4421 if (count > 20) continue;
4423 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4429 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4432 * @return ターゲットを指定し、実行したならばTRUEを返す。
4434 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4436 POSITION x, y, tx, ty;
4440 int b = 10 + randint1(10);
4442 if (!get_aim_dir(&dir)) return FALSE;
4444 /* Use the given direction */
4445 tx = p_ptr->x + 99 * ddx[dir];
4446 ty = p_ptr->y + 99 * ddy[dir];
4448 /* Hack -- Use an actual "target" */
4449 if ((dir == 5) && target_okay())
4460 /* Hack -- Stop at the target */
4461 if ((y == ty) && (x == tx)) break;
4465 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4467 /* Stop at maximum range */
4468 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4470 /* Stopped by walls/doors */
4471 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4473 /* Stopped by monsters */
4474 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4476 /* Save the new location */
4483 for (i = 0; i < b; i++)
4485 int count = 20, d = 0;
4491 x = tx - 5 + randint0(11);
4492 y = ty - 5 + randint0(11);
4494 dx = (tx > x) ? (tx - x) : (x - tx);
4495 dy = (ty > y) ? (ty - y) : (y - ty);
4497 /* Approximate distance */
4498 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4499 /* Within the radius */
4503 if (count < 0) continue;
4505 /* Cannot penetrate perm walls */
4506 if (!in_bounds(y, x) ||
4507 cave_stop_disintegration(y, x) ||
4508 !in_disintegration_range(ty, tx, y, x))
4511 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4518 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4522 * This spell should become more useful (more controlled) as the\n
4523 * player gains experience levels. Thus, add 1/5 of the player's\n
4524 * level to the die roll. This eliminates the worst effects later on,\n
4525 * while keeping the results quite random. It also allows some potent\n
4526 * effects only at high level.
4528 void cast_wonder(DIRECTION dir)
4530 PLAYER_LEVEL plev = p_ptr->lev;
4531 int die = randint1(100) + plev / 5;
4532 int vir = virtue_number(V_CHANCE);
4536 if (p_ptr->virtues[vir - 1] > 0)
4538 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4542 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4547 chg_virtue(V_CHANCE, 1);
4551 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4554 if (die < 8) clone_monster(dir);
4555 else if (die < 14) speed_monster(dir, plev);
4556 else if (die < 26) heal_monster(dir, damroll(4, 6));
4557 else if (die < 31) poly_monster(dir, plev);
4559 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4560 damroll(3 + ((plev - 1) / 5), 4));
4561 else if (die < 41) confuse_monster(dir, plev);
4562 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4563 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4565 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4566 damroll(3 + ((plev - 5) / 4), 8));
4568 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4569 damroll(5 + ((plev - 5) / 4), 8));
4571 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4572 damroll(6 + ((plev - 5) / 4), 8));
4574 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4575 damroll(8 + ((plev - 5) / 4), 8));
4576 else if (die < 76) hypodynamic_bolt(dir, 75);
4577 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4578 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4579 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4580 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4581 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4584 earthquake(p_ptr->y, p_ptr->x, 12);
4588 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4592 symbol_genocide(plev + 50, TRUE);
4594 else if (die < 110) dispel_monsters(120);
4597 dispel_monsters(150);
4598 slow_monsters(plev);
4599 sleep_monsters(plev);
4606 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4610 void cast_invoke_spirits(DIRECTION dir)
4612 PLAYER_LEVEL plev = p_ptr->lev;
4613 int die = randint1(100) + plev / 5;
4614 int vir = virtue_number(V_CHANCE);
4618 if (p_ptr->virtues[vir - 1] > 0)
4620 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4624 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4628 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4630 chg_virtue(V_CHANCE, 1);
4634 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4639 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4640 "Oh no! Mouldering forms rise from the earth around you!"));
4642 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4643 chg_virtue(V_UNLIFE, 1);
4647 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4649 set_afraid(p_ptr->afraid + randint1(4) + 4);
4653 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4654 "Your head is invaded by a horde of gibbering spectral voices..."));
4656 set_confused(p_ptr->confused + randint1(4) + 4);
4660 poly_monster(dir, plev);
4664 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4665 damroll(3 + ((plev - 1) / 5), 4));
4669 confuse_monster(dir, plev);
4673 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4677 (void)lite_line(dir, damroll(6, 8));
4681 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4682 damroll(3 + ((plev - 5) / 4), 8));
4686 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4687 damroll(5 + ((plev - 5) / 4), 8));
4691 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4692 damroll(6 + ((plev - 5) / 4), 8));
4696 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4697 damroll(8 + ((plev - 5) / 4), 8));
4701 hypodynamic_bolt(dir, 75);
4705 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4709 fire_ball(GF_ACID, dir, 40 + plev, 2);
4713 fire_ball(GF_ICE, dir, 70 + plev, 3);
4717 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4721 hypodynamic_bolt(dir, 100 + plev);
4725 earthquake(p_ptr->y, p_ptr->x, 12);
4729 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4733 symbol_genocide(plev + 50, TRUE);
4737 dispel_monsters(120);
4741 dispel_monsters(150);
4742 slow_monsters(plev);
4743 sleep_monsters(plev);
4749 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4750 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4755 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4758 void cast_shuffle(void)
4760 PLAYER_LEVEL plev = p_ptr->lev;
4763 int vir = virtue_number(V_CHANCE);
4766 /* Card sharks and high mages get a level bonus */
4767 if ((p_ptr->pclass == CLASS_ROGUE) ||
4768 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4769 (p_ptr->pclass == CLASS_SORCERER))
4770 die = (randint1(110)) + plev / 5;
4772 die = randint1(120);
4777 if (p_ptr->virtues[vir - 1] > 0)
4779 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4783 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4787 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4790 chg_virtue(V_CHANCE, 1);
4794 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4796 for (i = 0; i < randint1(3); i++)
4797 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4801 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4802 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4807 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4808 activate_ty_curse(FALSE, &count);
4812 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4813 aggravate_monsters(0);
4817 msg_print(_("《愚者》だ。", "It's the Fool."));
4823 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4824 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4828 msg_print(_("《月》だ。", "It's the Moon."));
4833 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4834 wild_magic(randint0(32));
4838 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4839 teleport_player(10, TELEPORT_PASSIVE);
4843 msg_print(_("《正義》だ。", "It's Justice."));
4844 set_blessed(p_ptr->lev, FALSE);
4848 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4849 teleport_player(100, TELEPORT_PASSIVE);
4853 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4854 teleport_player(200, TELEPORT_PASSIVE);
4858 msg_print(_("《塔》だ。", "It's the Tower."));
4863 msg_print(_("《節制》だ。", "It's Temperance."));
4864 sleep_monsters_touch();
4868 msg_print(_("《塔》だ。", "It's the Tower."));
4870 earthquake(p_ptr->y, p_ptr->x, 5);
4874 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4875 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4879 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4880 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4884 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4885 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4889 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4890 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4894 msg_print(_("《恋人》だ。", "It's the Lovers."));
4896 if (get_aim_dir(&dir))
4897 charm_monster(dir, MIN(p_ptr->lev, 20));
4901 msg_print(_("《隠者》だ。", "It's the Hermit."));
4906 msg_print(_("《審判》だ。", "It's the Judgement."));
4907 do_cmd_rerate(FALSE);
4908 lose_all_mutations();
4912 msg_print(_("《太陽》だ。", "It's the Sun."));
4913 chg_virtue(V_KNOWLEDGE, 1);
4914 chg_virtue(V_ENLIGHTEN, 1);
4919 msg_print(_("《世界》だ。", "It's the World."));
4920 if (p_ptr->exp < PY_MAX_EXP)
4922 s32b ee = (p_ptr->exp / 25) + 1;
4923 if (ee > 5000) ee = 5000;
4924 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4930 bool_hack life_stream(bool_hack message, bool_hack virtue)
4934 chg_virtue(V_VITALITY, 1);
4935 chg_virtue(V_UNLIFE, -5);
4939 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4942 (void)set_poisoned(0);
4944 (void)set_confused(0);
4948 (void)restore_all_status();
4949 (void)set_shero(0, TRUE);
4956 bool_hack heroism(int base)
4958 bool_hack ident = FALSE;
4959 if(set_afraid(0)) ident = TRUE;
4960 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4961 if(hp_player(10)) ident = TRUE;
4965 bool_hack berserk(int base)
4967 bool_hack ident = FALSE;
4968 if (set_afraid(0)) ident = TRUE;
4969 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4970 if (hp_player(30)) ident = TRUE;
4974 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4976 bool_hack ident = FALSE;
4977 if (hp_player(damroll(dice, sides))) ident = TRUE;
4978 if (set_blind(0)) ident = TRUE;
4979 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4980 if (set_shero(0, TRUE)) ident = TRUE;
4984 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4986 bool_hack ident = FALSE;
4987 if (hp_player(damroll(dice, sides))) ident = TRUE;
4988 if (set_blind(0)) ident = TRUE;
4989 if (set_confused(0)) ident = TRUE;
4990 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4991 if (set_shero(0, TRUE)) ident = TRUE;
4995 bool_hack cure_critical_wounds(HIT_POINT pow)
4997 bool_hack ident = FALSE;
4998 if (hp_player(pow)) ident = TRUE;
4999 if (set_blind(0)) ident = TRUE;
5000 if (set_confused(0)) ident = TRUE;
5001 if (set_poisoned(0)) ident = TRUE;
5002 if (set_stun(0)) ident = TRUE;
5003 if (set_cut(0)) ident = TRUE;
5004 if (set_shero(0, TRUE)) ident = TRUE;
5008 bool_hack true_healing(HIT_POINT pow)
5010 bool_hack ident = FALSE;
5011 if (hp_player(pow)) ident = TRUE;
5012 if (set_blind(0)) ident = TRUE;
5013 if (set_confused(0)) ident = TRUE;
5014 if (set_poisoned(0)) ident = TRUE;
5015 if (set_stun(0)) ident = TRUE;
5016 if (set_cut(0)) ident = TRUE;
5017 if (set_image(0)) ident = TRUE;
5021 bool_hack restore_mana(bool_hack magic_eater)
5023 bool_hack ident = FALSE;
5025 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
5028 for (i = 0; i < EATER_EXT * 2; i++)
5030 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
5031 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;
5033 for (; i < EATER_EXT * 3; i++)
5035 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
5036 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;
5037 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
5039 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5040 p_ptr->window |= (PW_PLAYER);
5043 else if (p_ptr->csp < p_ptr->msp)
5045 p_ptr->csp = p_ptr->msp;
5046 p_ptr->csp_frac = 0;
5047 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5048 p_ptr->redraw |= (PR_MANA);
5049 p_ptr->window |= (PW_PLAYER);
5050 p_ptr->window |= (PW_SPELL);
5057 bool restore_all_status(void)
5060 if (do_res_stat(A_STR)) ident = TRUE;
5061 if (do_res_stat(A_INT)) ident = TRUE;
5062 if (do_res_stat(A_WIS)) ident = TRUE;
5063 if (do_res_stat(A_DEX)) ident = TRUE;
5064 if (do_res_stat(A_CON)) ident = TRUE;
5065 if (do_res_stat(A_CHR)) ident = TRUE;
5070 * @brief 口を使う継続的な処理を中断する
5073 void stop_mouth(void)
5075 if (music_singing_any()) stop_singing();
5076 if (hex_spelling_any()) stop_hex_spell_all();
5080 bool_hack vampirism(void)
5087 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
5089 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
5093 /* Only works on adjacent monsters */
5094 if (!get_rep_dir2(&dir)) return FALSE;
5095 y = p_ptr->y + ddy[dir];
5096 x = p_ptr->x + ddx[dir];
5097 c_ptr = &cave[y][x];
5101 if (!(c_ptr->m_idx))
5103 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
5107 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
5109 dummy = p_ptr->lev * 2;
5111 if (hypodynamic_bolt(dir, dummy))
5113 if (p_ptr->food < PY_FOOD_FULL)
5114 /* No heal if we are "full" */
5115 (void)hp_player(dummy);
5117 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
5119 /* Gain nutritional sustenance: 150/hp drained */
5120 /* A Food ration gives 5000 food points (by contrast) */
5121 /* Don't ever get more than "Full" this way */
5122 /* But if we ARE Gorged, it won't cure us */
5123 dummy = p_ptr->food + MIN(5000, 100 * dummy);
5124 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
5125 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
5128 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
5132 bool panic_hit(void)
5137 if (!get_rep_dir2(&dir)) return FALSE;
5138 y = p_ptr->y + ddy[dir];
5139 x = p_ptr->x + ddx[dir];
5140 if (cave[y][x].m_idx)
5143 if (randint0(p_ptr->skill_dis) < 7)
5144 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5146 teleport_player(30, 0L);
5151 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5159 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5162 * currently this function allows pseudo-id of any object,
5163 * including silly ones like potions & scrolls, which always
5164 * get '{average}'. This should be changed, either to stop such
5165 * items from being pseudo-id'd, or to allow psychometry to
5166 * detect whether the unidentified potion/scroll/etc is
5167 * good (Cure Light Wounds, Restore Strength, etc) or
5168 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5170 bool psychometry(void)
5174 char o_name[MAX_NLEN];
5179 item_tester_no_ryoute = TRUE;
5181 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5182 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5184 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5186 /* Get the item (in the pack) */
5189 o_ptr = &inventory[item];
5192 /* Get the item (on the floor) */
5195 o_ptr = &o_list[0 - item];
5198 /* It is fully known, no information needed */
5199 if (object_is_known(o_ptr))
5201 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5205 /* Check for a feeling */
5206 feel = value_check_aux1(o_ptr);
5208 /* Get an object description */
5209 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5211 /* Skip non-feelings */
5214 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5219 msg_format("%sは%sという感じがする...",
5220 o_name, game_inscriptions[feel]);
5222 msg_format("You feel that the %s %s %s...",
5223 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5224 game_inscriptions[feel]);
5228 /* We have "felt" it */
5229 o_ptr->ident |= (IDENT_SENSE);
5232 o_ptr->feeling = feel;
5234 /* Player touches it */
5235 o_ptr->marked |= OM_TOUCHED;
5237 /* Combine / Reorder the pack (later) */
5238 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5241 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5243 /* Valid "tval" codes */
5244 switch (o_ptr->tval)
5272 /* Auto-inscription/destroy */
5273 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5275 /* Something happened */