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;
203 /* Only detect nearby objects */
204 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
206 /* Detect "gold" objects */
207 if (o_ptr->tval == TV_GOLD)
209 /* Hack -- memorize it */
210 o_ptr->marked |= OM_FOUND;
220 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
225 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
228 if (detect_monsters_string(range, "$"))
239 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
241 * @return 効力があった場合TRUEを返す
243 bool detect_objects_normal(POSITION range)
246 POSITION range2 = range;
250 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
253 for (i = 1; i < o_max; i++)
255 object_type *o_ptr = &o_list[i];
257 /* Skip dead objects */
258 if (!o_ptr->k_idx) continue;
260 /* Skip held objects */
261 if (o_ptr->held_m_idx) continue;
267 /* Only detect nearby objects */
268 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
270 /* Detect "real" objects */
271 if (o_ptr->tval != TV_GOLD)
273 /* Hack -- memorize it */
274 o_ptr->marked |= OM_FOUND;
284 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
289 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
292 if (detect_monsters_string(range, "!=?|/`"))
303 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
305 * @return 効力があった場合TRUEを返す
308 * This will light up all spaces with "magic" items, including artifacts,
309 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
310 * and "enchanted" items of the "good" variety.
312 * It can probably be argued that this function is now too powerful.
315 bool detect_objects_magic(POSITION range)
321 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
323 /* Scan all objects */
324 for (i = 1; i < o_max; i++)
326 object_type *o_ptr = &o_list[i];
328 /* Skip dead objects */
329 if (!o_ptr->k_idx) continue;
331 /* Skip held objects */
332 if (o_ptr->held_m_idx) continue;
338 /* Only detect nearby objects */
339 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
341 /* Examine the tval */
344 /* Artifacts, misc magic items, or enchanted wearables */
345 if (object_is_artifact(o_ptr) ||
346 object_is_ego(o_ptr) ||
347 (tv == TV_WHISTLE) ||
355 (tv == TV_LIFE_BOOK) ||
356 (tv == TV_SORCERY_BOOK) ||
357 (tv == TV_NATURE_BOOK) ||
358 (tv == TV_CHAOS_BOOK) ||
359 (tv == TV_DEATH_BOOK) ||
360 (tv == TV_TRUMP_BOOK) ||
361 (tv == TV_ARCANE_BOOK) ||
362 (tv == TV_CRAFT_BOOK) ||
363 (tv == TV_DAEMON_BOOK) ||
364 (tv == TV_CRUSADE_BOOK) ||
365 (tv == TV_MUSIC_BOOK) ||
366 (tv == TV_HISSATSU_BOOK) ||
367 (tv == TV_HEX_BOOK) ||
368 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
370 /* Memorize the item */
371 o_ptr->marked |= OM_FOUND;
384 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
393 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
395 * @return 効力があった場合TRUEを返す
397 bool detect_monsters_normal(POSITION range)
404 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
407 for (i = 1; i < m_max; i++)
409 monster_type *m_ptr = &m_list[i];
410 monster_race *r_ptr = &r_info[m_ptr->r_idx];
412 /* Skip dead monsters */
413 if (!m_ptr->r_idx) continue;
419 /* Only detect nearby monsters */
420 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
422 /* Detect all non-invisible monsters */
423 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
425 /* Repair visibility later */
426 repair_monsters = TRUE;
428 /* Hack -- Detect monster */
429 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
431 /* Update the monster */
432 update_mon(i, FALSE);
439 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
444 /* Describe result */
445 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
454 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
456 * @return 効力があった場合TRUEを返す
458 bool detect_monsters_invis(POSITION range)
464 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
467 for (i = 1; i < m_max; i++)
469 monster_type *m_ptr = &m_list[i];
470 monster_race *r_ptr = &r_info[m_ptr->r_idx];
472 /* Skip dead monsters */
473 if (!m_ptr->r_idx) continue;
479 /* Only detect nearby monsters */
480 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
482 /* Detect invisible monsters */
483 if (r_ptr->flags2 & RF2_INVISIBLE)
485 /* Update monster recall window */
486 if (p_ptr->monster_race_idx == m_ptr->r_idx)
489 p_ptr->window |= (PW_MONSTER);
492 /* Repair visibility later */
493 repair_monsters = TRUE;
495 /* Hack -- Detect monster */
496 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
498 /* Update the monster */
499 update_mon(i, FALSE);
506 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
511 /* Describe result */
512 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
520 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
522 * @return 効力があった場合TRUEを返す
524 bool detect_monsters_evil(POSITION range)
530 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
533 for (i = 1; i < m_max; i++)
535 monster_type *m_ptr = &m_list[i];
536 monster_race *r_ptr = &r_info[m_ptr->r_idx];
538 /* Skip dead monsters */
539 if (!m_ptr->r_idx) continue;
545 /* Only detect nearby monsters */
546 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
548 /* Detect evil monsters */
549 if (r_ptr->flags3 & RF3_EVIL)
551 if (is_original_ap(m_ptr))
553 /* Take note that they are evil */
554 r_ptr->r_flags3 |= (RF3_EVIL);
556 /* Update monster recall window */
557 if (p_ptr->monster_race_idx == m_ptr->r_idx)
560 p_ptr->window |= (PW_MONSTER);
564 /* Repair visibility later */
565 repair_monsters = TRUE;
567 /* Hack -- Detect monster */
568 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
570 /* Update the monster */
571 update_mon(i, FALSE);
581 /* Describe result */
582 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
590 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
592 * @return 効力があった場合TRUEを返す
594 bool detect_monsters_nonliving(POSITION range)
600 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
603 for (i = 1; i < m_max; i++)
605 monster_type *m_ptr = &m_list[i];
606 monster_race *r_ptr = &r_info[m_ptr->r_idx];
608 /* Skip dead monsters */
609 if (!m_ptr->r_idx) continue;
615 /* Only detect nearby monsters */
616 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
618 /* Detect non-living monsters */
619 if (!monster_living(r_ptr))
621 /* Update monster recall window */
622 if (p_ptr->monster_race_idx == m_ptr->r_idx)
625 p_ptr->window |= (PW_MONSTER);
628 /* Repair visibility later */
629 repair_monsters = TRUE;
631 /* Hack -- Detect monster */
632 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
634 /* Update the monster */
635 update_mon(i, FALSE);
645 /* Describe result */
646 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
654 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
656 * @return 効力があった場合TRUEを返す
658 bool detect_monsters_mind(POSITION range)
664 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
667 for (i = 1; i < m_max; i++)
669 monster_type *m_ptr = &m_list[i];
670 monster_race *r_ptr = &r_info[m_ptr->r_idx];
672 /* Skip dead monsters */
673 if (!m_ptr->r_idx) continue;
679 /* Only detect nearby monsters */
680 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
682 /* Detect non-living monsters */
683 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
685 /* Update monster recall window */
686 if (p_ptr->monster_race_idx == m_ptr->r_idx)
689 p_ptr->window |= (PW_MONSTER);
692 /* Repair visibility later */
693 repair_monsters = TRUE;
695 /* Hack -- Detect monster */
696 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
698 /* Update the monster */
699 update_mon(i, FALSE);
709 /* Describe result */
710 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
719 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
721 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
722 * @return 効力があった場合TRUEを返す
724 bool detect_monsters_string(POSITION range, cptr Match)
730 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
733 for (i = 1; i < m_max; i++)
735 monster_type *m_ptr = &m_list[i];
736 monster_race *r_ptr = &r_info[m_ptr->r_idx];
738 /* Skip dead monsters */
739 if (!m_ptr->r_idx) continue;
745 /* Only detect nearby monsters */
746 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
748 /* Detect monsters with the same symbol */
749 if (my_strchr(Match, r_ptr->d_char))
751 /* Update monster recall window */
752 if (p_ptr->monster_race_idx == m_ptr->r_idx)
755 p_ptr->window |= (PW_MONSTER);
758 /* Repair visibility later */
759 repair_monsters = TRUE;
761 /* Hack -- Detect monster */
762 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
764 /* Update the monster */
765 update_mon(i, FALSE);
772 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
777 /* Describe result */
778 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
786 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
788 * @param match_flag 感知フラグ
789 * @return 効力があった場合TRUEを返す
791 bool detect_monsters_xxx(POSITION range, u32b match_flag)
796 cptr desc_monsters = _("変なモンスター", "weird monsters");
798 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
801 for (i = 1; i < m_max; i++)
803 monster_type *m_ptr = &m_list[i];
804 monster_race *r_ptr = &r_info[m_ptr->r_idx];
806 /* Skip dead monsters */
807 if (!m_ptr->r_idx) continue;
813 /* Only detect nearby monsters */
814 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
816 /* Detect evil monsters */
817 if (r_ptr->flags3 & (match_flag))
819 if (is_original_ap(m_ptr))
821 /* Take note that they are something */
822 r_ptr->r_flags3 |= (match_flag);
824 /* Update monster recall window */
825 if (p_ptr->monster_race_idx == m_ptr->r_idx)
828 p_ptr->window |= (PW_MONSTER);
832 /* Repair visibility later */
833 repair_monsters = TRUE;
835 /* Hack -- Detect monster */
836 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
838 /* Update the monster */
839 update_mon(i, FALSE);
852 desc_monsters = _("デーモン", "demons");
855 desc_monsters = _("アンデッド", "the undead");
859 /* Describe result */
860 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
870 * @brief 全感知処理 / Detect everything
872 * @return 効力があった場合TRUEを返す
874 bool detect_all(POSITION range)
878 /* Detect everything */
879 if (detect_traps(range, TRUE)) detect = TRUE;
880 if (detect_doors(range)) detect = TRUE;
881 if (detect_stairs(range)) detect = TRUE;
883 /* There are too many hidden treasure. So... */
884 /* if (detect_treasure(range)) detect = TRUE; */
886 if (detect_objects_gold(range)) detect = TRUE;
887 if (detect_objects_normal(range)) detect = TRUE;
888 if (detect_monsters_invis(range)) detect = TRUE;
889 if (detect_monsters_normal(range)) detect = TRUE;
897 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
900 * @return 効力があった場合TRUEを返す
903 * Note that affected monsters are NOT auto-tracked by this usage.
905 * To avoid misbehavior when monster deaths have side-effects,
906 * this is done in two passes. -- JDL
909 bool project_hack(int typ, HIT_POINT dam)
912 int flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
913 bool obvious = FALSE;
916 /* Mark all (nearby) monsters */
917 for (i = 1; i < m_max; i++)
919 monster_type *m_ptr = &m_list[i];
921 /* Paranoia -- Skip dead monsters */
922 if (!m_ptr->r_idx) continue;
928 /* Require line of sight */
929 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
931 /* Mark the monster */
932 m_ptr->mflag |= (MFLAG_TEMP);
935 /* Affect all marked monsters */
936 for (i = 1; i < m_max; i++)
938 monster_type *m_ptr = &m_list[i];
940 /* Skip unmarked monsters */
941 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
944 m_ptr->mflag &= ~(MFLAG_TEMP);
950 /* Jump directly to the target monster */
951 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
960 * @brief 視界内モンスターを加速する処理 / Speed monsters
961 * @return 効力があった場合TRUEを返す
963 bool speed_monsters(void)
965 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
969 * @brief 視界内モンスターを加速する処理 / Slow monsters
970 * @return 効力があった場合TRUEを返す
972 bool slow_monsters(int power)
974 return (project_hack(GF_OLD_SLOW, power));
978 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
979 * @return 効力があった場合TRUEを返す
981 bool sleep_monsters(int power)
983 return (project_hack(GF_OLD_SLEEP, power));
987 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
988 * @return 効力があった場合TRUEを返す
990 bool banish_evil(int dist)
992 return (project_hack(GF_AWAY_EVIL, dist));
996 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
997 * @return 効力があった場合TRUEを返す
999 bool turn_undead(void)
1001 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
1003 chg_virtue(V_UNLIFE, -1);
1008 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
1009 * @return 効力があった場合TRUEを返す
1011 bool dispel_undead(HIT_POINT dam)
1013 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
1015 chg_virtue(V_UNLIFE, -2);
1020 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
1021 * @return 効力があった場合TRUEを返す
1023 bool dispel_evil(HIT_POINT dam)
1025 return (project_hack(GF_DISP_EVIL, dam));
1029 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
1030 * @return 効力があった場合TRUEを返す
1032 bool dispel_good(HIT_POINT dam)
1034 return (project_hack(GF_DISP_GOOD, dam));
1038 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
1039 * @return 効力があった場合TRUEを返す
1041 bool dispel_monsters(HIT_POINT dam)
1043 return (project_hack(GF_DISP_ALL, dam));
1047 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
1048 * @return 効力があった場合TRUEを返す
1050 bool dispel_living(HIT_POINT dam)
1052 return (project_hack(GF_DISP_LIVING, dam));
1056 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
1057 * @return 効力があった場合TRUEを返す
1059 bool dispel_demons(HIT_POINT dam)
1061 return (project_hack(GF_DISP_DEMON, dam));
1065 * @brief 視界内のモンスターに「聖戦」効果を与える処理
1066 * @return 効力があった場合TRUEを返す
1070 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
1074 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
1075 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
1078 void aggravate_monsters(MONSTER_IDX who)
1085 /* Aggravate everyone nearby */
1086 for (i = 1; i < m_max; i++)
1088 monster_type *m_ptr = &m_list[i];
1089 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
1091 /* Paranoia -- Skip dead monsters */
1092 if (!m_ptr->r_idx) continue;
1094 /* Skip aggravating monster (or player) */
1095 if (i == who) continue;
1097 /* Wake up nearby sleeping monsters */
1098 if (m_ptr->cdis < MAX_SIGHT * 2)
1101 if (MON_CSLEEP(m_ptr))
1103 (void)set_monster_csleep(i, 0);
1106 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1109 /* Speed up monsters in line of sight */
1110 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1114 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1122 if (speed) msg_print("付近で何かが突如興奮したような感じを受けた!");
1123 else if (sleep) msg_print("何かが突如興奮したような騒々しい音が遠くに聞こえた!");
1125 if (speed) msg_print("You feel a sudden stirring nearby!");
1126 else if (sleep) msg_print("You hear a sudden stirring in the distance!");
1128 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1133 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1134 * @param m_idx 抹殺するモンスターID
1135 * @param power 抹殺の威力
1136 * @param player_cast プレイヤーの魔法によるものならば TRUE
1137 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1138 * @param spell_name 抹殺効果を起こした魔法の名前
1139 * @return 効力があった場合TRUEを返す
1141 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1143 int msec = delay_factor * delay_factor * delay_factor;
1144 monster_type *m_ptr = &m_list[m_idx];
1145 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1146 bool resist = FALSE;
1148 if (is_pet(m_ptr) && !player_cast) return FALSE;
1150 /* Hack -- Skip Unique Monsters or Quest Monsters */
1151 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1153 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1155 else if (m_idx == p_ptr->riding) resist = TRUE;
1157 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1159 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1161 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1163 /* Delete the monster */
1166 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1170 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1171 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1174 delete_monster_idx(m_idx);
1177 if (resist && player_cast)
1179 bool see_m = is_seen(m_ptr);
1182 monster_desc(m_name, m_ptr, 0);
1185 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1187 if (MON_CSLEEP(m_ptr))
1189 (void)set_monster_csleep(m_idx, 0);
1192 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1195 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1199 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1203 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1209 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1212 /* Visual feedback */
1213 move_cursor_relative(p_ptr->y, p_ptr->x);
1216 p_ptr->redraw |= (PR_HP);
1219 p_ptr->window |= (PW_PLAYER);
1228 Term_xtra(TERM_XTRA_DELAY, msec);
1235 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1236 * @param power 抹殺の威力
1237 * @param player_cast プレイヤーの魔法によるものならば TRUE
1238 * @return 効力があった場合TRUEを返す
1240 bool symbol_genocide(int power, bool player_cast)
1244 bool result = FALSE;
1246 /* Prevent genocide in quest levels */
1247 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1252 /* Mega-Hack -- Get a monster symbol */
1253 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1255 /* Delete the monsters of that "type" */
1256 for (i = 1; i < m_max; i++)
1258 monster_type *m_ptr = &m_list[i];
1259 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1261 /* Paranoia -- Skip dead monsters */
1262 if (!m_ptr->r_idx) continue;
1264 /* Skip "wrong" monsters */
1265 if (r_ptr->d_char != typ) continue;
1268 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1273 chg_virtue(V_VITALITY, -2);
1274 chg_virtue(V_CHANCE, -1);
1282 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1283 * @param power 抹殺の威力
1284 * @param player_cast プレイヤーの魔法によるものならば TRUE
1285 * @return 効力があった場合TRUEを返す
1287 bool mass_genocide(int power, bool player_cast)
1290 bool result = FALSE;
1292 /* Prevent mass genocide in quest levels */
1293 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1298 /* Delete the (nearby) monsters */
1299 for (i = 1; i < m_max; i++)
1301 monster_type *m_ptr = &m_list[i];
1303 /* Paranoia -- Skip dead monsters */
1304 if (!m_ptr->r_idx) continue;
1306 /* Skip distant monsters */
1307 if (m_ptr->cdis > MAX_SIGHT) continue;
1310 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1315 chg_virtue(V_VITALITY, -2);
1316 chg_virtue(V_CHANCE, -1);
1324 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1325 * @param power 抹殺の威力
1326 * @param player_cast プレイヤーの魔法によるものならば TRUE
1327 * @return 効力があった場合TRUEを返す
1329 bool mass_genocide_undead(int power, bool player_cast)
1332 bool result = FALSE;
1334 /* Prevent mass genocide in quest levels */
1335 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1340 /* Delete the (nearby) monsters */
1341 for (i = 1; i < m_max; i++)
1343 monster_type *m_ptr = &m_list[i];
1344 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1346 /* Paranoia -- Skip dead monsters */
1347 if (!m_ptr->r_idx) continue;
1349 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1351 /* Skip distant monsters */
1352 if (m_ptr->cdis > MAX_SIGHT) continue;
1355 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1360 chg_virtue(V_UNLIFE, -2);
1361 chg_virtue(V_CHANCE, -1);
1369 * @brief 周辺モンスターを調査する / Probe nearby monsters
1370 * @return 効力があった場合TRUEを返す
1385 /* Probe all (nearby) monsters */
1386 for (i = 1; i < m_max; i++)
1388 monster_type *m_ptr = &m_list[i];
1389 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1391 /* Paranoia -- Skip dead monsters */
1392 if (!m_ptr->r_idx) continue;
1394 /* Require line of sight */
1395 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1397 /* Probe visible monsters */
1402 /* Start the message */
1405 msg_print(_("調査中...", "Probing..."));
1410 if (!is_original_ap(m_ptr))
1412 if (m_ptr->mflag2 & MFLAG2_KAGE)
1413 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1415 m_ptr->ap_r_idx = m_ptr->r_idx;
1416 lite_spot(m_ptr->fy, m_ptr->fx);
1418 /* Get "the monster" or "something" */
1419 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1421 speed = m_ptr->mspeed - 110;
1422 if (MON_FAST(m_ptr)) speed += 10;
1423 if (MON_SLOW(m_ptr)) speed -= 10;
1424 if (ironman_nightmare) speed += 5;
1426 /* Get the monster's alignment */
1428 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "善悪";
1429 else if (r_ptr->flags3 & RF3_EVIL) align = "邪悪";
1430 else if (r_ptr->flags3 & RF3_GOOD) align = "善良";
1431 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "中立(善悪)";
1432 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "中立(邪悪)";
1433 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "中立(善良)";
1436 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "good&evil";
1437 else if (r_ptr->flags3 & RF3_EVIL) align = "evil";
1438 else if (r_ptr->flags3 & RF3_GOOD) align = "good";
1439 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
1440 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "neutral(evil)";
1441 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "neutral(good)";
1442 else align = "neutral";
1445 /* Describe the monster */
1446 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1447 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1449 if (r_ptr->next_r_idx)
1451 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1455 strcat(buf, "xxx ");
1459 if (MON_CSLEEP(m_ptr)) strcat(buf,"睡眠 ");
1460 if (MON_STUNNED(m_ptr)) strcat(buf,"朦朧 ");
1461 if (MON_MONFEAR(m_ptr)) strcat(buf,"恐怖 ");
1462 if (MON_CONFUSED(m_ptr)) strcat(buf,"混乱 ");
1463 if (MON_INVULNER(m_ptr)) strcat(buf,"無敵 ");
1465 if (MON_CSLEEP(m_ptr)) strcat(buf,"sleeping ");
1466 if (MON_STUNNED(m_ptr)) strcat(buf,"stunned ");
1467 if (MON_MONFEAR(m_ptr)) strcat(buf,"scared ");
1468 if (MON_CONFUSED(m_ptr)) strcat(buf,"confused ");
1469 if (MON_INVULNER(m_ptr)) strcat(buf,"invulnerable ");
1471 buf[strlen(buf)-1] = '\0';
1474 /* HACK : Add the line to message buffer */
1476 p_ptr->window |= (PW_MESSAGE);
1479 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1482 Term_erase(0, 0, 255);
1484 /* Learn everything about this monster */
1485 if (lore_do_probe(m_ptr->r_idx))
1487 /* Get base name of monster */
1488 strcpy(buf, (r_name + r_ptr->name));
1491 /* Note that we learnt some new flags -Mogami- */
1492 msg_format("%sについてさらに詳しくなった気がする。", buf);
1497 /* Note that we learnt some new flags -Mogami- */
1498 msg_format("You now know more about %s.", buf);
1500 /* Clear -more- prompt */
1516 chg_virtue(V_KNOWLEDGE, 1);
1517 msg_print(_("これで全部です。", "That's all."));
1527 * @brief *破壊*処理を行う / The spell of destruction
1528 * @param y1 破壊の中心Y座標
1529 * @param x1 破壊の中心X座標
1531 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1532 * @return 効力があった場合TRUEを返す
1535 * This spell "deletes" monsters (instead of "killing" them).
1537 * Later we may use one function for both "destruction" and
1538 * "earthquake" by using the "full" to select "destruction".
1541 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1548 /* Prevent destruction of quest levels and town */
1549 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1554 /* Lose monster light */
1555 if (!in_generate) clear_mon_lite();
1557 /* Big area of affect */
1558 for (y = (y1 - r); y <= (y1 + r); y++)
1560 for (x = (x1 - r); x <= (x1 + r); x++)
1562 /* Skip illegal grids */
1563 if (!in_bounds(y, x)) continue;
1565 /* Extract the distance */
1566 k = distance(y1, x1, y, x);
1568 /* Stay in the circle of death */
1569 if (k > r) continue;
1571 /* Access the grid */
1572 c_ptr = &cave[y][x];
1574 /* Lose room and vault */
1575 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1577 /* Lose light and knowledge */
1578 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1580 if (!in_generate) /* Normal */
1583 c_ptr->info &= ~(CAVE_UNSAFE);
1585 /* Hack -- Notice player affect */
1586 if (player_bold(y, x))
1588 /* Hurt the player later */
1591 /* Do not hurt this grid */
1596 /* Hack -- Skip the epicenter */
1597 if ((y == y1) && (x == x1)) continue;
1601 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1602 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1604 if (in_generate) /* In generation */
1606 /* Delete the monster (if any) */
1607 delete_monster(y, x);
1609 else if (r_ptr->flags1 & RF1_QUESTOR)
1611 /* Heal the monster */
1612 m_ptr->hp = m_ptr->maxhp;
1614 /* Try to teleport away quest monsters */
1615 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1619 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1623 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1624 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1627 /* Delete the monster (if any) */
1628 delete_monster(y, x);
1632 /* During generation, destroyed artifacts are "preserved" */
1633 if (preserve_mode || in_generate)
1635 s16b this_o_idx, next_o_idx = 0;
1637 /* Scan all objects in the grid */
1638 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1642 /* Acquire object */
1643 o_ptr = &o_list[this_o_idx];
1645 /* Acquire next object */
1646 next_o_idx = o_ptr->next_o_idx;
1648 /* Hack -- Preserve unknown artifacts */
1649 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1651 /* Mega-Hack -- Preserve the artifact */
1652 a_info[o_ptr->name1].cur_num = 0;
1654 if (in_generate && cheat_peek)
1656 char o_name[MAX_NLEN];
1657 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1658 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1661 else if (in_generate && cheat_peek && o_ptr->art_name)
1663 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1664 "One of the random artifacts was *destroyed* during generation."));
1669 /* Delete objects */
1670 delete_object(y, x);
1672 /* Destroy "non-permanent" grids */
1673 if (!cave_perma_grid(c_ptr))
1675 /* Wall (or floor) type */
1678 if (!in_generate) /* Normal */
1682 /* Create granite wall */
1683 cave_set_feat(y, x, feat_granite);
1687 /* Create quartz vein */
1688 cave_set_feat(y, x, feat_quartz_vein);
1692 /* Create magma vein */
1693 cave_set_feat(y, x, feat_magma_vein);
1698 cave_set_feat(y, x, floor_type[randint0(100)]);
1701 else /* In generation */
1705 /* Create granite wall */
1706 place_extra_grid(c_ptr);
1710 /* Create quartz vein */
1711 c_ptr->feat = feat_quartz_vein;
1715 /* Create magma vein */
1716 c_ptr->feat = feat_magma_vein;
1721 place_floor_grid(c_ptr);
1724 /* Clear garbage of hidden trap or door */
1733 /* Process "re-glowing" */
1734 for (y = (y1 - r); y <= (y1 + r); y++)
1736 for (x = (x1 - r); x <= (x1 + r); x++)
1738 /* Skip illegal grids */
1739 if (!in_bounds(y, x)) continue;
1741 /* Extract the distance */
1742 k = distance(y1, x1, y, x);
1744 /* Stay in the circle of death */
1745 if (k > r) continue;
1747 /* Access the grid */
1748 c_ptr = &cave[y][x];
1750 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1751 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1756 for (i = 0; i < 9; i++)
1758 yy = y + ddy_ddd[i];
1759 xx = x + ddx_ddd[i];
1760 if (!in_bounds2(yy, xx)) continue;
1761 cc_ptr = &cave[yy][xx];
1762 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1764 c_ptr->info |= CAVE_GLOW;
1772 /* Hack -- Affect player */
1776 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1778 /* Blind the player */
1779 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1782 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1788 /* Mega-Hack -- Forget the view and lite */
1789 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1792 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1795 p_ptr->redraw |= (PR_MAP);
1798 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1800 if (p_ptr->special_defense & NINJA_S_STEALTH)
1802 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1812 * @brief 地震処理(サブルーチン) /
1813 * Induce an "earthquake" of the given radius at the given location.
1814 * @return 効力があった場合TRUEを返す
1818 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1822 * This will turn some walls into floors and some floors into walls.
1824 * The player will take damage and "jump" into a safe grid if possible,
1825 * otherwise, he will "tunnel" through the rubble instantaneously.
1827 * Monsters will take damage, and "jump" into a safe grid if possible,
1828 * otherwise they will be "buried" in the rubble, disappearing from
1829 * the level in the same way that they do when genocided.
1831 * Note that thus the player and monsters (except eaters of walls and
1832 * passers through walls) will never occupy the same grid as a wall.
1833 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1834 * for a single turn, unless that monster can pass_walls or kill_walls.
1835 * This has allowed massive simplification of the "monster" code.
1838 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1841 POSITION y, x, yy, xx, dy, dx;
1844 POSITION sy = 0, sx = 0;
1850 /* Prevent destruction of quest levels and town */
1851 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1856 /* Paranoia -- Enforce maximum range */
1859 /* Clear the "maximal blast" area */
1860 for (y = 0; y < 32; y++)
1862 for (x = 0; x < 32; x++)
1868 /* Check around the epicenter */
1869 for (dy = -r; dy <= r; dy++)
1871 for (dx = -r; dx <= r; dx++)
1873 /* Extract the location */
1877 /* Skip illegal grids */
1878 if (!in_bounds(yy, xx)) continue;
1880 /* Skip distant grids */
1881 if (distance(cy, cx, yy, xx) > r) continue;
1883 /* Access the grid */
1884 c_ptr = &cave[yy][xx];
1886 /* Lose room and vault */
1887 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1889 /* Lose light and knowledge */
1890 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1892 /* Skip the epicenter */
1893 if (!dx && !dy) continue;
1895 /* Skip most grids */
1896 if (randint0(100) < 85) continue;
1898 /* Damage this grid */
1899 map[16+yy-cy][16+xx-cx] = TRUE;
1901 /* Hack -- Take note of player damage */
1902 if (player_bold(yy, xx)) hurt = TRUE;
1906 /* First, affect the player (if necessary) */
1907 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1909 /* Check around the player */
1910 for (i = 0; i < 8; i++)
1912 /* Access the location */
1913 y = p_ptr->y + ddy_ddd[i];
1914 x = p_ptr->x + ddx_ddd[i];
1916 /* Skip non-empty grids */
1917 if (!cave_empty_bold(y, x)) continue;
1919 /* Important -- Skip "quake" grids */
1920 if (map[16+y-cy][16+x-cx]) continue;
1922 if (cave[y][x].m_idx) continue;
1924 /* Count "safe" grids */
1927 /* Randomize choice */
1928 if (randint0(sn) > 0) continue;
1930 /* Save the safe location */
1934 /* Random message */
1935 switch (randint1(3))
1939 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1944 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1949 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1954 /* Hurt the player a lot */
1957 /* Message and damage */
1958 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1962 /* Destroy the grid, and push the player to safety */
1965 /* Calculate results */
1966 switch (randint1(3))
1970 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1976 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1977 damage = damroll(10, 4);
1978 (void)set_stun(p_ptr->stun + randint1(50));
1983 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1984 damage = damroll(10, 4);
1985 (void)set_stun(p_ptr->stun + randint1(50));
1990 /* Move the player to the safe location */
1991 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1994 /* Important -- no wall on player */
1995 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1997 /* Take some damage */
2005 monster_type *m_ptr = &m_list[m_idx];
2007 /* Get the monster's real name */
2008 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
2010 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
2014 killer = _("地震", "an earthquake");
2017 take_hit(DAMAGE_ATTACK, damage, killer, -1);
2021 /* Examine the quaked region */
2022 for (dy = -r; dy <= r; dy++)
2024 for (dx = -r; dx <= r; dx++)
2026 /* Extract the location */
2030 /* Skip unaffected grids */
2031 if (!map[16+yy-cy][16+xx-cx]) continue;
2033 /* Access the grid */
2034 c_ptr = &cave[yy][xx];
2036 if (c_ptr->m_idx == p_ptr->riding) continue;
2038 /* Process monsters */
2041 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2042 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2044 /* Quest monsters */
2045 if (r_ptr->flags1 & RF1_QUESTOR)
2047 /* No wall on quest monsters */
2048 map[16+yy-cy][16+xx-cx] = FALSE;
2053 /* Most monsters cannot co-exist with rock */
2054 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
2055 !(r_ptr->flags2 & (RF2_PASS_WALL)))
2059 /* Assume not safe */
2062 /* Monster can move to escape the wall */
2063 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
2065 /* Look for safety */
2066 for (i = 0; i < 8; i++)
2068 /* Access the grid */
2069 y = yy + ddy_ddd[i];
2070 x = xx + ddx_ddd[i];
2072 /* Skip non-empty grids */
2073 if (!cave_empty_bold(y, x)) continue;
2075 /* Hack -- no safety on glyph of warding */
2076 if (is_glyph_grid(&cave[y][x])) continue;
2077 if (is_explosive_rune_grid(&cave[y][x])) continue;
2079 /* ... nor on the Pattern */
2080 if (pattern_tile(y, x)) continue;
2082 /* Important -- Skip "quake" grids */
2083 if (map[16+y-cy][16+x-cx]) continue;
2085 if (cave[y][x].m_idx) continue;
2086 if (player_bold(y, x)) continue;
2088 /* Count "safe" grids */
2091 /* Randomize choice */
2092 if (randint0(sn) > 0) continue;
2094 /* Save the safe grid */
2099 /* Describe the monster */
2100 monster_desc(m_name, m_ptr, 0);
2102 /* Scream in pain */
2103 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
2105 /* Take damage from the quake */
2106 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
2108 /* Monster is certainly awake */
2109 (void)set_monster_csleep(c_ptr->m_idx, 0);
2111 /* Apply damage directly */
2112 m_ptr->hp -= damage;
2114 /* Delete (not kill) "dead" monsters */
2118 if (!ignore_unview || is_seen(m_ptr))
2119 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
2123 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
2127 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
2128 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
2132 /* Delete the monster */
2133 delete_monster(yy, xx);
2135 /* No longer safe */
2139 /* Hack -- Escape from the rock */
2142 IDX m_idx_aux = cave[yy][xx].m_idx;
2144 /* Update the old location */
2145 cave[yy][xx].m_idx = 0;
2147 /* Update the new location */
2148 cave[sy][sx].m_idx = m_idx_aux;
2150 /* Move the monster */
2154 /* Update the monster (new location) */
2155 update_mon(m_idx, TRUE);
2157 /* Redraw the old grid */
2160 /* Redraw the new grid */
2168 /* Lose monster light */
2171 /* Examine the quaked region */
2172 for (dy = -r; dy <= r; dy++)
2174 for (dx = -r; dx <= r; dx++)
2176 /* Extract the location */
2180 /* Skip unaffected grids */
2181 if (!map[16+yy-cy][16+xx-cx]) continue;
2183 /* Access the cave grid */
2184 c_ptr = &cave[yy][xx];
2186 /* Paranoia -- never affect player */
2187 /* if (player_bold(yy, xx)) continue; */
2189 /* Destroy location (if valid) */
2190 if (cave_valid_bold(yy, xx))
2192 /* Delete objects */
2193 delete_object(yy, xx);
2195 /* Wall (or floor) type */
2196 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2201 /* Create granite wall */
2202 cave_set_feat(yy, xx, feat_granite);
2208 /* Create quartz vein */
2209 cave_set_feat(yy, xx, feat_quartz_vein);
2215 /* Create magma vein */
2216 cave_set_feat(yy, xx, feat_magma_vein);
2223 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2230 /* Process "re-glowing" */
2231 for (dy = -r; dy <= r; dy++)
2233 for (dx = -r; dx <= r; dx++)
2235 /* Extract the location */
2239 /* Skip illegal grids */
2240 if (!in_bounds(yy, xx)) continue;
2242 /* Skip distant grids */
2243 if (distance(cy, cx, yy, xx) > r) continue;
2245 /* Access the grid */
2246 c_ptr = &cave[yy][xx];
2248 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2249 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2254 for (ii = 0; ii < 9; ii++)
2256 yyy = yy + ddy_ddd[ii];
2257 xxx = xx + ddx_ddd[ii];
2258 if (!in_bounds2(yyy, xxx)) continue;
2259 cc_ptr = &cave[yyy][xxx];
2260 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2262 c_ptr->info |= CAVE_GLOW;
2271 /* Mega-Hack -- Forget the view and lite */
2272 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2275 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2277 /* Update the health bar */
2278 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2281 p_ptr->redraw |= (PR_MAP);
2284 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2286 if (p_ptr->special_defense & NINJA_S_STEALTH)
2288 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2296 * @brief 地震処理(プレイヤーの中心発動) /
2297 * Induce an "earthquake" of the given radius at the given location.
2298 * @return 効力があった場合TRUEを返す
2303 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2305 return earthquake_aux(cy, cx, r, 0);
2312 void discharge_minion(void)
2317 for (i = 1; i < m_max; i++)
2319 monster_type *m_ptr = &m_list[i];
2320 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2321 if (m_ptr->nickname) okay = FALSE;
2323 if (!okay || p_ptr->riding)
2325 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2328 for (i = 1; i < m_max; i++)
2331 monster_type *m_ptr = &m_list[i];
2332 monster_race *r_ptr;
2334 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2335 r_ptr = &r_info[m_ptr->r_idx];
2337 /* Uniques resist discharging */
2338 if (r_ptr->flags1 & RF1_UNIQUE)
2341 monster_desc(m_name, m_ptr, 0x00);
2342 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2343 delete_monster_idx(i);
2346 dam = m_ptr->maxhp / 2;
2347 if (dam > 100) dam = (dam-100)/2 + 100;
2348 if (dam > 400) dam = (dam-400)/2 + 400;
2349 if (dam > 800) dam = 800;
2350 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2351 m_ptr->fx, dam, GF_PLASMA,
2352 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2354 if (record_named_pet && m_ptr->nickname)
2358 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2359 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2362 delete_monster_idx(i);
2368 * @brief 部屋全体を照らすサブルーチン
2372 * This routine clears the entire "temp" set.
2373 * This routine will Perma-Lite all "temp" grids.
2374 * This routine is used (only) by "lite_room()"
2375 * Dark grids are illuminated.
2376 * Also, process all affected monsters.
2378 * SMART monsters always wake up when illuminated
2379 * NORMAL monsters wake up 1/4 the time when illuminated
2380 * STUPID monsters wake up 1/10 the time when illuminated
2383 static void cave_temp_room_lite(void)
2387 /* Clear them all */
2388 for (i = 0; i < temp_n; i++)
2393 cave_type *c_ptr = &cave[y][x];
2395 /* No longer in the array */
2396 c_ptr->info &= ~(CAVE_TEMP);
2398 /* Update only non-CAVE_GLOW grids */
2399 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2402 c_ptr->info |= (CAVE_GLOW);
2404 /* Process affected monsters */
2409 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2411 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2413 /* Update the monster */
2414 update_mon(c_ptr->m_idx, FALSE);
2416 /* Stupid monsters rarely wake up */
2417 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2419 /* Smart monsters always wake up */
2420 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2422 /* Sometimes monsters wake up */
2423 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2426 (void)set_monster_csleep(c_ptr->m_idx, 0);
2428 /* Notice the "waking up" */
2433 /* Acquire the monster name */
2434 monster_desc(m_name, m_ptr, 0);
2436 /* Dump a message */
2437 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2448 update_local_illumination(y, x);
2458 * @brief 部屋全体を暗くするサブルーチン
2462 * This routine clears the entire "temp" set.
2463 * This routine will "darken" all "temp" grids.
2464 * In addition, some of these grids will be "unmarked".
2465 * This routine is used (only) by "unlite_room()"
2466 * Also, process all affected monsters
2469 static void cave_temp_room_unlite(void)
2473 /* Clear them all */
2474 for (i = 0; i < temp_n; i++)
2480 cave_type *c_ptr = &cave[y][x];
2481 bool do_dark = !is_mirror_grid(c_ptr);
2483 /* No longer in the array */
2484 c_ptr->info &= ~(CAVE_TEMP);
2486 /* Darken the grid */
2489 if (dun_level || !is_daytime())
2491 for (j = 0; j < 9; j++)
2493 int by = y + ddy_ddd[j];
2494 int bx = x + ddx_ddd[j];
2496 if (in_bounds2(by, bx))
2498 cave_type *cc_ptr = &cave[by][bx];
2500 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2508 if (!do_dark) continue;
2511 c_ptr->info &= ~(CAVE_GLOW);
2513 /* Hack -- Forget "boring" grids */
2514 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2516 /* Forget the grid */
2517 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2523 /* Process affected monsters */
2526 /* Update the monster */
2527 update_mon(c_ptr->m_idx, FALSE);
2533 update_local_illumination(y, x);
2543 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2546 * @param pass_bold 地形条件を返す関数ポインタ
2549 static int next_to_open(int cy, int cx, bool (*pass_bold)(int, int))
2558 for (i = 0; i < 16; i++)
2560 y = cy + ddy_cdd[i % 8];
2561 x = cx + ddx_cdd[i % 8];
2563 /* Found a wall, break the length */
2564 if (!pass_bold(y, x))
2566 /* Track best length */
2580 return (MAX(len, blen));
2584 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2587 * @param pass_bold 地形条件を返す関数ポインタ
2590 static int next_to_walls_adj(int cy, int cx, bool (*pass_bold)(int, int))
2598 for (i = 0; i < 8; i++)
2600 y = cy + ddy_ddd[i];
2601 x = cx + ddx_ddd[i];
2603 if (!pass_bold(y, x)) c++;
2611 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2612 * @param y 部屋内のy座標1点
2613 * @param x 部屋内のx座標1点
2614 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2615 * @param pass_bold 地形条件を返す関数ポインタ
2618 static void cave_temp_room_aux(int y, int x, bool only_room, bool (*pass_bold)(int, int))
2623 c_ptr = &cave[y][x];
2625 /* Avoid infinite recursion */
2626 if (c_ptr->info & (CAVE_TEMP)) return;
2628 /* Do not "leave" the current room */
2629 if (!(c_ptr->info & (CAVE_ROOM)))
2631 if (only_room) return;
2634 if (!in_bounds2(y, x)) return;
2636 /* Do not exceed the maximum spell range */
2637 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2639 /* Verify this grid */
2641 * The reason why it is ==6 instead of >5 is that 8 is impossible
2642 * due to the check for cave_bold above.
2643 * 7 lights dead-end corridors (you need to do this for the
2644 * checkboard interesting rooms, so that the boundary is lit
2646 * This leaves only a check for 6 bounding walls!
2648 if (in_bounds(y, x) && pass_bold(y, x) &&
2649 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2652 /* Paranoia -- verify space */
2653 if (temp_n == TEMP_MAX) return;
2655 /* Mark the grid as "seen" */
2656 c_ptr->info |= (CAVE_TEMP);
2658 /* Add it to the "seen" set */
2665 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2668 * @return 光を通すならばtrueを返す。
2670 static bool cave_pass_lite_bold(int y, int x)
2672 return cave_los_bold(y, x);
2676 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2681 static void cave_temp_lite_room_aux(int y, int x)
2683 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2687 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2690 * @return 射線を通すならばtrueを返す。
2692 static bool cave_pass_dark_bold(int y, int x)
2694 return cave_have_flag_bold(y, x, FF_PROJECT);
2699 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2704 static void cave_temp_unlite_room_aux(int y, int x)
2706 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2711 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2716 void lite_room(int y1, int x1)
2720 /* Add the initial grid */
2721 cave_temp_lite_room_aux(y1, x1);
2723 /* While grids are in the queue, add their neighbors */
2724 for (i = 0; i < temp_n; i++)
2726 x = temp_x[i], y = temp_y[i];
2728 /* Walls get lit, but stop light */
2729 if (!cave_pass_lite_bold(y, x)) continue;
2731 /* Spread adjacent */
2732 cave_temp_lite_room_aux(y + 1, x);
2733 cave_temp_lite_room_aux(y - 1, x);
2734 cave_temp_lite_room_aux(y, x + 1);
2735 cave_temp_lite_room_aux(y, x - 1);
2737 /* Spread diagonal */
2738 cave_temp_lite_room_aux(y + 1, x + 1);
2739 cave_temp_lite_room_aux(y - 1, x - 1);
2740 cave_temp_lite_room_aux(y - 1, x + 1);
2741 cave_temp_lite_room_aux(y + 1, x - 1);
2744 /* Now, lite them all up at once */
2745 cave_temp_room_lite();
2747 if (p_ptr->special_defense & NINJA_S_STEALTH)
2749 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2755 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2760 void unlite_room(int y1, int x1)
2764 /* Add the initial grid */
2765 cave_temp_unlite_room_aux(y1, x1);
2767 /* Spread, breadth first */
2768 for (i = 0; i < temp_n; i++)
2770 x = temp_x[i], y = temp_y[i];
2772 /* Walls get dark, but stop darkness */
2773 if (!cave_pass_dark_bold(y, x)) continue;
2775 /* Spread adjacent */
2776 cave_temp_unlite_room_aux(y + 1, x);
2777 cave_temp_unlite_room_aux(y - 1, x);
2778 cave_temp_unlite_room_aux(y, x + 1);
2779 cave_temp_unlite_room_aux(y, x - 1);
2781 /* Spread diagonal */
2782 cave_temp_unlite_room_aux(y + 1, x + 1);
2783 cave_temp_unlite_room_aux(y - 1, x - 1);
2784 cave_temp_unlite_room_aux(y - 1, x + 1);
2785 cave_temp_unlite_room_aux(y + 1, x - 1);
2788 /* Now, darken them all at once */
2789 cave_temp_room_unlite();
2795 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2798 * @return 作用が実際にあった場合TRUEを返す
2800 bool lite_area(HIT_POINT dam, int rad)
2802 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2804 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2806 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2810 /* Hack -- Message */
2813 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2816 /* Hook into the "project()" function */
2817 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2819 /* Lite up the room */
2820 lite_room(p_ptr->y, p_ptr->x);
2828 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2831 * @return 作用が実際にあった場合TRUEを返す
2833 bool unlite_area(HIT_POINT dam, int rad)
2835 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2837 /* Hack -- Message */
2840 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2843 /* Hook into the "project()" function */
2844 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2846 /* Lite up the room */
2847 unlite_room(p_ptr->y, p_ptr->x);
2856 * @brief ボール系スペルの発動 / Cast a ball spell
2858 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2861 * @return 作用が実際にあった場合TRUEを返す
2864 * Stop if we hit a monster, act as a "ball"
2865 * Allow "target" mode to pass over monsters
2866 * Affect grids, objects, and monsters
2869 bool fire_ball(int typ, int dir, HIT_POINT dam, int rad)
2873 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2875 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2876 /* Use the given direction */
2877 tx = p_ptr->x + 99 * ddx[dir];
2878 ty = p_ptr->y + 99 * ddy[dir];
2880 /* Hack -- Use an actual "target" */
2881 if ((dir == 5) && target_okay())
2883 flg &= ~(PROJECT_STOP);
2888 /* Analyze the "dir" and the "target". Hurt items on floor. */
2889 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2893 * @brief ブレス系スペルの発動 / Cast a breath spell
2895 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2898 * @return 作用が実際にあった場合TRUEを返す
2901 * Stop if we hit a monster, act as a "ball"
2902 * Allow "target" mode to pass over monsters
2903 * Affect grids, objects, and monsters
2906 bool fire_breath(int typ, int dir, HIT_POINT dam, int rad)
2908 return fire_ball(typ, dir, dam, -rad);
2913 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2915 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2918 * @return 作用が実際にあった場合TRUEを返す
2921 * Stop if we hit a monster, act as a "ball"
2922 * Allow "target" mode to pass over monsters
2923 * Affect grids, objects, and monsters
2926 bool fire_rocket(int typ, int dir, HIT_POINT dam, int rad)
2930 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2932 /* Use the given direction */
2933 tx = p_ptr->x + 99 * ddx[dir];
2934 ty = p_ptr->y + 99 * ddy[dir];
2936 /* Hack -- Use an actual "target" */
2937 if ((dir == 5) && target_okay())
2943 /* Analyze the "dir" and the "target". Hurt items on floor. */
2944 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2949 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2951 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2954 * @return 作用が実際にあった場合TRUEを返す
2957 * Stop if we hit a monster, act as a "ball"
2958 * Allow "target" mode to pass over monsters
2959 * Affect grids, objects, and monsters
2962 bool fire_ball_hide(int typ, int dir, HIT_POINT dam, int rad)
2966 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2968 /* Use the given direction */
2969 tx = p_ptr->x + 99 * ddx[dir];
2970 ty = p_ptr->y + 99 * ddy[dir];
2972 /* Hack -- Use an actual "target" */
2973 if ((dir == 5) && target_okay())
2975 flg &= ~(PROJECT_STOP);
2980 /* Analyze the "dir" and the "target". Hurt items on floor. */
2981 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2986 * @brief メテオ系スペルの発動 / Cast a meteor spell
2987 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2993 * @return 作用が実際にあった場合TRUEを返す
2996 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2997 * player, or outside source, that starts out at an arbitrary location, and
2998 * leaving no trail from the "caster" to the target. This function is
2999 * especially useful for bombardments and similar. -LM-
3000 * Option to hurt the player.
3003 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
3005 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3007 /* Analyze the "target" and the caster. */
3008 return (project(who, rad, y, x, dam, typ, flg, -1));
3013 * @brief ブラスト系スペルの発動 / Cast a blast spell
3015 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3020 * @return 作用が実際にあった場合TRUEを返す
3022 bool fire_blast(int typ, int dir, int dd, int ds, int num, int dev)
3028 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
3033 /* Use the given direction */
3036 ly = ty = p_ptr->y + 20 * ddy[dir];
3037 lx = tx = p_ptr->x + 20 * ddx[dir];
3040 /* Use an actual "target" */
3041 else /* if (dir == 5) */
3046 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
3047 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
3050 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
3053 for (i = 0; i < num; i++)
3057 /* Get targets for some bolts */
3058 y = rand_spread(ly, ld * dev / 20);
3059 x = rand_spread(lx, ld * dev / 20);
3061 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
3064 /* Analyze the "dir" and the "target". */
3065 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
3076 * @brief モンスターとの位置交換処理 / Switch position with a monster.
3077 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3078 * @return 作用が実際にあった場合TRUEを返す
3080 bool teleport_swap(int dir)
3084 monster_type * m_ptr;
3085 monster_race * r_ptr;
3087 if ((dir == 5) && target_okay())
3094 tx = p_ptr->x + ddx[dir];
3095 ty = p_ptr->y + ddy[dir];
3097 c_ptr = &cave[ty][tx];
3099 if (p_ptr->anti_tele)
3101 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
3105 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
3107 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
3113 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
3115 msg_print(_("失敗した。", "Failed to swap."));
3121 m_ptr = &m_list[c_ptr->m_idx];
3122 r_ptr = &r_info[m_ptr->r_idx];
3124 (void)set_monster_csleep(c_ptr->m_idx, 0);
3126 if (r_ptr->flagsr & RFR_RES_TELE)
3128 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
3130 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
3136 sound(SOUND_TELEPORT);
3138 /* Swap the player and monster */
3139 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
3147 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
3149 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3152 * @return 作用が実際にあった場合TRUEを返す
3154 bool project_hook(int typ, int dir, HIT_POINT dam, BIT_FLAGS flg)
3158 /* Pass through the target if needed */
3159 flg |= (PROJECT_THRU);
3161 /* Use the given direction */
3162 tx = p_ptr->x + ddx[dir];
3163 ty = p_ptr->y + ddy[dir];
3165 /* Hack -- Use an actual "target" */
3166 if ((dir == 5) && target_okay())
3172 /* Analyze the "dir" and the "target", do NOT explode */
3173 return (project(0, 0, ty, tx, dam, typ, flg, -1));
3178 * @brief ボルト系スペルの発動 / Cast a bolt spell.
3180 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3182 * @return 作用が実際にあった場合TRUEを返す
3185 * Stop if we hit a monster, as a "bolt".
3186 * Affect monsters and grids (not objects).
3189 bool fire_bolt(int typ, int dir, HIT_POINT dam)
3191 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3192 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3193 return (project_hook(typ, dir, dam, flg));
3198 * @brief ビーム系スペルの発動 / Cast a beam spell.
3200 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3202 * @return 作用が実際にあった場合TRUEを返す
3205 * Pass through monsters, as a "beam".
3206 * Affect monsters, grids and objects.
3209 bool fire_beam(int typ, int dir, HIT_POINT dam)
3211 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3212 return (project_hook(typ, dir, dam, flg));
3217 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3218 * @param prob ビーム化する確率(%)
3220 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3222 * @return 作用が実際にあった場合TRUEを返す
3225 * Pass through monsters, as a "beam".
3226 * Affect monsters, grids and objects.
3229 bool fire_bolt_or_beam(int prob, int typ, int dir, HIT_POINT dam)
3231 if (randint0(100) < prob)
3233 return (fire_beam(typ, dir, dam));
3237 return (fire_bolt(typ, dir, dam));
3242 * @brief LITE_WEAK属性による光源ビーム処理
3243 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3245 * @return 作用が実際にあった場合TRUEを返す
3247 bool lite_line(int dir, HIT_POINT dam)
3249 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3250 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3255 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3257 * @return 作用が実際にあった場合TRUEを返す
3259 bool hypodynamic_bolt(int dir, HIT_POINT dam)
3261 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3262 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3267 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3269 * @return 作用が実際にあった場合TRUEを返す
3271 bool wall_to_mud(int dir, HIT_POINT dam)
3273 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3274 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3279 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3280 * @return 作用が実際にあった場合TRUEを返す
3282 bool wizard_lock(int dir)
3284 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3285 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3290 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3291 * @return 作用が実際にあった場合TRUEを返す
3293 bool destroy_door(int dir)
3295 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3296 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3301 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3302 * @return 作用が実際にあった場合TRUEを返す
3304 bool disarm_trap(int dir)
3306 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3307 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3312 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3314 * @return 作用が実際にあった場合TRUEを返す
3316 bool heal_monster(int dir, HIT_POINT dam)
3318 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3319 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3324 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3326 * @return 作用が実際にあった場合TRUEを返す
3328 bool speed_monster(int dir, int power)
3330 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3331 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3336 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3338 * @return 作用が実際にあった場合TRUEを返す
3340 bool slow_monster(int dir, int power)
3342 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3343 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3348 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3350 * @return 作用が実際にあった場合TRUEを返す
3352 bool sleep_monster(int dir, int power)
3354 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3355 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3359 * @brief モンスター拘束(STASIS)処理
3360 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3361 * @return 作用が実際にあった場合TRUEを返す
3362 * @details 威力はプレイヤーレベル*2に固定
3364 bool stasis_monster(int dir)
3366 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3370 * @brief 邪悪なモンスター拘束(STASIS)処理
3371 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3372 * @return 作用が実際にあった場合TRUEを返す
3373 * @details 威力はプレイヤーレベル*2に固定
3375 bool stasis_evil(int dir)
3377 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3382 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3383 * @param plev プレイヤーレベル(=効力)
3384 * @return 作用が実際にあった場合TRUEを返す
3386 bool confuse_monster(int dir, int plev)
3388 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3389 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3394 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3395 * @param plev プレイヤーレベル(=効力)
3396 * @return 作用が実際にあった場合TRUEを返す
3398 bool stun_monster(int dir, int plev)
3400 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3401 return (project_hook(GF_STUN, dir, plev, flg));
3405 * @brief チェンジモンスター処理
3406 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3408 * @return 作用が実際にあった場合TRUEを返す
3410 bool poly_monster(int dir, int power)
3412 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3413 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3415 chg_virtue(V_CHANCE, 1);
3420 * @brief クローンモンスター処理
3421 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3422 * @return 作用が実際にあった場合TRUEを返す
3424 bool clone_monster(int dir)
3426 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3427 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3432 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3433 * @param plev プレイヤーレベル(=効力)
3434 * @return 作用が実際にあった場合TRUEを返す
3436 bool fear_monster(int dir, int plev)
3438 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3439 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3444 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3445 * @param plev プレイヤーレベル(効力はplev*200)
3446 * @return 作用が実際にあった場合TRUEを返す
3448 bool death_ray(int dir, int plev)
3450 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3451 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3455 * @brief モンスター用テレポート処理
3456 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3457 * @param distance 移動距離
3458 * @return 作用が実際にあった場合TRUEを返す
3460 bool teleport_monster(int dir, int distance)
3462 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3463 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3467 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3468 * @return 作用が実際にあった場合TRUEを返す
3470 bool door_creation(void)
3472 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3473 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3477 * @brief トラップ生成処理(起点から周囲1マス)
3480 * @return 作用が実際にあった場合TRUEを返す
3482 bool trap_creation(int y, int x)
3484 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3485 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3489 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3490 * @return 作用が実際にあった場合TRUEを返す
3492 bool tree_creation(void)
3494 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3495 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3499 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3500 * @return 作用が実際にあった場合TRUEを返す
3502 bool glyph_creation(void)
3504 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3505 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3509 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3510 * @return 作用が実際にあった場合TRUEを返す
3512 bool wall_stone(void)
3514 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3516 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3519 p_ptr->update |= (PU_FLOW);
3522 p_ptr->redraw |= (PR_MAP);
3528 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3529 * @return 作用が実際にあった場合TRUEを返す
3531 bool destroy_doors_touch(void)
3533 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3534 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3538 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3539 * @return 作用が実際にあった場合TRUEを返す
3541 bool disarm_traps_touch(void)
3543 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3544 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3548 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3549 * @return 作用が実際にあった場合TRUEを返す
3551 bool sleep_monsters_touch(void)
3553 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3554 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3559 * @brief 死者復活処理(起点より周囲5マス)
3560 * @param who 術者モンスターID(0ならばプレイやー)
3563 * @return 作用が実際にあった場合TRUEを返す
3565 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3567 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3568 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3573 * @return 作用が実際にあった場合TRUEを返す
3575 void call_chaos(void)
3577 int Chaos_type, dummy, dir;
3578 int plev = p_ptr->lev;
3579 bool line_chaos = FALSE;
3581 int hurt_types[31] =
3583 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3584 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3585 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3586 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3587 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3588 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3589 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3590 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3593 Chaos_type = hurt_types[randint0(31)];
3594 if (one_in_(4)) line_chaos = TRUE;
3598 for (dummy = 1; dummy < 10; dummy++)
3603 fire_beam(Chaos_type, dummy, 150);
3605 fire_ball(Chaos_type, dummy, 150, 2);
3609 else if (one_in_(3))
3611 fire_ball(Chaos_type, 0, 500, 8);
3615 if (!get_aim_dir(&dir)) return;
3617 fire_beam(Chaos_type, dir, 250);
3619 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3624 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3625 * @param stop_ty 再帰処理停止フラグ
3627 * @return 作用が実際にあった場合TRUEを返す
3630 * rr9: Stop the nasty things when a Cyberdemon is summoned
3631 * or the player gets paralyzed.
3634 bool activate_ty_curse(bool stop_ty, int *count)
3638 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3642 switch (randint1(34))
3647 msg_print(_("地面が揺れた...", "The ground trembles..."));
3648 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3649 if (!one_in_(6)) break;
3654 HIT_POINT dam = damroll(10, 10);
3655 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3656 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3657 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3658 if (!one_in_(6)) break;
3663 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3664 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3665 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3666 if (!one_in_(6)) break;
3669 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3673 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3674 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3676 if (!one_in_(6)) break;
3677 case 1: case 2: case 3: case 16: case 17:
3678 aggravate_monsters(0);
3679 if (!one_in_(6)) break;
3680 case 4: case 5: case 6:
3681 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3682 if (!one_in_(6)) break;
3683 case 7: case 8: case 9: case 18:
3684 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3685 if (!one_in_(6)) break;
3686 case 10: case 11: case 12:
3687 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3688 lose_exp(p_ptr->exp / 16);
3689 if (!one_in_(6)) break;
3690 case 13: case 14: case 15: case 19: case 20:
3691 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3697 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3698 if (p_ptr->free_act)
3699 set_paralyzed(p_ptr->paralyzed + randint1(3));
3701 set_paralyzed(p_ptr->paralyzed + randint1(13));
3704 if (!one_in_(6)) break;
3705 case 21: case 22: case 23:
3706 (void)do_dec_stat(randint0(6));
3707 if (!one_in_(6)) break;
3709 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3711 if (!one_in_(6)) break;
3714 * Only summon Cyberdemons deep in the dungeon.
3716 if ((dun_level > 65) && !stop_ty)
3718 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3722 if (!one_in_(6)) break;
3728 (void)do_dec_stat(i);
3736 while (one_in_(3) && !stop_ty);
3742 * @brief HI_SUMMON(上級召喚)処理発動
3745 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3746 * @return 作用が実際にあった場合TRUEを返す
3748 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3753 BIT_FLAGS mode = PM_ALLOW_GROUP;
3760 mode |= PM_FORCE_FRIENDLY;
3764 mode |= PM_FORCE_PET;
3769 if (!pet) mode |= PM_NO_PET;
3771 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3773 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3775 switch (randint1(25) + (dun_level / 20))
3778 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3781 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3784 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3787 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3790 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3793 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3796 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3799 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3803 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3807 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3810 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3811 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3814 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3815 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3818 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3821 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3822 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3831 * @brief サイバーデーモンの召喚
3832 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3835 * @return 作用が実際にあった場合TRUEを返す
3837 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3840 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3842 BIT_FLAGS mode = PM_ALLOW_GROUP;
3844 /* Summoned by a monster */
3847 monster_type *m_ptr = &m_list[who];
3848 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3851 if (max_cyber > 4) max_cyber = 4;
3853 for (i = 0; i < max_cyber; i++)
3855 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3862 * @brief 周辺破壊効果(プレイヤー中心)
3863 * @return 作用が実際にあった場合TRUEを返す
3865 void wall_breaker(void)
3868 POSITION y = 0, x = 0;
3869 int attempts = 1000;
3871 if (randint1(80 + p_ptr->lev) < 70)
3875 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3877 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3879 if (!player_bold(y, x)) break;
3882 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3883 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3885 else if (randint1(100) > 30)
3887 earthquake(p_ptr->y, p_ptr->x, 1);
3891 int num = damroll(5, 3);
3893 for (i = 0; i < num; i++)
3897 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3899 if (!player_bold(y, x)) break;
3902 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3903 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3910 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3912 * @return 作用が実際にあった場合TRUEを返す
3914 bool confuse_monsters(HIT_POINT dam)
3916 return (project_hack(GF_OLD_CONF, dam));
3921 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3923 * @return 作用が実際にあった場合TRUEを返す
3925 bool charm_monsters(HIT_POINT dam)
3927 return (project_hack(GF_CHARM, dam));
3932 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3934 * @return 作用が実際にあった場合TRUEを返す
3936 bool charm_animals(HIT_POINT dam)
3938 return (project_hack(GF_CONTROL_ANIMAL, dam));
3943 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3945 * @return 作用が実際にあった場合TRUEを返す
3947 bool stun_monsters(HIT_POINT dam)
3949 return (project_hack(GF_STUN, dam));
3954 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3956 * @return 作用が実際にあった場合TRUEを返す
3958 bool stasis_monsters(HIT_POINT dam)
3960 return (project_hack(GF_STASIS, dam));
3965 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3967 * @return 作用が実際にあった場合TRUEを返す
3969 bool mindblast_monsters(HIT_POINT dam)
3971 return (project_hack(GF_PSI, dam));
3976 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3977 * @param dist 効力(距離)
3978 * @return 作用が実際にあった場合TRUEを返す
3980 bool banish_monsters(int dist)
3982 return (project_hack(GF_AWAY_ALL, dist));
3987 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3989 * @return 作用が実際にあった場合TRUEを返す
3991 bool turn_evil(HIT_POINT dam)
3993 return (project_hack(GF_TURN_EVIL, dam));
3998 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
4000 * @return 作用が実際にあった場合TRUEを返す
4002 bool turn_monsters(HIT_POINT dam)
4004 return (project_hack(GF_TURN_ALL, dam));
4009 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
4010 * @return 作用が実際にあった場合TRUEを返す
4012 bool deathray_monsters(void)
4014 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
4018 * @brief チャーム・モンスター(1体)
4019 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
4021 * @return 作用が実際にあった場合TRUEを返す
4023 bool charm_monster(int dir, int plev)
4025 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4026 return (project_hook(GF_CHARM, dir, plev, flg));
4030 * @brief アンデッド支配(1体)
4031 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
4033 * @return 作用が実際にあった場合TRUEを返す
4035 bool control_one_undead(int dir, int plev)
4037 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4038 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
4043 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
4045 * @return 作用が実際にあった場合TRUEを返す
4047 bool control_one_demon(int dir, int plev)
4049 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4050 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
4055 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
4057 * @return 作用が実際にあった場合TRUEを返す
4059 bool charm_animal(int dir, int plev)
4061 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
4062 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
4068 * @param success 判定成功上の処理ならばTRUE
4069 * @return 作用が実際にあった場合TRUEを返す
4071 bool kawarimi(bool success)
4074 object_type *q_ptr = &forge;
4077 if (p_ptr->is_dead) return FALSE;
4078 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
4079 if (randint0(200) < p_ptr->stun) return FALSE;
4081 if (!success && one_in_(3))
4083 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
4084 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4085 p_ptr->redraw |= (PR_STATUS);
4092 teleport_player(10 + randint1(90), 0L);
4096 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
4098 q_ptr->pval = MON_NINJA;
4100 /* Drop it in the dungeon */
4101 (void)drop_near(q_ptr, -1, y, x);
4104 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
4105 else msg_print("失敗!攻撃を受けてしまった。");
4107 if (success) msg_print("You have turned around just before the attack hit you.");
4108 else msg_print("Failed! You are hit by the attack.");
4111 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
4112 p_ptr->redraw |= (PR_STATUS);
4120 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
4121 * @param mdeath 目標モンスターが死亡したかを返す
4122 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
4124 bool rush_attack(bool *mdeath)
4131 bool tmp_mdeath = FALSE;
4134 if (mdeath) *mdeath = FALSE;
4137 if (!get_aim_dir(&dir)) return FALSE;
4139 /* Use the given direction */
4140 tx = p_ptr->x + project_length * ddx[dir];
4141 ty = p_ptr->y + project_length * ddy[dir];
4143 /* Hack -- Use an actual "target" */
4144 if ((dir == 5) && target_okay())
4150 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
4152 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
4155 /* No need to move */
4156 if (!path_n) return TRUE;
4158 /* Use ty and tx as to-move point */
4162 /* Project along the path */
4163 for (i = 0; i < path_n; i++)
4165 monster_type *m_ptr;
4167 int ny = GRID_Y(path_g[i]);
4168 int nx = GRID_X(path_g[i]);
4170 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
4175 /* Go to next grid */
4179 if (!cave[ny][nx].m_idx)
4183 msg_print(_("失敗!", "Failed!"));
4187 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4194 /* Move player before updating the monster */
4195 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4197 /* Update the monster */
4198 update_mon(cave[ny][nx].m_idx, TRUE);
4200 /* Found a monster */
4201 m_ptr = &m_list[cave[ny][nx].m_idx];
4203 if (tm_idx != cave[ny][nx].m_idx)
4206 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4207 m_ptr->ml ? "モンスター" : "何か");
4209 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4212 else if (!player_bold(ty, tx))
4214 /* Hold the monster name */
4217 /* Get the monster name (BEFORE polymorphing) */
4218 monster_desc(m_name, m_ptr, 0);
4219 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4222 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4224 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4229 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4231 if (mdeath) *mdeath = tmp_mdeath;
4237 * @brief 全鏡の消去 / Remove all mirrors in this floor
4238 * @param explode 爆発処理を伴うならばTRUE
4241 void remove_all_mirrors(bool explode)
4245 for (x = 0; x < cur_wid; x++)
4247 for (y = 0; y < cur_hgt; y++)
4249 if (is_mirror_grid(&cave[y][x]))
4251 remove_mirror(y, x);
4253 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4254 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4261 * @brief 『一つの指輪』の効果処理 /
4262 * Hack -- activate the ring of power
4263 * @param dir 発動の方向ID
4266 void ring_of_power(int dir)
4268 /* Pick a random effect */
4269 switch (randint1(10))
4275 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4278 /* Decrease all stats (permanently) */
4279 (void)dec_stat(A_STR, 50, TRUE);
4280 (void)dec_stat(A_INT, 50, TRUE);
4281 (void)dec_stat(A_WIS, 50, TRUE);
4282 (void)dec_stat(A_DEX, 50, TRUE);
4283 (void)dec_stat(A_CON, 50, TRUE);
4284 (void)dec_stat(A_CHR, 50, TRUE);
4286 /* Lose some experience (permanently) */
4287 p_ptr->exp -= (p_ptr->exp / 4);
4288 p_ptr->max_exp -= (p_ptr->exp / 4);
4297 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4299 /* Dispel monsters */
4300 dispel_monsters(1000);
4310 fire_ball(GF_MANA, dir, 600, 3);
4321 fire_bolt(GF_MANA, dir, 500);
4329 * @brief 運命の輪、並びにカオス的な効果の発動
4330 * @param spell ランダムな効果を選択するための基準ID
4333 void wild_magic(int spell)
4336 int type = SUMMON_MOLD + randint0(6);
4338 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4339 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4341 switch (randint1(spell) + randint1(8) + 1)
4346 teleport_player(10, TELEPORT_PASSIVE);
4351 teleport_player(100, TELEPORT_PASSIVE);
4355 teleport_player(200, TELEPORT_PASSIVE);
4365 lite_area(damroll(2, 3), 2);
4368 destroy_doors_touch();
4373 sleep_monsters_touch();
4377 trap_creation(p_ptr->y, p_ptr->x);
4386 aggravate_monsters(0);
4389 earthquake(p_ptr->y, p_ptr->x, 5);
4393 (void)gain_random_mutation(0);
4397 apply_disenchant(1);
4403 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4410 while (counter++ < 8)
4412 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4417 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4420 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4425 (void)activate_ty_curse(FALSE, &count);
4434 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4435 * / Drop 10+1d10 meteor ball at random places near the player
4440 void cast_meteor(HIT_POINT dam, int rad)
4443 int b = 10 + randint1(10);
4445 for (i = 0; i < b; i++)
4447 POSITION y = 0, x = 0;
4450 for (count = 0; count <= 20; count++)
4454 x = p_ptr->x - 8 + randint0(17);
4455 y = p_ptr->y - 8 + randint0(17);
4457 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4458 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4460 /* Approximate distance */
4461 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4463 if (d >= 9) continue;
4465 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4466 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4468 /* Valid position */
4472 if (count > 20) continue;
4474 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4480 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4483 * @return ターゲットを指定し、実行したならばTRUEを返す。
4485 bool cast_wrath_of_the_god(HIT_POINT dam, int rad)
4490 int b = 10 + randint1(10);
4492 if (!get_aim_dir(&dir)) return FALSE;
4494 /* Use the given direction */
4495 tx = p_ptr->x + 99 * ddx[dir];
4496 ty = p_ptr->y + 99 * ddy[dir];
4498 /* Hack -- Use an actual "target" */
4499 if ((dir == 5) && target_okay())
4510 /* Hack -- Stop at the target */
4511 if ((y == ty) && (x == tx)) break;
4515 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4517 /* Stop at maximum range */
4518 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4520 /* Stopped by walls/doors */
4521 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4523 /* Stopped by monsters */
4524 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4526 /* Save the new location */
4533 for (i = 0; i < b; i++)
4535 int count = 20, d = 0;
4541 x = tx - 5 + randint0(11);
4542 y = ty - 5 + randint0(11);
4544 dx = (tx > x) ? (tx - x) : (x - tx);
4545 dy = (ty > y) ? (ty - y) : (y - ty);
4547 /* Approximate distance */
4548 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4549 /* Within the radius */
4553 if (count < 0) continue;
4555 /* Cannot penetrate perm walls */
4556 if (!in_bounds(y, x) ||
4557 cave_stop_disintegration(y, x) ||
4558 !in_disintegration_range(ty, tx, y, x))
4561 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4568 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4572 * This spell should become more useful (more controlled) as the\n
4573 * player gains experience levels. Thus, add 1/5 of the player's\n
4574 * level to the die roll. This eliminates the worst effects later on,\n
4575 * while keeping the results quite random. It also allows some potent\n
4576 * effects only at high level.
4578 void cast_wonder(int dir)
4580 int plev = p_ptr->lev;
4581 int die = randint1(100) + plev / 5;
4582 int vir = virtue_number(V_CHANCE);
4586 if (p_ptr->virtues[vir - 1] > 0)
4588 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4592 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4597 chg_virtue(V_CHANCE, 1);
4601 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4604 if (die < 8) clone_monster(dir);
4605 else if (die < 14) speed_monster(dir, plev);
4606 else if (die < 26) heal_monster(dir, damroll(4, 6));
4607 else if (die < 31) poly_monster(dir, plev);
4609 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4610 damroll(3 + ((plev - 1) / 5), 4));
4611 else if (die < 41) confuse_monster(dir, plev);
4612 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4613 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4615 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4616 damroll(3 + ((plev - 5) / 4), 8));
4618 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4619 damroll(5 + ((plev - 5) / 4), 8));
4621 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4622 damroll(6 + ((plev - 5) / 4), 8));
4624 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4625 damroll(8 + ((plev - 5) / 4), 8));
4626 else if (die < 76) hypodynamic_bolt(dir, 75);
4627 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4628 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4629 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4630 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4631 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4634 earthquake(p_ptr->y, p_ptr->x, 12);
4638 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4642 symbol_genocide(plev + 50, TRUE);
4644 else if (die < 110) dispel_monsters(120);
4647 dispel_monsters(150);
4648 slow_monsters(plev);
4649 sleep_monsters(plev);
4656 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4660 void cast_invoke_spirits(int dir)
4662 int plev = p_ptr->lev;
4663 int die = randint1(100) + plev / 5;
4664 int vir = virtue_number(V_CHANCE);
4668 if (p_ptr->virtues[vir - 1] > 0)
4670 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4674 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4678 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4680 chg_virtue(V_CHANCE, 1);
4684 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4689 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4690 "Oh no! Mouldering forms rise from the earth around you!"));
4692 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4693 chg_virtue(V_UNLIFE, 1);
4697 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4699 set_afraid(p_ptr->afraid + randint1(4) + 4);
4703 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4704 "Your head is invaded by a horde of gibbering spectral voices..."));
4706 set_confused(p_ptr->confused + randint1(4) + 4);
4710 poly_monster(dir, plev);
4714 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4715 damroll(3 + ((plev - 1) / 5), 4));
4719 confuse_monster(dir, plev);
4723 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4727 (void)lite_line(dir, damroll(6, 8));
4731 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4732 damroll(3 + ((plev - 5) / 4), 8));
4736 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4737 damroll(5 + ((plev - 5) / 4), 8));
4741 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4742 damroll(6 + ((plev - 5) / 4), 8));
4746 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4747 damroll(8 + ((plev - 5) / 4), 8));
4751 hypodynamic_bolt(dir, 75);
4755 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4759 fire_ball(GF_ACID, dir, 40 + plev, 2);
4763 fire_ball(GF_ICE, dir, 70 + plev, 3);
4767 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4771 hypodynamic_bolt(dir, 100 + plev);
4775 earthquake(p_ptr->y, p_ptr->x, 12);
4779 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4783 symbol_genocide(plev + 50, TRUE);
4787 dispel_monsters(120);
4791 dispel_monsters(150);
4792 slow_monsters(plev);
4793 sleep_monsters(plev);
4799 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4800 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4805 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4808 void cast_shuffle(void)
4810 int plev = p_ptr->lev;
4813 int vir = virtue_number(V_CHANCE);
4816 /* Card sharks and high mages get a level bonus */
4817 if ((p_ptr->pclass == CLASS_ROGUE) ||
4818 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4819 (p_ptr->pclass == CLASS_SORCERER))
4820 die = (randint1(110)) + plev / 5;
4822 die = randint1(120);
4827 if (p_ptr->virtues[vir - 1] > 0)
4829 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4833 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4837 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4840 chg_virtue(V_CHANCE, 1);
4844 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4846 for (i = 0; i < randint1(3); i++)
4847 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4851 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4852 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4857 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4858 activate_ty_curse(FALSE, &count);
4862 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4863 aggravate_monsters(0);
4867 msg_print(_("《愚者》だ。", "It's the Fool."));
4873 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4874 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4878 msg_print(_("《月》だ。", "It's the Moon."));
4883 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4884 wild_magic(randint0(32));
4888 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4889 teleport_player(10, TELEPORT_PASSIVE);
4893 msg_print(_("《正義》だ。", "It's Justice."));
4894 set_blessed(p_ptr->lev, FALSE);
4898 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4899 teleport_player(100, TELEPORT_PASSIVE);
4903 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4904 teleport_player(200, TELEPORT_PASSIVE);
4908 msg_print(_("《塔》だ。", "It's the Tower."));
4913 msg_print(_("《節制》だ。", "It's Temperance."));
4914 sleep_monsters_touch();
4918 msg_print(_("《塔》だ。", "It's the Tower."));
4920 earthquake(p_ptr->y, p_ptr->x, 5);
4924 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4925 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4929 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4930 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4934 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4935 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4939 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4940 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4944 msg_print(_("《恋人》だ。", "It's the Lovers."));
4946 if (get_aim_dir(&dir))
4947 charm_monster(dir, MIN(p_ptr->lev, 20));
4951 msg_print(_("《隠者》だ。", "It's the Hermit."));
4956 msg_print(_("《審判》だ。", "It's the Judgement."));
4957 do_cmd_rerate(FALSE);
4958 lose_all_mutations();
4962 msg_print(_("《太陽》だ。", "It's the Sun."));
4963 chg_virtue(V_KNOWLEDGE, 1);
4964 chg_virtue(V_ENLIGHTEN, 1);
4969 msg_print(_("《世界》だ。", "It's the World."));
4970 if (p_ptr->exp < PY_MAX_EXP)
4972 s32b ee = (p_ptr->exp / 25) + 1;
4973 if (ee > 5000) ee = 5000;
4974 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4980 bool_hack life_stream(bool_hack message, bool_hack virtue)
4984 chg_virtue(V_VITALITY, 1);
4985 chg_virtue(V_UNLIFE, -5);
4989 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4992 (void)set_poisoned(0);
4994 (void)set_confused(0);
4998 (void)restore_all_status();
4999 (void)set_shero(0, TRUE);
5006 bool_hack heroism(int base)
5008 bool_hack ident = FALSE;
5009 if(set_afraid(0)) ident = TRUE;
5010 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
5011 if(hp_player(10)) ident = TRUE;
5015 bool_hack berserk(int base)
5017 bool_hack ident = FALSE;
5018 if (set_afraid(0)) ident = TRUE;
5019 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
5020 if (hp_player(30)) ident = TRUE;
5024 bool_hack cure_light_wounds(int dice, int sides)
5026 bool_hack ident = FALSE;
5027 if (hp_player(damroll(dice, sides))) ident = TRUE;
5028 if (set_blind(0)) ident = TRUE;
5029 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
5030 if (set_shero(0, TRUE)) ident = TRUE;
5034 bool_hack cure_serious_wounds(int dice, int sides)
5036 bool_hack ident = FALSE;
5037 if (hp_player(damroll(dice, sides))) ident = TRUE;
5038 if (set_blind(0)) ident = TRUE;
5039 if (set_confused(0)) ident = TRUE;
5040 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
5041 if (set_shero(0, TRUE)) ident = TRUE;
5045 bool_hack cure_critical_wounds(HIT_POINT pow)
5047 bool_hack ident = FALSE;
5048 if (hp_player(pow)) ident = TRUE;
5049 if (set_blind(0)) ident = TRUE;
5050 if (set_confused(0)) ident = TRUE;
5051 if (set_poisoned(0)) ident = TRUE;
5052 if (set_stun(0)) ident = TRUE;
5053 if (set_cut(0)) ident = TRUE;
5054 if (set_shero(0, TRUE)) ident = TRUE;
5058 bool_hack true_healing(HIT_POINT pow)
5060 bool_hack ident = FALSE;
5061 if (hp_player(pow)) ident = TRUE;
5062 if (set_blind(0)) ident = TRUE;
5063 if (set_confused(0)) ident = TRUE;
5064 if (set_poisoned(0)) ident = TRUE;
5065 if (set_stun(0)) ident = TRUE;
5066 if (set_cut(0)) ident = TRUE;
5067 if (set_image(0)) ident = TRUE;
5071 bool_hack restore_mana(bool_hack magic_eater)
5073 bool_hack ident = FALSE;
5075 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
5078 for (i = 0; i < EATER_EXT * 2; i++)
5080 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
5081 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;
5083 for (; i < EATER_EXT * 3; i++)
5085 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
5086 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;
5087 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
5089 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5090 p_ptr->window |= (PW_PLAYER);
5093 else if (p_ptr->csp < p_ptr->msp)
5095 p_ptr->csp = p_ptr->msp;
5096 p_ptr->csp_frac = 0;
5097 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
5098 p_ptr->redraw |= (PR_MANA);
5099 p_ptr->window |= (PW_PLAYER);
5100 p_ptr->window |= (PW_SPELL);
5107 bool restore_all_status(void)
5110 if (do_res_stat(A_STR)) ident = TRUE;
5111 if (do_res_stat(A_INT)) ident = TRUE;
5112 if (do_res_stat(A_WIS)) ident = TRUE;
5113 if (do_res_stat(A_DEX)) ident = TRUE;
5114 if (do_res_stat(A_CON)) ident = TRUE;
5115 if (do_res_stat(A_CHR)) ident = TRUE;
5120 * @brief 口を使う継続的な処理を中断する
5123 void stop_mouth(void)
5125 if (music_singing_any()) stop_singing();
5126 if (hex_spelling_any()) stop_hex_spell_all();
5130 bool_hack vampirism(void)
5136 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
5138 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
5142 /* Only works on adjacent monsters */
5143 if (!get_rep_dir2(&dir)) return FALSE;
5144 y = p_ptr->y + ddy[dir];
5145 x = p_ptr->x + ddx[dir];
5146 c_ptr = &cave[y][x];
5150 if (!(c_ptr->m_idx))
5152 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
5156 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
5158 dummy = p_ptr->lev * 2;
5160 if (hypodynamic_bolt(dir, dummy))
5162 if (p_ptr->food < PY_FOOD_FULL)
5163 /* No heal if we are "full" */
5164 (void)hp_player(dummy);
5166 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
5168 /* Gain nutritional sustenance: 150/hp drained */
5169 /* A Food ration gives 5000 food points (by contrast) */
5170 /* Don't ever get more than "Full" this way */
5171 /* But if we ARE Gorged, it won't cure us */
5172 dummy = p_ptr->food + MIN(5000, 100 * dummy);
5173 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
5174 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
5177 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
5181 bool panic_hit(void)
5186 if (!get_rep_dir2(&dir)) return FALSE;
5187 y = p_ptr->y + ddy[dir];
5188 x = p_ptr->x + ddx[dir];
5189 if (cave[y][x].m_idx)
5192 if (randint0(p_ptr->skill_dis) < 7)
5193 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5195 teleport_player(30, 0L);
5200 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5208 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5210 * @todo mind.cにこの関数を移動させるべき。
5212 * currently this function allows pseudo-id of any object,
5213 * including silly ones like potions & scrolls, which always
5214 * get '{average}'. This should be changed, either to stop such
5215 * items from being pseudo-id'd, or to allow psychometry to
5216 * detect whether the unidentified potion/scroll/etc is
5217 * good (Cure Light Wounds, Restore Strength, etc) or
5218 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5220 bool psychometry(void)
5224 char o_name[MAX_NLEN];
5229 item_tester_no_ryoute = TRUE;
5231 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5232 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5234 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5236 /* Get the item (in the pack) */
5239 o_ptr = &inventory[item];
5242 /* Get the item (on the floor) */
5245 o_ptr = &o_list[0 - item];
5248 /* It is fully known, no information needed */
5249 if (object_is_known(o_ptr))
5251 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5255 /* Check for a feeling */
5256 feel = value_check_aux1(o_ptr);
5258 /* Get an object description */
5259 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5261 /* Skip non-feelings */
5264 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5269 msg_format("%sは%sという感じがする...",
5270 o_name, game_inscriptions[feel]);
5272 msg_format("You feel that the %s %s %s...",
5273 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5274 game_inscriptions[feel]);
5278 /* We have "felt" it */
5279 o_ptr->ident |= (IDENT_SENSE);
5282 o_ptr->feeling = feel;
5284 /* Player touches it */
5285 o_ptr->marked |= OM_TOUCHED;
5287 /* Combine / Reorder the pack (later) */
5288 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5291 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5293 /* Valid "tval" codes */
5294 switch (o_ptr->tval)
5322 /* Auto-inscription/destroy */
5323 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5325 /* Something happened */