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);
59 if (cave_have_flag_grid(c_ptr, flag))
64 /* Hack -- Memorize */
65 c_ptr->info |= (CAVE_MARK);
79 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
81 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
82 * @return 効力があった場合TRUEを返す
84 bool detect_traps(POSITION range, bool known)
86 bool detect = detect_feat_flag(range, FF_TRAP, known);
88 if (known) p_ptr->dtrap = TRUE;
90 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
93 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
100 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
102 * @return 効力があった場合TRUEを返す
104 bool detect_doors(POSITION range)
106 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
108 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
111 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
118 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
120 * @return 効力があった場合TRUEを返す
122 bool detect_stairs(POSITION range)
124 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
126 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
129 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
136 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
138 * @return 効力があった場合TRUEを返す
140 bool detect_treasure(POSITION range)
142 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
144 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
147 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
154 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
156 * @return 効力があった場合TRUEを返す
158 bool detect_objects_gold(POSITION range)
161 POSITION range2 = range;
165 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
168 for (i = 1; i < o_max; i++)
170 object_type *o_ptr = &o_list[i];
172 /* Skip dead objects */
173 if (!o_ptr->k_idx) continue;
175 /* Skip held objects */
176 if (o_ptr->held_m_idx) continue;
181 /* Only detect nearby objects */
182 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
184 /* Detect "gold" objects */
185 if (o_ptr->tval == TV_GOLD)
187 o_ptr->marked |= OM_FOUND;
193 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
196 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
199 if (detect_monsters_string(range, "$"))
208 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
210 * @return 効力があった場合TRUEを返す
212 bool detect_objects_normal(POSITION range)
215 POSITION range2 = range;
219 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
222 for (i = 1; i < o_max; i++)
224 object_type *o_ptr = &o_list[i];
226 /* Skip dead objects */
227 if (!o_ptr->k_idx) continue;
229 /* Skip held objects */
230 if (o_ptr->held_m_idx) continue;
235 /* Only detect nearby objects */
236 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
238 /* Detect "real" objects */
239 if (o_ptr->tval != TV_GOLD)
241 o_ptr->marked |= OM_FOUND;
247 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
250 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
253 if (detect_monsters_string(range, "!=?|/`"))
262 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
264 * @return 効力があった場合TRUEを返す
267 * This will light up all spaces with "magic" items, including artifacts,
268 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
269 * and "enchanted" items of the "good" variety.
271 * It can probably be argued that this function is now too powerful.
274 bool detect_objects_magic(POSITION range)
280 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
282 /* Scan all objects */
283 for (i = 1; i < o_max; i++)
285 object_type *o_ptr = &o_list[i];
287 /* Skip dead objects */
288 if (!o_ptr->k_idx) continue;
290 /* Skip held objects */
291 if (o_ptr->held_m_idx) continue;
296 /* Only detect nearby objects */
297 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
299 /* Examine the tval */
302 /* Artifacts, misc magic items, or enchanted wearables */
303 if (object_is_artifact(o_ptr) ||
304 object_is_ego(o_ptr) ||
305 (tv == TV_WHISTLE) ||
313 (tv == TV_LIFE_BOOK) ||
314 (tv == TV_SORCERY_BOOK) ||
315 (tv == TV_NATURE_BOOK) ||
316 (tv == TV_CHAOS_BOOK) ||
317 (tv == TV_DEATH_BOOK) ||
318 (tv == TV_TRUMP_BOOK) ||
319 (tv == TV_ARCANE_BOOK) ||
320 (tv == TV_CRAFT_BOOK) ||
321 (tv == TV_DAEMON_BOOK) ||
322 (tv == TV_CRUSADE_BOOK) ||
323 (tv == TV_MUSIC_BOOK) ||
324 (tv == TV_HISSATSU_BOOK) ||
325 (tv == TV_HEX_BOOK) ||
326 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
328 /* Memorize the item */
329 o_ptr->marked |= OM_FOUND;
336 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
345 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
347 * @return 効力があった場合TRUEを返す
349 bool detect_monsters_normal(POSITION range)
356 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
359 for (i = 1; i < m_max; i++)
361 monster_type *m_ptr = &m_list[i];
362 monster_race *r_ptr = &r_info[m_ptr->r_idx];
364 /* Skip dead monsters */
365 if (!m_ptr->r_idx) continue;
370 /* Only detect nearby monsters */
371 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
373 /* Detect all non-invisible monsters */
374 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
376 /* Repair visibility later */
377 repair_monsters = TRUE;
379 /* Hack -- Detect monster */
380 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
381 update_monster(i, FALSE);
386 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
389 /* Describe result */
390 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
397 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
399 * @return 効力があった場合TRUEを返す
401 bool detect_monsters_invis(POSITION range)
407 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
410 for (i = 1; i < m_max; i++)
412 monster_type *m_ptr = &m_list[i];
413 monster_race *r_ptr = &r_info[m_ptr->r_idx];
415 /* Skip dead monsters */
416 if (!m_ptr->r_idx) continue;
421 /* Only detect nearby monsters */
422 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
424 /* Detect invisible monsters */
425 if (r_ptr->flags2 & RF2_INVISIBLE)
427 /* Update monster recall window */
428 if (p_ptr->monster_race_idx == m_ptr->r_idx)
430 p_ptr->window |= (PW_MONSTER);
433 /* Repair visibility later */
434 repair_monsters = TRUE;
436 /* Hack -- Detect monster */
437 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
438 update_monster(i, FALSE);
443 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
446 /* Describe result */
447 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
453 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
455 * @return 効力があった場合TRUEを返す
457 bool detect_monsters_evil(POSITION range)
463 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
466 for (i = 1; i < m_max; i++)
468 monster_type *m_ptr = &m_list[i];
469 monster_race *r_ptr = &r_info[m_ptr->r_idx];
471 /* Skip dead monsters */
472 if (!m_ptr->r_idx) continue;
477 /* Only detect nearby monsters */
478 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
480 /* Detect evil monsters */
481 if (r_ptr->flags3 & RF3_EVIL)
483 if (is_original_ap(m_ptr))
485 /* Take note that they are evil */
486 r_ptr->r_flags3 |= (RF3_EVIL);
488 /* Update monster recall window */
489 if (p_ptr->monster_race_idx == m_ptr->r_idx)
491 p_ptr->window |= (PW_MONSTER);
495 /* Repair visibility later */
496 repair_monsters = TRUE;
498 /* Hack -- Detect monster */
499 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
500 update_monster(i, FALSE);
506 /* Describe result */
507 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
513 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
515 * @return 効力があった場合TRUEを返す
517 bool detect_monsters_nonliving(POSITION range)
523 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
526 for (i = 1; i < m_max; i++)
528 monster_type *m_ptr = &m_list[i];
529 monster_race *r_ptr = &r_info[m_ptr->r_idx];
531 /* Skip dead monsters */
532 if (!m_ptr->r_idx) continue;
537 /* Only detect nearby monsters */
538 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
540 /* Detect non-living monsters */
541 if (!monster_living(r_ptr))
543 /* Update monster recall window */
544 if (p_ptr->monster_race_idx == m_ptr->r_idx)
546 p_ptr->window |= (PW_MONSTER);
549 /* Repair visibility later */
550 repair_monsters = TRUE;
552 /* Hack -- Detect monster */
553 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
554 update_monster(i, FALSE);
560 /* Describe result */
561 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
567 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
569 * @return 効力があった場合TRUEを返す
571 bool detect_monsters_mind(POSITION range)
577 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
580 for (i = 1; i < m_max; i++)
582 monster_type *m_ptr = &m_list[i];
583 monster_race *r_ptr = &r_info[m_ptr->r_idx];
585 /* Skip dead monsters */
586 if (!m_ptr->r_idx) continue;
591 /* Only detect nearby monsters */
592 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
594 /* Detect non-living monsters */
595 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
597 /* Update monster recall window */
598 if (p_ptr->monster_race_idx == m_ptr->r_idx)
600 p_ptr->window |= (PW_MONSTER);
603 /* Repair visibility later */
604 repair_monsters = TRUE;
606 /* Hack -- Detect monster */
607 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
608 update_monster(i, FALSE);
614 /* Describe result */
615 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
622 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
624 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
625 * @return 効力があった場合TRUEを返す
627 bool detect_monsters_string(POSITION range, cptr Match)
633 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
636 for (i = 1; i < m_max; i++)
638 monster_type *m_ptr = &m_list[i];
639 monster_race *r_ptr = &r_info[m_ptr->r_idx];
641 /* Skip dead monsters */
642 if (!m_ptr->r_idx) continue;
647 /* Only detect nearby monsters */
648 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
650 /* Detect monsters with the same symbol */
651 if (my_strchr(Match, r_ptr->d_char))
653 /* Update monster recall window */
654 if (p_ptr->monster_race_idx == m_ptr->r_idx)
656 p_ptr->window |= (PW_MONSTER);
659 /* Repair visibility later */
660 repair_monsters = TRUE;
662 /* Hack -- Detect monster */
663 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
664 update_monster(i, FALSE);
669 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
672 /* Describe result */
673 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
679 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
681 * @param match_flag 感知フラグ
682 * @return 効力があった場合TRUEを返す
684 bool detect_monsters_xxx(POSITION range, u32b match_flag)
689 cptr desc_monsters = _("変なモンスター", "weird monsters");
691 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
694 for (i = 1; i < m_max; i++)
696 monster_type *m_ptr = &m_list[i];
697 monster_race *r_ptr = &r_info[m_ptr->r_idx];
699 /* Skip dead monsters */
700 if (!m_ptr->r_idx) continue;
705 /* Only detect nearby monsters */
706 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
708 /* Detect evil monsters */
709 if (r_ptr->flags3 & (match_flag))
711 if (is_original_ap(m_ptr))
713 /* Take note that they are something */
714 r_ptr->r_flags3 |= (match_flag);
716 /* Update monster recall window */
717 if (p_ptr->monster_race_idx == m_ptr->r_idx)
719 p_ptr->window |= (PW_MONSTER);
723 /* Repair visibility later */
724 repair_monsters = TRUE;
726 /* Hack -- Detect monster */
727 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
728 update_monster(i, FALSE);
737 desc_monsters = _("デーモン", "demons");
740 desc_monsters = _("アンデッド", "the undead");
744 /* Describe result */
745 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
753 * @brief 全感知処理 / Detect everything
755 * @return 効力があった場合TRUEを返す
757 bool detect_all(POSITION range)
761 /* Detect everything */
762 if (detect_traps(range, TRUE)) detect = TRUE;
763 if (detect_doors(range)) detect = TRUE;
764 if (detect_stairs(range)) detect = TRUE;
766 /* There are too many hidden treasure. So... */
767 /* if (detect_treasure(range)) detect = TRUE; */
769 if (detect_objects_gold(range)) detect = TRUE;
770 if (detect_objects_normal(range)) detect = TRUE;
771 if (detect_monsters_invis(range)) detect = TRUE;
772 if (detect_monsters_normal(range)) detect = TRUE;
778 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
781 * @return 効力があった場合TRUEを返す
784 * Note that affected monsters are NOT auto-tracked by this usage.
786 * To avoid misbehavior when monster deaths have side-effects,
787 * this is done in two passes. -- JDL
790 bool project_hack(EFFECT_ID typ, HIT_POINT dam)
794 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
795 bool obvious = FALSE;
798 /* Mark all (nearby) monsters */
799 for (i = 1; i < m_max; i++)
801 monster_type *m_ptr = &m_list[i];
803 /* Paranoia -- Skip dead monsters */
804 if (!m_ptr->r_idx) continue;
809 /* Require line of sight */
810 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
812 /* Mark the monster */
813 m_ptr->mflag |= (MFLAG_TEMP);
816 /* Affect all marked monsters */
817 for (i = 1; i < m_max; i++)
819 monster_type *m_ptr = &m_list[i];
821 /* Skip unmarked monsters */
822 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
825 m_ptr->mflag &= ~(MFLAG_TEMP);
830 /* Jump directly to the target monster */
831 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
838 * @brief 視界内モンスターを加速する処理 / Speed monsters
839 * @return 効力があった場合TRUEを返す
841 bool speed_monsters(void)
843 return (project_hack(GF_OLD_SPEED, p_ptr->lev));
847 * @brief 視界内モンスターを加速する処理 / Slow monsters
848 * @return 効力があった場合TRUEを返す
850 bool slow_monsters(int power)
852 return (project_hack(GF_OLD_SLOW, power));
856 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
857 * @return 効力があった場合TRUEを返す
859 bool sleep_monsters(int power)
861 return (project_hack(GF_OLD_SLEEP, power));
865 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
866 * @return 効力があった場合TRUEを返す
868 bool banish_evil(int dist)
870 return (project_hack(GF_AWAY_EVIL, dist));
874 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
875 * @return 効力があった場合TRUEを返す
877 bool turn_undead(void)
879 bool tester = (project_hack(GF_TURN_UNDEAD, p_ptr->lev));
881 chg_virtue(V_UNLIFE, -1);
886 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
887 * @return 効力があった場合TRUEを返す
889 bool dispel_undead(HIT_POINT dam)
891 bool tester = (project_hack(GF_DISP_UNDEAD, dam));
893 chg_virtue(V_UNLIFE, -2);
898 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
899 * @return 効力があった場合TRUEを返す
901 bool dispel_evil(HIT_POINT dam)
903 return (project_hack(GF_DISP_EVIL, dam));
907 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
908 * @return 効力があった場合TRUEを返す
910 bool dispel_good(HIT_POINT dam)
912 return (project_hack(GF_DISP_GOOD, dam));
916 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
917 * @return 効力があった場合TRUEを返す
919 bool dispel_monsters(HIT_POINT dam)
921 return (project_hack(GF_DISP_ALL, dam));
925 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
926 * @return 効力があった場合TRUEを返す
928 bool dispel_living(HIT_POINT dam)
930 return (project_hack(GF_DISP_LIVING, dam));
934 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
935 * @return 効力があった場合TRUEを返す
937 bool dispel_demons(HIT_POINT dam)
939 return (project_hack(GF_DISP_DEMON, dam));
943 * @brief 視界内のモンスターに「聖戦」効果を与える処理
944 * @return 効力があった場合TRUEを返す
948 return (project_hack(GF_CRUSADE, p_ptr->lev*4));
952 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
953 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
956 void aggravate_monsters(MONSTER_IDX who)
962 /* Aggravate everyone nearby */
963 for (i = 1; i < m_max; i++)
965 monster_type *m_ptr = &m_list[i];
966 /* monster_race *r_ptr = &r_info[m_ptr->r_idx]; */
968 /* Paranoia -- Skip dead monsters */
969 if (!m_ptr->r_idx) continue;
971 /* Skip aggravating monster (or player) */
972 if (i == who) continue;
974 /* Wake up nearby sleeping monsters */
975 if (m_ptr->cdis < MAX_SIGHT * 2)
978 if (MON_CSLEEP(m_ptr))
980 (void)set_monster_csleep(i, 0);
983 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
986 /* Speed up monsters in line of sight */
987 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
991 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
997 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
998 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
999 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1004 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1005 * @param m_idx 抹殺するモンスターID
1006 * @param power 抹殺の威力
1007 * @param player_cast プレイヤーの魔法によるものならば TRUE
1008 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1009 * @param spell_name 抹殺効果を起こした魔法の名前
1010 * @return 効力があった場合TRUEを返す
1012 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
1014 int msec = delay_factor * delay_factor * delay_factor;
1015 monster_type *m_ptr = &m_list[m_idx];
1016 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1017 bool resist = FALSE;
1019 if (is_pet(m_ptr) && !player_cast) return FALSE;
1021 /* Hack -- Skip Unique Monsters or Quest Monsters */
1022 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1023 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1024 else if (m_idx == p_ptr->riding) resist = TRUE;
1025 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1026 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1027 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1032 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1036 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1037 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1040 delete_monster_idx(m_idx);
1043 if (resist && player_cast)
1045 bool see_m = is_seen(m_ptr);
1048 monster_desc(m_name, m_ptr, 0);
1051 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1053 if (MON_CSLEEP(m_ptr))
1055 (void)set_monster_csleep(m_idx, 0);
1058 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1061 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1065 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1069 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1074 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1077 /* Visual feedback */
1078 move_cursor_relative(p_ptr->y, p_ptr->x);
1081 p_ptr->redraw |= (PR_HP);
1082 p_ptr->window |= (PW_PLAYER);
1088 Term_xtra(TERM_XTRA_DELAY, msec);
1095 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1096 * @param power 抹殺の威力
1097 * @param player_cast プレイヤーの魔法によるものならば TRUE
1098 * @return 効力があった場合TRUEを返す
1100 bool symbol_genocide(int power, bool player_cast)
1104 bool result = FALSE;
1106 /* Prevent genocide in quest levels */
1107 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1112 /* Mega-Hack -- Get a monster symbol */
1113 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1115 /* Delete the monsters of that "type" */
1116 for (i = 1; i < m_max; i++)
1118 monster_type *m_ptr = &m_list[i];
1119 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1121 /* Paranoia -- Skip dead monsters */
1122 if (!m_ptr->r_idx) continue;
1124 /* Skip "wrong" monsters */
1125 if (r_ptr->d_char != typ) continue;
1128 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1133 chg_virtue(V_VITALITY, -2);
1134 chg_virtue(V_CHANCE, -1);
1142 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1143 * @param power 抹殺の威力
1144 * @param player_cast プレイヤーの魔法によるものならば TRUE
1145 * @return 効力があった場合TRUEを返す
1147 bool mass_genocide(int power, bool player_cast)
1150 bool result = FALSE;
1152 /* Prevent mass genocide in quest levels */
1153 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1158 /* Delete the (nearby) monsters */
1159 for (i = 1; i < m_max; i++)
1161 monster_type *m_ptr = &m_list[i];
1163 /* Paranoia -- Skip dead monsters */
1164 if (!m_ptr->r_idx) continue;
1166 /* Skip distant monsters */
1167 if (m_ptr->cdis > MAX_SIGHT) continue;
1170 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1175 chg_virtue(V_VITALITY, -2);
1176 chg_virtue(V_CHANCE, -1);
1184 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1185 * @param power 抹殺の威力
1186 * @param player_cast プレイヤーの魔法によるものならば TRUE
1187 * @return 効力があった場合TRUEを返す
1189 bool mass_genocide_undead(int power, bool player_cast)
1192 bool result = FALSE;
1194 /* Prevent mass genocide in quest levels */
1195 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1200 /* Delete the (nearby) monsters */
1201 for (i = 1; i < m_max; i++)
1203 monster_type *m_ptr = &m_list[i];
1204 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1206 /* Paranoia -- Skip dead monsters */
1207 if (!m_ptr->r_idx) continue;
1209 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1211 /* Skip distant monsters */
1212 if (m_ptr->cdis > MAX_SIGHT) continue;
1215 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1220 chg_virtue(V_UNLIFE, -2);
1221 chg_virtue(V_CHANCE, -1);
1229 * @brief 周辺モンスターを調査する / Probe nearby monsters
1230 * @return 効力があった場合TRUEを返す
1246 /* Probe all (nearby) monsters */
1247 for (i = 1; i < m_max; i++)
1249 monster_type *m_ptr = &m_list[i];
1250 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1252 /* Paranoia -- Skip dead monsters */
1253 if (!m_ptr->r_idx) continue;
1255 /* Require line of sight */
1256 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1258 /* Probe visible monsters */
1263 /* Start the message */
1266 msg_print(_("調査中...", "Probing..."));
1271 if (!is_original_ap(m_ptr))
1273 if (m_ptr->mflag2 & MFLAG2_KAGE)
1274 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1276 m_ptr->ap_r_idx = m_ptr->r_idx;
1277 lite_spot(m_ptr->fy, m_ptr->fx);
1279 /* Get "the monster" or "something" */
1280 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1282 speed = m_ptr->mspeed - 110;
1283 if (MON_FAST(m_ptr)) speed += 10;
1284 if (MON_SLOW(m_ptr)) speed -= 10;
1285 if (ironman_nightmare) speed += 5;
1287 /* Get the monster's alignment */
1288 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1289 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1290 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1291 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1292 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1293 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1294 else align = _("中立", "neutral");
1296 /* Describe the monster */
1297 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1298 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1300 if (r_ptr->next_r_idx)
1302 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1306 strcat(buf, "xxx ");
1309 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1310 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1311 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1312 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1313 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1314 buf[strlen(buf)-1] = '\0';
1317 /* HACK : Add the line to message buffer */
1319 p_ptr->window |= (PW_MESSAGE);
1322 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1325 Term_erase(0, 0, 255);
1327 /* Learn everything about this monster */
1328 if (lore_do_probe(m_ptr->r_idx))
1330 /* Get base name of monster */
1331 strcpy(buf, (r_name + r_ptr->name));
1334 /* Note that we learnt some new flags -Mogami- */
1335 msg_format("%sについてさらに詳しくなった気がする。", buf);
1340 /* Note that we learnt some new flags -Mogami- */
1341 msg_format("You now know more about %s.", buf);
1343 /* Clear -more- prompt */
1358 chg_virtue(V_KNOWLEDGE, 1);
1359 msg_print(_("これで全部です。", "That's all."));
1367 * @brief *破壊*処理を行う / The spell of destruction
1368 * @param y1 破壊の中心Y座標
1369 * @param x1 破壊の中心X座標
1371 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1372 * @return 効力があった場合TRUEを返す
1375 * This spell "deletes" monsters (instead of "killing" them).
1377 * Later we may use one function for both "destruction" and
1378 * "earthquake" by using the "full" to select "destruction".
1381 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1388 /* Prevent destruction of quest levels and town */
1389 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1394 /* Lose monster light */
1395 if (!in_generate) clear_mon_lite();
1397 /* Big area of affect */
1398 for (y = (y1 - r); y <= (y1 + r); y++)
1400 for (x = (x1 - r); x <= (x1 + r); x++)
1402 /* Skip illegal grids */
1403 if (!in_bounds(y, x)) continue;
1405 /* Extract the distance */
1406 k = distance(y1, x1, y, x);
1408 /* Stay in the circle of death */
1409 if (k > r) continue;
1410 c_ptr = &cave[y][x];
1412 /* Lose room and vault */
1413 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1415 /* Lose light and knowledge */
1416 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1418 if (!in_generate) /* Normal */
1421 c_ptr->info &= ~(CAVE_UNSAFE);
1423 /* Hack -- Notice player affect */
1424 if (player_bold(y, x))
1426 /* Hurt the player later */
1429 /* Do not hurt this grid */
1434 /* Hack -- Skip the epicenter */
1435 if ((y == y1) && (x == x1)) continue;
1439 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1440 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1442 if (in_generate) /* In generation */
1444 /* Delete the monster (if any) */
1445 delete_monster(y, x);
1447 else if (r_ptr->flags1 & RF1_QUESTOR)
1449 /* Heal the monster */
1450 m_ptr->hp = m_ptr->maxhp;
1452 /* Try to teleport away quest monsters */
1453 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1457 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1461 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1462 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1465 /* Delete the monster (if any) */
1466 delete_monster(y, x);
1470 /* During generation, destroyed artifacts are "preserved" */
1471 if (preserve_mode || in_generate)
1473 OBJECT_IDX this_o_idx, next_o_idx = 0;
1475 /* Scan all objects in the grid */
1476 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1480 /* Acquire object */
1481 o_ptr = &o_list[this_o_idx];
1483 /* Acquire next object */
1484 next_o_idx = o_ptr->next_o_idx;
1486 /* Hack -- Preserve unknown artifacts */
1487 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1489 /* Mega-Hack -- Preserve the artifact */
1490 a_info[o_ptr->name1].cur_num = 0;
1492 if (in_generate && cheat_peek)
1494 char o_name[MAX_NLEN];
1495 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1496 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1499 else if (in_generate && cheat_peek && o_ptr->art_name)
1501 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1502 "One of the random artifacts was *destroyed* during generation."));
1507 /* Delete objects */
1508 delete_object(y, x);
1510 /* Destroy "non-permanent" grids */
1511 if (!cave_perma_grid(c_ptr))
1513 /* Wall (or floor) type */
1516 if (!in_generate) /* Normal */
1520 /* Create granite wall */
1521 cave_set_feat(y, x, feat_granite);
1525 /* Create quartz vein */
1526 cave_set_feat(y, x, feat_quartz_vein);
1530 /* Create magma vein */
1531 cave_set_feat(y, x, feat_magma_vein);
1536 cave_set_feat(y, x, floor_type[randint0(100)]);
1539 else /* In generation */
1543 /* Create granite wall */
1544 place_extra_grid(c_ptr);
1548 /* Create quartz vein */
1549 c_ptr->feat = feat_quartz_vein;
1553 /* Create magma vein */
1554 c_ptr->feat = feat_magma_vein;
1559 place_floor_grid(c_ptr);
1562 /* Clear garbage of hidden trap or door */
1571 /* Process "re-glowing" */
1572 for (y = (y1 - r); y <= (y1 + r); y++)
1574 for (x = (x1 - r); x <= (x1 + r); x++)
1576 /* Skip illegal grids */
1577 if (!in_bounds(y, x)) continue;
1579 /* Extract the distance */
1580 k = distance(y1, x1, y, x);
1582 /* Stay in the circle of death */
1583 if (k > r) continue;
1584 c_ptr = &cave[y][x];
1586 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1587 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1592 for (i = 0; i < 9; i++)
1594 yy = y + ddy_ddd[i];
1595 xx = x + ddx_ddd[i];
1596 if (!in_bounds2(yy, xx)) continue;
1597 cc_ptr = &cave[yy][xx];
1598 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1600 c_ptr->info |= CAVE_GLOW;
1608 /* Hack -- Affect player */
1611 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1613 /* Blind the player */
1614 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1617 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1623 /* Mega-Hack -- Forget the view and lite */
1624 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1626 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1628 p_ptr->redraw |= (PR_MAP);
1630 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1632 if (p_ptr->special_defense & NINJA_S_STEALTH)
1634 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1644 * @brief 地震処理(サブルーチン) /
1645 * Induce an "earthquake" of the given radius at the given location.
1646 * @return 効力があった場合TRUEを返す
1650 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1654 * This will turn some walls into floors and some floors into walls.
1656 * The player will take damage and "jump" into a safe grid if possible,
1657 * otherwise, he will "tunnel" through the rubble instantaneously.
1659 * Monsters will take damage, and "jump" into a safe grid if possible,
1660 * otherwise they will be "buried" in the rubble, disappearing from
1661 * the level in the same way that they do when genocided.
1663 * Note that thus the player and monsters (except eaters of walls and
1664 * passers through walls) will never occupy the same grid as a wall.
1665 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1666 * for a single turn, unless that monster can pass_walls or kill_walls.
1667 * This has allowed massive simplification of the "monster" code.
1670 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1674 POSITION y, x, yy, xx, dy, dx;
1677 POSITION sy = 0, sx = 0;
1683 /* Prevent destruction of quest levels and town */
1684 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1689 /* Paranoia -- Enforce maximum range */
1692 /* Clear the "maximal blast" area */
1693 for (y = 0; y < 32; y++)
1695 for (x = 0; x < 32; x++)
1701 /* Check around the epicenter */
1702 for (dy = -r; dy <= r; dy++)
1704 for (dx = -r; dx <= r; dx++)
1706 /* Extract the location */
1710 /* Skip illegal grids */
1711 if (!in_bounds(yy, xx)) continue;
1713 /* Skip distant grids */
1714 if (distance(cy, cx, yy, xx) > r) continue;
1715 c_ptr = &cave[yy][xx];
1717 /* Lose room and vault */
1718 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1720 /* Lose light and knowledge */
1721 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1723 /* Skip the epicenter */
1724 if (!dx && !dy) continue;
1726 /* Skip most grids */
1727 if (randint0(100) < 85) continue;
1729 /* Damage this grid */
1730 map[16+yy-cy][16+xx-cx] = TRUE;
1732 /* Hack -- Take note of player damage */
1733 if (player_bold(yy, xx)) hurt = TRUE;
1737 /* First, affect the player (if necessary) */
1738 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1740 /* Check around the player */
1741 for (i = 0; i < 8; i++)
1743 /* Access the location */
1744 y = p_ptr->y + ddy_ddd[i];
1745 x = p_ptr->x + ddx_ddd[i];
1747 /* Skip non-empty grids */
1748 if (!cave_empty_bold(y, x)) continue;
1750 /* Important -- Skip "quake" grids */
1751 if (map[16+y-cy][16+x-cx]) continue;
1753 if (cave[y][x].m_idx) continue;
1755 /* Count "safe" grids */
1758 /* Randomize choice */
1759 if (randint0(sn) > 0) continue;
1761 /* Save the safe location */
1765 /* Random message */
1766 switch (randint1(3))
1770 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1775 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1780 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1785 /* Hurt the player a lot */
1788 /* Message and damage */
1789 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1793 /* Destroy the grid, and push the player to safety */
1796 /* Calculate results */
1797 switch (randint1(3))
1801 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1807 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1808 damage = damroll(10, 4);
1809 (void)set_stun(p_ptr->stun + randint1(50));
1814 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1815 damage = damroll(10, 4);
1816 (void)set_stun(p_ptr->stun + randint1(50));
1821 /* Move the player to the safe location */
1822 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1825 /* Important -- no wall on player */
1826 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1835 monster_type *m_ptr = &m_list[m_idx];
1837 /* Get the monster's real name */
1838 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1840 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1844 killer = _("地震", "an earthquake");
1847 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1851 /* Examine the quaked region */
1852 for (dy = -r; dy <= r; dy++)
1854 for (dx = -r; dx <= r; dx++)
1856 /* Extract the location */
1860 /* Skip unaffected grids */
1861 if (!map[16+yy-cy][16+xx-cx]) continue;
1862 c_ptr = &cave[yy][xx];
1864 if (c_ptr->m_idx == p_ptr->riding) continue;
1866 /* Process monsters */
1869 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1870 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1872 /* Quest monsters */
1873 if (r_ptr->flags1 & RF1_QUESTOR)
1875 /* No wall on quest monsters */
1876 map[16+yy-cy][16+xx-cx] = FALSE;
1881 /* Most monsters cannot co-exist with rock */
1882 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1883 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1887 /* Assume not safe */
1890 /* Monster can move to escape the wall */
1891 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1893 /* Look for safety */
1894 for (i = 0; i < 8; i++)
1896 y = yy + ddy_ddd[i];
1897 x = xx + ddx_ddd[i];
1899 /* Skip non-empty grids */
1900 if (!cave_empty_bold(y, x)) continue;
1902 /* Hack -- no safety on glyph of warding */
1903 if (is_glyph_grid(&cave[y][x])) continue;
1904 if (is_explosive_rune_grid(&cave[y][x])) continue;
1906 /* ... nor on the Pattern */
1907 if (pattern_tile(y, x)) continue;
1909 /* Important -- Skip "quake" grids */
1910 if (map[16+y-cy][16+x-cx]) continue;
1912 if (cave[y][x].m_idx) continue;
1913 if (player_bold(y, x)) continue;
1915 /* Count "safe" grids */
1918 /* Randomize choice */
1919 if (randint0(sn) > 0) continue;
1921 /* Save the safe grid */
1926 /* Describe the monster */
1927 monster_desc(m_name, m_ptr, 0);
1929 /* Scream in pain */
1930 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1932 /* Take damage from the quake */
1933 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1935 /* Monster is certainly awake */
1936 (void)set_monster_csleep(c_ptr->m_idx, 0);
1938 /* Apply damage directly */
1939 m_ptr->hp -= damage;
1941 /* Delete (not kill) "dead" monsters */
1944 if (!ignore_unview || is_seen(m_ptr))
1945 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1949 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1953 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1954 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1959 delete_monster(yy, xx);
1961 /* No longer safe */
1965 /* Hack -- Escape from the rock */
1968 IDX m_idx_aux = cave[yy][xx].m_idx;
1970 /* Update the old location */
1971 cave[yy][xx].m_idx = 0;
1973 /* Update the new location */
1974 cave[sy][sx].m_idx = m_idx_aux;
1976 /* Move the monster */
1980 /* Update the monster (new location) */
1981 update_monster(m_idx, TRUE);
1983 /* Redraw the old grid */
1986 /* Redraw the new grid */
1994 /* Lose monster light */
1997 /* Examine the quaked region */
1998 for (dy = -r; dy <= r; dy++)
2000 for (dx = -r; dx <= r; dx++)
2002 /* Extract the location */
2006 /* Skip unaffected grids */
2007 if (!map[16+yy-cy][16+xx-cx]) continue;
2009 /* Access the cave grid */
2010 c_ptr = &cave[yy][xx];
2012 /* Paranoia -- never affect player */
2013 /* if (player_bold(yy, xx)) continue; */
2015 /* Destroy location (if valid) */
2016 if (cave_valid_bold(yy, xx))
2018 /* Delete objects */
2019 delete_object(yy, xx);
2021 /* Wall (or floor) type */
2022 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2027 /* Create granite wall */
2028 cave_set_feat(yy, xx, feat_granite);
2034 /* Create quartz vein */
2035 cave_set_feat(yy, xx, feat_quartz_vein);
2041 /* Create magma vein */
2042 cave_set_feat(yy, xx, feat_magma_vein);
2049 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2056 /* Process "re-glowing" */
2057 for (dy = -r; dy <= r; dy++)
2059 for (dx = -r; dx <= r; dx++)
2061 /* Extract the location */
2065 /* Skip illegal grids */
2066 if (!in_bounds(yy, xx)) continue;
2068 /* Skip distant grids */
2069 if (distance(cy, cx, yy, xx) > r) continue;
2070 c_ptr = &cave[yy][xx];
2072 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2073 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2078 for (ii = 0; ii < 9; ii++)
2080 yyy = yy + ddy_ddd[ii];
2081 xxx = xx + ddx_ddd[ii];
2082 if (!in_bounds2(yyy, xxx)) continue;
2083 cc_ptr = &cave[yyy][xxx];
2084 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2086 c_ptr->info |= CAVE_GLOW;
2095 /* Mega-Hack -- Forget the view and lite */
2096 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2098 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2100 /* Update the health bar */
2101 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2103 p_ptr->redraw |= (PR_MAP);
2105 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2107 if (p_ptr->special_defense & NINJA_S_STEALTH)
2109 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2117 * @brief 地震処理(プレイヤーの中心発動) /
2118 * Induce an "earthquake" of the given radius at the given location.
2119 * @return 効力があった場合TRUEを返す
2124 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2126 return earthquake_aux(cy, cx, r, 0);
2133 void discharge_minion(void)
2138 for (i = 1; i < m_max; i++)
2140 monster_type *m_ptr = &m_list[i];
2141 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2142 if (m_ptr->nickname) okay = FALSE;
2144 if (!okay || p_ptr->riding)
2146 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2149 for (i = 1; i < m_max; i++)
2152 monster_type *m_ptr = &m_list[i];
2153 monster_race *r_ptr;
2155 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2156 r_ptr = &r_info[m_ptr->r_idx];
2158 /* Uniques resist discharging */
2159 if (r_ptr->flags1 & RF1_UNIQUE)
2162 monster_desc(m_name, m_ptr, 0x00);
2163 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2164 delete_monster_idx(i);
2167 dam = m_ptr->maxhp / 2;
2168 if (dam > 100) dam = (dam-100)/2 + 100;
2169 if (dam > 400) dam = (dam-400)/2 + 400;
2170 if (dam > 800) dam = 800;
2171 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2172 m_ptr->fx, dam, GF_PLASMA,
2173 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2175 if (record_named_pet && m_ptr->nickname)
2179 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2180 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2183 delete_monster_idx(i);
2189 * @brief 部屋全体を照らすサブルーチン
2193 * This routine clears the entire "temp" set.
2194 * This routine will Perma-Lite all "temp" grids.
2195 * This routine is used (only) by "lite_room()"
2196 * Dark grids are illuminated.
2197 * Also, process all affected monsters.
2199 * SMART monsters always wake up when illuminated
2200 * NORMAL monsters wake up 1/4 the time when illuminated
2201 * STUPID monsters wake up 1/10 the time when illuminated
2204 static void cave_temp_room_lite(void)
2208 /* Clear them all */
2209 for (i = 0; i < temp_n; i++)
2211 POSITION y = temp_y[i];
2212 POSITION x = temp_x[i];
2214 cave_type *c_ptr = &cave[y][x];
2216 /* No longer in the array */
2217 c_ptr->info &= ~(CAVE_TEMP);
2219 /* Update only non-CAVE_GLOW grids */
2220 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2223 c_ptr->info |= (CAVE_GLOW);
2225 /* Process affected monsters */
2230 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2232 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2233 update_monster(c_ptr->m_idx, FALSE);
2235 /* Stupid monsters rarely wake up */
2236 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2238 /* Smart monsters always wake up */
2239 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2241 /* Sometimes monsters wake up */
2242 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2245 (void)set_monster_csleep(c_ptr->m_idx, 0);
2247 /* Notice the "waking up" */
2252 /* Acquire the monster name */
2253 monster_desc(m_name, m_ptr, 0);
2255 /* Dump a message */
2256 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2267 update_local_illumination(y, x);
2277 * @brief 部屋全体を暗くするサブルーチン
2281 * This routine clears the entire "temp" set.
2282 * This routine will "darken" all "temp" grids.
2283 * In addition, some of these grids will be "unmarked".
2284 * This routine is used (only) by "unlite_room()"
2285 * Also, process all affected monsters
2288 static void cave_temp_room_unlite(void)
2292 /* Clear them all */
2293 for (i = 0; i < temp_n; i++)
2295 POSITION y = temp_y[i];
2296 POSITION x = temp_x[i];
2299 cave_type *c_ptr = &cave[y][x];
2300 bool do_dark = !is_mirror_grid(c_ptr);
2302 /* No longer in the array */
2303 c_ptr->info &= ~(CAVE_TEMP);
2305 /* Darken the grid */
2308 if (dun_level || !is_daytime())
2310 for (j = 0; j < 9; j++)
2312 int by = y + ddy_ddd[j];
2313 int bx = x + ddx_ddd[j];
2315 if (in_bounds2(by, bx))
2317 cave_type *cc_ptr = &cave[by][bx];
2319 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2327 if (!do_dark) continue;
2330 c_ptr->info &= ~(CAVE_GLOW);
2332 /* Hack -- Forget "boring" grids */
2333 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2335 /* Forget the grid */
2336 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2341 /* Process affected monsters */
2344 update_monster(c_ptr->m_idx, FALSE);
2350 update_local_illumination(y, x);
2360 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2363 * @param pass_bold 地形条件を返す関数ポインタ
2366 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2373 for (i = 0; i < 16; i++)
2375 y = cy + ddy_cdd[i % 8];
2376 x = cx + ddx_cdd[i % 8];
2378 /* Found a wall, break the length */
2379 if (!pass_bold(y, x))
2381 /* Track best length */
2395 return (MAX(len, blen));
2399 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2402 * @param pass_bold 地形条件を返す関数ポインタ
2405 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2411 for (i = 0; i < 8; i++)
2413 y = cy + ddy_ddd[i];
2414 x = cx + ddx_ddd[i];
2416 if (!pass_bold(y, x)) c++;
2424 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2425 * @param y 部屋内のy座標1点
2426 * @param x 部屋内のx座標1点
2427 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2428 * @param pass_bold 地形条件を返す関数ポインタ
2431 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2436 c_ptr = &cave[y][x];
2438 /* Avoid infinite recursion */
2439 if (c_ptr->info & (CAVE_TEMP)) return;
2441 /* Do not "leave" the current room */
2442 if (!(c_ptr->info & (CAVE_ROOM)))
2444 if (only_room) return;
2447 if (!in_bounds2(y, x)) return;
2449 /* Do not exceed the maximum spell range */
2450 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2452 /* Verify this grid */
2454 * The reason why it is ==6 instead of >5 is that 8 is impossible
2455 * due to the check for cave_bold above.
2456 * 7 lights dead-end corridors (you need to do this for the
2457 * checkboard interesting rooms, so that the boundary is lit
2459 * This leaves only a check for 6 bounding walls!
2461 if (in_bounds(y, x) && pass_bold(y, x) &&
2462 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2465 /* Paranoia -- verify space */
2466 if (temp_n == TEMP_MAX) return;
2468 /* Mark the grid as "seen" */
2469 c_ptr->info |= (CAVE_TEMP);
2471 /* Add it to the "seen" set */
2478 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2481 * @return 光を通すならばtrueを返す。
2483 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2485 return cave_los_bold(y, x);
2489 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2494 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2496 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2500 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2503 * @return 射線を通すならばtrueを返す。
2505 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2507 return cave_have_flag_bold(y, x, FF_PROJECT);
2512 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2517 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2519 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2524 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2529 void lite_room(POSITION y1, POSITION x1)
2534 /* Add the initial grid */
2535 cave_temp_lite_room_aux(y1, x1);
2537 /* While grids are in the queue, add their neighbors */
2538 for (i = 0; i < temp_n; i++)
2540 x = temp_x[i], y = temp_y[i];
2542 /* Walls get lit, but stop light */
2543 if (!cave_pass_lite_bold(y, x)) continue;
2545 /* Spread adjacent */
2546 cave_temp_lite_room_aux(y + 1, x);
2547 cave_temp_lite_room_aux(y - 1, x);
2548 cave_temp_lite_room_aux(y, x + 1);
2549 cave_temp_lite_room_aux(y, x - 1);
2551 /* Spread diagonal */
2552 cave_temp_lite_room_aux(y + 1, x + 1);
2553 cave_temp_lite_room_aux(y - 1, x - 1);
2554 cave_temp_lite_room_aux(y - 1, x + 1);
2555 cave_temp_lite_room_aux(y + 1, x - 1);
2558 /* Now, lite them all up at once */
2559 cave_temp_room_lite();
2561 if (p_ptr->special_defense & NINJA_S_STEALTH)
2563 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2569 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2574 void unlite_room(POSITION y1, POSITION x1)
2579 /* Add the initial grid */
2580 cave_temp_unlite_room_aux(y1, x1);
2582 /* Spread, breadth first */
2583 for (i = 0; i < temp_n; i++)
2585 x = temp_x[i], y = temp_y[i];
2587 /* Walls get dark, but stop darkness */
2588 if (!cave_pass_dark_bold(y, x)) continue;
2590 /* Spread adjacent */
2591 cave_temp_unlite_room_aux(y + 1, x);
2592 cave_temp_unlite_room_aux(y - 1, x);
2593 cave_temp_unlite_room_aux(y, x + 1);
2594 cave_temp_unlite_room_aux(y, x - 1);
2596 /* Spread diagonal */
2597 cave_temp_unlite_room_aux(y + 1, x + 1);
2598 cave_temp_unlite_room_aux(y - 1, x - 1);
2599 cave_temp_unlite_room_aux(y - 1, x + 1);
2600 cave_temp_unlite_room_aux(y + 1, x - 1);
2603 /* Now, darken them all at once */
2604 cave_temp_room_unlite();
2610 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2613 * @return 作用が実際にあった場合TRUEを返す
2615 bool lite_area(HIT_POINT dam, POSITION rad)
2617 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2619 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2621 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2625 /* Hack -- Message */
2628 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2631 /* Hook into the "project()" function */
2632 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2634 /* Lite up the room */
2635 lite_room(p_ptr->y, p_ptr->x);
2643 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2646 * @return 作用が実際にあった場合TRUEを返す
2648 bool unlite_area(HIT_POINT dam, POSITION rad)
2650 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2652 /* Hack -- Message */
2655 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2658 /* Hook into the "project()" function */
2659 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2661 /* Lite up the room */
2662 unlite_room(p_ptr->y, p_ptr->x);
2671 * @brief ボール系スペルの発動 / Cast a ball spell
2673 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2676 * @return 作用が実際にあった場合TRUEを返す
2679 * Stop if we hit a monster, act as a "ball"
2680 * Allow "target" mode to pass over monsters
2681 * Affect grids, objects, and monsters
2684 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2688 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2690 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2691 /* Use the given direction */
2692 tx = p_ptr->x + 99 * ddx[dir];
2693 ty = p_ptr->y + 99 * ddy[dir];
2695 /* Hack -- Use an actual "target" */
2696 if ((dir == 5) && target_okay())
2698 flg &= ~(PROJECT_STOP);
2703 /* Analyze the "dir" and the "target". Hurt items on floor. */
2704 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2708 * @brief ブレス系スペルの発動 / Cast a breath spell
2710 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2713 * @return 作用が実際にあった場合TRUEを返す
2716 * Stop if we hit a monster, act as a "ball"
2717 * Allow "target" mode to pass over monsters
2718 * Affect grids, objects, and monsters
2721 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2723 return fire_ball(typ, dir, dam, -rad);
2728 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2730 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2733 * @return 作用が実際にあった場合TRUEを返す
2736 * Stop if we hit a monster, act as a "ball"
2737 * Allow "target" mode to pass over monsters
2738 * Affect grids, objects, and monsters
2741 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2744 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2746 /* Use the given direction */
2747 tx = p_ptr->x + 99 * ddx[dir];
2748 ty = p_ptr->y + 99 * ddy[dir];
2750 /* Hack -- Use an actual "target" */
2751 if ((dir == 5) && target_okay())
2757 /* Analyze the "dir" and the "target". Hurt items on floor. */
2758 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2763 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2765 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2768 * @return 作用が実際にあった場合TRUEを返す
2771 * Stop if we hit a monster, act as a "ball"
2772 * Allow "target" mode to pass over monsters
2773 * Affect grids, objects, and monsters
2776 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2779 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2781 /* Use the given direction */
2782 tx = p_ptr->x + 99 * ddx[dir];
2783 ty = p_ptr->y + 99 * ddy[dir];
2785 /* Hack -- Use an actual "target" */
2786 if ((dir == 5) && target_okay())
2788 flg &= ~(PROJECT_STOP);
2793 /* Analyze the "dir" and the "target". Hurt items on floor. */
2794 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2799 * @brief メテオ系スペルの発動 / Cast a meteor spell
2800 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2806 * @return 作用が実際にあった場合TRUEを返す
2809 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2810 * player, or outside source, that starts out at an arbitrary location, and
2811 * leaving no trail from the "caster" to the target. This function is
2812 * especially useful for bombardments and similar. -LM-
2813 * Option to hurt the player.
2816 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2818 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2820 /* Analyze the "target" and the caster. */
2821 return (project(who, rad, y, x, dam, typ, flg, -1));
2826 * @brief ブラスト系スペルの発動 / Cast a blast spell
2828 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2833 * @return 作用が実際にあった場合TRUEを返す
2835 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2839 POSITION ty, tx, y, x;
2842 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2847 /* Use the given direction */
2850 ly = ty = p_ptr->y + 20 * ddy[dir];
2851 lx = tx = p_ptr->x + 20 * ddx[dir];
2854 /* Use an actual "target" */
2855 else /* if (dir == 5) */
2860 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2861 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2864 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2867 for (i = 0; i < num; i++)
2871 /* Get targets for some bolts */
2872 y = rand_spread(ly, ld * dev / 20);
2873 x = rand_spread(lx, ld * dev / 20);
2875 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2878 /* Analyze the "dir" and the "target". */
2879 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2890 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2891 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2892 * @return 作用が実際にあった場合TRUEを返す
2894 bool teleport_swap(DIRECTION dir)
2898 monster_type* m_ptr;
2899 monster_race* r_ptr;
2901 if ((dir == 5) && target_okay())
2908 tx = p_ptr->x + ddx[dir];
2909 ty = p_ptr->y + ddy[dir];
2911 c_ptr = &cave[ty][tx];
2913 if (p_ptr->anti_tele)
2915 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2919 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2921 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2927 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2929 msg_print(_("失敗した。", "Failed to swap."));
2935 m_ptr = &m_list[c_ptr->m_idx];
2936 r_ptr = &r_info[m_ptr->r_idx];
2938 (void)set_monster_csleep(c_ptr->m_idx, 0);
2940 if (r_ptr->flagsr & RFR_RES_TELE)
2942 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2944 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2950 sound(SOUND_TELEPORT);
2952 /* Swap the player and monster */
2953 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2961 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2963 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2966 * @return 作用が実際にあった場合TRUEを返す
2968 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2972 /* Pass through the target if needed */
2973 flg |= (PROJECT_THRU);
2975 /* Use the given direction */
2976 tx = p_ptr->x + ddx[dir];
2977 ty = p_ptr->y + ddy[dir];
2979 /* Hack -- Use an actual "target" */
2980 if ((dir == 5) && target_okay())
2986 /* Analyze the "dir" and the "target", do NOT explode */
2987 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2992 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2994 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2996 * @return 作用が実際にあった場合TRUEを返す
2999 * Stop if we hit a monster, as a "bolt".
3000 * Affect monsters and grids (not objects).
3003 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3005 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3006 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3007 return (project_hook(typ, dir, dam, flg));
3012 * @brief ビーム系スペルの発動 / Cast a beam spell.
3014 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3016 * @return 作用が実際にあった場合TRUEを返す
3019 * Pass through monsters, as a "beam".
3020 * Affect monsters, grids and objects.
3023 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3025 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3026 return (project_hook(typ, dir, dam, flg));
3031 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3032 * @param prob ビーム化する確率(%)
3034 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3036 * @return 作用が実際にあった場合TRUEを返す
3039 * Pass through monsters, as a "beam".
3040 * Affect monsters, grids and objects.
3043 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3045 if (randint0(100) < prob)
3047 return (fire_beam(typ, dir, dam));
3051 return (fire_bolt(typ, dir, dam));
3056 * @brief LITE_WEAK属性による光源ビーム処理
3057 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3059 * @return 作用が実際にあった場合TRUEを返す
3061 bool lite_line(DIRECTION dir, HIT_POINT dam)
3063 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3064 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3069 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3071 * @return 作用が実際にあった場合TRUEを返す
3073 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3075 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3076 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3081 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3083 * @return 作用が実際にあった場合TRUEを返す
3085 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3087 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3088 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3093 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3094 * @return 作用が実際にあった場合TRUEを返す
3096 bool wizard_lock(DIRECTION dir)
3098 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3099 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3104 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3105 * @return 作用が実際にあった場合TRUEを返す
3107 bool destroy_door(DIRECTION dir)
3109 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3110 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3115 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3116 * @return 作用が実際にあった場合TRUEを返す
3118 bool disarm_trap(DIRECTION dir)
3120 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3121 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3126 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3128 * @return 作用が実際にあった場合TRUEを返す
3130 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3132 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3133 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3138 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3140 * @return 作用が実際にあった場合TRUEを返す
3142 bool speed_monster(DIRECTION dir, int power)
3144 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3145 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3150 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3152 * @return 作用が実際にあった場合TRUEを返す
3154 bool slow_monster(DIRECTION dir, int power)
3156 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3157 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3162 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3164 * @return 作用が実際にあった場合TRUEを返す
3166 bool sleep_monster(DIRECTION dir, int power)
3168 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3169 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3173 * @brief モンスター拘束(STASIS)処理
3174 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3175 * @return 作用が実際にあった場合TRUEを返す
3176 * @details 威力はプレイヤーレベル*2に固定
3178 bool stasis_monster(DIRECTION dir)
3180 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3184 * @brief 邪悪なモンスター拘束(STASIS)処理
3185 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3186 * @return 作用が実際にあった場合TRUEを返す
3187 * @details 威力はプレイヤーレベル*2に固定
3189 bool stasis_evil(DIRECTION dir)
3191 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3196 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3197 * @param plev プレイヤーレベル(=効力)
3198 * @return 作用が実際にあった場合TRUEを返す
3200 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3202 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3203 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3208 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3209 * @param plev プレイヤーレベル(=効力)
3210 * @return 作用が実際にあった場合TRUEを返す
3212 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3214 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3215 return (project_hook(GF_STUN, dir, plev, flg));
3219 * @brief チェンジモンスター処理
3220 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3222 * @return 作用が実際にあった場合TRUEを返す
3224 bool poly_monster(DIRECTION dir, int power)
3226 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3227 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3229 chg_virtue(V_CHANCE, 1);
3234 * @brief クローンモンスター処理
3235 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3236 * @return 作用が実際にあった場合TRUEを返す
3238 bool clone_monster(DIRECTION dir)
3240 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3241 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3246 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3247 * @param plev プレイヤーレベル(=効力)
3248 * @return 作用が実際にあった場合TRUEを返す
3250 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3252 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3253 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3258 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3259 * @param plev プレイヤーレベル(効力はplev*200)
3260 * @return 作用が実際にあった場合TRUEを返す
3262 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3264 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3265 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3269 * @brief モンスター用テレポート処理
3270 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3271 * @param distance 移動距離
3272 * @return 作用が実際にあった場合TRUEを返す
3274 bool teleport_monster(DIRECTION dir, int distance)
3276 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3277 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3281 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3282 * @return 作用が実際にあった場合TRUEを返す
3284 bool door_creation(void)
3286 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3287 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3291 * @brief トラップ生成処理(起点から周囲1マス)
3294 * @return 作用が実際にあった場合TRUEを返す
3296 bool trap_creation(POSITION y, POSITION x)
3298 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3299 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3303 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3304 * @return 作用が実際にあった場合TRUEを返す
3306 bool tree_creation(void)
3308 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3309 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3313 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3314 * @return 作用が実際にあった場合TRUEを返す
3316 bool glyph_creation(void)
3318 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3319 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3323 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3324 * @return 作用が実際にあった場合TRUEを返す
3326 bool wall_stone(void)
3328 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3330 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3332 p_ptr->update |= (PU_FLOW);
3334 p_ptr->redraw |= (PR_MAP);
3340 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3341 * @return 作用が実際にあった場合TRUEを返す
3343 bool destroy_doors_touch(void)
3345 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3346 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3350 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3351 * @return 作用が実際にあった場合TRUEを返す
3353 bool disarm_traps_touch(void)
3355 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3356 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3360 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3361 * @return 作用が実際にあった場合TRUEを返す
3363 bool sleep_monsters_touch(void)
3365 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3366 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3371 * @brief 死者復活処理(起点より周囲5マス)
3372 * @param who 術者モンスターID(0ならばプレイヤー)
3375 * @return 作用が実際にあった場合TRUEを返す
3377 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3379 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3380 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3385 * @return 作用が実際にあった場合TRUEを返す
3387 void call_chaos(void)
3389 int Chaos_type, dummy, dir;
3390 PLAYER_LEVEL plev = p_ptr->lev;
3391 bool line_chaos = FALSE;
3393 int hurt_types[31] =
3395 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3396 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3397 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3398 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3399 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3400 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3401 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3402 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3405 Chaos_type = hurt_types[randint0(31)];
3406 if (one_in_(4)) line_chaos = TRUE;
3410 for (dummy = 1; dummy < 10; dummy++)
3415 fire_beam(Chaos_type, dummy, 150);
3417 fire_ball(Chaos_type, dummy, 150, 2);
3421 else if (one_in_(3))
3423 fire_ball(Chaos_type, 0, 500, 8);
3427 if (!get_aim_dir(&dir)) return;
3429 fire_beam(Chaos_type, dir, 250);
3431 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3436 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3437 * @param stop_ty 再帰処理停止フラグ
3439 * @return 作用が実際にあった場合TRUEを返す
3442 * rr9: Stop the nasty things when a Cyberdemon is summoned
3443 * or the player gets paralyzed.
3446 bool activate_ty_curse(bool stop_ty, int *count)
3450 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3454 switch (randint1(34))
3459 msg_print(_("地面が揺れた...", "The ground trembles..."));
3460 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3461 if (!one_in_(6)) break;
3466 HIT_POINT dam = damroll(10, 10);
3467 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3468 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3469 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3470 if (!one_in_(6)) break;
3475 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3476 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3477 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3478 if (!one_in_(6)) break;
3481 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3485 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3486 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3488 if (!one_in_(6)) break;
3489 case 1: case 2: case 3: case 16: case 17:
3490 aggravate_monsters(0);
3491 if (!one_in_(6)) break;
3492 case 4: case 5: case 6:
3493 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3494 if (!one_in_(6)) break;
3495 case 7: case 8: case 9: case 18:
3496 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3497 if (!one_in_(6)) break;
3498 case 10: case 11: case 12:
3499 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3500 lose_exp(p_ptr->exp / 16);
3501 if (!one_in_(6)) break;
3502 case 13: case 14: case 15: case 19: case 20:
3503 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3509 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3510 if (p_ptr->free_act)
3511 set_paralyzed(p_ptr->paralyzed + randint1(3));
3513 set_paralyzed(p_ptr->paralyzed + randint1(13));
3516 if (!one_in_(6)) break;
3517 case 21: case 22: case 23:
3518 (void)do_dec_stat(randint0(6));
3519 if (!one_in_(6)) break;
3521 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3523 if (!one_in_(6)) break;
3526 * Only summon Cyberdemons deep in the dungeon.
3528 if ((dun_level > 65) && !stop_ty)
3530 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3534 if (!one_in_(6)) break;
3540 (void)do_dec_stat(i);
3548 while (one_in_(3) && !stop_ty);
3554 * @brief HI_SUMMON(上級召喚)処理発動
3557 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3558 * @return 作用が実際にあった場合TRUEを返す
3560 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3565 BIT_FLAGS mode = PM_ALLOW_GROUP;
3572 mode |= PM_FORCE_FRIENDLY;
3576 mode |= PM_FORCE_PET;
3581 if (!pet) mode |= PM_NO_PET;
3583 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3585 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3587 switch (randint1(25) + (dun_level / 20))
3590 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3593 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3596 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3599 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3602 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3605 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3608 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3611 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3615 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3619 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3622 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3623 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3626 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3627 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3630 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3633 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3634 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3643 * @brief サイバーデーモンの召喚
3644 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3647 * @return 作用が実際にあった場合TRUEを返す
3649 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3652 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3654 BIT_FLAGS mode = PM_ALLOW_GROUP;
3656 /* Summoned by a monster */
3659 monster_type *m_ptr = &m_list[who];
3660 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3663 if (max_cyber > 4) max_cyber = 4;
3665 for (i = 0; i < max_cyber; i++)
3667 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3674 * @brief 周辺破壊効果(プレイヤー中心)
3675 * @return 作用が実際にあった場合TRUEを返す
3677 void wall_breaker(void)
3680 POSITION y = 0, x = 0;
3681 int attempts = 1000;
3683 if (randint1(80 + p_ptr->lev) < 70)
3687 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3689 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3691 if (!player_bold(y, x)) break;
3694 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3695 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3697 else if (randint1(100) > 30)
3699 earthquake(p_ptr->y, p_ptr->x, 1);
3703 int num = damroll(5, 3);
3705 for (i = 0; i < num; i++)
3709 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3711 if (!player_bold(y, x)) break;
3714 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3715 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3722 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3724 * @return 作用が実際にあった場合TRUEを返す
3726 bool confuse_monsters(HIT_POINT dam)
3728 return (project_hack(GF_OLD_CONF, dam));
3733 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3735 * @return 作用が実際にあった場合TRUEを返す
3737 bool charm_monsters(HIT_POINT dam)
3739 return (project_hack(GF_CHARM, dam));
3744 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3746 * @return 作用が実際にあった場合TRUEを返す
3748 bool charm_animals(HIT_POINT dam)
3750 return (project_hack(GF_CONTROL_ANIMAL, dam));
3755 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3757 * @return 作用が実際にあった場合TRUEを返す
3759 bool stun_monsters(HIT_POINT dam)
3761 return (project_hack(GF_STUN, dam));
3766 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3768 * @return 作用が実際にあった場合TRUEを返す
3770 bool stasis_monsters(HIT_POINT dam)
3772 return (project_hack(GF_STASIS, dam));
3777 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3779 * @return 作用が実際にあった場合TRUEを返す
3781 bool mindblast_monsters(HIT_POINT dam)
3783 return (project_hack(GF_PSI, dam));
3788 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3789 * @param dist 効力(距離)
3790 * @return 作用が実際にあった場合TRUEを返す
3792 bool banish_monsters(int dist)
3794 return (project_hack(GF_AWAY_ALL, dist));
3799 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3801 * @return 作用が実際にあった場合TRUEを返す
3803 bool turn_evil(HIT_POINT dam)
3805 return (project_hack(GF_TURN_EVIL, dam));
3810 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3812 * @return 作用が実際にあった場合TRUEを返す
3814 bool turn_monsters(HIT_POINT dam)
3816 return (project_hack(GF_TURN_ALL, dam));
3821 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3822 * @return 作用が実際にあった場合TRUEを返す
3824 bool deathray_monsters(void)
3826 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3830 * @brief チャーム・モンスター(1体)
3831 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3833 * @return 作用が実際にあった場合TRUEを返す
3835 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3837 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3838 return (project_hook(GF_CHARM, dir, plev, flg));
3842 * @brief アンデッド支配(1体)
3843 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3845 * @return 作用が実際にあった場合TRUEを返す
3847 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3849 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3850 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3855 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3857 * @return 作用が実際にあった場合TRUEを返す
3859 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3861 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3862 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3867 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3869 * @return 作用が実際にあった場合TRUEを返す
3871 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3873 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3874 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3880 * @param success 判定成功上の処理ならばTRUE
3881 * @return 作用が実際にあった場合TRUEを返す
3883 bool kawarimi(bool success)
3886 object_type *q_ptr = &forge;
3889 if (p_ptr->is_dead) return FALSE;
3890 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3891 if (randint0(200) < p_ptr->stun) return FALSE;
3893 if (!success && one_in_(3))
3895 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3896 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3897 p_ptr->redraw |= (PR_STATUS);
3904 teleport_player(10 + randint1(90), 0L);
3908 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3910 q_ptr->pval = MON_NINJA;
3912 /* Drop it in the dungeon */
3913 (void)drop_near(q_ptr, -1, y, x);
3916 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3917 else msg_print("失敗!攻撃を受けてしまった。");
3919 if (success) msg_print("You have turned around just before the attack hit you.");
3920 else msg_print("Failed! You are hit by the attack.");
3923 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3924 p_ptr->redraw |= (PR_STATUS);
3932 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3933 * @param mdeath 目標モンスターが死亡したかを返す
3934 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3936 bool rush_attack(bool *mdeath)
3943 bool tmp_mdeath = FALSE;
3946 if (mdeath) *mdeath = FALSE;
3949 if (!get_aim_dir(&dir)) return FALSE;
3951 /* Use the given direction */
3952 tx = p_ptr->x + project_length * ddx[dir];
3953 ty = p_ptr->y + project_length * ddy[dir];
3955 /* Hack -- Use an actual "target" */
3956 if ((dir == 5) && target_okay())
3962 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3964 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3967 /* No need to move */
3968 if (!path_n) return TRUE;
3970 /* Use ty and tx as to-move point */
3974 /* Project along the path */
3975 for (i = 0; i < path_n; i++)
3977 monster_type *m_ptr;
3979 int ny = GRID_Y(path_g[i]);
3980 int nx = GRID_X(path_g[i]);
3982 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3987 /* Go to next grid */
3991 if (!cave[ny][nx].m_idx)
3995 msg_print(_("失敗!", "Failed!"));
3999 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4006 /* Move player before updating the monster */
4007 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4008 update_monster(cave[ny][nx].m_idx, TRUE);
4010 /* Found a monster */
4011 m_ptr = &m_list[cave[ny][nx].m_idx];
4013 if (tm_idx != cave[ny][nx].m_idx)
4016 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4017 m_ptr->ml ? "モンスター" : "何か");
4019 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4022 else if (!player_bold(ty, tx))
4024 /* Hold the monster name */
4027 /* Get the monster name (BEFORE polymorphing) */
4028 monster_desc(m_name, m_ptr, 0);
4029 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4032 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4034 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4039 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4041 if (mdeath) *mdeath = tmp_mdeath;
4047 * @brief 全鏡の消去 / Remove all mirrors in this floor
4048 * @param explode 爆発処理を伴うならばTRUE
4051 void remove_all_mirrors(bool explode)
4055 for (x = 0; x < cur_wid; x++)
4057 for (y = 0; y < cur_hgt; y++)
4059 if (is_mirror_grid(&cave[y][x]))
4061 remove_mirror(y, x);
4063 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4064 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4071 * @brief 『一つの指輪』の効果処理 /
4072 * Hack -- activate the ring of power
4073 * @param dir 発動の方向ID
4076 void ring_of_power(DIRECTION dir)
4078 /* Pick a random effect */
4079 switch (randint1(10))
4084 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4087 /* Decrease all stats (permanently) */
4088 (void)dec_stat(A_STR, 50, TRUE);
4089 (void)dec_stat(A_INT, 50, TRUE);
4090 (void)dec_stat(A_WIS, 50, TRUE);
4091 (void)dec_stat(A_DEX, 50, TRUE);
4092 (void)dec_stat(A_CON, 50, TRUE);
4093 (void)dec_stat(A_CHR, 50, TRUE);
4095 /* Lose some experience (permanently) */
4096 p_ptr->exp -= (p_ptr->exp / 4);
4097 p_ptr->max_exp -= (p_ptr->exp / 4);
4105 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4107 /* Dispel monsters */
4108 dispel_monsters(1000);
4118 fire_ball(GF_MANA, dir, 600, 3);
4129 fire_bolt(GF_MANA, dir, 500);
4137 * @brief 運命の輪、並びにカオス的な効果の発動
4138 * @param spell ランダムな効果を選択するための基準ID
4141 void wild_magic(int spell)
4144 int type = SUMMON_MOLD + randint0(6);
4146 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4147 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4149 switch (randint1(spell) + randint1(8) + 1)
4154 teleport_player(10, TELEPORT_PASSIVE);
4159 teleport_player(100, TELEPORT_PASSIVE);
4163 teleport_player(200, TELEPORT_PASSIVE);
4173 lite_area(damroll(2, 3), 2);
4176 destroy_doors_touch();
4181 sleep_monsters_touch();
4185 trap_creation(p_ptr->y, p_ptr->x);
4194 aggravate_monsters(0);
4197 earthquake(p_ptr->y, p_ptr->x, 5);
4201 (void)gain_random_mutation(0);
4205 apply_disenchant(1);
4211 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4218 while (counter++ < 8)
4220 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4225 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4228 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4233 (void)activate_ty_curse(FALSE, &count);
4242 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4243 * / Drop 10+1d10 meteor ball at random places near the player
4248 void cast_meteor(HIT_POINT dam, POSITION rad)
4251 int b = 10 + randint1(10);
4253 for (i = 0; i < b; i++)
4255 POSITION y = 0, x = 0;
4258 for (count = 0; count <= 20; count++)
4262 x = p_ptr->x - 8 + randint0(17);
4263 y = p_ptr->y - 8 + randint0(17);
4265 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4266 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4268 /* Approximate distance */
4269 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4271 if (d >= 9) continue;
4273 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4274 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4276 /* Valid position */
4280 if (count > 20) continue;
4282 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4288 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4291 * @return ターゲットを指定し、実行したならばTRUEを返す。
4293 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4295 POSITION x, y, tx, ty;
4299 int b = 10 + randint1(10);
4301 if (!get_aim_dir(&dir)) return FALSE;
4303 /* Use the given direction */
4304 tx = p_ptr->x + 99 * ddx[dir];
4305 ty = p_ptr->y + 99 * ddy[dir];
4307 /* Hack -- Use an actual "target" */
4308 if ((dir == 5) && target_okay())
4319 /* Hack -- Stop at the target */
4320 if ((y == ty) && (x == tx)) break;
4324 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4326 /* Stop at maximum range */
4327 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4329 /* Stopped by walls/doors */
4330 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4332 /* Stopped by monsters */
4333 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4335 /* Save the new location */
4342 for (i = 0; i < b; i++)
4344 int count = 20, d = 0;
4350 x = tx - 5 + randint0(11);
4351 y = ty - 5 + randint0(11);
4353 dx = (tx > x) ? (tx - x) : (x - tx);
4354 dy = (ty > y) ? (ty - y) : (y - ty);
4356 /* Approximate distance */
4357 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4358 /* Within the radius */
4362 if (count < 0) continue;
4364 /* Cannot penetrate perm walls */
4365 if (!in_bounds(y, x) ||
4366 cave_stop_disintegration(y, x) ||
4367 !in_disintegration_range(ty, tx, y, x))
4370 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4377 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4381 * This spell should become more useful (more controlled) as the\n
4382 * player gains experience levels. Thus, add 1/5 of the player's\n
4383 * level to the die roll. This eliminates the worst effects later on,\n
4384 * while keeping the results quite random. It also allows some potent\n
4385 * effects only at high level.
4387 void cast_wonder(DIRECTION dir)
4389 PLAYER_LEVEL plev = p_ptr->lev;
4390 int die = randint1(100) + plev / 5;
4391 int vir = virtue_number(V_CHANCE);
4395 if (p_ptr->virtues[vir - 1] > 0)
4397 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4401 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4406 chg_virtue(V_CHANCE, 1);
4410 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4413 if (die < 8) clone_monster(dir);
4414 else if (die < 14) speed_monster(dir, plev);
4415 else if (die < 26) heal_monster(dir, damroll(4, 6));
4416 else if (die < 31) poly_monster(dir, plev);
4418 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4419 damroll(3 + ((plev - 1) / 5), 4));
4420 else if (die < 41) confuse_monster(dir, plev);
4421 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4422 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4424 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4425 damroll(3 + ((plev - 5) / 4), 8));
4427 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4428 damroll(5 + ((plev - 5) / 4), 8));
4430 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4431 damroll(6 + ((plev - 5) / 4), 8));
4433 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4434 damroll(8 + ((plev - 5) / 4), 8));
4435 else if (die < 76) hypodynamic_bolt(dir, 75);
4436 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4437 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4438 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4439 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4440 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4443 earthquake(p_ptr->y, p_ptr->x, 12);
4447 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4451 symbol_genocide(plev + 50, TRUE);
4453 else if (die < 110) dispel_monsters(120);
4456 dispel_monsters(150);
4457 slow_monsters(plev);
4458 sleep_monsters(plev);
4465 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4469 void cast_invoke_spirits(DIRECTION dir)
4471 PLAYER_LEVEL plev = p_ptr->lev;
4472 int die = randint1(100) + plev / 5;
4473 int vir = virtue_number(V_CHANCE);
4477 if (p_ptr->virtues[vir - 1] > 0)
4479 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4483 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4487 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4489 chg_virtue(V_CHANCE, 1);
4493 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4498 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4499 "Oh no! Mouldering forms rise from the earth around you!"));
4501 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4502 chg_virtue(V_UNLIFE, 1);
4506 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4508 set_afraid(p_ptr->afraid + randint1(4) + 4);
4512 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4513 "Your head is invaded by a horde of gibbering spectral voices..."));
4515 set_confused(p_ptr->confused + randint1(4) + 4);
4519 poly_monster(dir, plev);
4523 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4524 damroll(3 + ((plev - 1) / 5), 4));
4528 confuse_monster(dir, plev);
4532 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4536 (void)lite_line(dir, damroll(6, 8));
4540 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4541 damroll(3 + ((plev - 5) / 4), 8));
4545 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4546 damroll(5 + ((plev - 5) / 4), 8));
4550 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4551 damroll(6 + ((plev - 5) / 4), 8));
4555 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4556 damroll(8 + ((plev - 5) / 4), 8));
4560 hypodynamic_bolt(dir, 75);
4564 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4568 fire_ball(GF_ACID, dir, 40 + plev, 2);
4572 fire_ball(GF_ICE, dir, 70 + plev, 3);
4576 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4580 hypodynamic_bolt(dir, 100 + plev);
4584 earthquake(p_ptr->y, p_ptr->x, 12);
4588 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4592 symbol_genocide(plev + 50, TRUE);
4596 dispel_monsters(120);
4600 dispel_monsters(150);
4601 slow_monsters(plev);
4602 sleep_monsters(plev);
4608 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4609 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4614 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4617 void cast_shuffle(void)
4619 PLAYER_LEVEL plev = p_ptr->lev;
4622 int vir = virtue_number(V_CHANCE);
4625 /* Card sharks and high mages get a level bonus */
4626 if ((p_ptr->pclass == CLASS_ROGUE) ||
4627 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4628 (p_ptr->pclass == CLASS_SORCERER))
4629 die = (randint1(110)) + plev / 5;
4631 die = randint1(120);
4636 if (p_ptr->virtues[vir - 1] > 0)
4638 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4642 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4646 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4649 chg_virtue(V_CHANCE, 1);
4653 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4655 for (i = 0; i < randint1(3); i++)
4656 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4660 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4661 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4666 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4667 activate_ty_curse(FALSE, &count);
4671 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4672 aggravate_monsters(0);
4676 msg_print(_("《愚者》だ。", "It's the Fool."));
4682 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4683 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4687 msg_print(_("《月》だ。", "It's the Moon."));
4692 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4693 wild_magic(randint0(32));
4697 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4698 teleport_player(10, TELEPORT_PASSIVE);
4702 msg_print(_("《正義》だ。", "It's Justice."));
4703 set_blessed(p_ptr->lev, FALSE);
4707 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4708 teleport_player(100, TELEPORT_PASSIVE);
4712 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4713 teleport_player(200, TELEPORT_PASSIVE);
4717 msg_print(_("《塔》だ。", "It's the Tower."));
4722 msg_print(_("《節制》だ。", "It's Temperance."));
4723 sleep_monsters_touch();
4727 msg_print(_("《塔》だ。", "It's the Tower."));
4729 earthquake(p_ptr->y, p_ptr->x, 5);
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_MOLD, 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_BAT, 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_VORTEX, 0L);
4748 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4749 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4753 msg_print(_("《恋人》だ。", "It's the Lovers."));
4755 if (get_aim_dir(&dir))
4756 charm_monster(dir, MIN(p_ptr->lev, 20));
4760 msg_print(_("《隠者》だ。", "It's the Hermit."));
4765 msg_print(_("《審判》だ。", "It's the Judgement."));
4766 do_cmd_rerate(FALSE);
4767 lose_all_mutations();
4771 msg_print(_("《太陽》だ。", "It's the Sun."));
4772 chg_virtue(V_KNOWLEDGE, 1);
4773 chg_virtue(V_ENLIGHTEN, 1);
4778 msg_print(_("《世界》だ。", "It's the World."));
4779 if (p_ptr->exp < PY_MAX_EXP)
4781 s32b ee = (p_ptr->exp / 25) + 1;
4782 if (ee > 5000) ee = 5000;
4783 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4789 bool_hack life_stream(bool_hack message, bool_hack virtue)
4793 chg_virtue(V_VITALITY, 1);
4794 chg_virtue(V_UNLIFE, -5);
4798 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4801 (void)set_poisoned(0);
4803 (void)set_confused(0);
4807 (void)restore_all_status();
4808 (void)set_shero(0, TRUE);
4815 bool_hack heroism(int base)
4817 bool_hack ident = FALSE;
4818 if(set_afraid(0)) ident = TRUE;
4819 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4820 if(hp_player(10)) ident = TRUE;
4824 bool_hack berserk(int base)
4826 bool_hack ident = FALSE;
4827 if (set_afraid(0)) ident = TRUE;
4828 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4829 if (hp_player(30)) ident = TRUE;
4833 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4835 bool_hack ident = FALSE;
4836 if (hp_player(damroll(dice, sides))) ident = TRUE;
4837 if (set_blind(0)) ident = TRUE;
4838 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4839 if (set_shero(0, TRUE)) ident = TRUE;
4843 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4845 bool_hack ident = FALSE;
4846 if (hp_player(damroll(dice, sides))) ident = TRUE;
4847 if (set_blind(0)) ident = TRUE;
4848 if (set_confused(0)) ident = TRUE;
4849 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4850 if (set_shero(0, TRUE)) ident = TRUE;
4854 bool_hack cure_critical_wounds(HIT_POINT pow)
4856 bool_hack ident = FALSE;
4857 if (hp_player(pow)) ident = TRUE;
4858 if (set_blind(0)) ident = TRUE;
4859 if (set_confused(0)) ident = TRUE;
4860 if (set_poisoned(0)) ident = TRUE;
4861 if (set_stun(0)) ident = TRUE;
4862 if (set_cut(0)) ident = TRUE;
4863 if (set_shero(0, TRUE)) ident = TRUE;
4867 bool_hack true_healing(HIT_POINT pow)
4869 bool_hack ident = FALSE;
4870 if (hp_player(pow)) ident = TRUE;
4871 if (set_blind(0)) ident = TRUE;
4872 if (set_confused(0)) ident = TRUE;
4873 if (set_poisoned(0)) ident = TRUE;
4874 if (set_stun(0)) ident = TRUE;
4875 if (set_cut(0)) ident = TRUE;
4876 if (set_image(0)) ident = TRUE;
4880 bool_hack restore_mana(bool_hack magic_eater)
4882 bool_hack ident = FALSE;
4884 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4887 for (i = 0; i < EATER_EXT * 2; i++)
4889 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4890 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;
4892 for (; i < EATER_EXT * 3; i++)
4894 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4895 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;
4896 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4898 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4899 p_ptr->window |= (PW_PLAYER);
4902 else if (p_ptr->csp < p_ptr->msp)
4904 p_ptr->csp = p_ptr->msp;
4905 p_ptr->csp_frac = 0;
4906 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4907 p_ptr->redraw |= (PR_MANA);
4908 p_ptr->window |= (PW_PLAYER);
4909 p_ptr->window |= (PW_SPELL);
4916 bool restore_all_status(void)
4919 if (do_res_stat(A_STR)) ident = TRUE;
4920 if (do_res_stat(A_INT)) ident = TRUE;
4921 if (do_res_stat(A_WIS)) ident = TRUE;
4922 if (do_res_stat(A_DEX)) ident = TRUE;
4923 if (do_res_stat(A_CON)) ident = TRUE;
4924 if (do_res_stat(A_CHR)) ident = TRUE;
4929 * @brief 口を使う継続的な処理を中断する
4932 void stop_mouth(void)
4934 if (music_singing_any()) stop_singing();
4935 if (hex_spelling_any()) stop_hex_spell_all();
4939 bool_hack vampirism(void)
4946 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4948 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4952 /* Only works on adjacent monsters */
4953 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4954 y = p_ptr->y + ddy[dir];
4955 x = p_ptr->x + ddx[dir];
4956 c_ptr = &cave[y][x];
4960 if (!(c_ptr->m_idx))
4962 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4966 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4968 dummy = p_ptr->lev * 2;
4970 if (hypodynamic_bolt(dir, dummy))
4972 if (p_ptr->food < PY_FOOD_FULL)
4973 /* No heal if we are "full" */
4974 (void)hp_player(dummy);
4976 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4978 /* Gain nutritional sustenance: 150/hp drained */
4979 /* A Food ration gives 5000 food points (by contrast) */
4980 /* Don't ever get more than "Full" this way */
4981 /* But if we ARE Gorged, it won't cure us */
4982 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4983 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4984 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4987 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4991 bool panic_hit(void)
4996 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4997 y = p_ptr->y + ddy[dir];
4998 x = p_ptr->x + ddx[dir];
4999 if (cave[y][x].m_idx)
5002 if (randint0(p_ptr->skill_dis) < 7)
5003 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5005 teleport_player(30, 0L);
5010 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5018 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5021 * currently this function allows pseudo-id of any object,
5022 * including silly ones like potions & scrolls, which always
5023 * get '{average}'. This should be changed, either to stop such
5024 * items from being pseudo-id'd, or to allow psychometry to
5025 * detect whether the unidentified potion/scroll/etc is
5026 * good (Cure Light Wounds, Restore Strength, etc) or
5027 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5029 bool psychometry(void)
5033 char o_name[MAX_NLEN];
5038 item_tester_no_ryoute = TRUE;
5039 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5040 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5042 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5044 /* Get the item (in the pack) */
5047 o_ptr = &inventory[item];
5050 /* Get the item (on the floor) */
5053 o_ptr = &o_list[0 - item];
5056 /* It is fully known, no information needed */
5057 if (object_is_known(o_ptr))
5059 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5063 /* Check for a feeling */
5064 feel = value_check_aux1(o_ptr);
5066 /* Get an object description */
5067 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5069 /* Skip non-feelings */
5072 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5077 msg_format("%sは%sという感じがする...",
5078 o_name, game_inscriptions[feel]);
5080 msg_format("You feel that the %s %s %s...",
5081 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5082 game_inscriptions[feel]);
5086 /* We have "felt" it */
5087 o_ptr->ident |= (IDENT_SENSE);
5090 o_ptr->feeling = feel;
5092 /* Player touches it */
5093 o_ptr->marked |= OM_TOUCHED;
5095 /* Combine / Reorder the pack (later) */
5096 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5098 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5100 /* Valid "tval" codes */
5101 switch (o_ptr->tval)
5129 /* Auto-inscription/destroy */
5130 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5132 /* Something happened */