3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
20 * @brief プレイヤー周辺の地形を感知する
23 * @param known 地形から危険フラグを外すならTRUE
24 * @return 効力があった場合TRUEを返す
26 static bool detect_feat_flag(POSITION range, int flag, bool known)
32 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
34 /* Scan the current panel */
35 for (y = 1; y < cur_hgt - 1; y++)
37 for (x = 1; x <= cur_wid - 1; x++)
39 int dist = distance(p_ptr->y, p_ptr->x, y, x);
40 if (dist > range) continue;
46 /* Mark as detected */
47 if (dist <= range && known)
49 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
51 c_ptr->info &= ~(CAVE_UNSAFE);
58 if (cave_have_flag_grid(c_ptr, flag))
63 /* Hack -- Memorize */
64 c_ptr->info |= (CAVE_MARK);
77 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
79 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
80 * @return 効力があった場合TRUEを返す
82 bool detect_traps(POSITION range, bool known)
84 bool detect = detect_feat_flag(range, FF_TRAP, known);
86 if (known) p_ptr->dtrap = TRUE;
88 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
91 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
98 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
100 * @return 効力があった場合TRUEを返す
102 bool detect_doors(POSITION range)
104 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
106 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
109 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
116 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
118 * @return 効力があった場合TRUEを返す
120 bool detect_stairs(POSITION range)
122 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
124 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
127 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
134 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
136 * @return 効力があった場合TRUEを返す
138 bool detect_treasure(POSITION range)
140 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
142 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
145 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
152 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
154 * @return 効力があった場合TRUEを返す
156 bool detect_objects_gold(POSITION range)
159 POSITION range2 = range;
163 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
166 for (i = 1; i < o_max; i++)
168 object_type *o_ptr = &o_list[i];
170 /* Skip dead objects */
171 if (!o_ptr->k_idx) continue;
173 /* Skip held objects */
174 if (o_ptr->held_m_idx) continue;
179 /* Only detect nearby objects */
180 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
182 /* Detect "gold" objects */
183 if (o_ptr->tval == TV_GOLD)
185 o_ptr->marked |= OM_FOUND;
191 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
194 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
197 if (detect_monsters_string(range, "$"))
206 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
208 * @return 効力があった場合TRUEを返す
210 bool detect_objects_normal(POSITION range)
213 POSITION range2 = range;
217 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
220 for (i = 1; i < o_max; i++)
222 object_type *o_ptr = &o_list[i];
224 /* Skip dead objects */
225 if (!o_ptr->k_idx) continue;
227 /* Skip held objects */
228 if (o_ptr->held_m_idx) continue;
233 /* Only detect nearby objects */
234 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
236 /* Detect "real" objects */
237 if (o_ptr->tval != TV_GOLD)
239 o_ptr->marked |= OM_FOUND;
245 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
248 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
251 if (detect_monsters_string(range, "!=?|/`"))
260 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
262 * @return 効力があった場合TRUEを返す
265 * This will light up all spaces with "magic" items, including artifacts,
266 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
267 * and "enchanted" items of the "good" variety.
269 * It can probably be argued that this function is now too powerful.
272 bool detect_objects_magic(POSITION range)
278 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
280 /* Scan all objects */
281 for (i = 1; i < o_max; i++)
283 object_type *o_ptr = &o_list[i];
285 /* Skip dead objects */
286 if (!o_ptr->k_idx) continue;
288 /* Skip held objects */
289 if (o_ptr->held_m_idx) continue;
294 /* Only detect nearby objects */
295 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
297 /* Examine the tval */
300 /* Artifacts, misc magic items, or enchanted wearables */
301 if (object_is_artifact(o_ptr) ||
302 object_is_ego(o_ptr) ||
303 (tv == TV_WHISTLE) ||
311 (tv == TV_LIFE_BOOK) ||
312 (tv == TV_SORCERY_BOOK) ||
313 (tv == TV_NATURE_BOOK) ||
314 (tv == TV_CHAOS_BOOK) ||
315 (tv == TV_DEATH_BOOK) ||
316 (tv == TV_TRUMP_BOOK) ||
317 (tv == TV_ARCANE_BOOK) ||
318 (tv == TV_CRAFT_BOOK) ||
319 (tv == TV_DAEMON_BOOK) ||
320 (tv == TV_CRUSADE_BOOK) ||
321 (tv == TV_MUSIC_BOOK) ||
322 (tv == TV_HISSATSU_BOOK) ||
323 (tv == TV_HEX_BOOK) ||
324 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
326 /* Memorize the item */
327 o_ptr->marked |= OM_FOUND;
334 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
343 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
345 * @return 効力があった場合TRUEを返す
347 bool detect_monsters_normal(POSITION range)
354 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
357 for (i = 1; i < m_max; i++)
359 monster_type *m_ptr = &m_list[i];
360 monster_race *r_ptr = &r_info[m_ptr->r_idx];
362 /* Skip dead monsters */
363 if (!m_ptr->r_idx) continue;
368 /* Only detect nearby monsters */
369 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
371 /* Detect all non-invisible monsters */
372 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
374 /* Repair visibility later */
375 repair_monsters = TRUE;
377 /* Hack -- Detect monster */
378 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
379 update_monster(i, FALSE);
384 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
387 /* Describe result */
388 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
395 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
397 * @return 効力があった場合TRUEを返す
399 bool detect_monsters_invis(POSITION range)
405 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
408 for (i = 1; i < m_max; i++)
410 monster_type *m_ptr = &m_list[i];
411 monster_race *r_ptr = &r_info[m_ptr->r_idx];
413 /* Skip dead monsters */
414 if (!m_ptr->r_idx) continue;
419 /* Only detect nearby monsters */
420 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
422 /* Detect invisible monsters */
423 if (r_ptr->flags2 & RF2_INVISIBLE)
425 /* Update monster recall window */
426 if (p_ptr->monster_race_idx == m_ptr->r_idx)
428 p_ptr->window |= (PW_MONSTER);
431 /* Repair visibility later */
432 repair_monsters = TRUE;
434 /* Hack -- Detect monster */
435 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
436 update_monster(i, FALSE);
441 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
444 /* Describe result */
445 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
451 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
453 * @return 効力があった場合TRUEを返す
455 bool detect_monsters_evil(POSITION range)
461 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
464 for (i = 1; i < m_max; i++)
466 monster_type *m_ptr = &m_list[i];
467 monster_race *r_ptr = &r_info[m_ptr->r_idx];
469 /* Skip dead monsters */
470 if (!m_ptr->r_idx) continue;
475 /* Only detect nearby monsters */
476 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
478 /* Detect evil monsters */
479 if (r_ptr->flags3 & RF3_EVIL)
481 if (is_original_ap(m_ptr))
483 /* Take note that they are evil */
484 r_ptr->r_flags3 |= (RF3_EVIL);
486 /* Update monster recall window */
487 if (p_ptr->monster_race_idx == m_ptr->r_idx)
489 p_ptr->window |= (PW_MONSTER);
493 /* Repair visibility later */
494 repair_monsters = TRUE;
496 /* Hack -- Detect monster */
497 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
498 update_monster(i, FALSE);
504 /* Describe result */
505 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
511 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
513 * @return 効力があった場合TRUEを返す
515 bool detect_monsters_nonliving(POSITION range)
521 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
524 for (i = 1; i < m_max; i++)
526 monster_type *m_ptr = &m_list[i];
527 monster_race *r_ptr = &r_info[m_ptr->r_idx];
529 /* Skip dead monsters */
530 if (!m_ptr->r_idx) continue;
535 /* Only detect nearby monsters */
536 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
538 /* Detect non-living monsters */
539 if (!monster_living(r_ptr))
541 /* Update monster recall window */
542 if (p_ptr->monster_race_idx == m_ptr->r_idx)
544 p_ptr->window |= (PW_MONSTER);
547 /* Repair visibility later */
548 repair_monsters = TRUE;
550 /* Hack -- Detect monster */
551 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
552 update_monster(i, FALSE);
558 /* Describe result */
559 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
565 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
567 * @return 効力があった場合TRUEを返す
569 bool detect_monsters_mind(POSITION range)
575 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
578 for (i = 1; i < m_max; i++)
580 monster_type *m_ptr = &m_list[i];
581 monster_race *r_ptr = &r_info[m_ptr->r_idx];
583 /* Skip dead monsters */
584 if (!m_ptr->r_idx) continue;
589 /* Only detect nearby monsters */
590 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
592 /* Detect non-living monsters */
593 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
595 /* Update monster recall window */
596 if (p_ptr->monster_race_idx == m_ptr->r_idx)
598 p_ptr->window |= (PW_MONSTER);
601 /* Repair visibility later */
602 repair_monsters = TRUE;
604 /* Hack -- Detect monster */
605 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
606 update_monster(i, FALSE);
612 /* Describe result */
613 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
620 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
622 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
623 * @return 効力があった場合TRUEを返す
625 bool detect_monsters_string(POSITION range, cptr Match)
631 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
634 for (i = 1; i < m_max; i++)
636 monster_type *m_ptr = &m_list[i];
637 monster_race *r_ptr = &r_info[m_ptr->r_idx];
639 /* Skip dead monsters */
640 if (!m_ptr->r_idx) continue;
645 /* Only detect nearby monsters */
646 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
648 /* Detect monsters with the same symbol */
649 if (my_strchr(Match, r_ptr->d_char))
651 /* Update monster recall window */
652 if (p_ptr->monster_race_idx == m_ptr->r_idx)
654 p_ptr->window |= (PW_MONSTER);
657 /* Repair visibility later */
658 repair_monsters = TRUE;
660 /* Hack -- Detect monster */
661 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
662 update_monster(i, FALSE);
667 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
670 /* Describe result */
671 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
677 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
679 * @param match_flag 感知フラグ
680 * @return 効力があった場合TRUEを返す
682 bool detect_monsters_xxx(POSITION range, u32b match_flag)
687 cptr desc_monsters = _("変なモンスター", "weird monsters");
689 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
692 for (i = 1; i < m_max; i++)
694 monster_type *m_ptr = &m_list[i];
695 monster_race *r_ptr = &r_info[m_ptr->r_idx];
697 /* Skip dead monsters */
698 if (!m_ptr->r_idx) continue;
703 /* Only detect nearby monsters */
704 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
706 /* Detect evil monsters */
707 if (r_ptr->flags3 & (match_flag))
709 if (is_original_ap(m_ptr))
711 /* Take note that they are something */
712 r_ptr->r_flags3 |= (match_flag);
714 /* Update monster recall window */
715 if (p_ptr->monster_race_idx == m_ptr->r_idx)
717 p_ptr->window |= (PW_MONSTER);
721 /* Repair visibility later */
722 repair_monsters = TRUE;
724 /* Hack -- Detect monster */
725 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
726 update_monster(i, FALSE);
735 desc_monsters = _("デーモン", "demons");
738 desc_monsters = _("アンデッド", "the undead");
742 /* Describe result */
743 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
751 * @brief 全感知処理 / Detect everything
753 * @return 効力があった場合TRUEを返す
755 bool detect_all(POSITION range)
759 /* Detect everything */
760 if (detect_traps(range, TRUE)) detect = TRUE;
761 if (detect_doors(range)) detect = TRUE;
762 if (detect_stairs(range)) detect = TRUE;
764 /* There are too many hidden treasure. So... */
765 /* if (detect_treasure(range)) detect = TRUE; */
767 if (detect_objects_gold(range)) detect = TRUE;
768 if (detect_objects_normal(range)) detect = TRUE;
769 if (detect_monsters_invis(range)) detect = TRUE;
770 if (detect_monsters_normal(range)) detect = TRUE;
776 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
779 * @return 効力があった場合TRUEを返す
782 * Note that affected monsters are NOT auto-tracked by this usage.
784 * To avoid misbehavior when monster deaths have side-effects,
785 * this is done in two passes. -- JDL
788 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
792 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
793 bool obvious = FALSE;
796 /* Mark all (nearby) monsters */
797 for (i = 1; i < m_max; i++)
799 monster_type *m_ptr = &m_list[i];
801 /* Paranoia -- Skip dead monsters */
802 if (!m_ptr->r_idx) continue;
807 /* Require line of sight */
808 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
810 /* Mark the monster */
811 m_ptr->mflag |= (MFLAG_TEMP);
814 /* Affect all marked monsters */
815 for (i = 1; i < m_max; i++)
817 monster_type *m_ptr = &m_list[i];
819 /* Skip unmarked monsters */
820 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
823 m_ptr->mflag &= ~(MFLAG_TEMP);
828 /* Jump directly to the target monster */
829 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
836 * @brief 視界内モンスターを加速する処理 / Speed monsters
837 * @return 効力があった場合TRUEを返す
839 bool speed_monsters(void)
841 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
845 * @brief 視界内モンスターを加速する処理 / Slow monsters
846 * @return 効力があった場合TRUEを返す
848 bool slow_monsters(int power)
850 return (project_hack(GF_OLD_SLOW, power));
854 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
855 * @return 効力があった場合TRUEを返す
857 bool sleep_monsters(int power)
859 return (project_hack(GF_OLD_SLEEP, power));
863 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
864 * @return 効力があった場合TRUEを返す
866 bool banish_evil(int dist)
868 return (project_hack(GF_AWAY_EVIL, dist));
872 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
873 * @return 効力があった場合TRUEを返す
875 bool turn_undead(void)
877 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
879 chg_virtue(V_UNLIFE, -1);
884 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
885 * @return 効力があった場合TRUEを返す
887 bool dispel_undead(HIT_POINT dam)
889 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
891 chg_virtue(V_UNLIFE, -2);
896 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
897 * @return 効力があった場合TRUEを返す
899 bool dispel_evil(HIT_POINT dam)
901 return (project_hack(GF_DISP_EVIL, dam));
905 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
906 * @return 効力があった場合TRUEを返す
908 bool dispel_good(HIT_POINT dam)
910 return (project_hack(GF_DISP_GOOD, dam));
914 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
915 * @return 効力があった場合TRUEを返す
917 bool dispel_monsters(HIT_POINT dam)
919 return (project_hack(GF_DISP_ALL, dam));
923 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
924 * @return 効力があった場合TRUEを返す
926 bool dispel_living(HIT_POINT dam)
928 return (project_hack(GF_DISP_LIVING, dam));
932 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
933 * @return 効力があった場合TRUEを返す
935 bool dispel_demons(HIT_POINT dam)
937 return (project_hack(GF_DISP_DEMON, dam));
941 * @brief 視界内のモンスターに「聖戦」効果を与える処理
942 * @return 効力があった場合TRUEを返す
946 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
950 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
951 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
954 void aggravate_monsters(MONSTER_IDX who)
960 /* Aggravate everyone nearby */
961 for (i = 1; i < m_max; i++)
963 monster_type *m_ptr = &m_list[i];
964 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
966 /* Paranoia -- Skip dead monsters */
967 if (!m_ptr->r_idx) continue;
969 /* Skip aggravating monster (or player) */
970 if (i == who) continue;
972 /* Wake up nearby sleeping monsters */
973 if (m_ptr->cdis < MAX_SIGHT * 2)
976 if (MON_CSLEEP(m_ptr))
978 (void)set_monster_csleep(i, 0);
981 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
984 /* Speed up monsters in line of sight */
985 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
989 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
995 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
996 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
997 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1002 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1003 * @param m_idx 抹殺するモンスターID
1004 * @param power 抹殺の威力
1005 * @param player_cast プレイヤーの魔法によるものならば TRUE
1006 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1007 * @param spell_name 抹殺効果を起こした魔法の名前
1008 * @return 効力があった場合TRUEを返す
1010 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1012 int msec = delay_factor * delay_factor * delay_factor;
1013 monster_type *m_ptr = &m_list[m_idx];
1014 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1015 bool resist = FALSE;
1017 if (is_pet(m_ptr) && !player_cast) return FALSE;
1019 /* Hack -- Skip Unique Monsters or Quest Monsters */
1020 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1021 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1022 else if (m_idx == p_ptr->riding) resist = TRUE;
1023 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1024 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1025 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1030 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1034 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1035 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1038 delete_monster_idx(m_idx);
1041 if (resist && player_cast)
1043 bool see_m = is_seen(m_ptr);
1046 monster_desc(m_name, m_ptr, 0);
1049 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1051 if (MON_CSLEEP(m_ptr))
1053 (void)set_monster_csleep(m_idx, 0);
1056 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1059 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1063 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1067 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1072 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1075 /* Visual feedback */
1076 move_cursor_relative(p_ptr->y, p_ptr->x);
1078 p_ptr->redraw |= (PR_HP);
1079 p_ptr->window |= (PW_PLAYER);
1085 Term_xtra(TERM_XTRA_DELAY, msec);
1092 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1093 * @param power 抹殺の威力
1094 * @param player_cast プレイヤーの魔法によるものならば TRUE
1095 * @return 効力があった場合TRUEを返す
1097 bool symbol_genocide(int power, bool player_cast)
1101 bool result = FALSE;
1103 /* Prevent genocide in quest levels */
1104 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1109 /* Mega-Hack -- Get a monster symbol */
1110 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1112 /* Delete the monsters of that "type" */
1113 for (i = 1; i < m_max; i++)
1115 monster_type *m_ptr = &m_list[i];
1116 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1118 /* Paranoia -- Skip dead monsters */
1119 if (!m_ptr->r_idx) continue;
1121 /* Skip "wrong" monsters */
1122 if (r_ptr->d_char != typ) continue;
1125 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1130 chg_virtue(V_VITALITY, -2);
1131 chg_virtue(V_CHANCE, -1);
1139 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1140 * @param power 抹殺の威力
1141 * @param player_cast プレイヤーの魔法によるものならば TRUE
1142 * @return 効力があった場合TRUEを返す
1144 bool mass_genocide(int power, bool player_cast)
1147 bool result = FALSE;
1149 /* Prevent mass genocide in quest levels */
1150 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1155 /* Delete the (nearby) monsters */
1156 for (i = 1; i < m_max; i++)
1158 monster_type *m_ptr = &m_list[i];
1160 /* Paranoia -- Skip dead monsters */
1161 if (!m_ptr->r_idx) continue;
1163 /* Skip distant monsters */
1164 if (m_ptr->cdis > MAX_SIGHT) continue;
1167 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1172 chg_virtue(V_VITALITY, -2);
1173 chg_virtue(V_CHANCE, -1);
1181 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1182 * @param power 抹殺の威力
1183 * @param player_cast プレイヤーの魔法によるものならば TRUE
1184 * @return 効力があった場合TRUEを返す
1186 bool mass_genocide_undead(int power, bool player_cast)
1189 bool result = FALSE;
1191 /* Prevent mass genocide in quest levels */
1192 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1197 /* Delete the (nearby) monsters */
1198 for (i = 1; i < m_max; i++)
1200 monster_type *m_ptr = &m_list[i];
1201 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1203 /* Paranoia -- Skip dead monsters */
1204 if (!m_ptr->r_idx) continue;
1206 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1208 /* Skip distant monsters */
1209 if (m_ptr->cdis > MAX_SIGHT) continue;
1212 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1217 chg_virtue(V_UNLIFE, -2);
1218 chg_virtue(V_CHANCE, -1);
1226 * @brief 周辺モンスターを調査する / Probe nearby monsters
1227 * @return 効力があった場合TRUEを返す
1243 /* Probe all (nearby) monsters */
1244 for (i = 1; i < m_max; i++)
1246 monster_type *m_ptr = &m_list[i];
1247 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1249 /* Paranoia -- Skip dead monsters */
1250 if (!m_ptr->r_idx) continue;
1252 /* Require line of sight */
1253 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1255 /* Probe visible monsters */
1260 /* Start the message */
1263 msg_print(_("調査中...", "Probing..."));
1268 if (!is_original_ap(m_ptr))
1270 if (m_ptr->mflag2 & MFLAG2_KAGE)
1271 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1273 m_ptr->ap_r_idx = m_ptr->r_idx;
1274 lite_spot(m_ptr->fy, m_ptr->fx);
1276 /* Get "the monster" or "something" */
1277 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1279 speed = m_ptr->mspeed - 110;
1280 if (MON_FAST(m_ptr)) speed += 10;
1281 if (MON_SLOW(m_ptr)) speed -= 10;
1282 if (ironman_nightmare) speed += 5;
1284 /* Get the monster's alignment */
1285 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1286 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1287 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1288 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1289 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1290 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1291 else align = _("中立", "neutral");
1293 /* Describe the monster */
1294 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1295 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1297 if (r_ptr->next_r_idx)
1299 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1303 strcat(buf, "xxx ");
1306 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1307 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1308 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1309 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1310 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1311 buf[strlen(buf)-1] = '\0';
1314 /* HACK : Add the line to message buffer */
1316 p_ptr->window |= (PW_MESSAGE);
1319 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1322 Term_erase(0, 0, 255);
1324 /* Learn everything about this monster */
1325 if (lore_do_probe(m_ptr->r_idx))
1327 /* Get base name of monster */
1328 strcpy(buf, (r_name + r_ptr->name));
1331 /* Note that we learnt some new flags -Mogami- */
1332 msg_format("%sについてさらに詳しくなった気がする。", buf);
1337 /* Note that we learnt some new flags -Mogami- */
1338 msg_format("You now know more about %s.", buf);
1340 /* Clear -more- prompt */
1355 chg_virtue(V_KNOWLEDGE, 1);
1356 msg_print(_("これで全部です。", "That's all."));
1364 * @brief *破壊*処理を行う / The spell of destruction
1365 * @param y1 破壊の中心Y座標
1366 * @param x1 破壊の中心X座標
1368 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1369 * @return 効力があった場合TRUEを返す
1372 * This spell "deletes" monsters (instead of "killing" them).
1374 * Later we may use one function for both "destruction" and
1375 * "earthquake" by using the "full" to select "destruction".
1378 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1385 /* Prevent destruction of quest levels and town */
1386 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1391 /* Lose monster light */
1392 if (!in_generate) clear_mon_lite();
1394 /* Big area of affect */
1395 for (y = (y1 - r); y <= (y1 + r); y++)
1397 for (x = (x1 - r); x <= (x1 + r); x++)
1399 /* Skip illegal grids */
1400 if (!in_bounds(y, x)) continue;
1402 /* Extract the distance */
1403 k = distance(y1, x1, y, x);
1405 /* Stay in the circle of death */
1406 if (k > r) continue;
1407 c_ptr = &cave[y][x];
1409 /* Lose room and vault */
1410 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1412 /* Lose light and knowledge */
1413 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1415 if (!in_generate) /* Normal */
1418 c_ptr->info &= ~(CAVE_UNSAFE);
1420 /* Hack -- Notice player affect */
1421 if (player_bold(y, x))
1423 /* Hurt the player later */
1426 /* Do not hurt this grid */
1431 /* Hack -- Skip the epicenter */
1432 if ((y == y1) && (x == x1)) continue;
1436 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1437 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1439 if (in_generate) /* In generation */
1441 /* Delete the monster (if any) */
1442 delete_monster(y, x);
1444 else if (r_ptr->flags1 & RF1_QUESTOR)
1446 /* Heal the monster */
1447 m_ptr->hp = m_ptr->maxhp;
1449 /* Try to teleport away quest monsters */
1450 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1454 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1458 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1459 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1462 /* Delete the monster (if any) */
1463 delete_monster(y, x);
1467 /* During generation, destroyed artifacts are "preserved" */
1468 if (preserve_mode || in_generate)
1470 OBJECT_IDX this_o_idx, next_o_idx = 0;
1472 /* Scan all objects in the grid */
1473 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1477 /* Acquire object */
1478 o_ptr = &o_list[this_o_idx];
1480 /* Acquire next object */
1481 next_o_idx = o_ptr->next_o_idx;
1483 /* Hack -- Preserve unknown artifacts */
1484 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1486 /* Mega-Hack -- Preserve the artifact */
1487 a_info[o_ptr->name1].cur_num = 0;
1489 if (in_generate && cheat_peek)
1491 char o_name[MAX_NLEN];
1492 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1493 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1496 else if (in_generate && cheat_peek && o_ptr->art_name)
1498 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1499 "One of the random artifacts was *destroyed* during generation."));
1504 /* Delete objects */
1505 delete_object(y, x);
1507 /* Destroy "non-permanent" grids */
1508 if (!cave_perma_grid(c_ptr))
1510 /* Wall (or floor) type */
1513 if (!in_generate) /* Normal */
1517 /* Create granite wall */
1518 cave_set_feat(y, x, feat_granite);
1522 /* Create quartz vein */
1523 cave_set_feat(y, x, feat_quartz_vein);
1527 /* Create magma vein */
1528 cave_set_feat(y, x, feat_magma_vein);
1533 cave_set_feat(y, x, floor_type[randint0(100)]);
1536 else /* In generation */
1540 /* Create granite wall */
1541 place_extra_grid(c_ptr);
1545 /* Create quartz vein */
1546 c_ptr->feat = feat_quartz_vein;
1550 /* Create magma vein */
1551 c_ptr->feat = feat_magma_vein;
1556 place_floor_grid(c_ptr);
1559 /* Clear garbage of hidden trap or door */
1568 /* Process "re-glowing" */
1569 for (y = (y1 - r); y <= (y1 + r); y++)
1571 for (x = (x1 - r); x <= (x1 + r); x++)
1573 /* Skip illegal grids */
1574 if (!in_bounds(y, x)) continue;
1576 /* Extract the distance */
1577 k = distance(y1, x1, y, x);
1579 /* Stay in the circle of death */
1580 if (k > r) continue;
1581 c_ptr = &cave[y][x];
1583 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1584 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1589 for (i = 0; i < 9; i++)
1591 yy = y + ddy_ddd[i];
1592 xx = x + ddx_ddd[i];
1593 if (!in_bounds2(yy, xx)) continue;
1594 cc_ptr = &cave[yy][xx];
1595 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1597 c_ptr->info |= CAVE_GLOW;
1605 /* Hack -- Affect player */
1608 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1610 /* Blind the player */
1611 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1614 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1620 /* Mega-Hack -- Forget the view and lite */
1621 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1623 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1625 p_ptr->redraw |= (PR_MAP);
1627 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1629 if (p_ptr->special_defense & NINJA_S_STEALTH)
1631 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1641 * @brief 地震処理(サブルーチン) /
1642 * Induce an "earthquake" of the given radius at the given location.
1643 * @return 効力があった場合TRUEを返す
1647 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1651 * This will turn some walls into floors and some floors into walls.
1653 * The player will take damage and "jump" into a safe grid if possible,
1654 * otherwise, he will "tunnel" through the rubble instantaneously.
1656 * Monsters will take damage, and "jump" into a safe grid if possible,
1657 * otherwise they will be "buried" in the rubble, disappearing from
1658 * the level in the same way that they do when genocided.
1660 * Note that thus the player and monsters (except eaters of walls and
1661 * passers through walls) will never occupy the same grid as a wall.
1662 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1663 * for a single turn, unless that monster can pass_walls or kill_walls.
1664 * This has allowed massive simplification of the "monster" code.
1667 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1671 POSITION y, x, yy, xx, dy, dx;
1674 POSITION sy = 0, sx = 0;
1680 /* Prevent destruction of quest levels and town */
1681 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1686 /* Paranoia -- Enforce maximum range */
1689 /* Clear the "maximal blast" area */
1690 for (y = 0; y < 32; y++)
1692 for (x = 0; x < 32; x++)
1698 /* Check around the epicenter */
1699 for (dy = -r; dy <= r; dy++)
1701 for (dx = -r; dx <= r; dx++)
1703 /* Extract the location */
1707 /* Skip illegal grids */
1708 if (!in_bounds(yy, xx)) continue;
1710 /* Skip distant grids */
1711 if (distance(cy, cx, yy, xx) > r) continue;
1712 c_ptr = &cave[yy][xx];
1714 /* Lose room and vault */
1715 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1717 /* Lose light and knowledge */
1718 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1720 /* Skip the epicenter */
1721 if (!dx && !dy) continue;
1723 /* Skip most grids */
1724 if (randint0(100) < 85) continue;
1726 /* Damage this grid */
1727 map[16+yy-cy][16+xx-cx] = TRUE;
1729 /* Hack -- Take note of player damage */
1730 if (player_bold(yy, xx)) hurt = TRUE;
1734 /* First, affect the player (if necessary) */
1735 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1737 /* Check around the player */
1738 for (i = 0; i < 8; i++)
1740 /* Access the location */
1741 y = p_ptr->y + ddy_ddd[i];
1742 x = p_ptr->x + ddx_ddd[i];
1744 /* Skip non-empty grids */
1745 if (!cave_empty_bold(y, x)) continue;
1747 /* Important -- Skip "quake" grids */
1748 if (map[16+y-cy][16+x-cx]) continue;
1750 if (cave[y][x].m_idx) continue;
1752 /* Count "safe" grids */
1755 /* Randomize choice */
1756 if (randint0(sn) > 0) continue;
1758 /* Save the safe location */
1762 /* Random message */
1763 switch (randint1(3))
1767 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1772 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1777 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1782 /* Hurt the player a lot */
1785 /* Message and damage */
1786 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1790 /* Destroy the grid, and push the player to safety */
1793 /* Calculate results */
1794 switch (randint1(3))
1798 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1804 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1805 damage = damroll(10, 4);
1806 (void)set_stun(p_ptr->stun + randint1(50));
1811 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1812 damage = damroll(10, 4);
1813 (void)set_stun(p_ptr->stun + randint1(50));
1818 /* Move the player to the safe location */
1819 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1822 /* Important -- no wall on player */
1823 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1832 monster_type *m_ptr = &m_list[m_idx];
1834 /* Get the monster's real name */
1835 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1837 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1841 killer = _("地震", "an earthquake");
1844 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1848 /* Examine the quaked region */
1849 for (dy = -r; dy <= r; dy++)
1851 for (dx = -r; dx <= r; dx++)
1853 /* Extract the location */
1857 /* Skip unaffected grids */
1858 if (!map[16+yy-cy][16+xx-cx]) continue;
1859 c_ptr = &cave[yy][xx];
1861 if (c_ptr->m_idx == p_ptr->riding) continue;
1863 /* Process monsters */
1866 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1867 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1869 /* Quest monsters */
1870 if (r_ptr->flags1 & RF1_QUESTOR)
1872 /* No wall on quest monsters */
1873 map[16+yy-cy][16+xx-cx] = FALSE;
1878 /* Most monsters cannot co-exist with rock */
1879 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1880 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1884 /* Assume not safe */
1887 /* Monster can move to escape the wall */
1888 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1890 /* Look for safety */
1891 for (i = 0; i < 8; i++)
1893 y = yy + ddy_ddd[i];
1894 x = xx + ddx_ddd[i];
1896 /* Skip non-empty grids */
1897 if (!cave_empty_bold(y, x)) continue;
1899 /* Hack -- no safety on glyph of warding */
1900 if (is_glyph_grid(&cave[y][x])) continue;
1901 if (is_explosive_rune_grid(&cave[y][x])) continue;
1903 /* ... nor on the Pattern */
1904 if (pattern_tile(y, x)) continue;
1906 /* Important -- Skip "quake" grids */
1907 if (map[16+y-cy][16+x-cx]) continue;
1909 if (cave[y][x].m_idx) continue;
1910 if (player_bold(y, x)) continue;
1912 /* Count "safe" grids */
1915 /* Randomize choice */
1916 if (randint0(sn) > 0) continue;
1918 /* Save the safe grid */
1923 /* Describe the monster */
1924 monster_desc(m_name, m_ptr, 0);
1926 /* Scream in pain */
1927 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1929 /* Take damage from the quake */
1930 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1932 /* Monster is certainly awake */
1933 (void)set_monster_csleep(c_ptr->m_idx, 0);
1935 /* Apply damage directly */
1936 m_ptr->hp -= damage;
1938 /* Delete (not kill) "dead" monsters */
1941 if (!ignore_unview || is_seen(m_ptr))
1942 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1946 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1950 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1951 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1956 delete_monster(yy, xx);
1958 /* No longer safe */
1962 /* Hack -- Escape from the rock */
1965 IDX m_idx_aux = cave[yy][xx].m_idx;
1967 /* Update the old location */
1968 cave[yy][xx].m_idx = 0;
1970 /* Update the new location */
1971 cave[sy][sx].m_idx = m_idx_aux;
1973 /* Move the monster */
1977 /* Update the monster (new location) */
1978 update_monster(m_idx, TRUE);
1980 /* Redraw the old grid */
1983 /* Redraw the new grid */
1991 /* Lose monster light */
1994 /* Examine the quaked region */
1995 for (dy = -r; dy <= r; dy++)
1997 for (dx = -r; dx <= r; dx++)
1999 /* Extract the location */
2003 /* Skip unaffected grids */
2004 if (!map[16+yy-cy][16+xx-cx]) continue;
2006 /* Access the cave grid */
2007 c_ptr = &cave[yy][xx];
2009 /* Paranoia -- never affect player */
2010 /* if (player_bold(yy, xx)) continue; */
2012 /* Destroy location (if valid) */
2013 if (cave_valid_bold(yy, xx))
2015 /* Delete objects */
2016 delete_object(yy, xx);
2018 /* Wall (or floor) type */
2019 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2024 /* Create granite wall */
2025 cave_set_feat(yy, xx, feat_granite);
2031 /* Create quartz vein */
2032 cave_set_feat(yy, xx, feat_quartz_vein);
2038 /* Create magma vein */
2039 cave_set_feat(yy, xx, feat_magma_vein);
2046 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2053 /* Process "re-glowing" */
2054 for (dy = -r; dy <= r; dy++)
2056 for (dx = -r; dx <= r; dx++)
2058 /* Extract the location */
2062 /* Skip illegal grids */
2063 if (!in_bounds(yy, xx)) continue;
2065 /* Skip distant grids */
2066 if (distance(cy, cx, yy, xx) > r) continue;
2067 c_ptr = &cave[yy][xx];
2069 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2070 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2075 for (ii = 0; ii < 9; ii++)
2077 yyy = yy + ddy_ddd[ii];
2078 xxx = xx + ddx_ddd[ii];
2079 if (!in_bounds2(yyy, xxx)) continue;
2080 cc_ptr = &cave[yyy][xxx];
2081 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2083 c_ptr->info |= CAVE_GLOW;
2092 /* Mega-Hack -- Forget the view and lite */
2093 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2095 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2097 /* Update the health bar */
2098 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2100 p_ptr->redraw |= (PR_MAP);
2102 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2104 if (p_ptr->special_defense & NINJA_S_STEALTH)
2106 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2114 * @brief 地震処理(プレイヤーの中心発動) /
2115 * Induce an "earthquake" of the given radius at the given location.
2116 * @return 効力があった場合TRUEを返す
2121 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2123 return earthquake_aux(cy, cx, r, 0);
2130 void discharge_minion(void)
2135 for (i = 1; i < m_max; i++)
2137 monster_type *m_ptr = &m_list[i];
2138 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2139 if (m_ptr->nickname) okay = FALSE;
2141 if (!okay || p_ptr->riding)
2143 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2146 for (i = 1; i < m_max; i++)
2149 monster_type *m_ptr = &m_list[i];
2150 monster_race *r_ptr;
2152 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2153 r_ptr = &r_info[m_ptr->r_idx];
2155 /* Uniques resist discharging */
2156 if (r_ptr->flags1 & RF1_UNIQUE)
2159 monster_desc(m_name, m_ptr, 0x00);
2160 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2161 delete_monster_idx(i);
2164 dam = m_ptr->maxhp / 2;
2165 if (dam > 100) dam = (dam-100)/2 + 100;
2166 if (dam > 400) dam = (dam-400)/2 + 400;
2167 if (dam > 800) dam = 800;
2168 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2169 m_ptr->fx, dam, GF_PLASMA,
2170 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2172 if (record_named_pet && m_ptr->nickname)
2176 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2177 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2180 delete_monster_idx(i);
2186 * @brief 部屋全体を照らすサブルーチン
2190 * This routine clears the entire "temp" set.
2191 * This routine will Perma-Lite all "temp" grids.
2192 * This routine is used (only) by "lite_room()"
2193 * Dark grids are illuminated.
2194 * Also, process all affected monsters.
2196 * SMART monsters always wake up when illuminated
2197 * NORMAL monsters wake up 1/4 the time when illuminated
2198 * STUPID monsters wake up 1/10 the time when illuminated
2201 static void cave_temp_room_lite(void)
2205 /* Clear them all */
2206 for (i = 0; i < temp_n; i++)
2208 POSITION y = temp_y[i];
2209 POSITION x = temp_x[i];
2211 cave_type *c_ptr = &cave[y][x];
2213 /* No longer in the array */
2214 c_ptr->info &= ~(CAVE_TEMP);
2216 /* Update only non-CAVE_GLOW grids */
2217 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2220 c_ptr->info |= (CAVE_GLOW);
2222 /* Process affected monsters */
2227 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2229 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2230 update_monster(c_ptr->m_idx, FALSE);
2232 /* Stupid monsters rarely wake up */
2233 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2235 /* Smart monsters always wake up */
2236 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2238 /* Sometimes monsters wake up */
2239 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2242 (void)set_monster_csleep(c_ptr->m_idx, 0);
2244 /* Notice the "waking up" */
2249 /* Acquire the monster name */
2250 monster_desc(m_name, m_ptr, 0);
2252 /* Dump a message */
2253 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2263 update_local_illumination(y, x);
2273 * @brief 部屋全体を暗くするサブルーチン
2277 * This routine clears the entire "temp" set.
2278 * This routine will "darken" all "temp" grids.
2279 * In addition, some of these grids will be "unmarked".
2280 * This routine is used (only) by "unlite_room()"
2281 * Also, process all affected monsters
2284 static void cave_temp_room_unlite(void)
2288 /* Clear them all */
2289 for (i = 0; i < temp_n; i++)
2291 POSITION y = temp_y[i];
2292 POSITION x = temp_x[i];
2295 cave_type *c_ptr = &cave[y][x];
2296 bool do_dark = !is_mirror_grid(c_ptr);
2298 /* No longer in the array */
2299 c_ptr->info &= ~(CAVE_TEMP);
2301 /* Darken the grid */
2304 if (dun_level || !is_daytime())
2306 for (j = 0; j < 9; j++)
2308 int by = y + ddy_ddd[j];
2309 int bx = x + ddx_ddd[j];
2311 if (in_bounds2(by, bx))
2313 cave_type *cc_ptr = &cave[by][bx];
2315 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2323 if (!do_dark) continue;
2326 c_ptr->info &= ~(CAVE_GLOW);
2328 /* Hack -- Forget "boring" grids */
2329 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2331 /* Forget the grid */
2332 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2337 /* Process affected monsters */
2340 update_monster(c_ptr->m_idx, FALSE);
2345 update_local_illumination(y, x);
2355 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2358 * @param pass_bold 地形条件を返す関数ポインタ
2361 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2368 for (i = 0; i < 16; i++)
2370 y = cy + ddy_cdd[i % 8];
2371 x = cx + ddx_cdd[i % 8];
2373 /* Found a wall, break the length */
2374 if (!pass_bold(y, x))
2376 /* Track best length */
2390 return (MAX(len, blen));
2394 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2397 * @param pass_bold 地形条件を返す関数ポインタ
2400 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2406 for (i = 0; i < 8; i++)
2408 y = cy + ddy_ddd[i];
2409 x = cx + ddx_ddd[i];
2411 if (!pass_bold(y, x)) c++;
2419 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2420 * @param y 部屋内のy座標1点
2421 * @param x 部屋内のx座標1点
2422 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2423 * @param pass_bold 地形条件を返す関数ポインタ
2426 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2431 c_ptr = &cave[y][x];
2433 /* Avoid infinite recursion */
2434 if (c_ptr->info & (CAVE_TEMP)) return;
2436 /* Do not "leave" the current room */
2437 if (!(c_ptr->info & (CAVE_ROOM)))
2439 if (only_room) return;
2442 if (!in_bounds2(y, x)) return;
2444 /* Do not exceed the maximum spell range */
2445 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2447 /* Verify this grid */
2449 * The reason why it is ==6 instead of >5 is that 8 is impossible
2450 * due to the check for cave_bold above.
2451 * 7 lights dead-end corridors (you need to do this for the
2452 * checkboard interesting rooms, so that the boundary is lit
2454 * This leaves only a check for 6 bounding walls!
2456 if (in_bounds(y, x) && pass_bold(y, x) &&
2457 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2460 /* Paranoia -- verify space */
2461 if (temp_n == TEMP_MAX) return;
2463 /* Mark the grid as "seen" */
2464 c_ptr->info |= (CAVE_TEMP);
2466 /* Add it to the "seen" set */
2473 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2476 * @return 光を通すならばtrueを返す。
2478 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2480 return cave_los_bold(y, x);
2484 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2489 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2491 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2495 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2498 * @return 射線を通すならばtrueを返す。
2500 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2502 return cave_have_flag_bold(y, x, FF_PROJECT);
2507 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2512 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2514 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2519 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2524 void lite_room(POSITION y1, POSITION x1)
2529 /* Add the initial grid */
2530 cave_temp_lite_room_aux(y1, x1);
2532 /* While grids are in the queue, add their neighbors */
2533 for (i = 0; i < temp_n; i++)
2535 x = temp_x[i], y = temp_y[i];
2537 /* Walls get lit, but stop light */
2538 if (!cave_pass_lite_bold(y, x)) continue;
2540 /* Spread adjacent */
2541 cave_temp_lite_room_aux(y + 1, x);
2542 cave_temp_lite_room_aux(y - 1, x);
2543 cave_temp_lite_room_aux(y, x + 1);
2544 cave_temp_lite_room_aux(y, x - 1);
2546 /* Spread diagonal */
2547 cave_temp_lite_room_aux(y + 1, x + 1);
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);
2553 /* Now, lite them all up at once */
2554 cave_temp_room_lite();
2556 if (p_ptr->special_defense & NINJA_S_STEALTH)
2558 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2564 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2569 void unlite_room(POSITION y1, POSITION x1)
2574 /* Add the initial grid */
2575 cave_temp_unlite_room_aux(y1, x1);
2577 /* Spread, breadth first */
2578 for (i = 0; i < temp_n; i++)
2580 x = temp_x[i], y = temp_y[i];
2582 /* Walls get dark, but stop darkness */
2583 if (!cave_pass_dark_bold(y, x)) continue;
2585 /* Spread adjacent */
2586 cave_temp_unlite_room_aux(y + 1, x);
2587 cave_temp_unlite_room_aux(y - 1, x);
2588 cave_temp_unlite_room_aux(y, x + 1);
2589 cave_temp_unlite_room_aux(y, x - 1);
2591 /* Spread diagonal */
2592 cave_temp_unlite_room_aux(y + 1, x + 1);
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);
2598 /* Now, darken them all at once */
2599 cave_temp_room_unlite();
2605 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2608 * @return 作用が実際にあった場合TRUEを返す
2610 bool lite_area(HIT_POINT dam, POSITION rad)
2612 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2614 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2616 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2620 /* Hack -- Message */
2623 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2626 /* Hook into the "project()" function */
2627 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2629 /* Lite up the room */
2630 lite_room(p_ptr->y, p_ptr->x);
2638 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2641 * @return 作用が実際にあった場合TRUEを返す
2643 bool unlite_area(HIT_POINT dam, POSITION rad)
2645 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2647 /* Hack -- Message */
2650 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2653 /* Hook into the "project()" function */
2654 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2656 /* Lite up the room */
2657 unlite_room(p_ptr->y, p_ptr->x);
2666 * @brief ボール系スペルの発動 / Cast a ball spell
2668 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2671 * @return 作用が実際にあった場合TRUEを返す
2674 * Stop if we hit a monster, act as a "ball"
2675 * Allow "target" mode to pass over monsters
2676 * Affect grids, objects, and monsters
2679 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2683 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2685 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2686 /* Use the given direction */
2687 tx = p_ptr->x + 99 * ddx[dir];
2688 ty = p_ptr->y + 99 * ddy[dir];
2690 /* Hack -- Use an actual "target" */
2691 if ((dir == 5) && target_okay())
2693 flg &= ~(PROJECT_STOP);
2698 /* Analyze the "dir" and the "target". Hurt items on floor. */
2699 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2703 * @brief ブレス系スペルの発動 / Cast a breath spell
2705 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2708 * @return 作用が実際にあった場合TRUEを返す
2711 * Stop if we hit a monster, act as a "ball"
2712 * Allow "target" mode to pass over monsters
2713 * Affect grids, objects, and monsters
2716 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2718 return fire_ball(typ, dir, dam, -rad);
2723 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2725 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2728 * @return 作用が実際にあった場合TRUEを返す
2731 * Stop if we hit a monster, act as a "ball"
2732 * Allow "target" mode to pass over monsters
2733 * Affect grids, objects, and monsters
2736 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2739 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2741 /* Use the given direction */
2742 tx = p_ptr->x + 99 * ddx[dir];
2743 ty = p_ptr->y + 99 * ddy[dir];
2745 /* Hack -- Use an actual "target" */
2746 if ((dir == 5) && target_okay())
2752 /* Analyze the "dir" and the "target". Hurt items on floor. */
2753 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2758 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2760 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2763 * @return 作用が実際にあった場合TRUEを返す
2766 * Stop if we hit a monster, act as a "ball"
2767 * Allow "target" mode to pass over monsters
2768 * Affect grids, objects, and monsters
2771 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2774 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2776 /* Use the given direction */
2777 tx = p_ptr->x + 99 * ddx[dir];
2778 ty = p_ptr->y + 99 * ddy[dir];
2780 /* Hack -- Use an actual "target" */
2781 if ((dir == 5) && target_okay())
2783 flg &= ~(PROJECT_STOP);
2788 /* Analyze the "dir" and the "target". Hurt items on floor. */
2789 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2794 * @brief メテオ系スペルの発動 / Cast a meteor spell
2795 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2801 * @return 作用が実際にあった場合TRUEを返す
2804 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2805 * player, or outside source, that starts out at an arbitrary location, and
2806 * leaving no trail from the "caster" to the target. This function is
2807 * especially useful for bombardments and similar. -LM-
2808 * Option to hurt the player.
2811 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2813 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2815 /* Analyze the "target" and the caster. */
2816 return (project(who, rad, y, x, dam, typ, flg, -1));
2821 * @brief ブラスト系スペルの発動 / Cast a blast spell
2823 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2828 * @return 作用が実際にあった場合TRUEを返す
2830 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2834 POSITION ty, tx, y, x;
2837 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2842 /* Use the given direction */
2845 ly = ty = p_ptr->y + 20 * ddy[dir];
2846 lx = tx = p_ptr->x + 20 * ddx[dir];
2849 /* Use an actual "target" */
2850 else /* if (dir == 5) */
2855 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2856 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2859 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2862 for (i = 0; i < num; i++)
2866 /* Get targets for some bolts */
2867 y = rand_spread(ly, ld * dev / 20);
2868 x = rand_spread(lx, ld * dev / 20);
2870 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2873 /* Analyze the "dir" and the "target". */
2874 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2885 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2886 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2887 * @return 作用が実際にあった場合TRUEを返す
2889 bool teleport_swap(DIRECTION dir)
2893 monster_type* m_ptr;
2894 monster_race* r_ptr;
2896 if ((dir == 5) && target_okay())
2903 tx = p_ptr->x + ddx[dir];
2904 ty = p_ptr->y + ddy[dir];
2906 c_ptr = &cave[ty][tx];
2908 if (p_ptr->anti_tele)
2910 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2914 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2916 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2922 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2924 msg_print(_("失敗した。", "Failed to swap."));
2930 m_ptr = &m_list[c_ptr->m_idx];
2931 r_ptr = &r_info[m_ptr->r_idx];
2933 (void)set_monster_csleep(c_ptr->m_idx, 0);
2935 if (r_ptr->flagsr & RFR_RES_TELE)
2937 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2939 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2945 sound(SOUND_TELEPORT);
2947 /* Swap the player and monster */
2948 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2956 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2958 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2961 * @return 作用が実際にあった場合TRUEを返す
2963 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2967 /* Pass through the target if needed */
2968 flg |= (PROJECT_THRU);
2970 /* Use the given direction */
2971 tx = p_ptr->x + ddx[dir];
2972 ty = p_ptr->y + ddy[dir];
2974 /* Hack -- Use an actual "target" */
2975 if ((dir == 5) && target_okay())
2981 /* Analyze the "dir" and the "target", do NOT explode */
2982 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2987 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2989 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2991 * @return 作用が実際にあった場合TRUEを返す
2994 * Stop if we hit a monster, as a "bolt".
2995 * Affect monsters and grids (not objects).
2998 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3000 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3001 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3002 return (project_hook(typ, dir, dam, flg));
3007 * @brief ビーム系スペルの発動 / Cast a beam spell.
3009 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3011 * @return 作用が実際にあった場合TRUEを返す
3014 * Pass through monsters, as a "beam".
3015 * Affect monsters, grids and objects.
3018 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3020 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3021 return (project_hook(typ, dir, dam, flg));
3026 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3027 * @param prob ビーム化する確率(%)
3029 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3031 * @return 作用が実際にあった場合TRUEを返す
3034 * Pass through monsters, as a "beam".
3035 * Affect monsters, grids and objects.
3038 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3040 if (randint0(100) < prob)
3042 return (fire_beam(typ, dir, dam));
3046 return (fire_bolt(typ, dir, dam));
3051 * @brief LITE_WEAK属性による光源ビーム処理
3052 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3054 * @return 作用が実際にあった場合TRUEを返す
3056 bool lite_line(DIRECTION dir, HIT_POINT dam)
3058 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3059 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3064 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3066 * @return 作用が実際にあった場合TRUEを返す
3068 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3070 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3071 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3076 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3078 * @return 作用が実際にあった場合TRUEを返す
3080 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3082 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3083 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3088 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3089 * @return 作用が実際にあった場合TRUEを返す
3091 bool wizard_lock(DIRECTION dir)
3093 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3094 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3099 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3100 * @return 作用が実際にあった場合TRUEを返す
3102 bool destroy_door(DIRECTION dir)
3104 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3105 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3110 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3111 * @return 作用が実際にあった場合TRUEを返す
3113 bool disarm_trap(DIRECTION dir)
3115 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3116 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3121 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3123 * @return 作用が実際にあった場合TRUEを返す
3125 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3127 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3128 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3133 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3135 * @return 作用が実際にあった場合TRUEを返す
3137 bool speed_monster(DIRECTION dir, int power)
3139 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3140 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3145 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3147 * @return 作用が実際にあった場合TRUEを返す
3149 bool slow_monster(DIRECTION dir, int power)
3151 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3152 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3157 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3159 * @return 作用が実際にあった場合TRUEを返す
3161 bool sleep_monster(DIRECTION dir, int power)
3163 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3164 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3168 * @brief モンスター拘束(STASIS)処理
3169 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3170 * @return 作用が実際にあった場合TRUEを返す
3171 * @details 威力はプレイヤーレベル*2に固定
3173 bool stasis_monster(DIRECTION dir)
3175 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3179 * @brief 邪悪なモンスター拘束(STASIS)処理
3180 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3181 * @return 作用が実際にあった場合TRUEを返す
3182 * @details 威力はプレイヤーレベル*2に固定
3184 bool stasis_evil(DIRECTION dir)
3186 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3191 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3192 * @param plev プレイヤーレベル(=効力)
3193 * @return 作用が実際にあった場合TRUEを返す
3195 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3197 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3198 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3203 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3204 * @param plev プレイヤーレベル(=効力)
3205 * @return 作用が実際にあった場合TRUEを返す
3207 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3209 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3210 return (project_hook(GF_STUN, dir, plev, flg));
3214 * @brief チェンジモンスター処理
3215 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3217 * @return 作用が実際にあった場合TRUEを返す
3219 bool poly_monster(DIRECTION dir, int power)
3221 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3222 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3224 chg_virtue(V_CHANCE, 1);
3229 * @brief クローンモンスター処理
3230 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3231 * @return 作用が実際にあった場合TRUEを返す
3233 bool clone_monster(DIRECTION dir)
3235 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3236 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3241 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3242 * @param plev プレイヤーレベル(=効力)
3243 * @return 作用が実際にあった場合TRUEを返す
3245 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3247 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3248 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3253 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3254 * @param plev プレイヤーレベル(効力はplev*200)
3255 * @return 作用が実際にあった場合TRUEを返す
3257 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3259 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3260 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3264 * @brief モンスター用テレポート処理
3265 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3266 * @param distance 移動距離
3267 * @return 作用が実際にあった場合TRUEを返す
3269 bool teleport_monster(DIRECTION dir, int distance)
3271 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3272 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3276 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3277 * @return 作用が実際にあった場合TRUEを返す
3279 bool door_creation(void)
3281 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3282 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3286 * @brief トラップ生成処理(起点から周囲1マス)
3289 * @return 作用が実際にあった場合TRUEを返す
3291 bool trap_creation(POSITION y, POSITION x)
3293 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3294 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3298 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3299 * @return 作用が実際にあった場合TRUEを返す
3301 bool tree_creation(void)
3303 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3304 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3308 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3309 * @return 作用が実際にあった場合TRUEを返す
3311 bool glyph_creation(void)
3313 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3314 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3318 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3319 * @return 作用が実際にあった場合TRUEを返す
3321 bool wall_stone(void)
3323 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3325 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3327 p_ptr->update |= (PU_FLOW);
3329 p_ptr->redraw |= (PR_MAP);
3335 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3336 * @return 作用が実際にあった場合TRUEを返す
3338 bool destroy_doors_touch(void)
3340 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3341 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3345 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3346 * @return 作用が実際にあった場合TRUEを返す
3348 bool disarm_traps_touch(void)
3350 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3351 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3355 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3356 * @return 作用が実際にあった場合TRUEを返す
3358 bool sleep_monsters_touch(void)
3360 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3361 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3366 * @brief 死者復活処理(起点より周囲5マス)
3367 * @param who 術者モンスターID(0ならばプレイヤー)
3370 * @return 作用が実際にあった場合TRUEを返す
3372 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3374 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3375 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3380 * @return 作用が実際にあった場合TRUEを返す
3382 void call_chaos(void)
3384 int Chaos_type, dummy, dir;
3385 PLAYER_LEVEL plev = p_ptr->lev;
3386 bool line_chaos = FALSE;
3388 int hurt_types[31] =
3390 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3391 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3392 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3393 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3394 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3395 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3396 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3397 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3400 Chaos_type = hurt_types[randint0(31)];
3401 if (one_in_(4)) line_chaos = TRUE;
3405 for (dummy = 1; dummy < 10; dummy++)
3410 fire_beam(Chaos_type, dummy, 150);
3412 fire_ball(Chaos_type, dummy, 150, 2);
3416 else if (one_in_(3))
3418 fire_ball(Chaos_type, 0, 500, 8);
3422 if (!get_aim_dir(&dir)) return;
3424 fire_beam(Chaos_type, dir, 250);
3426 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3431 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3432 * @param stop_ty 再帰処理停止フラグ
3434 * @return 作用が実際にあった場合TRUEを返す
3437 * rr9: Stop the nasty things when a Cyberdemon is summoned
3438 * or the player gets paralyzed.
3441 bool activate_ty_curse(bool stop_ty, int *count)
3445 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3449 switch (randint1(34))
3454 msg_print(_("地面が揺れた...", "The ground trembles..."));
3455 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3456 if (!one_in_(6)) break;
3461 HIT_POINT dam = damroll(10, 10);
3462 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3463 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3464 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3465 if (!one_in_(6)) break;
3470 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3471 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3472 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3473 if (!one_in_(6)) break;
3476 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3480 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3481 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3483 if (!one_in_(6)) break;
3484 case 1: case 2: case 3: case 16: case 17:
3485 aggravate_monsters(0);
3486 if (!one_in_(6)) break;
3487 case 4: case 5: case 6:
3488 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3489 if (!one_in_(6)) break;
3490 case 7: case 8: case 9: case 18:
3491 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3492 if (!one_in_(6)) break;
3493 case 10: case 11: case 12:
3494 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3495 lose_exp(p_ptr->exp / 16);
3496 if (!one_in_(6)) break;
3497 case 13: case 14: case 15: case 19: case 20:
3498 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3504 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3505 if (p_ptr->free_act)
3506 set_paralyzed(p_ptr->paralyzed + randint1(3));
3508 set_paralyzed(p_ptr->paralyzed + randint1(13));
3511 if (!one_in_(6)) break;
3512 case 21: case 22: case 23:
3513 (void)do_dec_stat(randint0(6));
3514 if (!one_in_(6)) break;
3516 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3518 if (!one_in_(6)) break;
3521 * Only summon Cyberdemons deep in the dungeon.
3523 if ((dun_level > 65) && !stop_ty)
3525 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3529 if (!one_in_(6)) break;
3535 (void)do_dec_stat(i);
3543 while (one_in_(3) && !stop_ty);
3549 * @brief HI_SUMMON(上級召喚)処理発動
3552 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3553 * @return 作用が実際にあった場合TRUEを返す
3555 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3560 BIT_FLAGS mode = PM_ALLOW_GROUP;
3567 mode |= PM_FORCE_FRIENDLY;
3571 mode |= PM_FORCE_PET;
3576 if (!pet) mode |= PM_NO_PET;
3578 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3580 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3582 switch (randint1(25) + (dun_level / 20))
3585 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3588 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3591 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3594 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3597 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3600 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3603 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3606 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3610 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3614 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3617 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3618 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3621 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3622 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3625 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3628 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3629 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3638 * @brief サイバーデーモンの召喚
3639 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3642 * @return 作用が実際にあった場合TRUEを返す
3644 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3647 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3649 BIT_FLAGS mode = PM_ALLOW_GROUP;
3651 /* Summoned by a monster */
3654 monster_type *m_ptr = &m_list[who];
3655 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3658 if (max_cyber > 4) max_cyber = 4;
3660 for (i = 0; i < max_cyber; i++)
3662 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3669 * @brief 周辺破壊効果(プレイヤー中心)
3670 * @return 作用が実際にあった場合TRUEを返す
3672 void wall_breaker(void)
3675 POSITION y = 0, x = 0;
3676 int attempts = 1000;
3678 if (randint1(80 + p_ptr->lev) < 70)
3682 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3684 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3686 if (!player_bold(y, x)) break;
3689 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3690 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3692 else if (randint1(100) > 30)
3694 earthquake(p_ptr->y, p_ptr->x, 1);
3698 int num = damroll(5, 3);
3700 for (i = 0; i < num; i++)
3704 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3706 if (!player_bold(y, x)) break;
3709 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3710 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3717 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3719 * @return 作用が実際にあった場合TRUEを返す
3721 bool confuse_monsters(HIT_POINT dam)
3723 return (project_hack(GF_OLD_CONF, dam));
3728 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3730 * @return 作用が実際にあった場合TRUEを返す
3732 bool charm_monsters(HIT_POINT dam)
3734 return (project_hack(GF_CHARM, dam));
3739 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3741 * @return 作用が実際にあった場合TRUEを返す
3743 bool charm_animals(HIT_POINT dam)
3745 return (project_hack(GF_CONTROL_ANIMAL, dam));
3750 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3752 * @return 作用が実際にあった場合TRUEを返す
3754 bool stun_monsters(HIT_POINT dam)
3756 return (project_hack(GF_STUN, dam));
3761 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3763 * @return 作用が実際にあった場合TRUEを返す
3765 bool stasis_monsters(HIT_POINT dam)
3767 return (project_hack(GF_STASIS, dam));
3772 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3774 * @return 作用が実際にあった場合TRUEを返す
3776 bool mindblast_monsters(HIT_POINT dam)
3778 return (project_hack(GF_PSI, dam));
3783 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3784 * @param dist 効力(距離)
3785 * @return 作用が実際にあった場合TRUEを返す
3787 bool banish_monsters(int dist)
3789 return (project_hack(GF_AWAY_ALL, dist));
3794 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3796 * @return 作用が実際にあった場合TRUEを返す
3798 bool turn_evil(HIT_POINT dam)
3800 return (project_hack(GF_TURN_EVIL, dam));
3805 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3807 * @return 作用が実際にあった場合TRUEを返す
3809 bool turn_monsters(HIT_POINT dam)
3811 return (project_hack(GF_TURN_ALL, dam));
3816 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3817 * @return 作用が実際にあった場合TRUEを返す
3819 bool deathray_monsters(void)
3821 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3825 * @brief チャーム・モンスター(1体)
3826 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3828 * @return 作用が実際にあった場合TRUEを返す
3830 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3832 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3833 return (project_hook(GF_CHARM, dir, plev, flg));
3837 * @brief アンデッド支配(1体)
3838 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3840 * @return 作用が実際にあった場合TRUEを返す
3842 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3844 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3845 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3850 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3852 * @return 作用が実際にあった場合TRUEを返す
3854 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3856 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3857 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3862 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3864 * @return 作用が実際にあった場合TRUEを返す
3866 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3868 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3869 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3875 * @param success 判定成功上の処理ならばTRUE
3876 * @return 作用が実際にあった場合TRUEを返す
3878 bool kawarimi(bool success)
3881 object_type *q_ptr = &forge;
3884 if (p_ptr->is_dead) return FALSE;
3885 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3886 if (randint0(200) < p_ptr->stun) return FALSE;
3888 if (!success && one_in_(3))
3890 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3891 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3892 p_ptr->redraw |= (PR_STATUS);
3899 teleport_player(10 + randint1(90), 0L);
3903 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3905 q_ptr->pval = MON_NINJA;
3907 /* Drop it in the dungeon */
3908 (void)drop_near(q_ptr, -1, y, x);
3911 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3912 else msg_print("失敗!攻撃を受けてしまった。");
3914 if (success) msg_print("You have turned around just before the attack hit you.");
3915 else msg_print("Failed! You are hit by the attack.");
3918 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3919 p_ptr->redraw |= (PR_STATUS);
3927 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3928 * @param mdeath 目標モンスターが死亡したかを返す
3929 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3931 bool rush_attack(bool *mdeath)
3938 bool tmp_mdeath = FALSE;
3941 if (mdeath) *mdeath = FALSE;
3944 if (!get_aim_dir(&dir)) return FALSE;
3946 /* Use the given direction */
3947 tx = p_ptr->x + project_length * ddx[dir];
3948 ty = p_ptr->y + project_length * ddy[dir];
3950 /* Hack -- Use an actual "target" */
3951 if ((dir == 5) && target_okay())
3957 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3959 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3962 /* No need to move */
3963 if (!path_n) return TRUE;
3965 /* Use ty and tx as to-move point */
3969 /* Project along the path */
3970 for (i = 0; i < path_n; i++)
3972 monster_type *m_ptr;
3974 int ny = GRID_Y(path_g[i]);
3975 int nx = GRID_X(path_g[i]);
3977 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3982 /* Go to next grid */
3986 if (!cave[ny][nx].m_idx)
3990 msg_print(_("失敗!", "Failed!"));
3994 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4001 /* Move player before updating the monster */
4002 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4003 update_monster(cave[ny][nx].m_idx, TRUE);
4005 /* Found a monster */
4006 m_ptr = &m_list[cave[ny][nx].m_idx];
4008 if (tm_idx != cave[ny][nx].m_idx)
4011 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4012 m_ptr->ml ? "モンスター" : "何か");
4014 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4017 else if (!player_bold(ty, tx))
4019 /* Hold the monster name */
4022 /* Get the monster name (BEFORE polymorphing) */
4023 monster_desc(m_name, m_ptr, 0);
4024 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4027 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4029 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4034 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4036 if (mdeath) *mdeath = tmp_mdeath;
4042 * @brief 全鏡の消去 / Remove all mirrors in this floor
4043 * @param explode 爆発処理を伴うならばTRUE
4046 void remove_all_mirrors(bool explode)
4050 for (x = 0; x < cur_wid; x++)
4052 for (y = 0; y < cur_hgt; y++)
4054 if (is_mirror_grid(&cave[y][x]))
4056 remove_mirror(y, x);
4058 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4059 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4066 * @brief 『一つの指輪』の効果処理 /
4067 * Hack -- activate the ring of power
4068 * @param dir 発動の方向ID
4071 void ring_of_power(DIRECTION dir)
4073 /* Pick a random effect */
4074 switch (randint1(10))
4079 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4082 /* Decrease all stats (permanently) */
4083 (void)dec_stat(A_STR, 50, TRUE);
4084 (void)dec_stat(A_INT, 50, TRUE);
4085 (void)dec_stat(A_WIS, 50, TRUE);
4086 (void)dec_stat(A_DEX, 50, TRUE);
4087 (void)dec_stat(A_CON, 50, TRUE);
4088 (void)dec_stat(A_CHR, 50, TRUE);
4090 /* Lose some experience (permanently) */
4091 p_ptr->exp -= (p_ptr->exp / 4);
4092 p_ptr->max_exp -= (p_ptr->exp / 4);
4100 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4102 /* Dispel monsters */
4103 dispel_monsters(1000);
4113 fire_ball(GF_MANA, dir, 600, 3);
4124 fire_bolt(GF_MANA, dir, 500);
4132 * @brief 運命の輪、並びにカオス的な効果の発動
4133 * @param spell ランダムな効果を選択するための基準ID
4136 void wild_magic(int spell)
4139 int type = SUMMON_MOLD + randint0(6);
4141 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4142 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4144 switch (randint1(spell) + randint1(8) + 1)
4149 teleport_player(10, TELEPORT_PASSIVE);
4154 teleport_player(100, TELEPORT_PASSIVE);
4158 teleport_player(200, TELEPORT_PASSIVE);
4168 lite_area(damroll(2, 3), 2);
4171 destroy_doors_touch();
4176 sleep_monsters_touch();
4180 trap_creation(p_ptr->y, p_ptr->x);
4189 aggravate_monsters(0);
4192 earthquake(p_ptr->y, p_ptr->x, 5);
4196 (void)gain_random_mutation(0);
4200 apply_disenchant(1);
4206 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4213 while (counter++ < 8)
4215 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4220 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4223 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4228 (void)activate_ty_curse(FALSE, &count);
4237 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4238 * / Drop 10+1d10 meteor ball at random places near the player
4243 void cast_meteor(HIT_POINT dam, POSITION rad)
4246 int b = 10 + randint1(10);
4248 for (i = 0; i < b; i++)
4250 POSITION y = 0, x = 0;
4253 for (count = 0; count <= 20; count++)
4257 x = p_ptr->x - 8 + randint0(17);
4258 y = p_ptr->y - 8 + randint0(17);
4260 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4261 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4263 /* Approximate distance */
4264 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4266 if (d >= 9) continue;
4268 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4269 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4271 /* Valid position */
4275 if (count > 20) continue;
4277 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4283 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4286 * @return ターゲットを指定し、実行したならばTRUEを返す。
4288 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4290 POSITION x, y, tx, ty;
4294 int b = 10 + randint1(10);
4296 if (!get_aim_dir(&dir)) return FALSE;
4298 /* Use the given direction */
4299 tx = p_ptr->x + 99 * ddx[dir];
4300 ty = p_ptr->y + 99 * ddy[dir];
4302 /* Hack -- Use an actual "target" */
4303 if ((dir == 5) && target_okay())
4314 /* Hack -- Stop at the target */
4315 if ((y == ty) && (x == tx)) break;
4319 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4321 /* Stop at maximum range */
4322 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4324 /* Stopped by walls/doors */
4325 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4327 /* Stopped by monsters */
4328 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4330 /* Save the new location */
4337 for (i = 0; i < b; i++)
4339 int count = 20, d = 0;
4345 x = tx - 5 + randint0(11);
4346 y = ty - 5 + randint0(11);
4348 dx = (tx > x) ? (tx - x) : (x - tx);
4349 dy = (ty > y) ? (ty - y) : (y - ty);
4351 /* Approximate distance */
4352 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4353 /* Within the radius */
4357 if (count < 0) continue;
4359 /* Cannot penetrate perm walls */
4360 if (!in_bounds(y, x) ||
4361 cave_stop_disintegration(y, x) ||
4362 !in_disintegration_range(ty, tx, y, x))
4365 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4372 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4376 * This spell should become more useful (more controlled) as the\n
4377 * player gains experience levels. Thus, add 1/5 of the player's\n
4378 * level to the die roll. This eliminates the worst effects later on,\n
4379 * while keeping the results quite random. It also allows some potent\n
4380 * effects only at high level.
4382 void cast_wonder(DIRECTION dir)
4384 PLAYER_LEVEL plev = p_ptr->lev;
4385 int die = randint1(100) + plev / 5;
4386 int vir = virtue_number(V_CHANCE);
4390 if (p_ptr->virtues[vir - 1] > 0)
4392 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4396 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4401 chg_virtue(V_CHANCE, 1);
4405 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4408 if (die < 8) clone_monster(dir);
4409 else if (die < 14) speed_monster(dir, plev);
4410 else if (die < 26) heal_monster(dir, damroll(4, 6));
4411 else if (die < 31) poly_monster(dir, plev);
4413 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4414 damroll(3 + ((plev - 1) / 5), 4));
4415 else if (die < 41) confuse_monster(dir, plev);
4416 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4417 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4419 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4420 damroll(3 + ((plev - 5) / 4), 8));
4422 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4423 damroll(5 + ((plev - 5) / 4), 8));
4425 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4426 damroll(6 + ((plev - 5) / 4), 8));
4428 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4429 damroll(8 + ((plev - 5) / 4), 8));
4430 else if (die < 76) hypodynamic_bolt(dir, 75);
4431 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4432 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4433 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4434 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4435 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4438 earthquake(p_ptr->y, p_ptr->x, 12);
4442 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4446 symbol_genocide(plev + 50, TRUE);
4448 else if (die < 110) dispel_monsters(120);
4451 dispel_monsters(150);
4452 slow_monsters(plev);
4453 sleep_monsters(plev);
4460 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4464 void cast_invoke_spirits(DIRECTION dir)
4466 PLAYER_LEVEL plev = p_ptr->lev;
4467 int die = randint1(100) + plev / 5;
4468 int vir = virtue_number(V_CHANCE);
4472 if (p_ptr->virtues[vir - 1] > 0)
4474 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4478 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4482 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4484 chg_virtue(V_CHANCE, 1);
4488 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4493 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4494 "Oh no! Mouldering forms rise from the earth around you!"));
4496 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4497 chg_virtue(V_UNLIFE, 1);
4501 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4503 set_afraid(p_ptr->afraid + randint1(4) + 4);
4507 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4508 "Your head is invaded by a horde of gibbering spectral voices..."));
4510 set_confused(p_ptr->confused + randint1(4) + 4);
4514 poly_monster(dir, plev);
4518 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4519 damroll(3 + ((plev - 1) / 5), 4));
4523 confuse_monster(dir, plev);
4527 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4531 (void)lite_line(dir, damroll(6, 8));
4535 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4536 damroll(3 + ((plev - 5) / 4), 8));
4540 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4541 damroll(5 + ((plev - 5) / 4), 8));
4545 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4546 damroll(6 + ((plev - 5) / 4), 8));
4550 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4551 damroll(8 + ((plev - 5) / 4), 8));
4555 hypodynamic_bolt(dir, 75);
4559 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4563 fire_ball(GF_ACID, dir, 40 + plev, 2);
4567 fire_ball(GF_ICE, dir, 70 + plev, 3);
4571 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4575 hypodynamic_bolt(dir, 100 + plev);
4579 earthquake(p_ptr->y, p_ptr->x, 12);
4583 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4587 symbol_genocide(plev + 50, TRUE);
4591 dispel_monsters(120);
4595 dispel_monsters(150);
4596 slow_monsters(plev);
4597 sleep_monsters(plev);
4603 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4604 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4609 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4612 void cast_shuffle(void)
4614 PLAYER_LEVEL plev = p_ptr->lev;
4617 int vir = virtue_number(V_CHANCE);
4620 /* Card sharks and high mages get a level bonus */
4621 if ((p_ptr->pclass == CLASS_ROGUE) ||
4622 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4623 (p_ptr->pclass == CLASS_SORCERER))
4624 die = (randint1(110)) + plev / 5;
4626 die = randint1(120);
4631 if (p_ptr->virtues[vir - 1] > 0)
4633 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4637 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4641 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4644 chg_virtue(V_CHANCE, 1);
4648 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4650 for (i = 0; i < randint1(3); i++)
4651 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4655 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4656 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4661 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4662 activate_ty_curse(FALSE, &count);
4666 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4667 aggravate_monsters(0);
4671 msg_print(_("《愚者》だ。", "It's the Fool."));
4677 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4678 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4682 msg_print(_("《月》だ。", "It's the Moon."));
4687 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4688 wild_magic(randint0(32));
4692 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4693 teleport_player(10, TELEPORT_PASSIVE);
4697 msg_print(_("《正義》だ。", "It's Justice."));
4698 set_blessed(p_ptr->lev, FALSE);
4702 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4703 teleport_player(100, TELEPORT_PASSIVE);
4707 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4708 teleport_player(200, TELEPORT_PASSIVE);
4712 msg_print(_("《塔》だ。", "It's the Tower."));
4717 msg_print(_("《節制》だ。", "It's Temperance."));
4718 sleep_monsters_touch();
4722 msg_print(_("《塔》だ。", "It's the Tower."));
4724 earthquake(p_ptr->y, p_ptr->x, 5);
4728 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4729 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4733 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4734 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4738 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4739 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4743 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4744 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4748 msg_print(_("《恋人》だ。", "It's the Lovers."));
4750 if (get_aim_dir(&dir))
4751 charm_monster(dir, MIN(p_ptr->lev, 20));
4755 msg_print(_("《隠者》だ。", "It's the Hermit."));
4760 msg_print(_("《審判》だ。", "It's the Judgement."));
4761 do_cmd_rerate(FALSE);
4762 lose_all_mutations();
4766 msg_print(_("《太陽》だ。", "It's the Sun."));
4767 chg_virtue(V_KNOWLEDGE, 1);
4768 chg_virtue(V_ENLIGHTEN, 1);
4773 msg_print(_("《世界》だ。", "It's the World."));
4774 if (p_ptr->exp < PY_MAX_EXP)
4776 s32b ee = (p_ptr->exp / 25) + 1;
4777 if (ee > 5000) ee = 5000;
4778 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4784 bool_hack life_stream(bool_hack message, bool_hack virtue)
4788 chg_virtue(V_VITALITY, 1);
4789 chg_virtue(V_UNLIFE, -5);
4793 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4796 (void)set_poisoned(0);
4798 (void)set_confused(0);
4802 (void)restore_all_status();
4803 (void)set_shero(0, TRUE);
4810 bool_hack heroism(int base)
4812 bool_hack ident = FALSE;
4813 if(set_afraid(0)) ident = TRUE;
4814 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4815 if(hp_player(10)) ident = TRUE;
4819 bool_hack berserk(int base)
4821 bool_hack ident = FALSE;
4822 if (set_afraid(0)) ident = TRUE;
4823 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4824 if (hp_player(30)) ident = TRUE;
4828 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4830 bool_hack ident = FALSE;
4831 if (hp_player(damroll(dice, sides))) ident = TRUE;
4832 if (set_blind(0)) ident = TRUE;
4833 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4834 if (set_shero(0, TRUE)) ident = TRUE;
4838 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4840 bool_hack ident = FALSE;
4841 if (hp_player(damroll(dice, sides))) ident = TRUE;
4842 if (set_blind(0)) ident = TRUE;
4843 if (set_confused(0)) ident = TRUE;
4844 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4845 if (set_shero(0, TRUE)) ident = TRUE;
4849 bool_hack cure_critical_wounds(HIT_POINT pow)
4851 bool_hack ident = FALSE;
4852 if (hp_player(pow)) ident = TRUE;
4853 if (set_blind(0)) ident = TRUE;
4854 if (set_confused(0)) ident = TRUE;
4855 if (set_poisoned(0)) ident = TRUE;
4856 if (set_stun(0)) ident = TRUE;
4857 if (set_cut(0)) ident = TRUE;
4858 if (set_shero(0, TRUE)) ident = TRUE;
4862 bool_hack true_healing(HIT_POINT pow)
4864 bool_hack ident = FALSE;
4865 if (hp_player(pow)) ident = TRUE;
4866 if (set_blind(0)) ident = TRUE;
4867 if (set_confused(0)) ident = TRUE;
4868 if (set_poisoned(0)) ident = TRUE;
4869 if (set_stun(0)) ident = TRUE;
4870 if (set_cut(0)) ident = TRUE;
4871 if (set_image(0)) ident = TRUE;
4875 bool_hack restore_mana(bool_hack magic_eater)
4877 bool_hack ident = FALSE;
4879 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4882 for (i = 0; i < EATER_EXT * 2; i++)
4884 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4885 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;
4887 for (; i < EATER_EXT * 3; i++)
4889 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4890 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;
4891 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4893 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4894 p_ptr->window |= (PW_PLAYER);
4897 else if (p_ptr->csp < p_ptr->msp)
4899 p_ptr->csp = p_ptr->msp;
4900 p_ptr->csp_frac = 0;
4901 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4902 p_ptr->redraw |= (PR_MANA);
4903 p_ptr->window |= (PW_PLAYER);
4904 p_ptr->window |= (PW_SPELL);
4911 bool restore_all_status(void)
4914 if (do_res_stat(A_STR)) ident = TRUE;
4915 if (do_res_stat(A_INT)) ident = TRUE;
4916 if (do_res_stat(A_WIS)) ident = TRUE;
4917 if (do_res_stat(A_DEX)) ident = TRUE;
4918 if (do_res_stat(A_CON)) ident = TRUE;
4919 if (do_res_stat(A_CHR)) ident = TRUE;
4924 * @brief 口を使う継続的な処理を中断する
4927 void stop_mouth(void)
4929 if (music_singing_any()) stop_singing();
4930 if (hex_spelling_any()) stop_hex_spell_all();
4934 bool_hack vampirism(void)
4941 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4943 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4947 /* Only works on adjacent monsters */
4948 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4949 y = p_ptr->y + ddy[dir];
4950 x = p_ptr->x + ddx[dir];
4951 c_ptr = &cave[y][x];
4955 if (!(c_ptr->m_idx))
4957 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4961 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4963 dummy = p_ptr->lev * 2;
4965 if (hypodynamic_bolt(dir, dummy))
4967 if (p_ptr->food < PY_FOOD_FULL)
4968 /* No heal if we are "full" */
4969 (void)hp_player(dummy);
4971 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4973 /* Gain nutritional sustenance: 150/hp drained */
4974 /* A Food ration gives 5000 food points (by contrast) */
4975 /* Don't ever get more than "Full" this way */
4976 /* But if we ARE Gorged, it won't cure us */
4977 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4978 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4979 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4982 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4986 bool panic_hit(void)
4991 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4992 y = p_ptr->y + ddy[dir];
4993 x = p_ptr->x + ddx[dir];
4994 if (cave[y][x].m_idx)
4997 if (randint0(p_ptr->skill_dis) < 7)
4998 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5000 teleport_player(30, 0L);
5005 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5013 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5016 * currently this function allows pseudo-id of any object,
5017 * including silly ones like potions & scrolls, which always
5018 * get '{average}'. This should be changed, either to stop such
5019 * items from being pseudo-id'd, or to allow psychometry to
5020 * detect whether the unidentified potion/scroll/etc is
5021 * good (Cure Light Wounds, Restore Strength, etc) or
5022 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5024 bool psychometry(void)
5028 char o_name[MAX_NLEN];
5033 item_tester_no_ryoute = TRUE;
5034 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5035 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5037 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5039 /* Get the item (in the pack) */
5042 o_ptr = &inventory[item];
5045 /* Get the item (on the floor) */
5048 o_ptr = &o_list[0 - item];
5051 /* It is fully known, no information needed */
5052 if (object_is_known(o_ptr))
5054 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5058 /* Check for a feeling */
5059 feel = value_check_aux1(o_ptr);
5061 /* Get an object description */
5062 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5064 /* Skip non-feelings */
5067 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5072 msg_format("%sは%sという感じがする...",
5073 o_name, game_inscriptions[feel]);
5075 msg_format("You feel that the %s %s %s...",
5076 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5077 game_inscriptions[feel]);
5081 /* We have "felt" it */
5082 o_ptr->ident |= (IDENT_SENSE);
5085 o_ptr->feeling = feel;
5087 /* Player touches it */
5088 o_ptr->marked |= OM_TOUCHED;
5090 /* Combine / Reorder the pack (later) */
5091 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5093 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5095 /* Valid "tval" codes */
5096 switch (o_ptr->tval)
5124 /* Auto-inscription/destroy */
5125 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5127 /* Something happened */