3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "monsterrace-hook.h"
21 * @brief プレイヤー周辺の地形を感知する
24 * @param known 地形から危険フラグを外すならTRUE
25 * @return 効力があった場合TRUEを返す
27 static bool detect_feat_flag(POSITION range, int flag, bool known)
33 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
35 /* Scan the current panel */
36 for (y = 1; y < cur_hgt - 1; y++)
38 for (x = 1; x <= cur_wid - 1; x++)
40 int dist = distance(p_ptr->y, p_ptr->x, y, x);
41 if (dist > range) continue;
47 /* Mark as detected */
48 if (dist <= range && known)
50 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
52 c_ptr->info &= ~(CAVE_UNSAFE);
59 if (cave_have_flag_grid(c_ptr, flag))
64 /* Hack -- Memorize */
65 c_ptr->info |= (CAVE_MARK);
78 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
80 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
81 * @return 効力があった場合TRUEを返す
83 bool detect_traps(POSITION range, bool known)
85 bool detect = detect_feat_flag(range, FF_TRAP, known);
87 if (known) p_ptr->dtrap = TRUE;
89 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
92 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
99 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
101 * @return 効力があった場合TRUEを返す
103 bool detect_doors(POSITION range)
105 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
107 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
110 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
117 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
119 * @return 効力があった場合TRUEを返す
121 bool detect_stairs(POSITION range)
123 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
125 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
128 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
135 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
137 * @return 効力があった場合TRUEを返す
139 bool detect_treasure(POSITION range)
141 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
143 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
146 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
153 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
155 * @return 効力があった場合TRUEを返す
157 bool detect_objects_gold(POSITION range)
161 POSITION range2 = range;
165 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
168 for (i = 1; i < o_max; i++)
170 object_type *o_ptr = &o_list[i];
172 /* Skip dead objects */
173 if (!o_ptr->k_idx) continue;
175 /* Skip held objects */
176 if (o_ptr->held_m_idx) continue;
181 /* Only detect nearby objects */
182 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
184 /* Detect "gold" objects */
185 if (o_ptr->tval == TV_GOLD)
187 o_ptr->marked |= OM_FOUND;
193 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
196 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
199 if (detect_monsters_string(range, "$"))
208 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
210 * @return 効力があった場合TRUEを返す
212 bool detect_objects_normal(POSITION range)
216 POSITION range2 = range;
220 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
223 for (i = 1; i < o_max; i++)
225 object_type *o_ptr = &o_list[i];
227 /* Skip dead objects */
228 if (!o_ptr->k_idx) continue;
230 /* Skip held objects */
231 if (o_ptr->held_m_idx) continue;
236 /* Only detect nearby objects */
237 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
239 /* Detect "real" objects */
240 if (o_ptr->tval != TV_GOLD)
242 o_ptr->marked |= OM_FOUND;
248 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
251 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
254 if (detect_monsters_string(range, "!=?|/`"))
263 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
265 * @return 効力があった場合TRUEを返す
268 * This will light up all spaces with "magic" items, including artifacts,
269 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
270 * and "enchanted" items of the "good" variety.
272 * It can probably be argued that this function is now too powerful.
275 bool detect_objects_magic(POSITION range)
277 OBJECT_TYPE_VALUE tv;
283 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
285 /* Scan all objects */
286 for (i = 1; i < o_max; i++)
288 object_type *o_ptr = &o_list[i];
290 /* Skip dead objects */
291 if (!o_ptr->k_idx) continue;
293 /* Skip held objects */
294 if (o_ptr->held_m_idx) continue;
299 /* Only detect nearby objects */
300 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
302 /* Examine the tval */
305 /* Artifacts, misc magic items, or enchanted wearables */
306 if (object_is_artifact(o_ptr) ||
307 object_is_ego(o_ptr) ||
308 (tv == TV_WHISTLE) ||
316 (tv == TV_LIFE_BOOK) ||
317 (tv == TV_SORCERY_BOOK) ||
318 (tv == TV_NATURE_BOOK) ||
319 (tv == TV_CHAOS_BOOK) ||
320 (tv == TV_DEATH_BOOK) ||
321 (tv == TV_TRUMP_BOOK) ||
322 (tv == TV_ARCANE_BOOK) ||
323 (tv == TV_CRAFT_BOOK) ||
324 (tv == TV_DAEMON_BOOK) ||
325 (tv == TV_CRUSADE_BOOK) ||
326 (tv == TV_MUSIC_BOOK) ||
327 (tv == TV_HISSATSU_BOOK) ||
328 (tv == TV_HEX_BOOK) ||
329 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
331 /* Memorize the item */
332 o_ptr->marked |= OM_FOUND;
339 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
348 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
350 * @return 効力があった場合TRUEを返す
352 bool detect_monsters_normal(POSITION range)
359 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
362 for (i = 1; i < m_max; i++)
364 monster_type *m_ptr = &m_list[i];
365 monster_race *r_ptr = &r_info[m_ptr->r_idx];
367 /* Skip dead monsters */
368 if (!m_ptr->r_idx) continue;
373 /* Only detect nearby monsters */
374 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
376 /* Detect all non-invisible monsters */
377 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
379 /* Repair visibility later */
380 repair_monsters = TRUE;
382 /* Hack -- Detect monster */
383 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
384 update_monster(i, FALSE);
389 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
392 /* Describe result */
393 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
400 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
402 * @return 効力があった場合TRUEを返す
404 bool detect_monsters_invis(POSITION range)
410 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
413 for (i = 1; i < m_max; i++)
415 monster_type *m_ptr = &m_list[i];
416 monster_race *r_ptr = &r_info[m_ptr->r_idx];
418 /* Skip dead monsters */
419 if (!m_ptr->r_idx) continue;
424 /* Only detect nearby monsters */
425 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
427 /* Detect invisible monsters */
428 if (r_ptr->flags2 & RF2_INVISIBLE)
430 /* Update monster recall window */
431 if (p_ptr->monster_race_idx == m_ptr->r_idx)
433 p_ptr->window |= (PW_MONSTER);
436 /* Repair visibility later */
437 repair_monsters = TRUE;
439 /* Hack -- Detect monster */
440 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
441 update_monster(i, FALSE);
446 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
449 /* Describe result */
450 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
456 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
458 * @return 効力があった場合TRUEを返す
460 bool detect_monsters_evil(POSITION range)
466 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
469 for (i = 1; i < m_max; i++)
471 monster_type *m_ptr = &m_list[i];
472 monster_race *r_ptr = &r_info[m_ptr->r_idx];
474 /* Skip dead monsters */
475 if (!m_ptr->r_idx) continue;
480 /* Only detect nearby monsters */
481 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
483 /* Detect evil monsters */
484 if (r_ptr->flags3 & RF3_EVIL)
486 if (is_original_ap(m_ptr))
488 /* Take note that they are evil */
489 r_ptr->r_flags3 |= (RF3_EVIL);
491 /* Update monster recall window */
492 if (p_ptr->monster_race_idx == m_ptr->r_idx)
494 p_ptr->window |= (PW_MONSTER);
498 /* Repair visibility later */
499 repair_monsters = TRUE;
501 /* Hack -- Detect monster */
502 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
503 update_monster(i, FALSE);
509 /* Describe result */
510 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
516 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
518 * @return 効力があった場合TRUEを返す
520 bool detect_monsters_nonliving(POSITION range)
526 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
529 for (i = 1; i < m_max; i++)
531 monster_type *m_ptr = &m_list[i];
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(m_ptr->r_idx))
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];
969 /* Paranoia -- Skip dead monsters */
970 if (!m_ptr->r_idx) continue;
972 /* Skip aggravating monster (or player) */
973 if (i == who) continue;
975 /* Wake up nearby sleeping monsters */
976 if (m_ptr->cdis < MAX_SIGHT * 2)
979 if (MON_CSLEEP(m_ptr))
981 (void)set_monster_csleep(i, 0);
984 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
987 /* Speed up monsters in line of sight */
988 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
992 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
998 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
999 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1000 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1005 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1006 * @param m_idx 抹殺するモンスターID
1007 * @param power 抹殺の威力
1008 * @param player_cast プレイヤーの魔法によるものならば TRUE
1009 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1010 * @param spell_name 抹殺効果を起こした魔法の名前
1011 * @return 効力があった場合TRUEを返す
1013 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1015 int msec = delay_factor * delay_factor * delay_factor;
1016 monster_type *m_ptr = &m_list[m_idx];
1017 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1018 bool resist = FALSE;
1020 if (is_pet(m_ptr) && !player_cast) return FALSE;
1022 /* Hack -- Skip Unique Monsters or Quest Monsters */
1023 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1024 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1025 else if (m_idx == p_ptr->riding) resist = TRUE;
1026 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1027 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1028 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1033 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1037 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1038 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1041 delete_monster_idx(m_idx);
1044 if (resist && player_cast)
1046 bool see_m = is_seen(m_ptr);
1049 monster_desc(m_name, m_ptr, 0);
1052 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1054 if (MON_CSLEEP(m_ptr))
1056 (void)set_monster_csleep(m_idx, 0);
1059 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1062 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1066 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1070 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1075 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1078 /* Visual feedback */
1079 move_cursor_relative(p_ptr->y, p_ptr->x);
1081 p_ptr->redraw |= (PR_HP);
1082 p_ptr->window |= (PW_PLAYER);
1088 Term_xtra(TERM_XTRA_DELAY, msec);
1095 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1096 * @param power 抹殺の威力
1097 * @param player_cast プレイヤーの魔法によるものならば TRUE
1098 * @return 効力があった場合TRUEを返す
1100 bool symbol_genocide(int power, bool player_cast)
1104 bool result = FALSE;
1106 /* Prevent genocide in quest levels */
1107 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1112 /* Mega-Hack -- Get a monster symbol */
1113 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1115 /* Delete the monsters of that "type" */
1116 for (i = 1; i < m_max; i++)
1118 monster_type *m_ptr = &m_list[i];
1119 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1121 /* Paranoia -- Skip dead monsters */
1122 if (!m_ptr->r_idx) continue;
1124 /* Skip "wrong" monsters */
1125 if (r_ptr->d_char != typ) continue;
1128 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1133 chg_virtue(V_VITALITY, -2);
1134 chg_virtue(V_CHANCE, -1);
1142 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1143 * @param power 抹殺の威力
1144 * @param player_cast プレイヤーの魔法によるものならば TRUE
1145 * @return 効力があった場合TRUEを返す
1147 bool mass_genocide(int power, bool player_cast)
1150 bool result = FALSE;
1152 /* Prevent mass genocide in quest levels */
1153 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1158 /* Delete the (nearby) monsters */
1159 for (i = 1; i < m_max; i++)
1161 monster_type *m_ptr = &m_list[i];
1163 /* Paranoia -- Skip dead monsters */
1164 if (!m_ptr->r_idx) continue;
1166 /* Skip distant monsters */
1167 if (m_ptr->cdis > MAX_SIGHT) continue;
1170 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1175 chg_virtue(V_VITALITY, -2);
1176 chg_virtue(V_CHANCE, -1);
1184 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1185 * @param power 抹殺の威力
1186 * @param player_cast プレイヤーの魔法によるものならば TRUE
1187 * @return 効力があった場合TRUEを返す
1189 bool mass_genocide_undead(int power, bool player_cast)
1192 bool result = FALSE;
1194 /* Prevent mass genocide in quest levels */
1195 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1200 /* Delete the (nearby) monsters */
1201 for (i = 1; i < m_max; i++)
1203 monster_type *m_ptr = &m_list[i];
1204 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1206 /* Paranoia -- Skip dead monsters */
1207 if (!m_ptr->r_idx) continue;
1209 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1211 /* Skip distant monsters */
1212 if (m_ptr->cdis > MAX_SIGHT) continue;
1215 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1220 chg_virtue(V_UNLIFE, -2);
1221 chg_virtue(V_CHANCE, -1);
1229 * @brief 周辺モンスターを調査する / Probe nearby monsters
1230 * @return 効力があった場合TRUEを返す
1246 /* Probe all (nearby) monsters */
1247 for (i = 1; i < m_max; i++)
1249 monster_type *m_ptr = &m_list[i];
1250 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1252 /* Paranoia -- Skip dead monsters */
1253 if (!m_ptr->r_idx) continue;
1255 /* Require line of sight */
1256 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1258 /* Probe visible monsters */
1263 /* Start the message */
1266 msg_print(_("調査中...", "Probing..."));
1271 if (!is_original_ap(m_ptr))
1273 if (m_ptr->mflag2 & MFLAG2_KAGE)
1274 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1276 m_ptr->ap_r_idx = m_ptr->r_idx;
1277 lite_spot(m_ptr->fy, m_ptr->fx);
1279 /* Get "the monster" or "something" */
1280 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1282 speed = m_ptr->mspeed - 110;
1283 if (MON_FAST(m_ptr)) speed += 10;
1284 if (MON_SLOW(m_ptr)) speed -= 10;
1285 if (ironman_nightmare) speed += 5;
1287 /* Get the monster's alignment */
1288 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1289 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1290 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1291 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1292 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1293 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1294 else align = _("中立", "neutral");
1296 /* Describe the monster */
1297 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1298 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1300 if (r_ptr->next_r_idx)
1302 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1306 strcat(buf, "xxx ");
1309 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1310 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1311 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1312 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1313 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1314 buf[strlen(buf)-1] = '\0';
1317 /* HACK : Add the line to message buffer */
1319 p_ptr->window |= (PW_MESSAGE);
1322 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1325 Term_erase(0, 0, 255);
1327 /* Learn everything about this monster */
1328 if (lore_do_probe(m_ptr->r_idx))
1330 /* Get base name of monster */
1331 strcpy(buf, (r_name + r_ptr->name));
1334 /* Note that we learnt some new flags -Mogami- */
1335 msg_format("%sについてさらに詳しくなった気がする。", buf);
1340 /* Note that we learnt some new flags -Mogami- */
1341 msg_format("You now know more about %s.", buf);
1343 /* Clear -more- prompt */
1358 chg_virtue(V_KNOWLEDGE, 1);
1359 msg_print(_("これで全部です。", "That's all."));
1367 * @brief *破壊*処理を行う / The spell of destruction
1368 * @param y1 破壊の中心Y座標
1369 * @param x1 破壊の中心X座標
1371 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1372 * @return 効力があった場合TRUEを返す
1375 * This spell "deletes" monsters (instead of "killing" them).
1377 * Later we may use one function for both "destruction" and
1378 * "earthquake" by using the "full" to select "destruction".
1381 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1388 /* Prevent destruction of quest levels and town */
1389 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1394 /* Lose monster light */
1395 if (!in_generate) clear_mon_lite();
1397 /* Big area of affect */
1398 for (y = (y1 - r); y <= (y1 + r); y++)
1400 for (x = (x1 - r); x <= (x1 + r); x++)
1402 /* Skip illegal grids */
1403 if (!in_bounds(y, x)) continue;
1405 /* Extract the distance */
1406 k = distance(y1, x1, y, x);
1408 /* Stay in the circle of death */
1409 if (k > r) continue;
1410 c_ptr = &cave[y][x];
1412 /* Lose room and vault */
1413 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1415 /* Lose light and knowledge */
1416 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1418 if (!in_generate) /* Normal */
1421 c_ptr->info &= ~(CAVE_UNSAFE);
1423 /* Hack -- Notice player affect */
1424 if (player_bold(y, x))
1426 /* Hurt the player later */
1429 /* Do not hurt this grid */
1434 /* Hack -- Skip the epicenter */
1435 if ((y == y1) && (x == x1)) continue;
1439 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1440 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1442 if (in_generate) /* In generation */
1444 /* Delete the monster (if any) */
1445 delete_monster(y, x);
1447 else if (r_ptr->flags1 & RF1_QUESTOR)
1449 /* Heal the monster */
1450 m_ptr->hp = m_ptr->maxhp;
1452 /* Try to teleport away quest monsters */
1453 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1457 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1461 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1462 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1465 /* Delete the monster (if any) */
1466 delete_monster(y, x);
1470 /* During generation, destroyed artifacts are "preserved" */
1471 if (preserve_mode || in_generate)
1473 OBJECT_IDX this_o_idx, next_o_idx = 0;
1475 /* Scan all objects in the grid */
1476 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1479 o_ptr = &o_list[this_o_idx];
1481 /* Acquire next object */
1482 next_o_idx = o_ptr->next_o_idx;
1484 /* Hack -- Preserve unknown artifacts */
1485 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1487 /* Mega-Hack -- Preserve the artifact */
1488 a_info[o_ptr->name1].cur_num = 0;
1490 if (in_generate && cheat_peek)
1492 char o_name[MAX_NLEN];
1493 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1494 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1497 else if (in_generate && cheat_peek && o_ptr->art_name)
1499 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1500 "One of the random artifacts was *destroyed* during generation."));
1505 /* Delete objects */
1506 delete_object(y, x);
1508 /* Destroy "non-permanent" grids */
1509 if (!cave_perma_grid(c_ptr))
1511 /* Wall (or floor) type */
1514 if (!in_generate) /* Normal */
1518 /* Create granite wall */
1519 cave_set_feat(y, x, feat_granite);
1523 /* Create quartz vein */
1524 cave_set_feat(y, x, feat_quartz_vein);
1528 /* Create magma vein */
1529 cave_set_feat(y, x, feat_magma_vein);
1534 cave_set_feat(y, x, floor_type[randint0(100)]);
1537 else /* In generation */
1541 /* Create granite wall */
1542 place_extra_grid(c_ptr);
1546 /* Create quartz vein */
1547 c_ptr->feat = feat_quartz_vein;
1551 /* Create magma vein */
1552 c_ptr->feat = feat_magma_vein;
1557 place_floor_grid(c_ptr);
1560 /* Clear garbage of hidden trap or door */
1569 /* Process "re-glowing" */
1570 for (y = (y1 - r); y <= (y1 + r); y++)
1572 for (x = (x1 - r); x <= (x1 + r); x++)
1574 /* Skip illegal grids */
1575 if (!in_bounds(y, x)) continue;
1577 /* Extract the distance */
1578 k = distance(y1, x1, y, x);
1580 /* Stay in the circle of death */
1581 if (k > r) continue;
1582 c_ptr = &cave[y][x];
1584 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1585 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1590 for (i = 0; i < 9; i++)
1592 yy = y + ddy_ddd[i];
1593 xx = x + ddx_ddd[i];
1594 if (!in_bounds2(yy, xx)) continue;
1595 cc_ptr = &cave[yy][xx];
1596 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1598 c_ptr->info |= CAVE_GLOW;
1606 /* Hack -- Affect player */
1609 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1611 /* Blind the player */
1612 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1615 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1621 /* Mega-Hack -- Forget the view and lite */
1622 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1624 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1626 p_ptr->redraw |= (PR_MAP);
1628 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1630 if (p_ptr->special_defense & NINJA_S_STEALTH)
1632 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1642 * @brief 地震処理(サブルーチン) /
1643 * Induce an "earthquake" of the given radius at the given location.
1644 * @return 効力があった場合TRUEを返す
1648 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1652 * This will turn some walls into floors and some floors into walls.
1654 * The player will take damage and "jump" into a safe grid if possible,
1655 * otherwise, he will "tunnel" through the rubble instantaneously.
1657 * Monsters will take damage, and "jump" into a safe grid if possible,
1658 * otherwise they will be "buried" in the rubble, disappearing from
1659 * the level in the same way that they do when genocided.
1661 * Note that thus the player and monsters (except eaters of walls and
1662 * passers through walls) will never occupy the same grid as a wall.
1663 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1664 * for a single turn, unless that monster can pass_walls or kill_walls.
1665 * This has allowed massive simplification of the "monster" code.
1668 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1672 POSITION y, x, yy, xx, dy, dx;
1675 POSITION sy = 0, sx = 0;
1681 /* Prevent destruction of quest levels and town */
1682 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1687 /* Paranoia -- Enforce maximum range */
1690 /* Clear the "maximal blast" area */
1691 for (y = 0; y < 32; y++)
1693 for (x = 0; x < 32; x++)
1699 /* Check around the epicenter */
1700 for (dy = -r; dy <= r; dy++)
1702 for (dx = -r; dx <= r; dx++)
1704 /* Extract the location */
1708 /* Skip illegal grids */
1709 if (!in_bounds(yy, xx)) continue;
1711 /* Skip distant grids */
1712 if (distance(cy, cx, yy, xx) > r) continue;
1713 c_ptr = &cave[yy][xx];
1715 /* Lose room and vault */
1716 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1718 /* Lose light and knowledge */
1719 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1721 /* Skip the epicenter */
1722 if (!dx && !dy) continue;
1724 /* Skip most grids */
1725 if (randint0(100) < 85) continue;
1727 /* Damage this grid */
1728 map[16+yy-cy][16+xx-cx] = TRUE;
1730 /* Hack -- Take note of player damage */
1731 if (player_bold(yy, xx)) hurt = TRUE;
1735 /* First, affect the player (if necessary) */
1736 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1738 /* Check around the player */
1739 for (i = 0; i < 8; i++)
1741 /* Access the location */
1742 y = p_ptr->y + ddy_ddd[i];
1743 x = p_ptr->x + ddx_ddd[i];
1745 /* Skip non-empty grids */
1746 if (!cave_empty_bold(y, x)) continue;
1748 /* Important -- Skip "quake" grids */
1749 if (map[16+y-cy][16+x-cx]) continue;
1751 if (cave[y][x].m_idx) continue;
1753 /* Count "safe" grids */
1756 /* Randomize choice */
1757 if (randint0(sn) > 0) continue;
1759 /* Save the safe location */
1763 /* Random message */
1764 switch (randint1(3))
1768 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1773 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1778 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1783 /* Hurt the player a lot */
1786 /* Message and damage */
1787 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1791 /* Destroy the grid, and push the player to safety */
1794 /* Calculate results */
1795 switch (randint1(3))
1799 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1805 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1806 damage = damroll(10, 4);
1807 (void)set_stun(p_ptr->stun + randint1(50));
1812 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1813 damage = damroll(10, 4);
1814 (void)set_stun(p_ptr->stun + randint1(50));
1819 /* Move the player to the safe location */
1820 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1823 /* Important -- no wall on player */
1824 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1833 monster_type *m_ptr = &m_list[m_idx];
1835 /* Get the monster's real name */
1836 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1838 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1842 killer = _("地震", "an earthquake");
1845 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1849 /* Examine the quaked region */
1850 for (dy = -r; dy <= r; dy++)
1852 for (dx = -r; dx <= r; dx++)
1854 /* Extract the location */
1858 /* Skip unaffected grids */
1859 if (!map[16+yy-cy][16+xx-cx]) continue;
1860 c_ptr = &cave[yy][xx];
1862 if (c_ptr->m_idx == p_ptr->riding) continue;
1864 /* Process monsters */
1867 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1868 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1870 /* Quest monsters */
1871 if (r_ptr->flags1 & RF1_QUESTOR)
1873 /* No wall on quest monsters */
1874 map[16+yy-cy][16+xx-cx] = FALSE;
1879 /* Most monsters cannot co-exist with rock */
1880 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1881 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1885 /* Assume not safe */
1888 /* Monster can move to escape the wall */
1889 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1891 /* Look for safety */
1892 for (i = 0; i < 8; i++)
1894 y = yy + ddy_ddd[i];
1895 x = xx + ddx_ddd[i];
1897 /* Skip non-empty grids */
1898 if (!cave_empty_bold(y, x)) continue;
1900 /* Hack -- no safety on glyph of warding */
1901 if (is_glyph_grid(&cave[y][x])) continue;
1902 if (is_explosive_rune_grid(&cave[y][x])) continue;
1904 /* ... nor on the Pattern */
1905 if (pattern_tile(y, x)) continue;
1907 /* Important -- Skip "quake" grids */
1908 if (map[16+y-cy][16+x-cx]) continue;
1910 if (cave[y][x].m_idx) continue;
1911 if (player_bold(y, x)) continue;
1913 /* Count "safe" grids */
1916 /* Randomize choice */
1917 if (randint0(sn) > 0) continue;
1919 /* Save the safe grid */
1924 /* Describe the monster */
1925 monster_desc(m_name, m_ptr, 0);
1927 /* Scream in pain */
1928 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1930 /* Take damage from the quake */
1931 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1933 /* Monster is certainly awake */
1934 (void)set_monster_csleep(c_ptr->m_idx, 0);
1936 /* Apply damage directly */
1937 m_ptr->hp -= damage;
1939 /* Delete (not kill) "dead" monsters */
1942 if (!ignore_unview || is_seen(m_ptr))
1943 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1947 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1951 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1952 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1957 delete_monster(yy, xx);
1959 /* No longer safe */
1963 /* Hack -- Escape from the rock */
1966 IDX m_idx_aux = cave[yy][xx].m_idx;
1968 /* Update the old location */
1969 cave[yy][xx].m_idx = 0;
1971 /* Update the new location */
1972 cave[sy][sx].m_idx = m_idx_aux;
1974 /* Move the monster */
1978 /* Update the monster (new location) */
1979 update_monster(m_idx, TRUE);
1981 /* Redraw the old grid */
1984 /* Redraw the new grid */
1992 /* Lose monster light */
1995 /* Examine the quaked region */
1996 for (dy = -r; dy <= r; dy++)
1998 for (dx = -r; dx <= r; dx++)
2000 /* Extract the location */
2004 /* Skip unaffected grids */
2005 if (!map[16+yy-cy][16+xx-cx]) continue;
2007 /* Access the cave grid */
2008 c_ptr = &cave[yy][xx];
2010 /* Paranoia -- never affect player */
2011 /* if (player_bold(yy, xx)) continue; */
2013 /* Destroy location (if valid) */
2014 if (cave_valid_bold(yy, xx))
2016 /* Delete objects */
2017 delete_object(yy, xx);
2019 /* Wall (or floor) type */
2020 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2025 /* Create granite wall */
2026 cave_set_feat(yy, xx, feat_granite);
2032 /* Create quartz vein */
2033 cave_set_feat(yy, xx, feat_quartz_vein);
2039 /* Create magma vein */
2040 cave_set_feat(yy, xx, feat_magma_vein);
2047 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2054 /* Process "re-glowing" */
2055 for (dy = -r; dy <= r; dy++)
2057 for (dx = -r; dx <= r; dx++)
2059 /* Extract the location */
2063 /* Skip illegal grids */
2064 if (!in_bounds(yy, xx)) continue;
2066 /* Skip distant grids */
2067 if (distance(cy, cx, yy, xx) > r) continue;
2068 c_ptr = &cave[yy][xx];
2070 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2071 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2076 for (ii = 0; ii < 9; ii++)
2078 yyy = yy + ddy_ddd[ii];
2079 xxx = xx + ddx_ddd[ii];
2080 if (!in_bounds2(yyy, xxx)) continue;
2081 cc_ptr = &cave[yyy][xxx];
2082 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2084 c_ptr->info |= CAVE_GLOW;
2093 /* Mega-Hack -- Forget the view and lite */
2094 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2096 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2098 /* Update the health bar */
2099 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2101 p_ptr->redraw |= (PR_MAP);
2103 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2105 if (p_ptr->special_defense & NINJA_S_STEALTH)
2107 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2115 * @brief 地震処理(プレイヤーの中心発動) /
2116 * Induce an "earthquake" of the given radius at the given location.
2117 * @return 効力があった場合TRUEを返す
2122 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2124 return earthquake_aux(cy, cx, r, 0);
2131 void discharge_minion(void)
2136 for (i = 1; i < m_max; i++)
2138 monster_type *m_ptr = &m_list[i];
2139 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2140 if (m_ptr->nickname) okay = FALSE;
2142 if (!okay || p_ptr->riding)
2144 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2147 for (i = 1; i < m_max; i++)
2150 monster_type *m_ptr = &m_list[i];
2151 monster_race *r_ptr;
2153 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2154 r_ptr = &r_info[m_ptr->r_idx];
2156 /* Uniques resist discharging */
2157 if (r_ptr->flags1 & RF1_UNIQUE)
2160 monster_desc(m_name, m_ptr, 0x00);
2161 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2162 delete_monster_idx(i);
2165 dam = m_ptr->maxhp / 2;
2166 if (dam > 100) dam = (dam-100)/2 + 100;
2167 if (dam > 400) dam = (dam-400)/2 + 400;
2168 if (dam > 800) dam = 800;
2169 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2170 m_ptr->fx, dam, GF_PLASMA,
2171 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2173 if (record_named_pet && m_ptr->nickname)
2177 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2178 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2181 delete_monster_idx(i);
2187 * @brief 部屋全体を照らすサブルーチン
2191 * This routine clears the entire "temp" set.
2192 * This routine will Perma-Lite all "temp" grids.
2193 * This routine is used (only) by "lite_room()"
2194 * Dark grids are illuminated.
2195 * Also, process all affected monsters.
2197 * SMART monsters always wake up when illuminated
2198 * NORMAL monsters wake up 1/4 the time when illuminated
2199 * STUPID monsters wake up 1/10 the time when illuminated
2202 static void cave_temp_room_lite(void)
2206 /* Clear them all */
2207 for (i = 0; i < temp_n; i++)
2209 POSITION y = temp_y[i];
2210 POSITION x = temp_x[i];
2212 cave_type *c_ptr = &cave[y][x];
2214 /* No longer in the array */
2215 c_ptr->info &= ~(CAVE_TEMP);
2217 /* Update only non-CAVE_GLOW grids */
2218 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2221 c_ptr->info |= (CAVE_GLOW);
2223 /* Process affected monsters */
2228 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2230 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2231 update_monster(c_ptr->m_idx, FALSE);
2233 /* Stupid monsters rarely wake up */
2234 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2236 /* Smart monsters always wake up */
2237 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2239 /* Sometimes monsters wake up */
2240 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2243 (void)set_monster_csleep(c_ptr->m_idx, 0);
2245 /* Notice the "waking up" */
2250 /* Acquire the monster name */
2251 monster_desc(m_name, m_ptr, 0);
2253 /* Dump a message */
2254 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2264 update_local_illumination(y, x);
2274 * @brief 部屋全体を暗くするサブルーチン
2278 * This routine clears the entire "temp" set.
2279 * This routine will "darken" all "temp" grids.
2280 * In addition, some of these grids will be "unmarked".
2281 * This routine is used (only) by "unlite_room()"
2282 * Also, process all affected monsters
2285 static void cave_temp_room_unlite(void)
2289 /* Clear them all */
2290 for (i = 0; i < temp_n; i++)
2292 POSITION y = temp_y[i];
2293 POSITION x = temp_x[i];
2296 cave_type *c_ptr = &cave[y][x];
2297 bool do_dark = !is_mirror_grid(c_ptr);
2299 /* No longer in the array */
2300 c_ptr->info &= ~(CAVE_TEMP);
2302 /* Darken the grid */
2305 if (dun_level || !is_daytime())
2307 for (j = 0; j < 9; j++)
2309 int by = y + ddy_ddd[j];
2310 int bx = x + ddx_ddd[j];
2312 if (in_bounds2(by, bx))
2314 cave_type *cc_ptr = &cave[by][bx];
2316 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2324 if (!do_dark) continue;
2327 c_ptr->info &= ~(CAVE_GLOW);
2329 /* Hack -- Forget "boring" grids */
2330 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2332 /* Forget the grid */
2333 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2338 /* Process affected monsters */
2341 update_monster(c_ptr->m_idx, FALSE);
2346 update_local_illumination(y, x);
2356 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2359 * @param pass_bold 地形条件を返す関数ポインタ
2362 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2369 for (i = 0; i < 16; i++)
2371 y = cy + ddy_cdd[i % 8];
2372 x = cx + ddx_cdd[i % 8];
2374 /* Found a wall, break the length */
2375 if (!pass_bold(y, x))
2377 /* Track best length */
2391 return (MAX(len, blen));
2395 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2398 * @param pass_bold 地形条件を返す関数ポインタ
2401 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2407 for (i = 0; i < 8; i++)
2409 y = cy + ddy_ddd[i];
2410 x = cx + ddx_ddd[i];
2412 if (!pass_bold(y, x)) c++;
2420 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2421 * @param y 部屋内のy座標1点
2422 * @param x 部屋内のx座標1点
2423 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2424 * @param pass_bold 地形条件を返す関数ポインタ
2427 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2432 c_ptr = &cave[y][x];
2434 /* Avoid infinite recursion */
2435 if (c_ptr->info & (CAVE_TEMP)) return;
2437 /* Do not "leave" the current room */
2438 if (!(c_ptr->info & (CAVE_ROOM)))
2440 if (only_room) return;
2443 if (!in_bounds2(y, x)) return;
2445 /* Do not exceed the maximum spell range */
2446 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2448 /* Verify this grid */
2450 * The reason why it is ==6 instead of >5 is that 8 is impossible
2451 * due to the check for cave_bold above.
2452 * 7 lights dead-end corridors (you need to do this for the
2453 * checkboard interesting rooms, so that the boundary is lit
2455 * This leaves only a check for 6 bounding walls!
2457 if (in_bounds(y, x) && pass_bold(y, x) &&
2458 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2461 /* Paranoia -- verify space */
2462 if (temp_n == TEMP_MAX) return;
2464 /* Mark the grid as "seen" */
2465 c_ptr->info |= (CAVE_TEMP);
2467 /* Add it to the "seen" set */
2474 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2477 * @return 光を通すならばtrueを返す。
2479 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2481 return cave_los_bold(y, x);
2485 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2490 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2492 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2496 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2499 * @return 射線を通すならばtrueを返す。
2501 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2503 return cave_have_flag_bold(y, x, FF_PROJECT);
2508 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2513 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2515 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2520 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2525 void lite_room(POSITION y1, POSITION x1)
2530 /* Add the initial grid */
2531 cave_temp_lite_room_aux(y1, x1);
2533 /* While grids are in the queue, add their neighbors */
2534 for (i = 0; i < temp_n; i++)
2536 x = temp_x[i], y = temp_y[i];
2538 /* Walls get lit, but stop light */
2539 if (!cave_pass_lite_bold(y, x)) continue;
2541 /* Spread adjacent */
2542 cave_temp_lite_room_aux(y + 1, x);
2543 cave_temp_lite_room_aux(y - 1, x);
2544 cave_temp_lite_room_aux(y, x + 1);
2545 cave_temp_lite_room_aux(y, x - 1);
2547 /* Spread diagonal */
2548 cave_temp_lite_room_aux(y + 1, x + 1);
2549 cave_temp_lite_room_aux(y - 1, x - 1);
2550 cave_temp_lite_room_aux(y - 1, x + 1);
2551 cave_temp_lite_room_aux(y + 1, x - 1);
2554 /* Now, lite them all up at once */
2555 cave_temp_room_lite();
2557 if (p_ptr->special_defense & NINJA_S_STEALTH)
2559 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2565 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2570 void unlite_room(POSITION y1, POSITION x1)
2575 /* Add the initial grid */
2576 cave_temp_unlite_room_aux(y1, x1);
2578 /* Spread, breadth first */
2579 for (i = 0; i < temp_n; i++)
2581 x = temp_x[i], y = temp_y[i];
2583 /* Walls get dark, but stop darkness */
2584 if (!cave_pass_dark_bold(y, x)) continue;
2586 /* Spread adjacent */
2587 cave_temp_unlite_room_aux(y + 1, x);
2588 cave_temp_unlite_room_aux(y - 1, x);
2589 cave_temp_unlite_room_aux(y, x + 1);
2590 cave_temp_unlite_room_aux(y, x - 1);
2592 /* Spread diagonal */
2593 cave_temp_unlite_room_aux(y + 1, x + 1);
2594 cave_temp_unlite_room_aux(y - 1, x - 1);
2595 cave_temp_unlite_room_aux(y - 1, x + 1);
2596 cave_temp_unlite_room_aux(y + 1, x - 1);
2599 /* Now, darken them all at once */
2600 cave_temp_room_unlite();
2606 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2609 * @return 作用が実際にあった場合TRUEを返す
2611 bool lite_area(HIT_POINT dam, POSITION rad)
2613 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2615 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2617 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2621 /* Hack -- Message */
2624 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2627 /* Hook into the "project()" function */
2628 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2630 /* Lite up the room */
2631 lite_room(p_ptr->y, p_ptr->x);
2639 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2642 * @return 作用が実際にあった場合TRUEを返す
2644 bool unlite_area(HIT_POINT dam, POSITION rad)
2646 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2648 /* Hack -- Message */
2651 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2654 /* Hook into the "project()" function */
2655 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2657 /* Lite up the room */
2658 unlite_room(p_ptr->y, p_ptr->x);
2667 * @brief ボール系スペルの発動 / Cast a ball spell
2669 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2672 * @return 作用が実際にあった場合TRUEを返す
2675 * Stop if we hit a monster, act as a "ball"
2676 * Allow "target" mode to pass over monsters
2677 * Affect grids, objects, and monsters
2680 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2684 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2686 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2687 /* Use the given direction */
2688 tx = p_ptr->x + 99 * ddx[dir];
2689 ty = p_ptr->y + 99 * ddy[dir];
2691 /* Hack -- Use an actual "target" */
2692 if ((dir == 5) && target_okay())
2694 flg &= ~(PROJECT_STOP);
2699 /* Analyze the "dir" and the "target". Hurt items on floor. */
2700 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2704 * @brief ブレス系スペルの発動 / Cast a breath spell
2706 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2709 * @return 作用が実際にあった場合TRUEを返す
2712 * Stop if we hit a monster, act as a "ball"
2713 * Allow "target" mode to pass over monsters
2714 * Affect grids, objects, and monsters
2717 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2719 return fire_ball(typ, dir, dam, -rad);
2724 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2726 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2729 * @return 作用が実際にあった場合TRUEを返す
2732 * Stop if we hit a monster, act as a "ball"
2733 * Allow "target" mode to pass over monsters
2734 * Affect grids, objects, and monsters
2737 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2740 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2742 /* Use the given direction */
2743 tx = p_ptr->x + 99 * ddx[dir];
2744 ty = p_ptr->y + 99 * ddy[dir];
2746 /* Hack -- Use an actual "target" */
2747 if ((dir == 5) && target_okay())
2753 /* Analyze the "dir" and the "target". Hurt items on floor. */
2754 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2759 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2761 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2764 * @return 作用が実際にあった場合TRUEを返す
2767 * Stop if we hit a monster, act as a "ball"
2768 * Allow "target" mode to pass over monsters
2769 * Affect grids, objects, and monsters
2772 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2775 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2777 /* Use the given direction */
2778 tx = p_ptr->x + 99 * ddx[dir];
2779 ty = p_ptr->y + 99 * ddy[dir];
2781 /* Hack -- Use an actual "target" */
2782 if ((dir == 5) && target_okay())
2784 flg &= ~(PROJECT_STOP);
2789 /* Analyze the "dir" and the "target". Hurt items on floor. */
2790 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2795 * @brief メテオ系スペルの発動 / Cast a meteor spell
2796 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2802 * @return 作用が実際にあった場合TRUEを返す
2805 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2806 * player, or outside source, that starts out at an arbitrary location, and
2807 * leaving no trail from the "caster" to the target. This function is
2808 * especially useful for bombardments and similar. -LM-
2809 * Option to hurt the player.
2812 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2814 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2816 /* Analyze the "target" and the caster. */
2817 return (project(who, rad, y, x, dam, typ, flg, -1));
2822 * @brief ブラスト系スペルの発動 / Cast a blast spell
2824 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2829 * @return 作用が実際にあった場合TRUEを返す
2831 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2835 POSITION ty, tx, y, x;
2838 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2843 /* Use the given direction */
2846 ly = ty = p_ptr->y + 20 * ddy[dir];
2847 lx = tx = p_ptr->x + 20 * ddx[dir];
2850 /* Use an actual "target" */
2851 else /* if (dir == 5) */
2856 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2857 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2860 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2863 for (i = 0; i < num; i++)
2867 /* Get targets for some bolts */
2868 y = rand_spread(ly, ld * dev / 20);
2869 x = rand_spread(lx, ld * dev / 20);
2871 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2874 /* Analyze the "dir" and the "target". */
2875 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2886 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2887 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2888 * @return 作用が実際にあった場合TRUEを返す
2890 bool teleport_swap(DIRECTION dir)
2894 monster_type* m_ptr;
2895 monster_race* r_ptr;
2897 if ((dir == 5) && target_okay())
2904 tx = p_ptr->x + ddx[dir];
2905 ty = p_ptr->y + ddy[dir];
2907 c_ptr = &cave[ty][tx];
2909 if (p_ptr->anti_tele)
2911 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2915 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2917 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2923 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2925 msg_print(_("失敗した。", "Failed to swap."));
2931 m_ptr = &m_list[c_ptr->m_idx];
2932 r_ptr = &r_info[m_ptr->r_idx];
2934 (void)set_monster_csleep(c_ptr->m_idx, 0);
2936 if (r_ptr->flagsr & RFR_RES_TELE)
2938 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2940 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2946 sound(SOUND_TELEPORT);
2948 /* Swap the player and monster */
2949 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2957 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2959 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2962 * @return 作用が実際にあった場合TRUEを返す
2964 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2968 /* Pass through the target if needed */
2969 flg |= (PROJECT_THRU);
2971 /* Use the given direction */
2972 tx = p_ptr->x + ddx[dir];
2973 ty = p_ptr->y + ddy[dir];
2975 /* Hack -- Use an actual "target" */
2976 if ((dir == 5) && target_okay())
2982 /* Analyze the "dir" and the "target", do NOT explode */
2983 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2988 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2990 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2992 * @return 作用が実際にあった場合TRUEを返す
2995 * Stop if we hit a monster, as a "bolt".
2996 * Affect monsters and grids (not objects).
2999 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3001 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3002 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3003 return (project_hook(typ, dir, dam, flg));
3008 * @brief ビーム系スペルの発動 / Cast a beam spell.
3010 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3012 * @return 作用が実際にあった場合TRUEを返す
3015 * Pass through monsters, as a "beam".
3016 * Affect monsters, grids and objects.
3019 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3021 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3022 return (project_hook(typ, dir, dam, flg));
3027 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3028 * @param prob ビーム化する確率(%)
3030 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3032 * @return 作用が実際にあった場合TRUEを返す
3035 * Pass through monsters, as a "beam".
3036 * Affect monsters, grids and objects.
3039 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3041 if (randint0(100) < prob)
3043 return (fire_beam(typ, dir, dam));
3047 return (fire_bolt(typ, dir, dam));
3052 * @brief LITE_WEAK属性による光源ビーム処理
3053 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3055 * @return 作用が実際にあった場合TRUEを返す
3057 bool lite_line(DIRECTION dir, HIT_POINT dam)
3059 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3060 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3065 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3067 * @return 作用が実際にあった場合TRUEを返す
3069 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3071 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3072 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3077 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3079 * @return 作用が実際にあった場合TRUEを返す
3081 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3083 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3084 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3089 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3090 * @return 作用が実際にあった場合TRUEを返す
3092 bool wizard_lock(DIRECTION dir)
3094 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3095 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3100 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3101 * @return 作用が実際にあった場合TRUEを返す
3103 bool destroy_door(DIRECTION dir)
3105 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3106 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3111 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3112 * @return 作用が実際にあった場合TRUEを返す
3114 bool disarm_trap(DIRECTION dir)
3116 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3117 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3122 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3124 * @return 作用が実際にあった場合TRUEを返す
3126 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3128 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3129 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3134 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3136 * @return 作用が実際にあった場合TRUEを返す
3138 bool speed_monster(DIRECTION dir, int power)
3140 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3141 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3146 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3148 * @return 作用が実際にあった場合TRUEを返す
3150 bool slow_monster(DIRECTION dir, int power)
3152 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3153 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3158 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3160 * @return 作用が実際にあった場合TRUEを返す
3162 bool sleep_monster(DIRECTION dir, int power)
3164 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3165 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3169 * @brief モンスター拘束(STASIS)処理
3170 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3171 * @return 作用が実際にあった場合TRUEを返す
3172 * @details 威力はプレイヤーレベル*2に固定
3174 bool stasis_monster(DIRECTION dir)
3176 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3180 * @brief 邪悪なモンスター拘束(STASIS)処理
3181 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3182 * @return 作用が実際にあった場合TRUEを返す
3183 * @details 威力はプレイヤーレベル*2に固定
3185 bool stasis_evil(DIRECTION dir)
3187 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3192 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3193 * @param plev プレイヤーレベル(=効力)
3194 * @return 作用が実際にあった場合TRUEを返す
3196 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3198 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3199 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3204 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3205 * @param plev プレイヤーレベル(=効力)
3206 * @return 作用が実際にあった場合TRUEを返す
3208 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3210 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3211 return (project_hook(GF_STUN, dir, plev, flg));
3215 * @brief チェンジモンスター処理
3216 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3218 * @return 作用が実際にあった場合TRUEを返す
3220 bool poly_monster(DIRECTION dir, int power)
3222 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3223 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3225 chg_virtue(V_CHANCE, 1);
3230 * @brief クローンモンスター処理
3231 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3232 * @return 作用が実際にあった場合TRUEを返す
3234 bool clone_monster(DIRECTION dir)
3236 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3237 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3242 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3243 * @param plev プレイヤーレベル(=効力)
3244 * @return 作用が実際にあった場合TRUEを返す
3246 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3248 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3249 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3254 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3255 * @param plev プレイヤーレベル(効力はplev*200)
3256 * @return 作用が実際にあった場合TRUEを返す
3258 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3260 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3261 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3265 * @brief モンスター用テレポート処理
3266 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3267 * @param distance 移動距離
3268 * @return 作用が実際にあった場合TRUEを返す
3270 bool teleport_monster(DIRECTION dir, int distance)
3272 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3273 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3277 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3278 * @return 作用が実際にあった場合TRUEを返す
3280 bool door_creation(void)
3282 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3283 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3287 * @brief トラップ生成処理(起点から周囲1マス)
3290 * @return 作用が実際にあった場合TRUEを返す
3292 bool trap_creation(POSITION y, POSITION x)
3294 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3295 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3299 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3300 * @return 作用が実際にあった場合TRUEを返す
3302 bool tree_creation(void)
3304 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3305 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3309 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3310 * @return 作用が実際にあった場合TRUEを返す
3312 bool glyph_creation(void)
3314 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3315 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3319 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3320 * @return 作用が実際にあった場合TRUEを返す
3322 bool wall_stone(void)
3324 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3326 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3328 p_ptr->update |= (PU_FLOW);
3330 p_ptr->redraw |= (PR_MAP);
3336 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3337 * @return 作用が実際にあった場合TRUEを返す
3339 bool destroy_doors_touch(void)
3341 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3342 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3346 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3347 * @return 作用が実際にあった場合TRUEを返す
3349 bool disarm_traps_touch(void)
3351 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3352 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3356 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3357 * @return 作用が実際にあった場合TRUEを返す
3359 bool sleep_monsters_touch(void)
3361 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3362 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3367 * @brief 死者復活処理(起点より周囲5マス)
3368 * @param who 術者モンスターID(0ならばプレイヤー)
3371 * @return 作用が実際にあった場合TRUEを返す
3373 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3375 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3376 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3381 * @return 作用が実際にあった場合TRUEを返す
3383 void call_chaos(void)
3385 int Chaos_type, dummy, dir;
3386 PLAYER_LEVEL plev = p_ptr->lev;
3387 bool line_chaos = FALSE;
3389 int hurt_types[31] =
3391 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3392 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3393 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3394 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3395 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3396 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3397 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3398 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3401 Chaos_type = hurt_types[randint0(31)];
3402 if (one_in_(4)) line_chaos = TRUE;
3406 for (dummy = 1; dummy < 10; dummy++)
3411 fire_beam(Chaos_type, dummy, 150);
3413 fire_ball(Chaos_type, dummy, 150, 2);
3417 else if (one_in_(3))
3419 fire_ball(Chaos_type, 0, 500, 8);
3423 if (!get_aim_dir(&dir)) return;
3425 fire_beam(Chaos_type, dir, 250);
3427 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3432 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3433 * @param stop_ty 再帰処理停止フラグ
3435 * @return 作用が実際にあった場合TRUEを返す
3438 * rr9: Stop the nasty things when a Cyberdemon is summoned
3439 * or the player gets paralyzed.
3442 bool activate_ty_curse(bool stop_ty, int *count)
3446 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3450 switch (randint1(34))
3455 msg_print(_("地面が揺れた...", "The ground trembles..."));
3456 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3457 if (!one_in_(6)) break;
3462 HIT_POINT dam = damroll(10, 10);
3463 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3464 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3465 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3466 if (!one_in_(6)) break;
3471 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3472 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3473 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3474 if (!one_in_(6)) break;
3477 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3481 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3482 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3484 if (!one_in_(6)) break;
3485 case 1: case 2: case 3: case 16: case 17:
3486 aggravate_monsters(0);
3487 if (!one_in_(6)) break;
3488 case 4: case 5: case 6:
3489 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3490 if (!one_in_(6)) break;
3491 case 7: case 8: case 9: case 18:
3492 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3493 if (!one_in_(6)) break;
3494 case 10: case 11: case 12:
3495 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3496 lose_exp(p_ptr->exp / 16);
3497 if (!one_in_(6)) break;
3498 case 13: case 14: case 15: case 19: case 20:
3499 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3505 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3506 if (p_ptr->free_act)
3507 set_paralyzed(p_ptr->paralyzed + randint1(3));
3509 set_paralyzed(p_ptr->paralyzed + randint1(13));
3512 if (!one_in_(6)) break;
3513 case 21: case 22: case 23:
3514 (void)do_dec_stat(randint0(6));
3515 if (!one_in_(6)) break;
3517 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3519 if (!one_in_(6)) break;
3522 * Only summon Cyberdemons deep in the dungeon.
3524 if ((dun_level > 65) && !stop_ty)
3526 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3530 if (!one_in_(6)) break;
3536 (void)do_dec_stat(i);
3544 while (one_in_(3) && !stop_ty);
3550 * @brief HI_SUMMON(上級召喚)処理発動
3553 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3554 * @return 作用が実際にあった場合TRUEを返す
3556 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3561 BIT_FLAGS mode = PM_ALLOW_GROUP;
3568 mode |= PM_FORCE_FRIENDLY;
3572 mode |= PM_FORCE_PET;
3577 if (!pet) mode |= PM_NO_PET;
3579 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3581 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3583 switch (randint1(25) + (dun_level / 20))
3586 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3589 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3592 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3595 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3598 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3601 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3604 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3607 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3611 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3615 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3618 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3619 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3622 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3623 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3626 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3629 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3630 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3639 * @brief サイバーデーモンの召喚
3640 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3643 * @return 作用が実際にあった場合TRUEを返す
3645 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3648 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3650 BIT_FLAGS mode = PM_ALLOW_GROUP;
3652 /* Summoned by a monster */
3655 monster_type *m_ptr = &m_list[who];
3656 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3659 if (max_cyber > 4) max_cyber = 4;
3661 for (i = 0; i < max_cyber; i++)
3663 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3670 * @brief 周辺破壊効果(プレイヤー中心)
3671 * @return 作用が実際にあった場合TRUEを返す
3673 void wall_breaker(void)
3676 POSITION y = 0, x = 0;
3677 int attempts = 1000;
3679 if (randint1(80 + p_ptr->lev) < 70)
3683 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3685 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3687 if (!player_bold(y, x)) break;
3690 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3691 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3693 else if (randint1(100) > 30)
3695 earthquake(p_ptr->y, p_ptr->x, 1);
3699 int num = damroll(5, 3);
3701 for (i = 0; i < num; i++)
3705 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3707 if (!player_bold(y, x)) break;
3710 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3711 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3718 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3720 * @return 作用が実際にあった場合TRUEを返す
3722 bool confuse_monsters(HIT_POINT dam)
3724 return (project_hack(GF_OLD_CONF, dam));
3729 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3731 * @return 作用が実際にあった場合TRUEを返す
3733 bool charm_monsters(HIT_POINT dam)
3735 return (project_hack(GF_CHARM, dam));
3740 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3742 * @return 作用が実際にあった場合TRUEを返す
3744 bool charm_animals(HIT_POINT dam)
3746 return (project_hack(GF_CONTROL_ANIMAL, dam));
3751 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3753 * @return 作用が実際にあった場合TRUEを返す
3755 bool stun_monsters(HIT_POINT dam)
3757 return (project_hack(GF_STUN, dam));
3762 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3764 * @return 作用が実際にあった場合TRUEを返す
3766 bool stasis_monsters(HIT_POINT dam)
3768 return (project_hack(GF_STASIS, dam));
3773 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3775 * @return 作用が実際にあった場合TRUEを返す
3777 bool mindblast_monsters(HIT_POINT dam)
3779 return (project_hack(GF_PSI, dam));
3784 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3785 * @param dist 効力(距離)
3786 * @return 作用が実際にあった場合TRUEを返す
3788 bool banish_monsters(int dist)
3790 return (project_hack(GF_AWAY_ALL, dist));
3795 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3797 * @return 作用が実際にあった場合TRUEを返す
3799 bool turn_evil(HIT_POINT dam)
3801 return (project_hack(GF_TURN_EVIL, dam));
3806 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3808 * @return 作用が実際にあった場合TRUEを返す
3810 bool turn_monsters(HIT_POINT dam)
3812 return (project_hack(GF_TURN_ALL, dam));
3817 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3818 * @return 作用が実際にあった場合TRUEを返す
3820 bool deathray_monsters(void)
3822 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3826 * @brief チャーム・モンスター(1体)
3827 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3829 * @return 作用が実際にあった場合TRUEを返す
3831 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3833 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3834 return (project_hook(GF_CHARM, dir, plev, flg));
3838 * @brief アンデッド支配(1体)
3839 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3841 * @return 作用が実際にあった場合TRUEを返す
3843 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3845 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3846 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3851 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3853 * @return 作用が実際にあった場合TRUEを返す
3855 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3857 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3858 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3863 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3865 * @return 作用が実際にあった場合TRUEを返す
3867 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3869 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3870 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3876 * @param success 判定成功上の処理ならばTRUE
3877 * @return 作用が実際にあった場合TRUEを返す
3879 bool kawarimi(bool success)
3882 object_type *q_ptr = &forge;
3885 if (p_ptr->is_dead) return FALSE;
3886 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3887 if (randint0(200) < p_ptr->stun) return FALSE;
3889 if (!success && one_in_(3))
3891 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3892 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3893 p_ptr->redraw |= (PR_STATUS);
3900 teleport_player(10 + randint1(90), 0L);
3904 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3906 q_ptr->pval = MON_NINJA;
3908 /* Drop it in the dungeon */
3909 (void)drop_near(q_ptr, -1, y, x);
3912 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3913 else msg_print("失敗!攻撃を受けてしまった。");
3915 if (success) msg_print("You have turned around just before the attack hit you.");
3916 else msg_print("Failed! You are hit by the attack.");
3919 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3920 p_ptr->redraw |= (PR_STATUS);
3928 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3929 * @param mdeath 目標モンスターが死亡したかを返す
3930 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3932 bool rush_attack(bool *mdeath)
3939 bool tmp_mdeath = FALSE;
3942 if (mdeath) *mdeath = FALSE;
3945 if (!get_aim_dir(&dir)) return FALSE;
3947 /* Use the given direction */
3948 tx = p_ptr->x + project_length * ddx[dir];
3949 ty = p_ptr->y + project_length * ddy[dir];
3951 /* Hack -- Use an actual "target" */
3952 if ((dir == 5) && target_okay())
3958 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3960 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3963 /* No need to move */
3964 if (!path_n) return TRUE;
3966 /* Use ty and tx as to-move point */
3970 /* Project along the path */
3971 for (i = 0; i < path_n; i++)
3973 monster_type *m_ptr;
3975 int ny = GRID_Y(path_g[i]);
3976 int nx = GRID_X(path_g[i]);
3978 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3983 /* Go to next grid */
3987 if (!cave[ny][nx].m_idx)
3991 msg_print(_("失敗!", "Failed!"));
3995 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4002 /* Move player before updating the monster */
4003 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4004 update_monster(cave[ny][nx].m_idx, TRUE);
4006 /* Found a monster */
4007 m_ptr = &m_list[cave[ny][nx].m_idx];
4009 if (tm_idx != cave[ny][nx].m_idx)
4012 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4013 m_ptr->ml ? "モンスター" : "何か");
4015 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4018 else if (!player_bold(ty, tx))
4020 /* Hold the monster name */
4023 /* Get the monster name (BEFORE polymorphing) */
4024 monster_desc(m_name, m_ptr, 0);
4025 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4028 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4030 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4035 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4037 if (mdeath) *mdeath = tmp_mdeath;
4043 * @brief 全鏡の消去 / Remove all mirrors in this floor
4044 * @param explode 爆発処理を伴うならばTRUE
4047 void remove_all_mirrors(bool explode)
4051 for (x = 0; x < cur_wid; x++)
4053 for (y = 0; y < cur_hgt; y++)
4055 if (is_mirror_grid(&cave[y][x]))
4057 remove_mirror(y, x);
4059 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4060 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4067 * @brief 『一つの指輪』の効果処理 /
4068 * Hack -- activate the ring of power
4069 * @param dir 発動の方向ID
4072 void ring_of_power(DIRECTION dir)
4074 /* Pick a random effect */
4075 switch (randint1(10))
4080 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4083 /* Decrease all stats (permanently) */
4084 (void)dec_stat(A_STR, 50, TRUE);
4085 (void)dec_stat(A_INT, 50, TRUE);
4086 (void)dec_stat(A_WIS, 50, TRUE);
4087 (void)dec_stat(A_DEX, 50, TRUE);
4088 (void)dec_stat(A_CON, 50, TRUE);
4089 (void)dec_stat(A_CHR, 50, TRUE);
4091 /* Lose some experience (permanently) */
4092 p_ptr->exp -= (p_ptr->exp / 4);
4093 p_ptr->max_exp -= (p_ptr->exp / 4);
4101 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4103 /* Dispel monsters */
4104 dispel_monsters(1000);
4114 fire_ball(GF_MANA, dir, 600, 3);
4125 fire_bolt(GF_MANA, dir, 500);
4133 * @brief 運命の輪、並びにカオス的な効果の発動
4134 * @param spell ランダムな効果を選択するための基準ID
4137 void wild_magic(int spell)
4140 int type = SUMMON_MOLD + randint0(6);
4142 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4143 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4145 switch (randint1(spell) + randint1(8) + 1)
4150 teleport_player(10, TELEPORT_PASSIVE);
4155 teleport_player(100, TELEPORT_PASSIVE);
4159 teleport_player(200, TELEPORT_PASSIVE);
4169 lite_area(damroll(2, 3), 2);
4172 destroy_doors_touch();
4177 sleep_monsters_touch();
4181 trap_creation(p_ptr->y, p_ptr->x);
4190 aggravate_monsters(0);
4193 earthquake(p_ptr->y, p_ptr->x, 5);
4197 (void)gain_random_mutation(0);
4201 apply_disenchant(1);
4207 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4214 while (counter++ < 8)
4216 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4221 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4224 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4229 (void)activate_ty_curse(FALSE, &count);
4238 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4239 * / Drop 10+1d10 meteor ball at random places near the player
4244 void cast_meteor(HIT_POINT dam, POSITION rad)
4247 int b = 10 + randint1(10);
4249 for (i = 0; i < b; i++)
4251 POSITION y = 0, x = 0;
4254 for (count = 0; count <= 20; count++)
4258 x = p_ptr->x - 8 + randint0(17);
4259 y = p_ptr->y - 8 + randint0(17);
4261 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4262 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4264 /* Approximate distance */
4265 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4267 if (d >= 9) continue;
4269 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4270 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4272 /* Valid position */
4276 if (count > 20) continue;
4278 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4284 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4287 * @return ターゲットを指定し、実行したならばTRUEを返す。
4289 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4291 POSITION x, y, tx, ty;
4295 int b = 10 + randint1(10);
4297 if (!get_aim_dir(&dir)) return FALSE;
4299 /* Use the given direction */
4300 tx = p_ptr->x + 99 * ddx[dir];
4301 ty = p_ptr->y + 99 * ddy[dir];
4303 /* Hack -- Use an actual "target" */
4304 if ((dir == 5) && target_okay())
4315 /* Hack -- Stop at the target */
4316 if ((y == ty) && (x == tx)) break;
4320 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4322 /* Stop at maximum range */
4323 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4325 /* Stopped by walls/doors */
4326 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4328 /* Stopped by monsters */
4329 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4331 /* Save the new location */
4338 for (i = 0; i < b; i++)
4340 int count = 20, d = 0;
4346 x = tx - 5 + randint0(11);
4347 y = ty - 5 + randint0(11);
4349 dx = (tx > x) ? (tx - x) : (x - tx);
4350 dy = (ty > y) ? (ty - y) : (y - ty);
4352 /* Approximate distance */
4353 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4354 /* Within the radius */
4358 if (count < 0) continue;
4360 /* Cannot penetrate perm walls */
4361 if (!in_bounds(y, x) ||
4362 cave_stop_disintegration(y, x) ||
4363 !in_disintegration_range(ty, tx, y, x))
4366 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4373 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4377 * This spell should become more useful (more controlled) as the\n
4378 * player gains experience levels. Thus, add 1/5 of the player's\n
4379 * level to the die roll. This eliminates the worst effects later on,\n
4380 * while keeping the results quite random. It also allows some potent\n
4381 * effects only at high level.
4383 void cast_wonder(DIRECTION dir)
4385 PLAYER_LEVEL plev = p_ptr->lev;
4386 int die = randint1(100) + plev / 5;
4387 int vir = virtue_number(V_CHANCE);
4391 if (p_ptr->virtues[vir - 1] > 0)
4393 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4397 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4402 chg_virtue(V_CHANCE, 1);
4406 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4409 if (die < 8) clone_monster(dir);
4410 else if (die < 14) speed_monster(dir, plev);
4411 else if (die < 26) heal_monster(dir, damroll(4, 6));
4412 else if (die < 31) poly_monster(dir, plev);
4414 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4415 damroll(3 + ((plev - 1) / 5), 4));
4416 else if (die < 41) confuse_monster(dir, plev);
4417 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4418 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4420 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4421 damroll(3 + ((plev - 5) / 4), 8));
4423 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4424 damroll(5 + ((plev - 5) / 4), 8));
4426 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4427 damroll(6 + ((plev - 5) / 4), 8));
4429 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4430 damroll(8 + ((plev - 5) / 4), 8));
4431 else if (die < 76) hypodynamic_bolt(dir, 75);
4432 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4433 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4434 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4435 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4436 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4439 earthquake(p_ptr->y, p_ptr->x, 12);
4443 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4447 symbol_genocide(plev + 50, TRUE);
4449 else if (die < 110) dispel_monsters(120);
4452 dispel_monsters(150);
4453 slow_monsters(plev);
4454 sleep_monsters(plev);
4461 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4465 void cast_invoke_spirits(DIRECTION dir)
4467 PLAYER_LEVEL plev = p_ptr->lev;
4468 int die = randint1(100) + plev / 5;
4469 int vir = virtue_number(V_CHANCE);
4473 if (p_ptr->virtues[vir - 1] > 0)
4475 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4479 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4483 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4485 chg_virtue(V_CHANCE, 1);
4489 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4494 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4495 "Oh no! Mouldering forms rise from the earth around you!"));
4497 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4498 chg_virtue(V_UNLIFE, 1);
4502 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4504 set_afraid(p_ptr->afraid + randint1(4) + 4);
4508 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4509 "Your head is invaded by a horde of gibbering spectral voices..."));
4511 set_confused(p_ptr->confused + randint1(4) + 4);
4515 poly_monster(dir, plev);
4519 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4520 damroll(3 + ((plev - 1) / 5), 4));
4524 confuse_monster(dir, plev);
4528 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4532 (void)lite_line(dir, damroll(6, 8));
4536 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4537 damroll(3 + ((plev - 5) / 4), 8));
4541 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4542 damroll(5 + ((plev - 5) / 4), 8));
4546 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4547 damroll(6 + ((plev - 5) / 4), 8));
4551 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4552 damroll(8 + ((plev - 5) / 4), 8));
4556 hypodynamic_bolt(dir, 75);
4560 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4564 fire_ball(GF_ACID, dir, 40 + plev, 2);
4568 fire_ball(GF_ICE, dir, 70 + plev, 3);
4572 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4576 hypodynamic_bolt(dir, 100 + plev);
4580 earthquake(p_ptr->y, p_ptr->x, 12);
4584 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4588 symbol_genocide(plev + 50, TRUE);
4592 dispel_monsters(120);
4596 dispel_monsters(150);
4597 slow_monsters(plev);
4598 sleep_monsters(plev);
4604 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4605 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4610 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4613 void cast_shuffle(void)
4615 PLAYER_LEVEL plev = p_ptr->lev;
4618 int vir = virtue_number(V_CHANCE);
4621 /* Card sharks and high mages get a level bonus */
4622 if ((p_ptr->pclass == CLASS_ROGUE) ||
4623 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4624 (p_ptr->pclass == CLASS_SORCERER))
4625 die = (randint1(110)) + plev / 5;
4627 die = randint1(120);
4632 if (p_ptr->virtues[vir - 1] > 0)
4634 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4638 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4642 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4645 chg_virtue(V_CHANCE, 1);
4649 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4651 for (i = 0; i < randint1(3); i++)
4652 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4656 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4657 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4662 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4663 activate_ty_curse(FALSE, &count);
4667 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4668 aggravate_monsters(0);
4672 msg_print(_("《愚者》だ。", "It's the Fool."));
4678 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4679 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4683 msg_print(_("《月》だ。", "It's the Moon."));
4688 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4689 wild_magic(randint0(32));
4693 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4694 teleport_player(10, TELEPORT_PASSIVE);
4698 msg_print(_("《正義》だ。", "It's Justice."));
4699 set_blessed(p_ptr->lev, FALSE);
4703 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4704 teleport_player(100, TELEPORT_PASSIVE);
4708 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4709 teleport_player(200, TELEPORT_PASSIVE);
4713 msg_print(_("《塔》だ。", "It's the Tower."));
4718 msg_print(_("《節制》だ。", "It's Temperance."));
4719 sleep_monsters_touch();
4723 msg_print(_("《塔》だ。", "It's the Tower."));
4725 earthquake(p_ptr->y, p_ptr->x, 5);
4729 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4730 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4734 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4735 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4739 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4740 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4744 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4745 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4749 msg_print(_("《恋人》だ。", "It's the Lovers."));
4751 if (get_aim_dir(&dir))
4752 charm_monster(dir, MIN(p_ptr->lev, 20));
4756 msg_print(_("《隠者》だ。", "It's the Hermit."));
4761 msg_print(_("《審判》だ。", "It's the Judgement."));
4762 do_cmd_rerate(FALSE);
4763 lose_all_mutations();
4767 msg_print(_("《太陽》だ。", "It's the Sun."));
4768 chg_virtue(V_KNOWLEDGE, 1);
4769 chg_virtue(V_ENLIGHTEN, 1);
4774 msg_print(_("《世界》だ。", "It's the World."));
4775 if (p_ptr->exp < PY_MAX_EXP)
4777 s32b ee = (p_ptr->exp / 25) + 1;
4778 if (ee > 5000) ee = 5000;
4779 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4785 bool_hack life_stream(bool_hack message, bool_hack virtue)
4789 chg_virtue(V_VITALITY, 1);
4790 chg_virtue(V_UNLIFE, -5);
4794 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4797 (void)set_poisoned(0);
4799 (void)set_confused(0);
4803 (void)restore_all_status();
4804 (void)set_shero(0, TRUE);
4811 bool_hack heroism(int base)
4813 bool_hack ident = FALSE;
4814 if(set_afraid(0)) ident = TRUE;
4815 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4816 if(hp_player(10)) ident = TRUE;
4820 bool_hack berserk(int base)
4822 bool_hack ident = FALSE;
4823 if (set_afraid(0)) ident = TRUE;
4824 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4825 if (hp_player(30)) ident = TRUE;
4829 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4831 bool_hack ident = FALSE;
4832 if (hp_player(damroll(dice, sides))) ident = TRUE;
4833 if (set_blind(0)) ident = TRUE;
4834 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4835 if (set_shero(0, TRUE)) ident = TRUE;
4839 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4841 bool_hack ident = FALSE;
4842 if (hp_player(damroll(dice, sides))) ident = TRUE;
4843 if (set_blind(0)) ident = TRUE;
4844 if (set_confused(0)) ident = TRUE;
4845 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4846 if (set_shero(0, TRUE)) ident = TRUE;
4850 bool_hack cure_critical_wounds(HIT_POINT pow)
4852 bool_hack ident = FALSE;
4853 if (hp_player(pow)) ident = TRUE;
4854 if (set_blind(0)) ident = TRUE;
4855 if (set_confused(0)) ident = TRUE;
4856 if (set_poisoned(0)) ident = TRUE;
4857 if (set_stun(0)) ident = TRUE;
4858 if (set_cut(0)) ident = TRUE;
4859 if (set_shero(0, TRUE)) ident = TRUE;
4863 bool_hack true_healing(HIT_POINT pow)
4865 bool_hack ident = FALSE;
4866 if (hp_player(pow)) ident = TRUE;
4867 if (set_blind(0)) ident = TRUE;
4868 if (set_confused(0)) ident = TRUE;
4869 if (set_poisoned(0)) ident = TRUE;
4870 if (set_stun(0)) ident = TRUE;
4871 if (set_cut(0)) ident = TRUE;
4872 if (set_image(0)) ident = TRUE;
4876 bool_hack restore_mana(bool_hack magic_eater)
4878 bool_hack ident = FALSE;
4880 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4883 for (i = 0; i < EATER_EXT * 2; i++)
4885 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4886 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;
4888 for (; i < EATER_EXT * 3; i++)
4890 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4891 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;
4892 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4894 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4895 p_ptr->window |= (PW_PLAYER);
4898 else if (p_ptr->csp < p_ptr->msp)
4900 p_ptr->csp = p_ptr->msp;
4901 p_ptr->csp_frac = 0;
4902 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4903 p_ptr->redraw |= (PR_MANA);
4904 p_ptr->window |= (PW_PLAYER);
4905 p_ptr->window |= (PW_SPELL);
4912 bool restore_all_status(void)
4915 if (do_res_stat(A_STR)) ident = TRUE;
4916 if (do_res_stat(A_INT)) ident = TRUE;
4917 if (do_res_stat(A_WIS)) ident = TRUE;
4918 if (do_res_stat(A_DEX)) ident = TRUE;
4919 if (do_res_stat(A_CON)) ident = TRUE;
4920 if (do_res_stat(A_CHR)) ident = TRUE;
4925 * @brief 口を使う継続的な処理を中断する
4928 void stop_mouth(void)
4930 if (music_singing_any()) stop_singing();
4931 if (hex_spelling_any()) stop_hex_spell_all();
4935 bool_hack vampirism(void)
4942 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4944 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4948 /* Only works on adjacent monsters */
4949 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4950 y = p_ptr->y + ddy[dir];
4951 x = p_ptr->x + ddx[dir];
4952 c_ptr = &cave[y][x];
4956 if (!(c_ptr->m_idx))
4958 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4962 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4964 dummy = p_ptr->lev * 2;
4966 if (hypodynamic_bolt(dir, dummy))
4968 if (p_ptr->food < PY_FOOD_FULL)
4969 /* No heal if we are "full" */
4970 (void)hp_player(dummy);
4972 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4974 /* Gain nutritional sustenance: 150/hp drained */
4975 /* A Food ration gives 5000 food points (by contrast) */
4976 /* Don't ever get more than "Full" this way */
4977 /* But if we ARE Gorged, it won't cure us */
4978 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4979 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4980 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4983 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4987 bool panic_hit(void)
4992 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4993 y = p_ptr->y + ddy[dir];
4994 x = p_ptr->x + ddx[dir];
4995 if (cave[y][x].m_idx)
4998 if (randint0(p_ptr->skill_dis) < 7)
4999 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5001 teleport_player(30, 0L);
5006 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5014 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5017 * currently this function allows pseudo-id of any object,
5018 * including silly ones like potions & scrolls, which always
5019 * get '{average}'. This should be changed, either to stop such
5020 * items from being pseudo-id'd, or to allow psychometry to
5021 * detect whether the unidentified potion/scroll/etc is
5022 * good (Cure Light Wounds, Restore Strength, etc) or
5023 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5025 bool psychometry(void)
5029 char o_name[MAX_NLEN];
5034 item_tester_no_ryoute = TRUE;
5035 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5036 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5038 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5040 /* Get the item (in the pack) */
5043 o_ptr = &inventory[item];
5046 /* Get the item (on the floor) */
5049 o_ptr = &o_list[0 - item];
5052 /* It is fully known, no information needed */
5053 if (object_is_known(o_ptr))
5055 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5059 /* Check for a feeling */
5060 feel = value_check_aux1(o_ptr);
5062 /* Get an object description */
5063 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5065 /* Skip non-feelings */
5068 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5073 msg_format("%sは%sという感じがする...",
5074 o_name, game_inscriptions[feel]);
5076 msg_format("You feel that the %s %s %s...",
5077 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5078 game_inscriptions[feel]);
5082 /* We have "felt" it */
5083 o_ptr->ident |= (IDENT_SENSE);
5086 o_ptr->feeling = feel;
5088 /* Player touches it */
5089 o_ptr->marked |= OM_TOUCHED;
5091 /* Combine / Reorder the pack (later) */
5092 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5094 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5096 /* Valid "tval" codes */
5097 switch (o_ptr->tval)
5125 /* Auto-inscription/destroy */
5126 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5128 /* Something happened */