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;
46 /* Mark as detected */
47 if (dist <= range && known)
49 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
51 c_ptr->info &= ~(CAVE_UNSAFE);
58 if (cave_have_flag_grid(c_ptr, flag))
63 /* Hack -- Memorize */
64 c_ptr->info |= (CAVE_MARK);
77 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
79 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
80 * @return 効力があった場合TRUEを返す
82 bool detect_traps(POSITION range, bool known)
84 bool detect = detect_feat_flag(range, FF_TRAP, known);
86 if (known) p_ptr->dtrap = TRUE;
88 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
91 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
98 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
100 * @return 効力があった場合TRUEを返す
102 bool detect_doors(POSITION range)
104 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
106 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
109 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
116 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
118 * @return 効力があった場合TRUEを返す
120 bool detect_stairs(POSITION range)
122 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
124 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
127 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
134 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
136 * @return 効力があった場合TRUEを返す
138 bool detect_treasure(POSITION range)
140 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
142 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
145 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
152 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
154 * @return 効力があった場合TRUEを返す
156 bool detect_objects_gold(POSITION range)
160 POSITION range2 = range;
164 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
167 for (i = 1; i < o_max; i++)
169 object_type *o_ptr = &o_list[i];
171 /* Skip dead objects */
172 if (!o_ptr->k_idx) continue;
174 /* Skip held objects */
175 if (o_ptr->held_m_idx) continue;
180 /* Only detect nearby objects */
181 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
183 /* Detect "gold" objects */
184 if (o_ptr->tval == TV_GOLD)
186 o_ptr->marked |= OM_FOUND;
192 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
195 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
198 if (detect_monsters_string(range, "$"))
207 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
209 * @return 効力があった場合TRUEを返す
211 bool detect_objects_normal(POSITION range)
215 POSITION range2 = range;
219 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
222 for (i = 1; i < o_max; i++)
224 object_type *o_ptr = &o_list[i];
226 /* Skip dead objects */
227 if (!o_ptr->k_idx) continue;
229 /* Skip held objects */
230 if (o_ptr->held_m_idx) continue;
235 /* Only detect nearby objects */
236 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
238 /* Detect "real" objects */
239 if (o_ptr->tval != TV_GOLD)
241 o_ptr->marked |= OM_FOUND;
247 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
250 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
253 if (detect_monsters_string(range, "!=?|/`"))
262 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
264 * @return 効力があった場合TRUEを返す
267 * This will light up all spaces with "magic" items, including artifacts,
268 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
269 * and "enchanted" items of the "good" variety.
271 * It can probably be argued that this function is now too powerful.
274 bool detect_objects_magic(POSITION range)
276 OBJECT_TYPE_VALUE tv;
282 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
284 /* Scan all objects */
285 for (i = 1; i < o_max; i++)
287 object_type *o_ptr = &o_list[i];
289 /* Skip dead objects */
290 if (!o_ptr->k_idx) continue;
292 /* Skip held objects */
293 if (o_ptr->held_m_idx) continue;
298 /* Only detect nearby objects */
299 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
301 /* Examine the tval */
304 /* Artifacts, misc magic items, or enchanted wearables */
305 if (object_is_artifact(o_ptr) ||
306 object_is_ego(o_ptr) ||
307 (tv == TV_WHISTLE) ||
315 (tv == TV_LIFE_BOOK) ||
316 (tv == TV_SORCERY_BOOK) ||
317 (tv == TV_NATURE_BOOK) ||
318 (tv == TV_CHAOS_BOOK) ||
319 (tv == TV_DEATH_BOOK) ||
320 (tv == TV_TRUMP_BOOK) ||
321 (tv == TV_ARCANE_BOOK) ||
322 (tv == TV_CRAFT_BOOK) ||
323 (tv == TV_DAEMON_BOOK) ||
324 (tv == TV_CRUSADE_BOOK) ||
325 (tv == TV_MUSIC_BOOK) ||
326 (tv == TV_HISSATSU_BOOK) ||
327 (tv == TV_HEX_BOOK) ||
328 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
330 /* Memorize the item */
331 o_ptr->marked |= OM_FOUND;
338 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
347 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
349 * @return 効力があった場合TRUEを返す
351 bool detect_monsters_normal(POSITION range)
358 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
361 for (i = 1; i < m_max; i++)
363 monster_type *m_ptr = &m_list[i];
364 monster_race *r_ptr = &r_info[m_ptr->r_idx];
366 /* Skip dead monsters */
367 if (!m_ptr->r_idx) continue;
372 /* Only detect nearby monsters */
373 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
375 /* Detect all non-invisible monsters */
376 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
378 /* Repair visibility later */
379 repair_monsters = TRUE;
381 /* Hack -- Detect monster */
382 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
383 update_monster(i, FALSE);
388 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
391 /* Describe result */
392 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
399 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
401 * @return 効力があった場合TRUEを返す
403 bool detect_monsters_invis(POSITION range)
409 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
412 for (i = 1; i < m_max; i++)
414 monster_type *m_ptr = &m_list[i];
415 monster_race *r_ptr = &r_info[m_ptr->r_idx];
417 /* Skip dead monsters */
418 if (!m_ptr->r_idx) continue;
423 /* Only detect nearby monsters */
424 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
426 /* Detect invisible monsters */
427 if (r_ptr->flags2 & RF2_INVISIBLE)
429 /* Update monster recall window */
430 if (p_ptr->monster_race_idx == m_ptr->r_idx)
432 p_ptr->window |= (PW_MONSTER);
435 /* Repair visibility later */
436 repair_monsters = TRUE;
438 /* Hack -- Detect monster */
439 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
440 update_monster(i, FALSE);
445 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
448 /* Describe result */
449 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
455 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
457 * @return 効力があった場合TRUEを返す
459 bool detect_monsters_evil(POSITION range)
465 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
468 for (i = 1; i < m_max; i++)
470 monster_type *m_ptr = &m_list[i];
471 monster_race *r_ptr = &r_info[m_ptr->r_idx];
473 /* Skip dead monsters */
474 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 evil monsters */
483 if (r_ptr->flags3 & RF3_EVIL)
485 if (is_original_ap(m_ptr))
487 /* Take note that they are evil */
488 r_ptr->r_flags3 |= (RF3_EVIL);
490 /* Update monster recall window */
491 if (p_ptr->monster_race_idx == m_ptr->r_idx)
493 p_ptr->window |= (PW_MONSTER);
497 /* Repair visibility later */
498 repair_monsters = TRUE;
500 /* Hack -- Detect monster */
501 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
502 update_monster(i, FALSE);
508 /* Describe result */
509 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
515 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
517 * @return 効力があった場合TRUEを返す
519 bool detect_monsters_nonliving(POSITION range)
525 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
528 for (i = 1; i < m_max; i++)
530 monster_type *m_ptr = &m_list[i];
531 monster_race *r_ptr = &r_info[m_ptr->r_idx];
533 /* Skip dead monsters */
534 if (!m_ptr->r_idx) continue;
539 /* Only detect nearby monsters */
540 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
542 /* Detect non-living monsters */
543 if (!monster_living(r_ptr))
545 /* Update monster recall window */
546 if (p_ptr->monster_race_idx == m_ptr->r_idx)
548 p_ptr->window |= (PW_MONSTER);
551 /* Repair visibility later */
552 repair_monsters = TRUE;
554 /* Hack -- Detect monster */
555 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
556 update_monster(i, FALSE);
562 /* Describe result */
563 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
569 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
571 * @return 効力があった場合TRUEを返す
573 bool detect_monsters_mind(POSITION range)
579 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
582 for (i = 1; i < m_max; i++)
584 monster_type *m_ptr = &m_list[i];
585 monster_race *r_ptr = &r_info[m_ptr->r_idx];
587 /* Skip dead monsters */
588 if (!m_ptr->r_idx) continue;
593 /* Only detect nearby monsters */
594 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
596 /* Detect non-living monsters */
597 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
599 /* Update monster recall window */
600 if (p_ptr->monster_race_idx == m_ptr->r_idx)
602 p_ptr->window |= (PW_MONSTER);
605 /* Repair visibility later */
606 repair_monsters = TRUE;
608 /* Hack -- Detect monster */
609 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
610 update_monster(i, FALSE);
616 /* Describe result */
617 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
624 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
626 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
627 * @return 効力があった場合TRUEを返す
629 bool detect_monsters_string(POSITION range, cptr Match)
635 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
638 for (i = 1; i < m_max; i++)
640 monster_type *m_ptr = &m_list[i];
641 monster_race *r_ptr = &r_info[m_ptr->r_idx];
643 /* Skip dead monsters */
644 if (!m_ptr->r_idx) continue;
649 /* Only detect nearby monsters */
650 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
652 /* Detect monsters with the same symbol */
653 if (my_strchr(Match, r_ptr->d_char))
655 /* Update monster recall window */
656 if (p_ptr->monster_race_idx == m_ptr->r_idx)
658 p_ptr->window |= (PW_MONSTER);
661 /* Repair visibility later */
662 repair_monsters = TRUE;
664 /* Hack -- Detect monster */
665 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
666 update_monster(i, FALSE);
671 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
674 /* Describe result */
675 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
681 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
683 * @param match_flag 感知フラグ
684 * @return 効力があった場合TRUEを返す
686 bool detect_monsters_xxx(POSITION range, u32b match_flag)
691 cptr desc_monsters = _("変なモンスター", "weird monsters");
693 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
696 for (i = 1; i < m_max; i++)
698 monster_type *m_ptr = &m_list[i];
699 monster_race *r_ptr = &r_info[m_ptr->r_idx];
701 /* Skip dead monsters */
702 if (!m_ptr->r_idx) continue;
707 /* Only detect nearby monsters */
708 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
710 /* Detect evil monsters */
711 if (r_ptr->flags3 & (match_flag))
713 if (is_original_ap(m_ptr))
715 /* Take note that they are something */
716 r_ptr->r_flags3 |= (match_flag);
718 /* Update monster recall window */
719 if (p_ptr->monster_race_idx == m_ptr->r_idx)
721 p_ptr->window |= (PW_MONSTER);
725 /* Repair visibility later */
726 repair_monsters = TRUE;
728 /* Hack -- Detect monster */
729 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
730 update_monster(i, FALSE);
739 desc_monsters = _("デーモン", "demons");
742 desc_monsters = _("アンデッド", "the undead");
746 /* Describe result */
747 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
755 * @brief 全感知処理 / Detect everything
757 * @return 効力があった場合TRUEを返す
759 bool detect_all(POSITION range)
763 /* Detect everything */
764 if (detect_traps(range, TRUE)) detect = TRUE;
765 if (detect_doors(range)) detect = TRUE;
766 if (detect_stairs(range)) detect = TRUE;
768 /* There are too many hidden treasure. So... */
769 /* if (detect_treasure(range)) detect = TRUE; */
771 if (detect_objects_gold(range)) detect = TRUE;
772 if (detect_objects_normal(range)) detect = TRUE;
773 if (detect_monsters_invis(range)) detect = TRUE;
774 if (detect_monsters_normal(range)) detect = TRUE;
780 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
783 * @return 効力があった場合TRUEを返す
786 * Note that affected monsters are NOT auto-tracked by this usage.
788 * To avoid misbehavior when monster deaths have side-effects,
789 * this is done in two passes. -- JDL
792 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
796 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
797 bool obvious = FALSE;
800 /* Mark all (nearby) monsters */
801 for (i = 1; i < m_max; i++)
803 monster_type *m_ptr = &m_list[i];
805 /* Paranoia -- Skip dead monsters */
806 if (!m_ptr->r_idx) continue;
811 /* Require line of sight */
812 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
814 /* Mark the monster */
815 m_ptr->mflag |= (MFLAG_TEMP);
818 /* Affect all marked monsters */
819 for (i = 1; i < m_max; i++)
821 monster_type *m_ptr = &m_list[i];
823 /* Skip unmarked monsters */
824 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
827 m_ptr->mflag &= ~(MFLAG_TEMP);
832 /* Jump directly to the target monster */
833 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
840 * @brief 視界内モンスターを加速する処理 / Speed monsters
841 * @return 効力があった場合TRUEを返す
843 bool speed_monsters(void)
845 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
849 * @brief 視界内モンスターを加速する処理 / Slow monsters
850 * @return 効力があった場合TRUEを返す
852 bool slow_monsters(int power)
854 return (project_hack(GF_OLD_SLOW, power));
858 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
859 * @return 効力があった場合TRUEを返す
861 bool sleep_monsters(int power)
863 return (project_hack(GF_OLD_SLEEP, power));
867 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
868 * @return 効力があった場合TRUEを返す
870 bool banish_evil(int dist)
872 return (project_hack(GF_AWAY_EVIL, dist));
876 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
877 * @return 効力があった場合TRUEを返す
879 bool turn_undead(void)
881 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
883 chg_virtue(V_UNLIFE, -1);
888 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
889 * @return 効力があった場合TRUEを返す
891 bool dispel_undead(HIT_POINT dam)
893 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
895 chg_virtue(V_UNLIFE, -2);
900 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
901 * @return 効力があった場合TRUEを返す
903 bool dispel_evil(HIT_POINT dam)
905 return (project_hack(GF_DISP_EVIL, dam));
909 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
910 * @return 効力があった場合TRUEを返す
912 bool dispel_good(HIT_POINT dam)
914 return (project_hack(GF_DISP_GOOD, dam));
918 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
919 * @return 効力があった場合TRUEを返す
921 bool dispel_monsters(HIT_POINT dam)
923 return (project_hack(GF_DISP_ALL, dam));
927 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
928 * @return 効力があった場合TRUEを返す
930 bool dispel_living(HIT_POINT dam)
932 return (project_hack(GF_DISP_LIVING, dam));
936 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
937 * @return 効力があった場合TRUEを返す
939 bool dispel_demons(HIT_POINT dam)
941 return (project_hack(GF_DISP_DEMON, dam));
945 * @brief 視界内のモンスターに「聖戦」効果を与える処理
946 * @return 効力があった場合TRUEを返す
950 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
954 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
955 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
958 void aggravate_monsters(MONSTER_IDX who)
964 /* Aggravate everyone nearby */
965 for (i = 1; i < m_max; i++)
967 monster_type *m_ptr = &m_list[i];
968 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
970 /* Paranoia -- Skip dead monsters */
971 if (!m_ptr->r_idx) continue;
973 /* Skip aggravating monster (or player) */
974 if (i == who) continue;
976 /* Wake up nearby sleeping monsters */
977 if (m_ptr->cdis < MAX_SIGHT * 2)
980 if (MON_CSLEEP(m_ptr))
982 (void)set_monster_csleep(i, 0);
985 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
988 /* Speed up monsters in line of sight */
989 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
993 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
999 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1000 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1001 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1006 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1007 * @param m_idx 抹殺するモンスターID
1008 * @param power 抹殺の威力
1009 * @param player_cast プレイヤーの魔法によるものならば TRUE
1010 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1011 * @param spell_name 抹殺効果を起こした魔法の名前
1012 * @return 効力があった場合TRUEを返す
1014 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1016 int msec = delay_factor * delay_factor * delay_factor;
1017 monster_type *m_ptr = &m_list[m_idx];
1018 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1019 bool resist = FALSE;
1021 if (is_pet(m_ptr) && !player_cast) return FALSE;
1023 /* Hack -- Skip Unique Monsters or Quest Monsters */
1024 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1025 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1026 else if (m_idx == p_ptr->riding) resist = TRUE;
1027 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1028 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1029 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1034 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1038 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1039 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1042 delete_monster_idx(m_idx);
1045 if (resist && player_cast)
1047 bool see_m = is_seen(m_ptr);
1050 monster_desc(m_name, m_ptr, 0);
1053 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1055 if (MON_CSLEEP(m_ptr))
1057 (void)set_monster_csleep(m_idx, 0);
1060 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1063 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1067 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1071 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1076 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1079 /* Visual feedback */
1080 move_cursor_relative(p_ptr->y, p_ptr->x);
1082 p_ptr->redraw |= (PR_HP);
1083 p_ptr->window |= (PW_PLAYER);
1089 Term_xtra(TERM_XTRA_DELAY, msec);
1096 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1097 * @param power 抹殺の威力
1098 * @param player_cast プレイヤーの魔法によるものならば TRUE
1099 * @return 効力があった場合TRUEを返す
1101 bool symbol_genocide(int power, bool player_cast)
1105 bool result = FALSE;
1107 /* Prevent genocide in quest levels */
1108 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1113 /* Mega-Hack -- Get a monster symbol */
1114 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1116 /* Delete the monsters of that "type" */
1117 for (i = 1; i < m_max; i++)
1119 monster_type *m_ptr = &m_list[i];
1120 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1122 /* Paranoia -- Skip dead monsters */
1123 if (!m_ptr->r_idx) continue;
1125 /* Skip "wrong" monsters */
1126 if (r_ptr->d_char != typ) continue;
1129 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1134 chg_virtue(V_VITALITY, -2);
1135 chg_virtue(V_CHANCE, -1);
1143 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1144 * @param power 抹殺の威力
1145 * @param player_cast プレイヤーの魔法によるものならば TRUE
1146 * @return 効力があった場合TRUEを返す
1148 bool mass_genocide(int power, bool player_cast)
1151 bool result = FALSE;
1153 /* Prevent mass genocide in quest levels */
1154 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1159 /* Delete the (nearby) monsters */
1160 for (i = 1; i < m_max; i++)
1162 monster_type *m_ptr = &m_list[i];
1164 /* Paranoia -- Skip dead monsters */
1165 if (!m_ptr->r_idx) continue;
1167 /* Skip distant monsters */
1168 if (m_ptr->cdis > MAX_SIGHT) continue;
1171 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1176 chg_virtue(V_VITALITY, -2);
1177 chg_virtue(V_CHANCE, -1);
1185 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1186 * @param power 抹殺の威力
1187 * @param player_cast プレイヤーの魔法によるものならば TRUE
1188 * @return 効力があった場合TRUEを返す
1190 bool mass_genocide_undead(int power, bool player_cast)
1193 bool result = FALSE;
1195 /* Prevent mass genocide in quest levels */
1196 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1201 /* Delete the (nearby) monsters */
1202 for (i = 1; i < m_max; i++)
1204 monster_type *m_ptr = &m_list[i];
1205 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1207 /* Paranoia -- Skip dead monsters */
1208 if (!m_ptr->r_idx) continue;
1210 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1212 /* Skip distant monsters */
1213 if (m_ptr->cdis > MAX_SIGHT) continue;
1216 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1221 chg_virtue(V_UNLIFE, -2);
1222 chg_virtue(V_CHANCE, -1);
1230 * @brief 周辺モンスターを調査する / Probe nearby monsters
1231 * @return 効力があった場合TRUEを返す
1247 /* Probe all (nearby) monsters */
1248 for (i = 1; i < m_max; i++)
1250 monster_type *m_ptr = &m_list[i];
1251 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1253 /* Paranoia -- Skip dead monsters */
1254 if (!m_ptr->r_idx) continue;
1256 /* Require line of sight */
1257 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1259 /* Probe visible monsters */
1264 /* Start the message */
1267 msg_print(_("調査中...", "Probing..."));
1272 if (!is_original_ap(m_ptr))
1274 if (m_ptr->mflag2 & MFLAG2_KAGE)
1275 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1277 m_ptr->ap_r_idx = m_ptr->r_idx;
1278 lite_spot(m_ptr->fy, m_ptr->fx);
1280 /* Get "the monster" or "something" */
1281 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1283 speed = m_ptr->mspeed - 110;
1284 if (MON_FAST(m_ptr)) speed += 10;
1285 if (MON_SLOW(m_ptr)) speed -= 10;
1286 if (ironman_nightmare) speed += 5;
1288 /* Get the monster's alignment */
1289 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1290 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1291 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1292 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1293 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1294 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1295 else align = _("中立", "neutral");
1297 /* Describe the monster */
1298 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1299 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1301 if (r_ptr->next_r_idx)
1303 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1307 strcat(buf, "xxx ");
1310 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1311 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1312 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1313 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1314 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1315 buf[strlen(buf)-1] = '\0';
1318 /* HACK : Add the line to message buffer */
1320 p_ptr->window |= (PW_MESSAGE);
1323 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1326 Term_erase(0, 0, 255);
1328 /* Learn everything about this monster */
1329 if (lore_do_probe(m_ptr->r_idx))
1331 /* Get base name of monster */
1332 strcpy(buf, (r_name + r_ptr->name));
1335 /* Note that we learnt some new flags -Mogami- */
1336 msg_format("%sについてさらに詳しくなった気がする。", buf);
1341 /* Note that we learnt some new flags -Mogami- */
1342 msg_format("You now know more about %s.", buf);
1344 /* Clear -more- prompt */
1359 chg_virtue(V_KNOWLEDGE, 1);
1360 msg_print(_("これで全部です。", "That's all."));
1368 * @brief *破壊*処理を行う / The spell of destruction
1369 * @param y1 破壊の中心Y座標
1370 * @param x1 破壊の中心X座標
1372 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1373 * @return 効力があった場合TRUEを返す
1376 * This spell "deletes" monsters (instead of "killing" them).
1378 * Later we may use one function for both "destruction" and
1379 * "earthquake" by using the "full" to select "destruction".
1382 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1389 /* Prevent destruction of quest levels and town */
1390 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1395 /* Lose monster light */
1396 if (!in_generate) clear_mon_lite();
1398 /* Big area of affect */
1399 for (y = (y1 - r); y <= (y1 + r); y++)
1401 for (x = (x1 - r); x <= (x1 + r); x++)
1403 /* Skip illegal grids */
1404 if (!in_bounds(y, x)) continue;
1406 /* Extract the distance */
1407 k = distance(y1, x1, y, x);
1409 /* Stay in the circle of death */
1410 if (k > r) continue;
1411 c_ptr = &cave[y][x];
1413 /* Lose room and vault */
1414 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1416 /* Lose light and knowledge */
1417 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1419 if (!in_generate) /* Normal */
1422 c_ptr->info &= ~(CAVE_UNSAFE);
1424 /* Hack -- Notice player affect */
1425 if (player_bold(y, x))
1427 /* Hurt the player later */
1430 /* Do not hurt this grid */
1435 /* Hack -- Skip the epicenter */
1436 if ((y == y1) && (x == x1)) continue;
1440 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1441 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1443 if (in_generate) /* In generation */
1445 /* Delete the monster (if any) */
1446 delete_monster(y, x);
1448 else if (r_ptr->flags1 & RF1_QUESTOR)
1450 /* Heal the monster */
1451 m_ptr->hp = m_ptr->maxhp;
1453 /* Try to teleport away quest monsters */
1454 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1458 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1462 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1463 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1466 /* Delete the monster (if any) */
1467 delete_monster(y, x);
1471 /* During generation, destroyed artifacts are "preserved" */
1472 if (preserve_mode || in_generate)
1474 OBJECT_IDX this_o_idx, next_o_idx = 0;
1476 /* Scan all objects in the grid */
1477 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1481 /* Acquire object */
1482 o_ptr = &o_list[this_o_idx];
1484 /* Acquire next object */
1485 next_o_idx = o_ptr->next_o_idx;
1487 /* Hack -- Preserve unknown artifacts */
1488 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1490 /* Mega-Hack -- Preserve the artifact */
1491 a_info[o_ptr->name1].cur_num = 0;
1493 if (in_generate && cheat_peek)
1495 char o_name[MAX_NLEN];
1496 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1497 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1500 else if (in_generate && cheat_peek && o_ptr->art_name)
1502 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1503 "One of the random artifacts was *destroyed* during generation."));
1508 /* Delete objects */
1509 delete_object(y, x);
1511 /* Destroy "non-permanent" grids */
1512 if (!cave_perma_grid(c_ptr))
1514 /* Wall (or floor) type */
1517 if (!in_generate) /* Normal */
1521 /* Create granite wall */
1522 cave_set_feat(y, x, feat_granite);
1526 /* Create quartz vein */
1527 cave_set_feat(y, x, feat_quartz_vein);
1531 /* Create magma vein */
1532 cave_set_feat(y, x, feat_magma_vein);
1537 cave_set_feat(y, x, floor_type[randint0(100)]);
1540 else /* In generation */
1544 /* Create granite wall */
1545 place_extra_grid(c_ptr);
1549 /* Create quartz vein */
1550 c_ptr->feat = feat_quartz_vein;
1554 /* Create magma vein */
1555 c_ptr->feat = feat_magma_vein;
1560 place_floor_grid(c_ptr);
1563 /* Clear garbage of hidden trap or door */
1572 /* Process "re-glowing" */
1573 for (y = (y1 - r); y <= (y1 + r); y++)
1575 for (x = (x1 - r); x <= (x1 + r); x++)
1577 /* Skip illegal grids */
1578 if (!in_bounds(y, x)) continue;
1580 /* Extract the distance */
1581 k = distance(y1, x1, y, x);
1583 /* Stay in the circle of death */
1584 if (k > r) continue;
1585 c_ptr = &cave[y][x];
1587 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1588 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1593 for (i = 0; i < 9; i++)
1595 yy = y + ddy_ddd[i];
1596 xx = x + ddx_ddd[i];
1597 if (!in_bounds2(yy, xx)) continue;
1598 cc_ptr = &cave[yy][xx];
1599 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1601 c_ptr->info |= CAVE_GLOW;
1609 /* Hack -- Affect player */
1612 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1614 /* Blind the player */
1615 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1618 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1624 /* Mega-Hack -- Forget the view and lite */
1625 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1627 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1629 p_ptr->redraw |= (PR_MAP);
1631 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1633 if (p_ptr->special_defense & NINJA_S_STEALTH)
1635 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1645 * @brief 地震処理(サブルーチン) /
1646 * Induce an "earthquake" of the given radius at the given location.
1647 * @return 効力があった場合TRUEを返す
1651 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1655 * This will turn some walls into floors and some floors into walls.
1657 * The player will take damage and "jump" into a safe grid if possible,
1658 * otherwise, he will "tunnel" through the rubble instantaneously.
1660 * Monsters will take damage, and "jump" into a safe grid if possible,
1661 * otherwise they will be "buried" in the rubble, disappearing from
1662 * the level in the same way that they do when genocided.
1664 * Note that thus the player and monsters (except eaters of walls and
1665 * passers through walls) will never occupy the same grid as a wall.
1666 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1667 * for a single turn, unless that monster can pass_walls or kill_walls.
1668 * This has allowed massive simplification of the "monster" code.
1671 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1675 POSITION y, x, yy, xx, dy, dx;
1678 POSITION sy = 0, sx = 0;
1684 /* Prevent destruction of quest levels and town */
1685 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1690 /* Paranoia -- Enforce maximum range */
1693 /* Clear the "maximal blast" area */
1694 for (y = 0; y < 32; y++)
1696 for (x = 0; x < 32; x++)
1702 /* Check around the epicenter */
1703 for (dy = -r; dy <= r; dy++)
1705 for (dx = -r; dx <= r; dx++)
1707 /* Extract the location */
1711 /* Skip illegal grids */
1712 if (!in_bounds(yy, xx)) continue;
1714 /* Skip distant grids */
1715 if (distance(cy, cx, yy, xx) > r) continue;
1716 c_ptr = &cave[yy][xx];
1718 /* Lose room and vault */
1719 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1721 /* Lose light and knowledge */
1722 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1724 /* Skip the epicenter */
1725 if (!dx && !dy) continue;
1727 /* Skip most grids */
1728 if (randint0(100) < 85) continue;
1730 /* Damage this grid */
1731 map[16+yy-cy][16+xx-cx] = TRUE;
1733 /* Hack -- Take note of player damage */
1734 if (player_bold(yy, xx)) hurt = TRUE;
1738 /* First, affect the player (if necessary) */
1739 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1741 /* Check around the player */
1742 for (i = 0; i < 8; i++)
1744 /* Access the location */
1745 y = p_ptr->y + ddy_ddd[i];
1746 x = p_ptr->x + ddx_ddd[i];
1748 /* Skip non-empty grids */
1749 if (!cave_empty_bold(y, x)) continue;
1751 /* Important -- Skip "quake" grids */
1752 if (map[16+y-cy][16+x-cx]) continue;
1754 if (cave[y][x].m_idx) continue;
1756 /* Count "safe" grids */
1759 /* Randomize choice */
1760 if (randint0(sn) > 0) continue;
1762 /* Save the safe location */
1766 /* Random message */
1767 switch (randint1(3))
1771 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1776 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1781 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1786 /* Hurt the player a lot */
1789 /* Message and damage */
1790 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1794 /* Destroy the grid, and push the player to safety */
1797 /* Calculate results */
1798 switch (randint1(3))
1802 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1808 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1809 damage = damroll(10, 4);
1810 (void)set_stun(p_ptr->stun + randint1(50));
1815 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1816 damage = damroll(10, 4);
1817 (void)set_stun(p_ptr->stun + randint1(50));
1822 /* Move the player to the safe location */
1823 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1826 /* Important -- no wall on player */
1827 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1836 monster_type *m_ptr = &m_list[m_idx];
1838 /* Get the monster's real name */
1839 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1841 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1845 killer = _("地震", "an earthquake");
1848 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1852 /* Examine the quaked region */
1853 for (dy = -r; dy <= r; dy++)
1855 for (dx = -r; dx <= r; dx++)
1857 /* Extract the location */
1861 /* Skip unaffected grids */
1862 if (!map[16+yy-cy][16+xx-cx]) continue;
1863 c_ptr = &cave[yy][xx];
1865 if (c_ptr->m_idx == p_ptr->riding) continue;
1867 /* Process monsters */
1870 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1871 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1873 /* Quest monsters */
1874 if (r_ptr->flags1 & RF1_QUESTOR)
1876 /* No wall on quest monsters */
1877 map[16+yy-cy][16+xx-cx] = FALSE;
1882 /* Most monsters cannot co-exist with rock */
1883 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1884 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1888 /* Assume not safe */
1891 /* Monster can move to escape the wall */
1892 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1894 /* Look for safety */
1895 for (i = 0; i < 8; i++)
1897 y = yy + ddy_ddd[i];
1898 x = xx + ddx_ddd[i];
1900 /* Skip non-empty grids */
1901 if (!cave_empty_bold(y, x)) continue;
1903 /* Hack -- no safety on glyph of warding */
1904 if (is_glyph_grid(&cave[y][x])) continue;
1905 if (is_explosive_rune_grid(&cave[y][x])) continue;
1907 /* ... nor on the Pattern */
1908 if (pattern_tile(y, x)) continue;
1910 /* Important -- Skip "quake" grids */
1911 if (map[16+y-cy][16+x-cx]) continue;
1913 if (cave[y][x].m_idx) continue;
1914 if (player_bold(y, x)) continue;
1916 /* Count "safe" grids */
1919 /* Randomize choice */
1920 if (randint0(sn) > 0) continue;
1922 /* Save the safe grid */
1927 /* Describe the monster */
1928 monster_desc(m_name, m_ptr, 0);
1930 /* Scream in pain */
1931 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1933 /* Take damage from the quake */
1934 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1936 /* Monster is certainly awake */
1937 (void)set_monster_csleep(c_ptr->m_idx, 0);
1939 /* Apply damage directly */
1940 m_ptr->hp -= damage;
1942 /* Delete (not kill) "dead" monsters */
1945 if (!ignore_unview || is_seen(m_ptr))
1946 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1950 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1954 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1955 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1960 delete_monster(yy, xx);
1962 /* No longer safe */
1966 /* Hack -- Escape from the rock */
1969 IDX m_idx_aux = cave[yy][xx].m_idx;
1971 /* Update the old location */
1972 cave[yy][xx].m_idx = 0;
1974 /* Update the new location */
1975 cave[sy][sx].m_idx = m_idx_aux;
1977 /* Move the monster */
1981 /* Update the monster (new location) */
1982 update_monster(m_idx, TRUE);
1984 /* Redraw the old grid */
1987 /* Redraw the new grid */
1995 /* Lose monster light */
1998 /* Examine the quaked region */
1999 for (dy = -r; dy <= r; dy++)
2001 for (dx = -r; dx <= r; dx++)
2003 /* Extract the location */
2007 /* Skip unaffected grids */
2008 if (!map[16+yy-cy][16+xx-cx]) continue;
2010 /* Access the cave grid */
2011 c_ptr = &cave[yy][xx];
2013 /* Paranoia -- never affect player */
2014 /* if (player_bold(yy, xx)) continue; */
2016 /* Destroy location (if valid) */
2017 if (cave_valid_bold(yy, xx))
2019 /* Delete objects */
2020 delete_object(yy, xx);
2022 /* Wall (or floor) type */
2023 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2028 /* Create granite wall */
2029 cave_set_feat(yy, xx, feat_granite);
2035 /* Create quartz vein */
2036 cave_set_feat(yy, xx, feat_quartz_vein);
2042 /* Create magma vein */
2043 cave_set_feat(yy, xx, feat_magma_vein);
2050 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2057 /* Process "re-glowing" */
2058 for (dy = -r; dy <= r; dy++)
2060 for (dx = -r; dx <= r; dx++)
2062 /* Extract the location */
2066 /* Skip illegal grids */
2067 if (!in_bounds(yy, xx)) continue;
2069 /* Skip distant grids */
2070 if (distance(cy, cx, yy, xx) > r) continue;
2071 c_ptr = &cave[yy][xx];
2073 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2074 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2079 for (ii = 0; ii < 9; ii++)
2081 yyy = yy + ddy_ddd[ii];
2082 xxx = xx + ddx_ddd[ii];
2083 if (!in_bounds2(yyy, xxx)) continue;
2084 cc_ptr = &cave[yyy][xxx];
2085 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2087 c_ptr->info |= CAVE_GLOW;
2096 /* Mega-Hack -- Forget the view and lite */
2097 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2099 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2101 /* Update the health bar */
2102 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2104 p_ptr->redraw |= (PR_MAP);
2106 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2108 if (p_ptr->special_defense & NINJA_S_STEALTH)
2110 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2118 * @brief 地震処理(プレイヤーの中心発動) /
2119 * Induce an "earthquake" of the given radius at the given location.
2120 * @return 効力があった場合TRUEを返す
2125 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2127 return earthquake_aux(cy, cx, r, 0);
2134 void discharge_minion(void)
2139 for (i = 1; i < m_max; i++)
2141 monster_type *m_ptr = &m_list[i];
2142 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2143 if (m_ptr->nickname) okay = FALSE;
2145 if (!okay || p_ptr->riding)
2147 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2150 for (i = 1; i < m_max; i++)
2153 monster_type *m_ptr = &m_list[i];
2154 monster_race *r_ptr;
2156 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2157 r_ptr = &r_info[m_ptr->r_idx];
2159 /* Uniques resist discharging */
2160 if (r_ptr->flags1 & RF1_UNIQUE)
2163 monster_desc(m_name, m_ptr, 0x00);
2164 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2165 delete_monster_idx(i);
2168 dam = m_ptr->maxhp / 2;
2169 if (dam > 100) dam = (dam-100)/2 + 100;
2170 if (dam > 400) dam = (dam-400)/2 + 400;
2171 if (dam > 800) dam = 800;
2172 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2173 m_ptr->fx, dam, GF_PLASMA,
2174 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2176 if (record_named_pet && m_ptr->nickname)
2180 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2181 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2184 delete_monster_idx(i);
2190 * @brief 部屋全体を照らすサブルーチン
2194 * This routine clears the entire "temp" set.
2195 * This routine will Perma-Lite all "temp" grids.
2196 * This routine is used (only) by "lite_room()"
2197 * Dark grids are illuminated.
2198 * Also, process all affected monsters.
2200 * SMART monsters always wake up when illuminated
2201 * NORMAL monsters wake up 1/4 the time when illuminated
2202 * STUPID monsters wake up 1/10 the time when illuminated
2205 static void cave_temp_room_lite(void)
2209 /* Clear them all */
2210 for (i = 0; i < temp_n; i++)
2212 POSITION y = temp_y[i];
2213 POSITION x = temp_x[i];
2215 cave_type *c_ptr = &cave[y][x];
2217 /* No longer in the array */
2218 c_ptr->info &= ~(CAVE_TEMP);
2220 /* Update only non-CAVE_GLOW grids */
2221 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2224 c_ptr->info |= (CAVE_GLOW);
2226 /* Process affected monsters */
2231 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2233 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2234 update_monster(c_ptr->m_idx, FALSE);
2236 /* Stupid monsters rarely wake up */
2237 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2239 /* Smart monsters always wake up */
2240 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2242 /* Sometimes monsters wake up */
2243 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2246 (void)set_monster_csleep(c_ptr->m_idx, 0);
2248 /* Notice the "waking up" */
2253 /* Acquire the monster name */
2254 monster_desc(m_name, m_ptr, 0);
2256 /* Dump a message */
2257 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2267 update_local_illumination(y, x);
2277 * @brief 部屋全体を暗くするサブルーチン
2281 * This routine clears the entire "temp" set.
2282 * This routine will "darken" all "temp" grids.
2283 * In addition, some of these grids will be "unmarked".
2284 * This routine is used (only) by "unlite_room()"
2285 * Also, process all affected monsters
2288 static void cave_temp_room_unlite(void)
2292 /* Clear them all */
2293 for (i = 0; i < temp_n; i++)
2295 POSITION y = temp_y[i];
2296 POSITION x = temp_x[i];
2299 cave_type *c_ptr = &cave[y][x];
2300 bool do_dark = !is_mirror_grid(c_ptr);
2302 /* No longer in the array */
2303 c_ptr->info &= ~(CAVE_TEMP);
2305 /* Darken the grid */
2308 if (dun_level || !is_daytime())
2310 for (j = 0; j < 9; j++)
2312 int by = y + ddy_ddd[j];
2313 int bx = x + ddx_ddd[j];
2315 if (in_bounds2(by, bx))
2317 cave_type *cc_ptr = &cave[by][bx];
2319 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2327 if (!do_dark) continue;
2330 c_ptr->info &= ~(CAVE_GLOW);
2332 /* Hack -- Forget "boring" grids */
2333 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2335 /* Forget the grid */
2336 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2341 /* Process affected monsters */
2344 update_monster(c_ptr->m_idx, FALSE);
2349 update_local_illumination(y, x);
2359 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2362 * @param pass_bold 地形条件を返す関数ポインタ
2365 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2372 for (i = 0; i < 16; i++)
2374 y = cy + ddy_cdd[i % 8];
2375 x = cx + ddx_cdd[i % 8];
2377 /* Found a wall, break the length */
2378 if (!pass_bold(y, x))
2380 /* Track best length */
2394 return (MAX(len, blen));
2398 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2401 * @param pass_bold 地形条件を返す関数ポインタ
2404 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2410 for (i = 0; i < 8; i++)
2412 y = cy + ddy_ddd[i];
2413 x = cx + ddx_ddd[i];
2415 if (!pass_bold(y, x)) c++;
2423 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2424 * @param y 部屋内のy座標1点
2425 * @param x 部屋内のx座標1点
2426 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2427 * @param pass_bold 地形条件を返す関数ポインタ
2430 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2435 c_ptr = &cave[y][x];
2437 /* Avoid infinite recursion */
2438 if (c_ptr->info & (CAVE_TEMP)) return;
2440 /* Do not "leave" the current room */
2441 if (!(c_ptr->info & (CAVE_ROOM)))
2443 if (only_room) return;
2446 if (!in_bounds2(y, x)) return;
2448 /* Do not exceed the maximum spell range */
2449 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2451 /* Verify this grid */
2453 * The reason why it is ==6 instead of >5 is that 8 is impossible
2454 * due to the check for cave_bold above.
2455 * 7 lights dead-end corridors (you need to do this for the
2456 * checkboard interesting rooms, so that the boundary is lit
2458 * This leaves only a check for 6 bounding walls!
2460 if (in_bounds(y, x) && pass_bold(y, x) &&
2461 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2464 /* Paranoia -- verify space */
2465 if (temp_n == TEMP_MAX) return;
2467 /* Mark the grid as "seen" */
2468 c_ptr->info |= (CAVE_TEMP);
2470 /* Add it to the "seen" set */
2477 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2480 * @return 光を通すならばtrueを返す。
2482 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2484 return cave_los_bold(y, x);
2488 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2493 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2495 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2499 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2502 * @return 射線を通すならばtrueを返す。
2504 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2506 return cave_have_flag_bold(y, x, FF_PROJECT);
2511 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2516 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2518 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2523 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2528 void lite_room(POSITION y1, POSITION x1)
2533 /* Add the initial grid */
2534 cave_temp_lite_room_aux(y1, x1);
2536 /* While grids are in the queue, add their neighbors */
2537 for (i = 0; i < temp_n; i++)
2539 x = temp_x[i], y = temp_y[i];
2541 /* Walls get lit, but stop light */
2542 if (!cave_pass_lite_bold(y, x)) continue;
2544 /* Spread adjacent */
2545 cave_temp_lite_room_aux(y + 1, x);
2546 cave_temp_lite_room_aux(y - 1, x);
2547 cave_temp_lite_room_aux(y, x + 1);
2548 cave_temp_lite_room_aux(y, x - 1);
2550 /* Spread diagonal */
2551 cave_temp_lite_room_aux(y + 1, x + 1);
2552 cave_temp_lite_room_aux(y - 1, x - 1);
2553 cave_temp_lite_room_aux(y - 1, x + 1);
2554 cave_temp_lite_room_aux(y + 1, x - 1);
2557 /* Now, lite them all up at once */
2558 cave_temp_room_lite();
2560 if (p_ptr->special_defense & NINJA_S_STEALTH)
2562 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2568 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2573 void unlite_room(POSITION y1, POSITION x1)
2578 /* Add the initial grid */
2579 cave_temp_unlite_room_aux(y1, x1);
2581 /* Spread, breadth first */
2582 for (i = 0; i < temp_n; i++)
2584 x = temp_x[i], y = temp_y[i];
2586 /* Walls get dark, but stop darkness */
2587 if (!cave_pass_dark_bold(y, x)) continue;
2589 /* Spread adjacent */
2590 cave_temp_unlite_room_aux(y + 1, x);
2591 cave_temp_unlite_room_aux(y - 1, x);
2592 cave_temp_unlite_room_aux(y, x + 1);
2593 cave_temp_unlite_room_aux(y, x - 1);
2595 /* Spread diagonal */
2596 cave_temp_unlite_room_aux(y + 1, x + 1);
2597 cave_temp_unlite_room_aux(y - 1, x - 1);
2598 cave_temp_unlite_room_aux(y - 1, x + 1);
2599 cave_temp_unlite_room_aux(y + 1, x - 1);
2602 /* Now, darken them all at once */
2603 cave_temp_room_unlite();
2609 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2612 * @return 作用が実際にあった場合TRUEを返す
2614 bool lite_area(HIT_POINT dam, POSITION rad)
2616 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2618 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2620 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2624 /* Hack -- Message */
2627 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2630 /* Hook into the "project()" function */
2631 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2633 /* Lite up the room */
2634 lite_room(p_ptr->y, p_ptr->x);
2642 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2645 * @return 作用が実際にあった場合TRUEを返す
2647 bool unlite_area(HIT_POINT dam, POSITION rad)
2649 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2651 /* Hack -- Message */
2654 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2657 /* Hook into the "project()" function */
2658 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2660 /* Lite up the room */
2661 unlite_room(p_ptr->y, p_ptr->x);
2670 * @brief ボール系スペルの発動 / Cast a ball spell
2672 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2675 * @return 作用が実際にあった場合TRUEを返す
2678 * Stop if we hit a monster, act as a "ball"
2679 * Allow "target" mode to pass over monsters
2680 * Affect grids, objects, and monsters
2683 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2687 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2689 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2690 /* Use the given direction */
2691 tx = p_ptr->x + 99 * ddx[dir];
2692 ty = p_ptr->y + 99 * ddy[dir];
2694 /* Hack -- Use an actual "target" */
2695 if ((dir == 5) && target_okay())
2697 flg &= ~(PROJECT_STOP);
2702 /* Analyze the "dir" and the "target". Hurt items on floor. */
2703 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2707 * @brief ブレス系スペルの発動 / Cast a breath spell
2709 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2712 * @return 作用が実際にあった場合TRUEを返す
2715 * Stop if we hit a monster, act as a "ball"
2716 * Allow "target" mode to pass over monsters
2717 * Affect grids, objects, and monsters
2720 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2722 return fire_ball(typ, dir, dam, -rad);
2727 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2729 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2732 * @return 作用が実際にあった場合TRUEを返す
2735 * Stop if we hit a monster, act as a "ball"
2736 * Allow "target" mode to pass over monsters
2737 * Affect grids, objects, and monsters
2740 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2743 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2745 /* Use the given direction */
2746 tx = p_ptr->x + 99 * ddx[dir];
2747 ty = p_ptr->y + 99 * ddy[dir];
2749 /* Hack -- Use an actual "target" */
2750 if ((dir == 5) && target_okay())
2756 /* Analyze the "dir" and the "target". Hurt items on floor. */
2757 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2762 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2764 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2767 * @return 作用が実際にあった場合TRUEを返す
2770 * Stop if we hit a monster, act as a "ball"
2771 * Allow "target" mode to pass over monsters
2772 * Affect grids, objects, and monsters
2775 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2778 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2780 /* Use the given direction */
2781 tx = p_ptr->x + 99 * ddx[dir];
2782 ty = p_ptr->y + 99 * ddy[dir];
2784 /* Hack -- Use an actual "target" */
2785 if ((dir == 5) && target_okay())
2787 flg &= ~(PROJECT_STOP);
2792 /* Analyze the "dir" and the "target". Hurt items on floor. */
2793 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2798 * @brief メテオ系スペルの発動 / Cast a meteor spell
2799 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2805 * @return 作用が実際にあった場合TRUEを返す
2808 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2809 * player, or outside source, that starts out at an arbitrary location, and
2810 * leaving no trail from the "caster" to the target. This function is
2811 * especially useful for bombardments and similar. -LM-
2812 * Option to hurt the player.
2815 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2817 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2819 /* Analyze the "target" and the caster. */
2820 return (project(who, rad, y, x, dam, typ, flg, -1));
2825 * @brief ブラスト系スペルの発動 / Cast a blast spell
2827 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2832 * @return 作用が実際にあった場合TRUEを返す
2834 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2838 POSITION ty, tx, y, x;
2841 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2846 /* Use the given direction */
2849 ly = ty = p_ptr->y + 20 * ddy[dir];
2850 lx = tx = p_ptr->x + 20 * ddx[dir];
2853 /* Use an actual "target" */
2854 else /* if (dir == 5) */
2859 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2860 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2863 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2866 for (i = 0; i < num; i++)
2870 /* Get targets for some bolts */
2871 y = rand_spread(ly, ld * dev / 20);
2872 x = rand_spread(lx, ld * dev / 20);
2874 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2877 /* Analyze the "dir" and the "target". */
2878 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2889 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2890 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2891 * @return 作用が実際にあった場合TRUEを返す
2893 bool teleport_swap(DIRECTION dir)
2897 monster_type* m_ptr;
2898 monster_race* r_ptr;
2900 if ((dir == 5) && target_okay())
2907 tx = p_ptr->x + ddx[dir];
2908 ty = p_ptr->y + ddy[dir];
2910 c_ptr = &cave[ty][tx];
2912 if (p_ptr->anti_tele)
2914 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2918 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2920 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2926 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2928 msg_print(_("失敗した。", "Failed to swap."));
2934 m_ptr = &m_list[c_ptr->m_idx];
2935 r_ptr = &r_info[m_ptr->r_idx];
2937 (void)set_monster_csleep(c_ptr->m_idx, 0);
2939 if (r_ptr->flagsr & RFR_RES_TELE)
2941 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2943 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2949 sound(SOUND_TELEPORT);
2951 /* Swap the player and monster */
2952 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2960 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2962 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2965 * @return 作用が実際にあった場合TRUEを返す
2967 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2971 /* Pass through the target if needed */
2972 flg |= (PROJECT_THRU);
2974 /* Use the given direction */
2975 tx = p_ptr->x + ddx[dir];
2976 ty = p_ptr->y + ddy[dir];
2978 /* Hack -- Use an actual "target" */
2979 if ((dir == 5) && target_okay())
2985 /* Analyze the "dir" and the "target", do NOT explode */
2986 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2991 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2993 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2995 * @return 作用が実際にあった場合TRUEを返す
2998 * Stop if we hit a monster, as a "bolt".
2999 * Affect monsters and grids (not objects).
3002 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3004 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3005 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3006 return (project_hook(typ, dir, dam, flg));
3011 * @brief ビーム系スペルの発動 / Cast a beam spell.
3013 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3015 * @return 作用が実際にあった場合TRUEを返す
3018 * Pass through monsters, as a "beam".
3019 * Affect monsters, grids and objects.
3022 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3024 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3025 return (project_hook(typ, dir, dam, flg));
3030 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3031 * @param prob ビーム化する確率(%)
3033 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3035 * @return 作用が実際にあった場合TRUEを返す
3038 * Pass through monsters, as a "beam".
3039 * Affect monsters, grids and objects.
3042 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3044 if (randint0(100) < prob)
3046 return (fire_beam(typ, dir, dam));
3050 return (fire_bolt(typ, dir, dam));
3055 * @brief LITE_WEAK属性による光源ビーム処理
3056 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3058 * @return 作用が実際にあった場合TRUEを返す
3060 bool lite_line(DIRECTION dir, HIT_POINT dam)
3062 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3063 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3068 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3070 * @return 作用が実際にあった場合TRUEを返す
3072 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3074 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3075 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3080 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3082 * @return 作用が実際にあった場合TRUEを返す
3084 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3086 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3087 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3092 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3093 * @return 作用が実際にあった場合TRUEを返す
3095 bool wizard_lock(DIRECTION dir)
3097 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3098 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3103 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3104 * @return 作用が実際にあった場合TRUEを返す
3106 bool destroy_door(DIRECTION dir)
3108 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3109 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3114 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3115 * @return 作用が実際にあった場合TRUEを返す
3117 bool disarm_trap(DIRECTION dir)
3119 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3120 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3125 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3127 * @return 作用が実際にあった場合TRUEを返す
3129 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3131 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3132 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3137 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3139 * @return 作用が実際にあった場合TRUEを返す
3141 bool speed_monster(DIRECTION dir, int power)
3143 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3144 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3149 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3151 * @return 作用が実際にあった場合TRUEを返す
3153 bool slow_monster(DIRECTION dir, int power)
3155 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3156 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3161 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3163 * @return 作用が実際にあった場合TRUEを返す
3165 bool sleep_monster(DIRECTION dir, int power)
3167 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3168 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3172 * @brief モンスター拘束(STASIS)処理
3173 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3174 * @return 作用が実際にあった場合TRUEを返す
3175 * @details 威力はプレイヤーレベル*2に固定
3177 bool stasis_monster(DIRECTION dir)
3179 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3183 * @brief 邪悪なモンスター拘束(STASIS)処理
3184 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3185 * @return 作用が実際にあった場合TRUEを返す
3186 * @details 威力はプレイヤーレベル*2に固定
3188 bool stasis_evil(DIRECTION dir)
3190 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3195 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3196 * @param plev プレイヤーレベル(=効力)
3197 * @return 作用が実際にあった場合TRUEを返す
3199 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3201 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3202 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3207 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3208 * @param plev プレイヤーレベル(=効力)
3209 * @return 作用が実際にあった場合TRUEを返す
3211 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3213 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3214 return (project_hook(GF_STUN, dir, plev, flg));
3218 * @brief チェンジモンスター処理
3219 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3221 * @return 作用が実際にあった場合TRUEを返す
3223 bool poly_monster(DIRECTION dir, int power)
3225 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3226 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3228 chg_virtue(V_CHANCE, 1);
3233 * @brief クローンモンスター処理
3234 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3235 * @return 作用が実際にあった場合TRUEを返す
3237 bool clone_monster(DIRECTION dir)
3239 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3240 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3245 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3246 * @param plev プレイヤーレベル(=効力)
3247 * @return 作用が実際にあった場合TRUEを返す
3249 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3251 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3252 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3257 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3258 * @param plev プレイヤーレベル(効力はplev*200)
3259 * @return 作用が実際にあった場合TRUEを返す
3261 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3263 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3264 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3268 * @brief モンスター用テレポート処理
3269 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3270 * @param distance 移動距離
3271 * @return 作用が実際にあった場合TRUEを返す
3273 bool teleport_monster(DIRECTION dir, int distance)
3275 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3276 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3280 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3281 * @return 作用が実際にあった場合TRUEを返す
3283 bool door_creation(void)
3285 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3286 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3290 * @brief トラップ生成処理(起点から周囲1マス)
3293 * @return 作用が実際にあった場合TRUEを返す
3295 bool trap_creation(POSITION y, POSITION x)
3297 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3298 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3302 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3303 * @return 作用が実際にあった場合TRUEを返す
3305 bool tree_creation(void)
3307 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3308 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3312 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3313 * @return 作用が実際にあった場合TRUEを返す
3315 bool glyph_creation(void)
3317 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3318 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3322 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3323 * @return 作用が実際にあった場合TRUEを返す
3325 bool wall_stone(void)
3327 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3329 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3331 p_ptr->update |= (PU_FLOW);
3333 p_ptr->redraw |= (PR_MAP);
3339 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3340 * @return 作用が実際にあった場合TRUEを返す
3342 bool destroy_doors_touch(void)
3344 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3345 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3349 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3350 * @return 作用が実際にあった場合TRUEを返す
3352 bool disarm_traps_touch(void)
3354 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3355 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3359 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3360 * @return 作用が実際にあった場合TRUEを返す
3362 bool sleep_monsters_touch(void)
3364 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3365 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3370 * @brief 死者復活処理(起点より周囲5マス)
3371 * @param who 術者モンスターID(0ならばプレイヤー)
3374 * @return 作用が実際にあった場合TRUEを返す
3376 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3378 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3379 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3384 * @return 作用が実際にあった場合TRUEを返す
3386 void call_chaos(void)
3388 int Chaos_type, dummy, dir;
3389 PLAYER_LEVEL plev = p_ptr->lev;
3390 bool line_chaos = FALSE;
3392 int hurt_types[31] =
3394 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3395 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3396 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3397 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3398 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3399 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3400 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3401 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3404 Chaos_type = hurt_types[randint0(31)];
3405 if (one_in_(4)) line_chaos = TRUE;
3409 for (dummy = 1; dummy < 10; dummy++)
3414 fire_beam(Chaos_type, dummy, 150);
3416 fire_ball(Chaos_type, dummy, 150, 2);
3420 else if (one_in_(3))
3422 fire_ball(Chaos_type, 0, 500, 8);
3426 if (!get_aim_dir(&dir)) return;
3428 fire_beam(Chaos_type, dir, 250);
3430 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3435 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3436 * @param stop_ty 再帰処理停止フラグ
3438 * @return 作用が実際にあった場合TRUEを返す
3441 * rr9: Stop the nasty things when a Cyberdemon is summoned
3442 * or the player gets paralyzed.
3445 bool activate_ty_curse(bool stop_ty, int *count)
3449 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3453 switch (randint1(34))
3458 msg_print(_("地面が揺れた...", "The ground trembles..."));
3459 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3460 if (!one_in_(6)) break;
3465 HIT_POINT dam = damroll(10, 10);
3466 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3467 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3468 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3469 if (!one_in_(6)) break;
3474 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3475 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3476 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3477 if (!one_in_(6)) break;
3480 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3484 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3485 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3487 if (!one_in_(6)) break;
3488 case 1: case 2: case 3: case 16: case 17:
3489 aggravate_monsters(0);
3490 if (!one_in_(6)) break;
3491 case 4: case 5: case 6:
3492 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3493 if (!one_in_(6)) break;
3494 case 7: case 8: case 9: case 18:
3495 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3496 if (!one_in_(6)) break;
3497 case 10: case 11: case 12:
3498 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3499 lose_exp(p_ptr->exp / 16);
3500 if (!one_in_(6)) break;
3501 case 13: case 14: case 15: case 19: case 20:
3502 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3508 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3509 if (p_ptr->free_act)
3510 set_paralyzed(p_ptr->paralyzed + randint1(3));
3512 set_paralyzed(p_ptr->paralyzed + randint1(13));
3515 if (!one_in_(6)) break;
3516 case 21: case 22: case 23:
3517 (void)do_dec_stat(randint0(6));
3518 if (!one_in_(6)) break;
3520 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3522 if (!one_in_(6)) break;
3525 * Only summon Cyberdemons deep in the dungeon.
3527 if ((dun_level > 65) && !stop_ty)
3529 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3533 if (!one_in_(6)) break;
3539 (void)do_dec_stat(i);
3547 while (one_in_(3) && !stop_ty);
3553 * @brief HI_SUMMON(上級召喚)処理発動
3556 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3557 * @return 作用が実際にあった場合TRUEを返す
3559 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3564 BIT_FLAGS mode = PM_ALLOW_GROUP;
3571 mode |= PM_FORCE_FRIENDLY;
3575 mode |= PM_FORCE_PET;
3580 if (!pet) mode |= PM_NO_PET;
3582 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3584 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3586 switch (randint1(25) + (dun_level / 20))
3589 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3592 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3595 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3598 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3601 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3604 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3607 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3610 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3614 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3618 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3621 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3622 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3625 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3626 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3629 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3632 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3633 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3642 * @brief サイバーデーモンの召喚
3643 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3646 * @return 作用が実際にあった場合TRUEを返す
3648 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3651 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3653 BIT_FLAGS mode = PM_ALLOW_GROUP;
3655 /* Summoned by a monster */
3658 monster_type *m_ptr = &m_list[who];
3659 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3662 if (max_cyber > 4) max_cyber = 4;
3664 for (i = 0; i < max_cyber; i++)
3666 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3673 * @brief 周辺破壊効果(プレイヤー中心)
3674 * @return 作用が実際にあった場合TRUEを返す
3676 void wall_breaker(void)
3679 POSITION y = 0, x = 0;
3680 int attempts = 1000;
3682 if (randint1(80 + p_ptr->lev) < 70)
3686 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3688 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3690 if (!player_bold(y, x)) break;
3693 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3694 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3696 else if (randint1(100) > 30)
3698 earthquake(p_ptr->y, p_ptr->x, 1);
3702 int num = damroll(5, 3);
3704 for (i = 0; i < num; i++)
3708 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3710 if (!player_bold(y, x)) break;
3713 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3714 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3721 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3723 * @return 作用が実際にあった場合TRUEを返す
3725 bool confuse_monsters(HIT_POINT dam)
3727 return (project_hack(GF_OLD_CONF, dam));
3732 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3734 * @return 作用が実際にあった場合TRUEを返す
3736 bool charm_monsters(HIT_POINT dam)
3738 return (project_hack(GF_CHARM, dam));
3743 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3745 * @return 作用が実際にあった場合TRUEを返す
3747 bool charm_animals(HIT_POINT dam)
3749 return (project_hack(GF_CONTROL_ANIMAL, dam));
3754 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3756 * @return 作用が実際にあった場合TRUEを返す
3758 bool stun_monsters(HIT_POINT dam)
3760 return (project_hack(GF_STUN, dam));
3765 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3767 * @return 作用が実際にあった場合TRUEを返す
3769 bool stasis_monsters(HIT_POINT dam)
3771 return (project_hack(GF_STASIS, dam));
3776 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3778 * @return 作用が実際にあった場合TRUEを返す
3780 bool mindblast_monsters(HIT_POINT dam)
3782 return (project_hack(GF_PSI, dam));
3787 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3788 * @param dist 効力(距離)
3789 * @return 作用が実際にあった場合TRUEを返す
3791 bool banish_monsters(int dist)
3793 return (project_hack(GF_AWAY_ALL, dist));
3798 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3800 * @return 作用が実際にあった場合TRUEを返す
3802 bool turn_evil(HIT_POINT dam)
3804 return (project_hack(GF_TURN_EVIL, dam));
3809 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3811 * @return 作用が実際にあった場合TRUEを返す
3813 bool turn_monsters(HIT_POINT dam)
3815 return (project_hack(GF_TURN_ALL, dam));
3820 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3821 * @return 作用が実際にあった場合TRUEを返す
3823 bool deathray_monsters(void)
3825 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3829 * @brief チャーム・モンスター(1体)
3830 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3832 * @return 作用が実際にあった場合TRUEを返す
3834 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3836 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3837 return (project_hook(GF_CHARM, dir, plev, flg));
3841 * @brief アンデッド支配(1体)
3842 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3844 * @return 作用が実際にあった場合TRUEを返す
3846 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3848 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3849 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3854 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3856 * @return 作用が実際にあった場合TRUEを返す
3858 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3860 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3861 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3866 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3868 * @return 作用が実際にあった場合TRUEを返す
3870 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3872 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3873 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3879 * @param success 判定成功上の処理ならばTRUE
3880 * @return 作用が実際にあった場合TRUEを返す
3882 bool kawarimi(bool success)
3885 object_type *q_ptr = &forge;
3888 if (p_ptr->is_dead) return FALSE;
3889 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3890 if (randint0(200) < p_ptr->stun) return FALSE;
3892 if (!success && one_in_(3))
3894 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3895 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3896 p_ptr->redraw |= (PR_STATUS);
3903 teleport_player(10 + randint1(90), 0L);
3907 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3909 q_ptr->pval = MON_NINJA;
3911 /* Drop it in the dungeon */
3912 (void)drop_near(q_ptr, -1, y, x);
3915 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3916 else msg_print("失敗!攻撃を受けてしまった。");
3918 if (success) msg_print("You have turned around just before the attack hit you.");
3919 else msg_print("Failed! You are hit by the attack.");
3922 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3923 p_ptr->redraw |= (PR_STATUS);
3931 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3932 * @param mdeath 目標モンスターが死亡したかを返す
3933 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3935 bool rush_attack(bool *mdeath)
3942 bool tmp_mdeath = FALSE;
3945 if (mdeath) *mdeath = FALSE;
3948 if (!get_aim_dir(&dir)) return FALSE;
3950 /* Use the given direction */
3951 tx = p_ptr->x + project_length * ddx[dir];
3952 ty = p_ptr->y + project_length * ddy[dir];
3954 /* Hack -- Use an actual "target" */
3955 if ((dir == 5) && target_okay())
3961 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3963 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3966 /* No need to move */
3967 if (!path_n) return TRUE;
3969 /* Use ty and tx as to-move point */
3973 /* Project along the path */
3974 for (i = 0; i < path_n; i++)
3976 monster_type *m_ptr;
3978 int ny = GRID_Y(path_g[i]);
3979 int nx = GRID_X(path_g[i]);
3981 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3986 /* Go to next grid */
3990 if (!cave[ny][nx].m_idx)
3994 msg_print(_("失敗!", "Failed!"));
3998 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4005 /* Move player before updating the monster */
4006 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4007 update_monster(cave[ny][nx].m_idx, TRUE);
4009 /* Found a monster */
4010 m_ptr = &m_list[cave[ny][nx].m_idx];
4012 if (tm_idx != cave[ny][nx].m_idx)
4015 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4016 m_ptr->ml ? "モンスター" : "何か");
4018 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4021 else if (!player_bold(ty, tx))
4023 /* Hold the monster name */
4026 /* Get the monster name (BEFORE polymorphing) */
4027 monster_desc(m_name, m_ptr, 0);
4028 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4031 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4033 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4038 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4040 if (mdeath) *mdeath = tmp_mdeath;
4046 * @brief 全鏡の消去 / Remove all mirrors in this floor
4047 * @param explode 爆発処理を伴うならばTRUE
4050 void remove_all_mirrors(bool explode)
4054 for (x = 0; x < cur_wid; x++)
4056 for (y = 0; y < cur_hgt; y++)
4058 if (is_mirror_grid(&cave[y][x]))
4060 remove_mirror(y, x);
4062 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4063 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4070 * @brief 『一つの指輪』の効果処理 /
4071 * Hack -- activate the ring of power
4072 * @param dir 発動の方向ID
4075 void ring_of_power(DIRECTION dir)
4077 /* Pick a random effect */
4078 switch (randint1(10))
4083 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4086 /* Decrease all stats (permanently) */
4087 (void)dec_stat(A_STR, 50, TRUE);
4088 (void)dec_stat(A_INT, 50, TRUE);
4089 (void)dec_stat(A_WIS, 50, TRUE);
4090 (void)dec_stat(A_DEX, 50, TRUE);
4091 (void)dec_stat(A_CON, 50, TRUE);
4092 (void)dec_stat(A_CHR, 50, TRUE);
4094 /* Lose some experience (permanently) */
4095 p_ptr->exp -= (p_ptr->exp / 4);
4096 p_ptr->max_exp -= (p_ptr->exp / 4);
4104 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4106 /* Dispel monsters */
4107 dispel_monsters(1000);
4117 fire_ball(GF_MANA, dir, 600, 3);
4128 fire_bolt(GF_MANA, dir, 500);
4136 * @brief 運命の輪、並びにカオス的な効果の発動
4137 * @param spell ランダムな効果を選択するための基準ID
4140 void wild_magic(int spell)
4143 int type = SUMMON_MOLD + randint0(6);
4145 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4146 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4148 switch (randint1(spell) + randint1(8) + 1)
4153 teleport_player(10, TELEPORT_PASSIVE);
4158 teleport_player(100, TELEPORT_PASSIVE);
4162 teleport_player(200, TELEPORT_PASSIVE);
4172 lite_area(damroll(2, 3), 2);
4175 destroy_doors_touch();
4180 sleep_monsters_touch();
4184 trap_creation(p_ptr->y, p_ptr->x);
4193 aggravate_monsters(0);
4196 earthquake(p_ptr->y, p_ptr->x, 5);
4200 (void)gain_random_mutation(0);
4204 apply_disenchant(1);
4210 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4217 while (counter++ < 8)
4219 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4224 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4227 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4232 (void)activate_ty_curse(FALSE, &count);
4241 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4242 * / Drop 10+1d10 meteor ball at random places near the player
4247 void cast_meteor(HIT_POINT dam, POSITION rad)
4250 int b = 10 + randint1(10);
4252 for (i = 0; i < b; i++)
4254 POSITION y = 0, x = 0;
4257 for (count = 0; count <= 20; count++)
4261 x = p_ptr->x - 8 + randint0(17);
4262 y = p_ptr->y - 8 + randint0(17);
4264 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4265 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4267 /* Approximate distance */
4268 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4270 if (d >= 9) continue;
4272 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4273 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4275 /* Valid position */
4279 if (count > 20) continue;
4281 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4287 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4290 * @return ターゲットを指定し、実行したならばTRUEを返す。
4292 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4294 POSITION x, y, tx, ty;
4298 int b = 10 + randint1(10);
4300 if (!get_aim_dir(&dir)) return FALSE;
4302 /* Use the given direction */
4303 tx = p_ptr->x + 99 * ddx[dir];
4304 ty = p_ptr->y + 99 * ddy[dir];
4306 /* Hack -- Use an actual "target" */
4307 if ((dir == 5) && target_okay())
4318 /* Hack -- Stop at the target */
4319 if ((y == ty) && (x == tx)) break;
4323 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4325 /* Stop at maximum range */
4326 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4328 /* Stopped by walls/doors */
4329 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4331 /* Stopped by monsters */
4332 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4334 /* Save the new location */
4341 for (i = 0; i < b; i++)
4343 int count = 20, d = 0;
4349 x = tx - 5 + randint0(11);
4350 y = ty - 5 + randint0(11);
4352 dx = (tx > x) ? (tx - x) : (x - tx);
4353 dy = (ty > y) ? (ty - y) : (y - ty);
4355 /* Approximate distance */
4356 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4357 /* Within the radius */
4361 if (count < 0) continue;
4363 /* Cannot penetrate perm walls */
4364 if (!in_bounds(y, x) ||
4365 cave_stop_disintegration(y, x) ||
4366 !in_disintegration_range(ty, tx, y, x))
4369 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4376 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4380 * This spell should become more useful (more controlled) as the\n
4381 * player gains experience levels. Thus, add 1/5 of the player's\n
4382 * level to the die roll. This eliminates the worst effects later on,\n
4383 * while keeping the results quite random. It also allows some potent\n
4384 * effects only at high level.
4386 void cast_wonder(DIRECTION dir)
4388 PLAYER_LEVEL plev = p_ptr->lev;
4389 int die = randint1(100) + plev / 5;
4390 int vir = virtue_number(V_CHANCE);
4394 if (p_ptr->virtues[vir - 1] > 0)
4396 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4400 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4405 chg_virtue(V_CHANCE, 1);
4409 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4412 if (die < 8) clone_monster(dir);
4413 else if (die < 14) speed_monster(dir, plev);
4414 else if (die < 26) heal_monster(dir, damroll(4, 6));
4415 else if (die < 31) poly_monster(dir, plev);
4417 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4418 damroll(3 + ((plev - 1) / 5), 4));
4419 else if (die < 41) confuse_monster(dir, plev);
4420 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4421 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4423 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4424 damroll(3 + ((plev - 5) / 4), 8));
4426 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4427 damroll(5 + ((plev - 5) / 4), 8));
4429 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4430 damroll(6 + ((plev - 5) / 4), 8));
4432 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4433 damroll(8 + ((plev - 5) / 4), 8));
4434 else if (die < 76) hypodynamic_bolt(dir, 75);
4435 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4436 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4437 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4438 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4439 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4442 earthquake(p_ptr->y, p_ptr->x, 12);
4446 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4450 symbol_genocide(plev + 50, TRUE);
4452 else if (die < 110) dispel_monsters(120);
4455 dispel_monsters(150);
4456 slow_monsters(plev);
4457 sleep_monsters(plev);
4464 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4468 void cast_invoke_spirits(DIRECTION dir)
4470 PLAYER_LEVEL plev = p_ptr->lev;
4471 int die = randint1(100) + plev / 5;
4472 int vir = virtue_number(V_CHANCE);
4476 if (p_ptr->virtues[vir - 1] > 0)
4478 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4482 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4486 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4488 chg_virtue(V_CHANCE, 1);
4492 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4497 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4498 "Oh no! Mouldering forms rise from the earth around you!"));
4500 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4501 chg_virtue(V_UNLIFE, 1);
4505 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4507 set_afraid(p_ptr->afraid + randint1(4) + 4);
4511 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4512 "Your head is invaded by a horde of gibbering spectral voices..."));
4514 set_confused(p_ptr->confused + randint1(4) + 4);
4518 poly_monster(dir, plev);
4522 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4523 damroll(3 + ((plev - 1) / 5), 4));
4527 confuse_monster(dir, plev);
4531 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4535 (void)lite_line(dir, damroll(6, 8));
4539 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4540 damroll(3 + ((plev - 5) / 4), 8));
4544 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4545 damroll(5 + ((plev - 5) / 4), 8));
4549 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4550 damroll(6 + ((plev - 5) / 4), 8));
4554 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4555 damroll(8 + ((plev - 5) / 4), 8));
4559 hypodynamic_bolt(dir, 75);
4563 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4567 fire_ball(GF_ACID, dir, 40 + plev, 2);
4571 fire_ball(GF_ICE, dir, 70 + plev, 3);
4575 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4579 hypodynamic_bolt(dir, 100 + plev);
4583 earthquake(p_ptr->y, p_ptr->x, 12);
4587 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4591 symbol_genocide(plev + 50, TRUE);
4595 dispel_monsters(120);
4599 dispel_monsters(150);
4600 slow_monsters(plev);
4601 sleep_monsters(plev);
4607 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4608 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4613 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4616 void cast_shuffle(void)
4618 PLAYER_LEVEL plev = p_ptr->lev;
4621 int vir = virtue_number(V_CHANCE);
4624 /* Card sharks and high mages get a level bonus */
4625 if ((p_ptr->pclass == CLASS_ROGUE) ||
4626 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4627 (p_ptr->pclass == CLASS_SORCERER))
4628 die = (randint1(110)) + plev / 5;
4630 die = randint1(120);
4635 if (p_ptr->virtues[vir - 1] > 0)
4637 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4641 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4645 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4648 chg_virtue(V_CHANCE, 1);
4652 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4654 for (i = 0; i < randint1(3); i++)
4655 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4659 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4660 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4665 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4666 activate_ty_curse(FALSE, &count);
4670 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4671 aggravate_monsters(0);
4675 msg_print(_("《愚者》だ。", "It's the Fool."));
4681 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4682 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4686 msg_print(_("《月》だ。", "It's the Moon."));
4691 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4692 wild_magic(randint0(32));
4696 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4697 teleport_player(10, TELEPORT_PASSIVE);
4701 msg_print(_("《正義》だ。", "It's Justice."));
4702 set_blessed(p_ptr->lev, FALSE);
4706 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4707 teleport_player(100, TELEPORT_PASSIVE);
4711 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4712 teleport_player(200, TELEPORT_PASSIVE);
4716 msg_print(_("《塔》だ。", "It's the Tower."));
4721 msg_print(_("《節制》だ。", "It's Temperance."));
4722 sleep_monsters_touch();
4726 msg_print(_("《塔》だ。", "It's the Tower."));
4728 earthquake(p_ptr->y, p_ptr->x, 5);
4732 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4733 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4737 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4738 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4742 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4743 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4747 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4748 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4752 msg_print(_("《恋人》だ。", "It's the Lovers."));
4754 if (get_aim_dir(&dir))
4755 charm_monster(dir, MIN(p_ptr->lev, 20));
4759 msg_print(_("《隠者》だ。", "It's the Hermit."));
4764 msg_print(_("《審判》だ。", "It's the Judgement."));
4765 do_cmd_rerate(FALSE);
4766 lose_all_mutations();
4770 msg_print(_("《太陽》だ。", "It's the Sun."));
4771 chg_virtue(V_KNOWLEDGE, 1);
4772 chg_virtue(V_ENLIGHTEN, 1);
4777 msg_print(_("《世界》だ。", "It's the World."));
4778 if (p_ptr->exp < PY_MAX_EXP)
4780 s32b ee = (p_ptr->exp / 25) + 1;
4781 if (ee > 5000) ee = 5000;
4782 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4788 bool_hack life_stream(bool_hack message, bool_hack virtue)
4792 chg_virtue(V_VITALITY, 1);
4793 chg_virtue(V_UNLIFE, -5);
4797 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4800 (void)set_poisoned(0);
4802 (void)set_confused(0);
4806 (void)restore_all_status();
4807 (void)set_shero(0, TRUE);
4814 bool_hack heroism(int base)
4816 bool_hack ident = FALSE;
4817 if(set_afraid(0)) ident = TRUE;
4818 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4819 if(hp_player(10)) ident = TRUE;
4823 bool_hack berserk(int base)
4825 bool_hack ident = FALSE;
4826 if (set_afraid(0)) ident = TRUE;
4827 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4828 if (hp_player(30)) ident = TRUE;
4832 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4834 bool_hack ident = FALSE;
4835 if (hp_player(damroll(dice, sides))) ident = TRUE;
4836 if (set_blind(0)) ident = TRUE;
4837 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4838 if (set_shero(0, TRUE)) ident = TRUE;
4842 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4844 bool_hack ident = FALSE;
4845 if (hp_player(damroll(dice, sides))) ident = TRUE;
4846 if (set_blind(0)) ident = TRUE;
4847 if (set_confused(0)) ident = TRUE;
4848 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4849 if (set_shero(0, TRUE)) ident = TRUE;
4853 bool_hack cure_critical_wounds(HIT_POINT pow)
4855 bool_hack ident = FALSE;
4856 if (hp_player(pow)) ident = TRUE;
4857 if (set_blind(0)) ident = TRUE;
4858 if (set_confused(0)) ident = TRUE;
4859 if (set_poisoned(0)) ident = TRUE;
4860 if (set_stun(0)) ident = TRUE;
4861 if (set_cut(0)) ident = TRUE;
4862 if (set_shero(0, TRUE)) ident = TRUE;
4866 bool_hack true_healing(HIT_POINT pow)
4868 bool_hack ident = FALSE;
4869 if (hp_player(pow)) ident = TRUE;
4870 if (set_blind(0)) ident = TRUE;
4871 if (set_confused(0)) ident = TRUE;
4872 if (set_poisoned(0)) ident = TRUE;
4873 if (set_stun(0)) ident = TRUE;
4874 if (set_cut(0)) ident = TRUE;
4875 if (set_image(0)) ident = TRUE;
4879 bool_hack restore_mana(bool_hack magic_eater)
4881 bool_hack ident = FALSE;
4883 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4886 for (i = 0; i < EATER_EXT * 2; i++)
4888 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4889 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;
4891 for (; i < EATER_EXT * 3; i++)
4893 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4894 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;
4895 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4897 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4898 p_ptr->window |= (PW_PLAYER);
4901 else if (p_ptr->csp < p_ptr->msp)
4903 p_ptr->csp = p_ptr->msp;
4904 p_ptr->csp_frac = 0;
4905 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4906 p_ptr->redraw |= (PR_MANA);
4907 p_ptr->window |= (PW_PLAYER);
4908 p_ptr->window |= (PW_SPELL);
4915 bool restore_all_status(void)
4918 if (do_res_stat(A_STR)) ident = TRUE;
4919 if (do_res_stat(A_INT)) ident = TRUE;
4920 if (do_res_stat(A_WIS)) ident = TRUE;
4921 if (do_res_stat(A_DEX)) ident = TRUE;
4922 if (do_res_stat(A_CON)) ident = TRUE;
4923 if (do_res_stat(A_CHR)) ident = TRUE;
4928 * @brief 口を使う継続的な処理を中断する
4931 void stop_mouth(void)
4933 if (music_singing_any()) stop_singing();
4934 if (hex_spelling_any()) stop_hex_spell_all();
4938 bool_hack vampirism(void)
4945 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4947 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4951 /* Only works on adjacent monsters */
4952 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4953 y = p_ptr->y + ddy[dir];
4954 x = p_ptr->x + ddx[dir];
4955 c_ptr = &cave[y][x];
4959 if (!(c_ptr->m_idx))
4961 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4965 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4967 dummy = p_ptr->lev * 2;
4969 if (hypodynamic_bolt(dir, dummy))
4971 if (p_ptr->food < PY_FOOD_FULL)
4972 /* No heal if we are "full" */
4973 (void)hp_player(dummy);
4975 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4977 /* Gain nutritional sustenance: 150/hp drained */
4978 /* A Food ration gives 5000 food points (by contrast) */
4979 /* Don't ever get more than "Full" this way */
4980 /* But if we ARE Gorged, it won't cure us */
4981 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4982 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4983 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4986 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4990 bool panic_hit(void)
4995 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4996 y = p_ptr->y + ddy[dir];
4997 x = p_ptr->x + ddx[dir];
4998 if (cave[y][x].m_idx)
5001 if (randint0(p_ptr->skill_dis) < 7)
5002 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5004 teleport_player(30, 0L);
5009 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5017 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5020 * currently this function allows pseudo-id of any object,
5021 * including silly ones like potions & scrolls, which always
5022 * get '{average}'. This should be changed, either to stop such
5023 * items from being pseudo-id'd, or to allow psychometry to
5024 * detect whether the unidentified potion/scroll/etc is
5025 * good (Cure Light Wounds, Restore Strength, etc) or
5026 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5028 bool psychometry(void)
5032 char o_name[MAX_NLEN];
5037 item_tester_no_ryoute = TRUE;
5038 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5039 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5041 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5043 /* Get the item (in the pack) */
5046 o_ptr = &inventory[item];
5049 /* Get the item (on the floor) */
5052 o_ptr = &o_list[0 - item];
5055 /* It is fully known, no information needed */
5056 if (object_is_known(o_ptr))
5058 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5062 /* Check for a feeling */
5063 feel = value_check_aux1(o_ptr);
5065 /* Get an object description */
5066 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5068 /* Skip non-feelings */
5071 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5076 msg_format("%sは%sという感じがする...",
5077 o_name, game_inscriptions[feel]);
5079 msg_format("You feel that the %s %s %s...",
5080 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5081 game_inscriptions[feel]);
5085 /* We have "felt" it */
5086 o_ptr->ident |= (IDENT_SENSE);
5089 o_ptr->feeling = feel;
5091 /* Player touches it */
5092 o_ptr->marked |= OM_TOUCHED;
5094 /* Combine / Reorder the pack (later) */
5095 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5097 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5099 /* Valid "tval" codes */
5100 switch (o_ptr->tval)
5128 /* Auto-inscription/destroy */
5129 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5131 /* Something happened */