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);
1629 p_ptr->redraw |= (PR_MAP);
1631 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1633 if (p_ptr->special_defense & NINJA_S_STEALTH)
1635 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1645 * @brief 地震処理(サブルーチン) /
1646 * Induce an "earthquake" of the given radius at the given location.
1647 * @return 効力があった場合TRUEを返す
1651 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1655 * This will turn some walls into floors and some floors into walls.
1657 * The player will take damage and "jump" into a safe grid if possible,
1658 * otherwise, he will "tunnel" through the rubble instantaneously.
1660 * Monsters will take damage, and "jump" into a safe grid if possible,
1661 * otherwise they will be "buried" in the rubble, disappearing from
1662 * the level in the same way that they do when genocided.
1664 * Note that thus the player and monsters (except eaters of walls and
1665 * passers through walls) will never occupy the same grid as a wall.
1666 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1667 * for a single turn, unless that monster can pass_walls or kill_walls.
1668 * This has allowed massive simplification of the "monster" code.
1671 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1675 POSITION y, x, yy, xx, dy, dx;
1678 POSITION sy = 0, sx = 0;
1684 /* Prevent destruction of quest levels and town */
1685 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1690 /* Paranoia -- Enforce maximum range */
1693 /* Clear the "maximal blast" area */
1694 for (y = 0; y < 32; y++)
1696 for (x = 0; x < 32; x++)
1702 /* Check around the epicenter */
1703 for (dy = -r; dy <= r; dy++)
1705 for (dx = -r; dx <= r; dx++)
1707 /* Extract the location */
1711 /* Skip illegal grids */
1712 if (!in_bounds(yy, xx)) continue;
1714 /* Skip distant grids */
1715 if (distance(cy, cx, yy, xx) > r) continue;
1716 c_ptr = &cave[yy][xx];
1718 /* Lose room and vault */
1719 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1721 /* Lose light and knowledge */
1722 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1724 /* Skip the epicenter */
1725 if (!dx && !dy) continue;
1727 /* Skip most grids */
1728 if (randint0(100) < 85) continue;
1730 /* Damage this grid */
1731 map[16+yy-cy][16+xx-cx] = TRUE;
1733 /* Hack -- Take note of player damage */
1734 if (player_bold(yy, xx)) hurt = TRUE;
1738 /* First, affect the player (if necessary) */
1739 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1741 /* Check around the player */
1742 for (i = 0; i < 8; i++)
1744 /* Access the location */
1745 y = p_ptr->y + ddy_ddd[i];
1746 x = p_ptr->x + ddx_ddd[i];
1748 /* Skip non-empty grids */
1749 if (!cave_empty_bold(y, x)) continue;
1751 /* Important -- Skip "quake" grids */
1752 if (map[16+y-cy][16+x-cx]) continue;
1754 if (cave[y][x].m_idx) continue;
1756 /* Count "safe" grids */
1759 /* Randomize choice */
1760 if (randint0(sn) > 0) continue;
1762 /* Save the safe location */
1766 /* Random message */
1767 switch (randint1(3))
1771 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1776 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1781 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1786 /* Hurt the player a lot */
1789 /* Message and damage */
1790 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1794 /* Destroy the grid, and push the player to safety */
1797 /* Calculate results */
1798 switch (randint1(3))
1802 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1808 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1809 damage = damroll(10, 4);
1810 (void)set_stun(p_ptr->stun + randint1(50));
1815 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1816 damage = damroll(10, 4);
1817 (void)set_stun(p_ptr->stun + randint1(50));
1822 /* Move the player to the safe location */
1823 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1826 /* Important -- no wall on player */
1827 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1836 monster_type *m_ptr = &m_list[m_idx];
1838 /* Get the monster's real name */
1839 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1841 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1845 killer = _("地震", "an earthquake");
1848 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1852 /* Examine the quaked region */
1853 for (dy = -r; dy <= r; dy++)
1855 for (dx = -r; dx <= r; dx++)
1857 /* Extract the location */
1861 /* Skip unaffected grids */
1862 if (!map[16+yy-cy][16+xx-cx]) continue;
1863 c_ptr = &cave[yy][xx];
1865 if (c_ptr->m_idx == p_ptr->riding) continue;
1867 /* Process monsters */
1870 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1871 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1873 /* Quest monsters */
1874 if (r_ptr->flags1 & RF1_QUESTOR)
1876 /* No wall on quest monsters */
1877 map[16+yy-cy][16+xx-cx] = FALSE;
1882 /* Most monsters cannot co-exist with rock */
1883 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1884 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1888 /* Assume not safe */
1891 /* Monster can move to escape the wall */
1892 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1894 /* Look for safety */
1895 for (i = 0; i < 8; i++)
1897 y = yy + ddy_ddd[i];
1898 x = xx + ddx_ddd[i];
1900 /* Skip non-empty grids */
1901 if (!cave_empty_bold(y, x)) continue;
1903 /* Hack -- no safety on glyph of warding */
1904 if (is_glyph_grid(&cave[y][x])) continue;
1905 if (is_explosive_rune_grid(&cave[y][x])) continue;
1907 /* ... nor on the Pattern */
1908 if (pattern_tile(y, x)) continue;
1910 /* Important -- Skip "quake" grids */
1911 if (map[16+y-cy][16+x-cx]) continue;
1913 if (cave[y][x].m_idx) continue;
1914 if (player_bold(y, x)) continue;
1916 /* Count "safe" grids */
1919 /* Randomize choice */
1920 if (randint0(sn) > 0) continue;
1922 /* Save the safe grid */
1927 /* Describe the monster */
1928 monster_desc(m_name, m_ptr, 0);
1930 /* Scream in pain */
1931 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1933 /* Take damage from the quake */
1934 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1936 /* Monster is certainly awake */
1937 (void)set_monster_csleep(c_ptr->m_idx, 0);
1939 /* Apply damage directly */
1940 m_ptr->hp -= damage;
1942 /* Delete (not kill) "dead" monsters */
1945 if (!ignore_unview || is_seen(m_ptr))
1946 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1950 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1954 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1955 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1960 delete_monster(yy, xx);
1962 /* No longer safe */
1966 /* Hack -- Escape from the rock */
1969 IDX m_idx_aux = cave[yy][xx].m_idx;
1971 /* Update the old location */
1972 cave[yy][xx].m_idx = 0;
1974 /* Update the new location */
1975 cave[sy][sx].m_idx = m_idx_aux;
1977 /* Move the monster */
1981 /* Update the monster (new location) */
1982 update_monster(m_idx, TRUE);
1984 /* Redraw the old grid */
1987 /* Redraw the new grid */
1995 /* Lose monster light */
1998 /* Examine the quaked region */
1999 for (dy = -r; dy <= r; dy++)
2001 for (dx = -r; dx <= r; dx++)
2003 /* Extract the location */
2007 /* Skip unaffected grids */
2008 if (!map[16+yy-cy][16+xx-cx]) continue;
2010 /* Access the cave grid */
2011 c_ptr = &cave[yy][xx];
2013 /* Paranoia -- never affect player */
2014 /* if (player_bold(yy, xx)) continue; */
2016 /* Destroy location (if valid) */
2017 if (cave_valid_bold(yy, xx))
2019 /* Delete objects */
2020 delete_object(yy, xx);
2022 /* Wall (or floor) type */
2023 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2028 /* Create granite wall */
2029 cave_set_feat(yy, xx, feat_granite);
2035 /* Create quartz vein */
2036 cave_set_feat(yy, xx, feat_quartz_vein);
2042 /* Create magma vein */
2043 cave_set_feat(yy, xx, feat_magma_vein);
2050 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2057 /* Process "re-glowing" */
2058 for (dy = -r; dy <= r; dy++)
2060 for (dx = -r; dx <= r; dx++)
2062 /* Extract the location */
2066 /* Skip illegal grids */
2067 if (!in_bounds(yy, xx)) continue;
2069 /* Skip distant grids */
2070 if (distance(cy, cx, yy, xx) > r) continue;
2071 c_ptr = &cave[yy][xx];
2073 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2074 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2079 for (ii = 0; ii < 9; ii++)
2081 yyy = yy + ddy_ddd[ii];
2082 xxx = xx + ddx_ddd[ii];
2083 if (!in_bounds2(yyy, xxx)) continue;
2084 cc_ptr = &cave[yyy][xxx];
2085 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2087 c_ptr->info |= CAVE_GLOW;
2096 /* Mega-Hack -- Forget the view and lite */
2097 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2099 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2101 /* Update the health bar */
2102 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2105 p_ptr->redraw |= (PR_MAP);
2107 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2109 if (p_ptr->special_defense & NINJA_S_STEALTH)
2111 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2119 * @brief 地震処理(プレイヤーの中心発動) /
2120 * Induce an "earthquake" of the given radius at the given location.
2121 * @return 効力があった場合TRUEを返す
2126 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2128 return earthquake_aux(cy, cx, r, 0);
2135 void discharge_minion(void)
2140 for (i = 1; i < m_max; i++)
2142 monster_type *m_ptr = &m_list[i];
2143 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2144 if (m_ptr->nickname) okay = FALSE;
2146 if (!okay || p_ptr->riding)
2148 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2151 for (i = 1; i < m_max; i++)
2154 monster_type *m_ptr = &m_list[i];
2155 monster_race *r_ptr;
2157 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2158 r_ptr = &r_info[m_ptr->r_idx];
2160 /* Uniques resist discharging */
2161 if (r_ptr->flags1 & RF1_UNIQUE)
2164 monster_desc(m_name, m_ptr, 0x00);
2165 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2166 delete_monster_idx(i);
2169 dam = m_ptr->maxhp / 2;
2170 if (dam > 100) dam = (dam-100)/2 + 100;
2171 if (dam > 400) dam = (dam-400)/2 + 400;
2172 if (dam > 800) dam = 800;
2173 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2174 m_ptr->fx, dam, GF_PLASMA,
2175 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2177 if (record_named_pet && m_ptr->nickname)
2181 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2182 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2185 delete_monster_idx(i);
2191 * @brief 部屋全体を照らすサブルーチン
2195 * This routine clears the entire "temp" set.
2196 * This routine will Perma-Lite all "temp" grids.
2197 * This routine is used (only) by "lite_room()"
2198 * Dark grids are illuminated.
2199 * Also, process all affected monsters.
2201 * SMART monsters always wake up when illuminated
2202 * NORMAL monsters wake up 1/4 the time when illuminated
2203 * STUPID monsters wake up 1/10 the time when illuminated
2206 static void cave_temp_room_lite(void)
2210 /* Clear them all */
2211 for (i = 0; i < temp_n; i++)
2213 POSITION y = temp_y[i];
2214 POSITION x = temp_x[i];
2216 cave_type *c_ptr = &cave[y][x];
2218 /* No longer in the array */
2219 c_ptr->info &= ~(CAVE_TEMP);
2221 /* Update only non-CAVE_GLOW grids */
2222 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2225 c_ptr->info |= (CAVE_GLOW);
2227 /* Process affected monsters */
2232 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2234 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2235 update_monster(c_ptr->m_idx, FALSE);
2237 /* Stupid monsters rarely wake up */
2238 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2240 /* Smart monsters always wake up */
2241 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2243 /* Sometimes monsters wake up */
2244 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2247 (void)set_monster_csleep(c_ptr->m_idx, 0);
2249 /* Notice the "waking up" */
2254 /* Acquire the monster name */
2255 monster_desc(m_name, m_ptr, 0);
2257 /* Dump a message */
2258 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2269 update_local_illumination(y, x);
2279 * @brief 部屋全体を暗くするサブルーチン
2283 * This routine clears the entire "temp" set.
2284 * This routine will "darken" all "temp" grids.
2285 * In addition, some of these grids will be "unmarked".
2286 * This routine is used (only) by "unlite_room()"
2287 * Also, process all affected monsters
2290 static void cave_temp_room_unlite(void)
2294 /* Clear them all */
2295 for (i = 0; i < temp_n; i++)
2297 POSITION y = temp_y[i];
2298 POSITION x = temp_x[i];
2301 cave_type *c_ptr = &cave[y][x];
2302 bool do_dark = !is_mirror_grid(c_ptr);
2304 /* No longer in the array */
2305 c_ptr->info &= ~(CAVE_TEMP);
2307 /* Darken the grid */
2310 if (dun_level || !is_daytime())
2312 for (j = 0; j < 9; j++)
2314 int by = y + ddy_ddd[j];
2315 int bx = x + ddx_ddd[j];
2317 if (in_bounds2(by, bx))
2319 cave_type *cc_ptr = &cave[by][bx];
2321 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2329 if (!do_dark) continue;
2332 c_ptr->info &= ~(CAVE_GLOW);
2334 /* Hack -- Forget "boring" grids */
2335 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2337 /* Forget the grid */
2338 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2343 /* Process affected monsters */
2346 update_monster(c_ptr->m_idx, FALSE);
2352 update_local_illumination(y, x);
2362 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2365 * @param pass_bold 地形条件を返す関数ポインタ
2368 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2375 for (i = 0; i < 16; i++)
2377 y = cy + ddy_cdd[i % 8];
2378 x = cx + ddx_cdd[i % 8];
2380 /* Found a wall, break the length */
2381 if (!pass_bold(y, x))
2383 /* Track best length */
2397 return (MAX(len, blen));
2401 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2404 * @param pass_bold 地形条件を返す関数ポインタ
2407 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2413 for (i = 0; i < 8; i++)
2415 y = cy + ddy_ddd[i];
2416 x = cx + ddx_ddd[i];
2418 if (!pass_bold(y, x)) c++;
2426 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2427 * @param y 部屋内のy座標1点
2428 * @param x 部屋内のx座標1点
2429 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2430 * @param pass_bold 地形条件を返す関数ポインタ
2433 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2438 c_ptr = &cave[y][x];
2440 /* Avoid infinite recursion */
2441 if (c_ptr->info & (CAVE_TEMP)) return;
2443 /* Do not "leave" the current room */
2444 if (!(c_ptr->info & (CAVE_ROOM)))
2446 if (only_room) return;
2449 if (!in_bounds2(y, x)) return;
2451 /* Do not exceed the maximum spell range */
2452 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2454 /* Verify this grid */
2456 * The reason why it is ==6 instead of >5 is that 8 is impossible
2457 * due to the check for cave_bold above.
2458 * 7 lights dead-end corridors (you need to do this for the
2459 * checkboard interesting rooms, so that the boundary is lit
2461 * This leaves only a check for 6 bounding walls!
2463 if (in_bounds(y, x) && pass_bold(y, x) &&
2464 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2467 /* Paranoia -- verify space */
2468 if (temp_n == TEMP_MAX) return;
2470 /* Mark the grid as "seen" */
2471 c_ptr->info |= (CAVE_TEMP);
2473 /* Add it to the "seen" set */
2480 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2483 * @return 光を通すならばtrueを返す。
2485 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2487 return cave_los_bold(y, x);
2491 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2496 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2498 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2502 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2505 * @return 射線を通すならばtrueを返す。
2507 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2509 return cave_have_flag_bold(y, x, FF_PROJECT);
2514 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2519 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2521 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2526 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2531 void lite_room(POSITION y1, POSITION x1)
2536 /* Add the initial grid */
2537 cave_temp_lite_room_aux(y1, x1);
2539 /* While grids are in the queue, add their neighbors */
2540 for (i = 0; i < temp_n; i++)
2542 x = temp_x[i], y = temp_y[i];
2544 /* Walls get lit, but stop light */
2545 if (!cave_pass_lite_bold(y, x)) continue;
2547 /* Spread adjacent */
2548 cave_temp_lite_room_aux(y + 1, x);
2549 cave_temp_lite_room_aux(y - 1, x);
2550 cave_temp_lite_room_aux(y, x + 1);
2551 cave_temp_lite_room_aux(y, x - 1);
2553 /* Spread diagonal */
2554 cave_temp_lite_room_aux(y + 1, x + 1);
2555 cave_temp_lite_room_aux(y - 1, x - 1);
2556 cave_temp_lite_room_aux(y - 1, x + 1);
2557 cave_temp_lite_room_aux(y + 1, x - 1);
2560 /* Now, lite them all up at once */
2561 cave_temp_room_lite();
2563 if (p_ptr->special_defense & NINJA_S_STEALTH)
2565 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2571 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2576 void unlite_room(POSITION y1, POSITION x1)
2581 /* Add the initial grid */
2582 cave_temp_unlite_room_aux(y1, x1);
2584 /* Spread, breadth first */
2585 for (i = 0; i < temp_n; i++)
2587 x = temp_x[i], y = temp_y[i];
2589 /* Walls get dark, but stop darkness */
2590 if (!cave_pass_dark_bold(y, x)) continue;
2592 /* Spread adjacent */
2593 cave_temp_unlite_room_aux(y + 1, x);
2594 cave_temp_unlite_room_aux(y - 1, x);
2595 cave_temp_unlite_room_aux(y, x + 1);
2596 cave_temp_unlite_room_aux(y, x - 1);
2598 /* Spread diagonal */
2599 cave_temp_unlite_room_aux(y + 1, x + 1);
2600 cave_temp_unlite_room_aux(y - 1, x - 1);
2601 cave_temp_unlite_room_aux(y - 1, x + 1);
2602 cave_temp_unlite_room_aux(y + 1, x - 1);
2605 /* Now, darken them all at once */
2606 cave_temp_room_unlite();
2612 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2615 * @return 作用が実際にあった場合TRUEを返す
2617 bool lite_area(HIT_POINT dam, POSITION rad)
2619 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2621 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2623 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2627 /* Hack -- Message */
2630 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2633 /* Hook into the "project()" function */
2634 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2636 /* Lite up the room */
2637 lite_room(p_ptr->y, p_ptr->x);
2645 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2648 * @return 作用が実際にあった場合TRUEを返す
2650 bool unlite_area(HIT_POINT dam, POSITION rad)
2652 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2654 /* Hack -- Message */
2657 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2660 /* Hook into the "project()" function */
2661 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2663 /* Lite up the room */
2664 unlite_room(p_ptr->y, p_ptr->x);
2673 * @brief ボール系スペルの発動 / Cast a ball spell
2675 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2678 * @return 作用が実際にあった場合TRUEを返す
2681 * Stop if we hit a monster, act as a "ball"
2682 * Allow "target" mode to pass over monsters
2683 * Affect grids, objects, and monsters
2686 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2690 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2692 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2693 /* Use the given direction */
2694 tx = p_ptr->x + 99 * ddx[dir];
2695 ty = p_ptr->y + 99 * ddy[dir];
2697 /* Hack -- Use an actual "target" */
2698 if ((dir == 5) && target_okay())
2700 flg &= ~(PROJECT_STOP);
2705 /* Analyze the "dir" and the "target". Hurt items on floor. */
2706 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2710 * @brief ブレス系スペルの発動 / Cast a breath spell
2712 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2715 * @return 作用が実際にあった場合TRUEを返す
2718 * Stop if we hit a monster, act as a "ball"
2719 * Allow "target" mode to pass over monsters
2720 * Affect grids, objects, and monsters
2723 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2725 return fire_ball(typ, dir, dam, -rad);
2730 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2732 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2735 * @return 作用が実際にあった場合TRUEを返す
2738 * Stop if we hit a monster, act as a "ball"
2739 * Allow "target" mode to pass over monsters
2740 * Affect grids, objects, and monsters
2743 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2746 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2748 /* Use the given direction */
2749 tx = p_ptr->x + 99 * ddx[dir];
2750 ty = p_ptr->y + 99 * ddy[dir];
2752 /* Hack -- Use an actual "target" */
2753 if ((dir == 5) && target_okay())
2759 /* Analyze the "dir" and the "target". Hurt items on floor. */
2760 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2765 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2767 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2770 * @return 作用が実際にあった場合TRUEを返す
2773 * Stop if we hit a monster, act as a "ball"
2774 * Allow "target" mode to pass over monsters
2775 * Affect grids, objects, and monsters
2778 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2781 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2783 /* Use the given direction */
2784 tx = p_ptr->x + 99 * ddx[dir];
2785 ty = p_ptr->y + 99 * ddy[dir];
2787 /* Hack -- Use an actual "target" */
2788 if ((dir == 5) && target_okay())
2790 flg &= ~(PROJECT_STOP);
2795 /* Analyze the "dir" and the "target". Hurt items on floor. */
2796 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2801 * @brief メテオ系スペルの発動 / Cast a meteor spell
2802 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2808 * @return 作用が実際にあった場合TRUEを返す
2811 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2812 * player, or outside source, that starts out at an arbitrary location, and
2813 * leaving no trail from the "caster" to the target. This function is
2814 * especially useful for bombardments and similar. -LM-
2815 * Option to hurt the player.
2818 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2820 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2822 /* Analyze the "target" and the caster. */
2823 return (project(who, rad, y, x, dam, typ, flg, -1));
2828 * @brief ブラスト系スペルの発動 / Cast a blast spell
2830 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2835 * @return 作用が実際にあった場合TRUEを返す
2837 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2841 POSITION ty, tx, y, x;
2844 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2849 /* Use the given direction */
2852 ly = ty = p_ptr->y + 20 * ddy[dir];
2853 lx = tx = p_ptr->x + 20 * ddx[dir];
2856 /* Use an actual "target" */
2857 else /* if (dir == 5) */
2862 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2863 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2866 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2869 for (i = 0; i < num; i++)
2873 /* Get targets for some bolts */
2874 y = rand_spread(ly, ld * dev / 20);
2875 x = rand_spread(lx, ld * dev / 20);
2877 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2880 /* Analyze the "dir" and the "target". */
2881 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2892 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2893 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2894 * @return 作用が実際にあった場合TRUEを返す
2896 bool teleport_swap(DIRECTION dir)
2900 monster_type* m_ptr;
2901 monster_race* r_ptr;
2903 if ((dir == 5) && target_okay())
2910 tx = p_ptr->x + ddx[dir];
2911 ty = p_ptr->y + ddy[dir];
2913 c_ptr = &cave[ty][tx];
2915 if (p_ptr->anti_tele)
2917 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2921 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2923 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2929 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2931 msg_print(_("失敗した。", "Failed to swap."));
2937 m_ptr = &m_list[c_ptr->m_idx];
2938 r_ptr = &r_info[m_ptr->r_idx];
2940 (void)set_monster_csleep(c_ptr->m_idx, 0);
2942 if (r_ptr->flagsr & RFR_RES_TELE)
2944 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2946 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2952 sound(SOUND_TELEPORT);
2954 /* Swap the player and monster */
2955 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2963 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2965 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2968 * @return 作用が実際にあった場合TRUEを返す
2970 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2974 /* Pass through the target if needed */
2975 flg |= (PROJECT_THRU);
2977 /* Use the given direction */
2978 tx = p_ptr->x + ddx[dir];
2979 ty = p_ptr->y + ddy[dir];
2981 /* Hack -- Use an actual "target" */
2982 if ((dir == 5) && target_okay())
2988 /* Analyze the "dir" and the "target", do NOT explode */
2989 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2994 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2996 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2998 * @return 作用が実際にあった場合TRUEを返す
3001 * Stop if we hit a monster, as a "bolt".
3002 * Affect monsters and grids (not objects).
3005 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3007 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
3008 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
3009 return (project_hook(typ, dir, dam, flg));
3014 * @brief ビーム系スペルの発動 / Cast a beam spell.
3016 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3018 * @return 作用が実際にあった場合TRUEを返す
3021 * Pass through monsters, as a "beam".
3022 * Affect monsters, grids and objects.
3025 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3027 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3028 return (project_hook(typ, dir, dam, flg));
3033 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3034 * @param prob ビーム化する確率(%)
3036 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3038 * @return 作用が実際にあった場合TRUEを返す
3041 * Pass through monsters, as a "beam".
3042 * Affect monsters, grids and objects.
3045 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3047 if (randint0(100) < prob)
3049 return (fire_beam(typ, dir, dam));
3053 return (fire_bolt(typ, dir, dam));
3058 * @brief LITE_WEAK属性による光源ビーム処理
3059 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3061 * @return 作用が実際にあった場合TRUEを返す
3063 bool lite_line(DIRECTION dir, HIT_POINT dam)
3065 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3066 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3071 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3073 * @return 作用が実際にあった場合TRUEを返す
3075 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3077 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3078 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3083 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3085 * @return 作用が実際にあった場合TRUEを返す
3087 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3089 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3090 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3095 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3096 * @return 作用が実際にあった場合TRUEを返す
3098 bool wizard_lock(DIRECTION dir)
3100 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3101 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3106 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3107 * @return 作用が実際にあった場合TRUEを返す
3109 bool destroy_door(DIRECTION dir)
3111 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3112 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3117 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3118 * @return 作用が実際にあった場合TRUEを返す
3120 bool disarm_trap(DIRECTION dir)
3122 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3123 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3128 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3130 * @return 作用が実際にあった場合TRUEを返す
3132 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3134 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3135 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3140 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3142 * @return 作用が実際にあった場合TRUEを返す
3144 bool speed_monster(DIRECTION dir, int power)
3146 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3147 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3152 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3154 * @return 作用が実際にあった場合TRUEを返す
3156 bool slow_monster(DIRECTION dir, int power)
3158 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3159 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3164 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3166 * @return 作用が実際にあった場合TRUEを返す
3168 bool sleep_monster(DIRECTION dir, int power)
3170 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3171 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3175 * @brief モンスター拘束(STASIS)処理
3176 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3177 * @return 作用が実際にあった場合TRUEを返す
3178 * @details 威力はプレイヤーレベル*2に固定
3180 bool stasis_monster(DIRECTION dir)
3182 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3186 * @brief 邪悪なモンスター拘束(STASIS)処理
3187 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3188 * @return 作用が実際にあった場合TRUEを返す
3189 * @details 威力はプレイヤーレベル*2に固定
3191 bool stasis_evil(DIRECTION dir)
3193 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3198 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3199 * @param plev プレイヤーレベル(=効力)
3200 * @return 作用が実際にあった場合TRUEを返す
3202 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3204 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3205 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3210 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3211 * @param plev プレイヤーレベル(=効力)
3212 * @return 作用が実際にあった場合TRUEを返す
3214 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3216 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3217 return (project_hook(GF_STUN, dir, plev, flg));
3221 * @brief チェンジモンスター処理
3222 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3224 * @return 作用が実際にあった場合TRUEを返す
3226 bool poly_monster(DIRECTION dir, int power)
3228 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3229 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3231 chg_virtue(V_CHANCE, 1);
3236 * @brief クローンモンスター処理
3237 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3238 * @return 作用が実際にあった場合TRUEを返す
3240 bool clone_monster(DIRECTION dir)
3242 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3243 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3248 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3249 * @param plev プレイヤーレベル(=効力)
3250 * @return 作用が実際にあった場合TRUEを返す
3252 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3254 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3255 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3260 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3261 * @param plev プレイヤーレベル(効力はplev*200)
3262 * @return 作用が実際にあった場合TRUEを返す
3264 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3266 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3267 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3271 * @brief モンスター用テレポート処理
3272 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3273 * @param distance 移動距離
3274 * @return 作用が実際にあった場合TRUEを返す
3276 bool teleport_monster(DIRECTION dir, int distance)
3278 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3279 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3283 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3284 * @return 作用が実際にあった場合TRUEを返す
3286 bool door_creation(void)
3288 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3289 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3293 * @brief トラップ生成処理(起点から周囲1マス)
3296 * @return 作用が実際にあった場合TRUEを返す
3298 bool trap_creation(POSITION y, POSITION x)
3300 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3301 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3305 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3306 * @return 作用が実際にあった場合TRUEを返す
3308 bool tree_creation(void)
3310 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3311 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3315 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3316 * @return 作用が実際にあった場合TRUEを返す
3318 bool glyph_creation(void)
3320 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3321 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3325 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3326 * @return 作用が実際にあった場合TRUEを返す
3328 bool wall_stone(void)
3330 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3332 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3334 p_ptr->update |= (PU_FLOW);
3337 p_ptr->redraw |= (PR_MAP);
3343 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3344 * @return 作用が実際にあった場合TRUEを返す
3346 bool destroy_doors_touch(void)
3348 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3349 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3353 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3354 * @return 作用が実際にあった場合TRUEを返す
3356 bool disarm_traps_touch(void)
3358 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3359 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3363 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3364 * @return 作用が実際にあった場合TRUEを返す
3366 bool sleep_monsters_touch(void)
3368 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3369 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3374 * @brief 死者復活処理(起点より周囲5マス)
3375 * @param who 術者モンスターID(0ならばプレイヤー)
3378 * @return 作用が実際にあった場合TRUEを返す
3380 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3382 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3383 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3388 * @return 作用が実際にあった場合TRUEを返す
3390 void call_chaos(void)
3392 int Chaos_type, dummy, dir;
3393 PLAYER_LEVEL plev = p_ptr->lev;
3394 bool line_chaos = FALSE;
3396 int hurt_types[31] =
3398 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3399 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3400 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3401 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3402 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3403 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3404 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3405 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3408 Chaos_type = hurt_types[randint0(31)];
3409 if (one_in_(4)) line_chaos = TRUE;
3413 for (dummy = 1; dummy < 10; dummy++)
3418 fire_beam(Chaos_type, dummy, 150);
3420 fire_ball(Chaos_type, dummy, 150, 2);
3424 else if (one_in_(3))
3426 fire_ball(Chaos_type, 0, 500, 8);
3430 if (!get_aim_dir(&dir)) return;
3432 fire_beam(Chaos_type, dir, 250);
3434 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3439 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3440 * @param stop_ty 再帰処理停止フラグ
3442 * @return 作用が実際にあった場合TRUEを返す
3445 * rr9: Stop the nasty things when a Cyberdemon is summoned
3446 * or the player gets paralyzed.
3449 bool activate_ty_curse(bool stop_ty, int *count)
3453 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3457 switch (randint1(34))
3462 msg_print(_("地面が揺れた...", "The ground trembles..."));
3463 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3464 if (!one_in_(6)) break;
3469 HIT_POINT dam = damroll(10, 10);
3470 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3471 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3472 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3473 if (!one_in_(6)) break;
3478 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3479 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3480 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3481 if (!one_in_(6)) break;
3484 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3488 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3489 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3491 if (!one_in_(6)) break;
3492 case 1: case 2: case 3: case 16: case 17:
3493 aggravate_monsters(0);
3494 if (!one_in_(6)) break;
3495 case 4: case 5: case 6:
3496 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3497 if (!one_in_(6)) break;
3498 case 7: case 8: case 9: case 18:
3499 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3500 if (!one_in_(6)) break;
3501 case 10: case 11: case 12:
3502 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3503 lose_exp(p_ptr->exp / 16);
3504 if (!one_in_(6)) break;
3505 case 13: case 14: case 15: case 19: case 20:
3506 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3512 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3513 if (p_ptr->free_act)
3514 set_paralyzed(p_ptr->paralyzed + randint1(3));
3516 set_paralyzed(p_ptr->paralyzed + randint1(13));
3519 if (!one_in_(6)) break;
3520 case 21: case 22: case 23:
3521 (void)do_dec_stat(randint0(6));
3522 if (!one_in_(6)) break;
3524 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3526 if (!one_in_(6)) break;
3529 * Only summon Cyberdemons deep in the dungeon.
3531 if ((dun_level > 65) && !stop_ty)
3533 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3537 if (!one_in_(6)) break;
3543 (void)do_dec_stat(i);
3551 while (one_in_(3) && !stop_ty);
3557 * @brief HI_SUMMON(上級召喚)処理発動
3560 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3561 * @return 作用が実際にあった場合TRUEを返す
3563 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3568 BIT_FLAGS mode = PM_ALLOW_GROUP;
3575 mode |= PM_FORCE_FRIENDLY;
3579 mode |= PM_FORCE_PET;
3584 if (!pet) mode |= PM_NO_PET;
3586 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3588 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3590 switch (randint1(25) + (dun_level / 20))
3593 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3596 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3599 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3602 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3605 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3608 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3611 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3614 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3618 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3622 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3625 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3626 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3629 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3630 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3633 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3636 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3637 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3646 * @brief サイバーデーモンの召喚
3647 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3650 * @return 作用が実際にあった場合TRUEを返す
3652 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3655 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3657 BIT_FLAGS mode = PM_ALLOW_GROUP;
3659 /* Summoned by a monster */
3662 monster_type *m_ptr = &m_list[who];
3663 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3666 if (max_cyber > 4) max_cyber = 4;
3668 for (i = 0; i < max_cyber; i++)
3670 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3677 * @brief 周辺破壊効果(プレイヤー中心)
3678 * @return 作用が実際にあった場合TRUEを返す
3680 void wall_breaker(void)
3683 POSITION y = 0, x = 0;
3684 int attempts = 1000;
3686 if (randint1(80 + p_ptr->lev) < 70)
3690 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3692 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3694 if (!player_bold(y, x)) break;
3697 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3698 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3700 else if (randint1(100) > 30)
3702 earthquake(p_ptr->y, p_ptr->x, 1);
3706 int num = damroll(5, 3);
3708 for (i = 0; i < num; i++)
3712 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3714 if (!player_bold(y, x)) break;
3717 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3718 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3725 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3727 * @return 作用が実際にあった場合TRUEを返す
3729 bool confuse_monsters(HIT_POINT dam)
3731 return (project_hack(GF_OLD_CONF, dam));
3736 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3738 * @return 作用が実際にあった場合TRUEを返す
3740 bool charm_monsters(HIT_POINT dam)
3742 return (project_hack(GF_CHARM, dam));
3747 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3749 * @return 作用が実際にあった場合TRUEを返す
3751 bool charm_animals(HIT_POINT dam)
3753 return (project_hack(GF_CONTROL_ANIMAL, dam));
3758 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3760 * @return 作用が実際にあった場合TRUEを返す
3762 bool stun_monsters(HIT_POINT dam)
3764 return (project_hack(GF_STUN, dam));
3769 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3771 * @return 作用が実際にあった場合TRUEを返す
3773 bool stasis_monsters(HIT_POINT dam)
3775 return (project_hack(GF_STASIS, dam));
3780 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3782 * @return 作用が実際にあった場合TRUEを返す
3784 bool mindblast_monsters(HIT_POINT dam)
3786 return (project_hack(GF_PSI, dam));
3791 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3792 * @param dist 効力(距離)
3793 * @return 作用が実際にあった場合TRUEを返す
3795 bool banish_monsters(int dist)
3797 return (project_hack(GF_AWAY_ALL, dist));
3802 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3804 * @return 作用が実際にあった場合TRUEを返す
3806 bool turn_evil(HIT_POINT dam)
3808 return (project_hack(GF_TURN_EVIL, dam));
3813 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3815 * @return 作用が実際にあった場合TRUEを返す
3817 bool turn_monsters(HIT_POINT dam)
3819 return (project_hack(GF_TURN_ALL, dam));
3824 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3825 * @return 作用が実際にあった場合TRUEを返す
3827 bool deathray_monsters(void)
3829 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3833 * @brief チャーム・モンスター(1体)
3834 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3836 * @return 作用が実際にあった場合TRUEを返す
3838 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3840 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3841 return (project_hook(GF_CHARM, dir, plev, flg));
3845 * @brief アンデッド支配(1体)
3846 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3848 * @return 作用が実際にあった場合TRUEを返す
3850 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3852 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3853 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3858 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3860 * @return 作用が実際にあった場合TRUEを返す
3862 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3864 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3865 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3870 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3872 * @return 作用が実際にあった場合TRUEを返す
3874 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3876 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3877 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3883 * @param success 判定成功上の処理ならばTRUE
3884 * @return 作用が実際にあった場合TRUEを返す
3886 bool kawarimi(bool success)
3889 object_type *q_ptr = &forge;
3892 if (p_ptr->is_dead) return FALSE;
3893 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3894 if (randint0(200) < p_ptr->stun) return FALSE;
3896 if (!success && one_in_(3))
3898 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3899 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3900 p_ptr->redraw |= (PR_STATUS);
3907 teleport_player(10 + randint1(90), 0L);
3911 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3913 q_ptr->pval = MON_NINJA;
3915 /* Drop it in the dungeon */
3916 (void)drop_near(q_ptr, -1, y, x);
3919 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3920 else msg_print("失敗!攻撃を受けてしまった。");
3922 if (success) msg_print("You have turned around just before the attack hit you.");
3923 else msg_print("Failed! You are hit by the attack.");
3926 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3927 p_ptr->redraw |= (PR_STATUS);
3935 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3936 * @param mdeath 目標モンスターが死亡したかを返す
3937 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3939 bool rush_attack(bool *mdeath)
3946 bool tmp_mdeath = FALSE;
3949 if (mdeath) *mdeath = FALSE;
3952 if (!get_aim_dir(&dir)) return FALSE;
3954 /* Use the given direction */
3955 tx = p_ptr->x + project_length * ddx[dir];
3956 ty = p_ptr->y + project_length * ddy[dir];
3958 /* Hack -- Use an actual "target" */
3959 if ((dir == 5) && target_okay())
3965 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3967 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3970 /* No need to move */
3971 if (!path_n) return TRUE;
3973 /* Use ty and tx as to-move point */
3977 /* Project along the path */
3978 for (i = 0; i < path_n; i++)
3980 monster_type *m_ptr;
3982 int ny = GRID_Y(path_g[i]);
3983 int nx = GRID_X(path_g[i]);
3985 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3990 /* Go to next grid */
3994 if (!cave[ny][nx].m_idx)
3998 msg_print(_("失敗!", "Failed!"));
4002 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
4009 /* Move player before updating the monster */
4010 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4011 update_monster(cave[ny][nx].m_idx, TRUE);
4013 /* Found a monster */
4014 m_ptr = &m_list[cave[ny][nx].m_idx];
4016 if (tm_idx != cave[ny][nx].m_idx)
4019 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
4020 m_ptr->ml ? "モンスター" : "何か");
4022 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
4025 else if (!player_bold(ty, tx))
4027 /* Hold the monster name */
4030 /* Get the monster name (BEFORE polymorphing) */
4031 monster_desc(m_name, m_ptr, 0);
4032 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4035 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4037 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4042 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4044 if (mdeath) *mdeath = tmp_mdeath;
4050 * @brief 全鏡の消去 / Remove all mirrors in this floor
4051 * @param explode 爆発処理を伴うならばTRUE
4054 void remove_all_mirrors(bool explode)
4058 for (x = 0; x < cur_wid; x++)
4060 for (y = 0; y < cur_hgt; y++)
4062 if (is_mirror_grid(&cave[y][x]))
4064 remove_mirror(y, x);
4066 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4067 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4074 * @brief 『一つの指輪』の効果処理 /
4075 * Hack -- activate the ring of power
4076 * @param dir 発動の方向ID
4079 void ring_of_power(DIRECTION dir)
4081 /* Pick a random effect */
4082 switch (randint1(10))
4087 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4090 /* Decrease all stats (permanently) */
4091 (void)dec_stat(A_STR, 50, TRUE);
4092 (void)dec_stat(A_INT, 50, TRUE);
4093 (void)dec_stat(A_WIS, 50, TRUE);
4094 (void)dec_stat(A_DEX, 50, TRUE);
4095 (void)dec_stat(A_CON, 50, TRUE);
4096 (void)dec_stat(A_CHR, 50, TRUE);
4098 /* Lose some experience (permanently) */
4099 p_ptr->exp -= (p_ptr->exp / 4);
4100 p_ptr->max_exp -= (p_ptr->exp / 4);
4108 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4110 /* Dispel monsters */
4111 dispel_monsters(1000);
4121 fire_ball(GF_MANA, dir, 600, 3);
4132 fire_bolt(GF_MANA, dir, 500);
4140 * @brief 運命の輪、並びにカオス的な効果の発動
4141 * @param spell ランダムな効果を選択するための基準ID
4144 void wild_magic(int spell)
4147 int type = SUMMON_MOLD + randint0(6);
4149 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4150 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4152 switch (randint1(spell) + randint1(8) + 1)
4157 teleport_player(10, TELEPORT_PASSIVE);
4162 teleport_player(100, TELEPORT_PASSIVE);
4166 teleport_player(200, TELEPORT_PASSIVE);
4176 lite_area(damroll(2, 3), 2);
4179 destroy_doors_touch();
4184 sleep_monsters_touch();
4188 trap_creation(p_ptr->y, p_ptr->x);
4197 aggravate_monsters(0);
4200 earthquake(p_ptr->y, p_ptr->x, 5);
4204 (void)gain_random_mutation(0);
4208 apply_disenchant(1);
4214 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4221 while (counter++ < 8)
4223 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4228 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4231 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4236 (void)activate_ty_curse(FALSE, &count);
4245 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4246 * / Drop 10+1d10 meteor ball at random places near the player
4251 void cast_meteor(HIT_POINT dam, POSITION rad)
4254 int b = 10 + randint1(10);
4256 for (i = 0; i < b; i++)
4258 POSITION y = 0, x = 0;
4261 for (count = 0; count <= 20; count++)
4265 x = p_ptr->x - 8 + randint0(17);
4266 y = p_ptr->y - 8 + randint0(17);
4268 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4269 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4271 /* Approximate distance */
4272 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4274 if (d >= 9) continue;
4276 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4277 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4279 /* Valid position */
4283 if (count > 20) continue;
4285 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4291 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4294 * @return ターゲットを指定し、実行したならばTRUEを返す。
4296 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4298 POSITION x, y, tx, ty;
4302 int b = 10 + randint1(10);
4304 if (!get_aim_dir(&dir)) return FALSE;
4306 /* Use the given direction */
4307 tx = p_ptr->x + 99 * ddx[dir];
4308 ty = p_ptr->y + 99 * ddy[dir];
4310 /* Hack -- Use an actual "target" */
4311 if ((dir == 5) && target_okay())
4322 /* Hack -- Stop at the target */
4323 if ((y == ty) && (x == tx)) break;
4327 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4329 /* Stop at maximum range */
4330 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4332 /* Stopped by walls/doors */
4333 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4335 /* Stopped by monsters */
4336 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4338 /* Save the new location */
4345 for (i = 0; i < b; i++)
4347 int count = 20, d = 0;
4353 x = tx - 5 + randint0(11);
4354 y = ty - 5 + randint0(11);
4356 dx = (tx > x) ? (tx - x) : (x - tx);
4357 dy = (ty > y) ? (ty - y) : (y - ty);
4359 /* Approximate distance */
4360 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4361 /* Within the radius */
4365 if (count < 0) continue;
4367 /* Cannot penetrate perm walls */
4368 if (!in_bounds(y, x) ||
4369 cave_stop_disintegration(y, x) ||
4370 !in_disintegration_range(ty, tx, y, x))
4373 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4380 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4384 * This spell should become more useful (more controlled) as the\n
4385 * player gains experience levels. Thus, add 1/5 of the player's\n
4386 * level to the die roll. This eliminates the worst effects later on,\n
4387 * while keeping the results quite random. It also allows some potent\n
4388 * effects only at high level.
4390 void cast_wonder(DIRECTION dir)
4392 PLAYER_LEVEL plev = p_ptr->lev;
4393 int die = randint1(100) + plev / 5;
4394 int vir = virtue_number(V_CHANCE);
4398 if (p_ptr->virtues[vir - 1] > 0)
4400 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4404 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4409 chg_virtue(V_CHANCE, 1);
4413 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4416 if (die < 8) clone_monster(dir);
4417 else if (die < 14) speed_monster(dir, plev);
4418 else if (die < 26) heal_monster(dir, damroll(4, 6));
4419 else if (die < 31) poly_monster(dir, plev);
4421 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4422 damroll(3 + ((plev - 1) / 5), 4));
4423 else if (die < 41) confuse_monster(dir, plev);
4424 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4425 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4427 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4428 damroll(3 + ((plev - 5) / 4), 8));
4430 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4431 damroll(5 + ((plev - 5) / 4), 8));
4433 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4434 damroll(6 + ((plev - 5) / 4), 8));
4436 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4437 damroll(8 + ((plev - 5) / 4), 8));
4438 else if (die < 76) hypodynamic_bolt(dir, 75);
4439 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4440 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4441 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4442 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4443 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4446 earthquake(p_ptr->y, p_ptr->x, 12);
4450 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4454 symbol_genocide(plev + 50, TRUE);
4456 else if (die < 110) dispel_monsters(120);
4459 dispel_monsters(150);
4460 slow_monsters(plev);
4461 sleep_monsters(plev);
4468 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4472 void cast_invoke_spirits(DIRECTION dir)
4474 PLAYER_LEVEL plev = p_ptr->lev;
4475 int die = randint1(100) + plev / 5;
4476 int vir = virtue_number(V_CHANCE);
4480 if (p_ptr->virtues[vir - 1] > 0)
4482 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4486 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4490 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4492 chg_virtue(V_CHANCE, 1);
4496 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4501 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4502 "Oh no! Mouldering forms rise from the earth around you!"));
4504 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4505 chg_virtue(V_UNLIFE, 1);
4509 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4511 set_afraid(p_ptr->afraid + randint1(4) + 4);
4515 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4516 "Your head is invaded by a horde of gibbering spectral voices..."));
4518 set_confused(p_ptr->confused + randint1(4) + 4);
4522 poly_monster(dir, plev);
4526 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4527 damroll(3 + ((plev - 1) / 5), 4));
4531 confuse_monster(dir, plev);
4535 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4539 (void)lite_line(dir, damroll(6, 8));
4543 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4544 damroll(3 + ((plev - 5) / 4), 8));
4548 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4549 damroll(5 + ((plev - 5) / 4), 8));
4553 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4554 damroll(6 + ((plev - 5) / 4), 8));
4558 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4559 damroll(8 + ((plev - 5) / 4), 8));
4563 hypodynamic_bolt(dir, 75);
4567 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4571 fire_ball(GF_ACID, dir, 40 + plev, 2);
4575 fire_ball(GF_ICE, dir, 70 + plev, 3);
4579 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4583 hypodynamic_bolt(dir, 100 + plev);
4587 earthquake(p_ptr->y, p_ptr->x, 12);
4591 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4595 symbol_genocide(plev + 50, TRUE);
4599 dispel_monsters(120);
4603 dispel_monsters(150);
4604 slow_monsters(plev);
4605 sleep_monsters(plev);
4611 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4612 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4617 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4620 void cast_shuffle(void)
4622 PLAYER_LEVEL plev = p_ptr->lev;
4625 int vir = virtue_number(V_CHANCE);
4628 /* Card sharks and high mages get a level bonus */
4629 if ((p_ptr->pclass == CLASS_ROGUE) ||
4630 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4631 (p_ptr->pclass == CLASS_SORCERER))
4632 die = (randint1(110)) + plev / 5;
4634 die = randint1(120);
4639 if (p_ptr->virtues[vir - 1] > 0)
4641 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4645 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4649 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4652 chg_virtue(V_CHANCE, 1);
4656 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4658 for (i = 0; i < randint1(3); i++)
4659 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4663 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4664 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4669 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4670 activate_ty_curse(FALSE, &count);
4674 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4675 aggravate_monsters(0);
4679 msg_print(_("《愚者》だ。", "It's the Fool."));
4685 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4686 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4690 msg_print(_("《月》だ。", "It's the Moon."));
4695 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4696 wild_magic(randint0(32));
4700 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4701 teleport_player(10, TELEPORT_PASSIVE);
4705 msg_print(_("《正義》だ。", "It's Justice."));
4706 set_blessed(p_ptr->lev, FALSE);
4710 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4711 teleport_player(100, TELEPORT_PASSIVE);
4715 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4716 teleport_player(200, TELEPORT_PASSIVE);
4720 msg_print(_("《塔》だ。", "It's the Tower."));
4725 msg_print(_("《節制》だ。", "It's Temperance."));
4726 sleep_monsters_touch();
4730 msg_print(_("《塔》だ。", "It's the Tower."));
4732 earthquake(p_ptr->y, p_ptr->x, 5);
4736 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4737 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4741 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4742 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4746 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4747 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4751 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4752 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4756 msg_print(_("《恋人》だ。", "It's the Lovers."));
4758 if (get_aim_dir(&dir))
4759 charm_monster(dir, MIN(p_ptr->lev, 20));
4763 msg_print(_("《隠者》だ。", "It's the Hermit."));
4768 msg_print(_("《審判》だ。", "It's the Judgement."));
4769 do_cmd_rerate(FALSE);
4770 lose_all_mutations();
4774 msg_print(_("《太陽》だ。", "It's the Sun."));
4775 chg_virtue(V_KNOWLEDGE, 1);
4776 chg_virtue(V_ENLIGHTEN, 1);
4781 msg_print(_("《世界》だ。", "It's the World."));
4782 if (p_ptr->exp < PY_MAX_EXP)
4784 s32b ee = (p_ptr->exp / 25) + 1;
4785 if (ee > 5000) ee = 5000;
4786 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4792 bool_hack life_stream(bool_hack message, bool_hack virtue)
4796 chg_virtue(V_VITALITY, 1);
4797 chg_virtue(V_UNLIFE, -5);
4801 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4804 (void)set_poisoned(0);
4806 (void)set_confused(0);
4810 (void)restore_all_status();
4811 (void)set_shero(0, TRUE);
4818 bool_hack heroism(int base)
4820 bool_hack ident = FALSE;
4821 if(set_afraid(0)) ident = TRUE;
4822 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4823 if(hp_player(10)) ident = TRUE;
4827 bool_hack berserk(int base)
4829 bool_hack ident = FALSE;
4830 if (set_afraid(0)) ident = TRUE;
4831 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4832 if (hp_player(30)) ident = TRUE;
4836 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4838 bool_hack ident = FALSE;
4839 if (hp_player(damroll(dice, sides))) ident = TRUE;
4840 if (set_blind(0)) ident = TRUE;
4841 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4842 if (set_shero(0, TRUE)) ident = TRUE;
4846 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4848 bool_hack ident = FALSE;
4849 if (hp_player(damroll(dice, sides))) ident = TRUE;
4850 if (set_blind(0)) ident = TRUE;
4851 if (set_confused(0)) ident = TRUE;
4852 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4853 if (set_shero(0, TRUE)) ident = TRUE;
4857 bool_hack cure_critical_wounds(HIT_POINT pow)
4859 bool_hack ident = FALSE;
4860 if (hp_player(pow)) ident = TRUE;
4861 if (set_blind(0)) ident = TRUE;
4862 if (set_confused(0)) ident = TRUE;
4863 if (set_poisoned(0)) ident = TRUE;
4864 if (set_stun(0)) ident = TRUE;
4865 if (set_cut(0)) ident = TRUE;
4866 if (set_shero(0, TRUE)) ident = TRUE;
4870 bool_hack true_healing(HIT_POINT pow)
4872 bool_hack ident = FALSE;
4873 if (hp_player(pow)) ident = TRUE;
4874 if (set_blind(0)) ident = TRUE;
4875 if (set_confused(0)) ident = TRUE;
4876 if (set_poisoned(0)) ident = TRUE;
4877 if (set_stun(0)) ident = TRUE;
4878 if (set_cut(0)) ident = TRUE;
4879 if (set_image(0)) ident = TRUE;
4883 bool_hack restore_mana(bool_hack magic_eater)
4885 bool_hack ident = FALSE;
4887 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4890 for (i = 0; i < EATER_EXT * 2; i++)
4892 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4893 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;
4895 for (; i < EATER_EXT * 3; i++)
4897 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4898 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;
4899 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4901 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4902 p_ptr->window |= (PW_PLAYER);
4905 else if (p_ptr->csp < p_ptr->msp)
4907 p_ptr->csp = p_ptr->msp;
4908 p_ptr->csp_frac = 0;
4909 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4910 p_ptr->redraw |= (PR_MANA);
4911 p_ptr->window |= (PW_PLAYER);
4912 p_ptr->window |= (PW_SPELL);
4919 bool restore_all_status(void)
4922 if (do_res_stat(A_STR)) ident = TRUE;
4923 if (do_res_stat(A_INT)) ident = TRUE;
4924 if (do_res_stat(A_WIS)) ident = TRUE;
4925 if (do_res_stat(A_DEX)) ident = TRUE;
4926 if (do_res_stat(A_CON)) ident = TRUE;
4927 if (do_res_stat(A_CHR)) ident = TRUE;
4932 * @brief 口を使う継続的な処理を中断する
4935 void stop_mouth(void)
4937 if (music_singing_any()) stop_singing();
4938 if (hex_spelling_any()) stop_hex_spell_all();
4942 bool_hack vampirism(void)
4949 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4951 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4955 /* Only works on adjacent monsters */
4956 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4957 y = p_ptr->y + ddy[dir];
4958 x = p_ptr->x + ddx[dir];
4959 c_ptr = &cave[y][x];
4963 if (!(c_ptr->m_idx))
4965 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4969 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4971 dummy = p_ptr->lev * 2;
4973 if (hypodynamic_bolt(dir, dummy))
4975 if (p_ptr->food < PY_FOOD_FULL)
4976 /* No heal if we are "full" */
4977 (void)hp_player(dummy);
4979 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4981 /* Gain nutritional sustenance: 150/hp drained */
4982 /* A Food ration gives 5000 food points (by contrast) */
4983 /* Don't ever get more than "Full" this way */
4984 /* But if we ARE Gorged, it won't cure us */
4985 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4986 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4987 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4990 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4994 bool panic_hit(void)
4999 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
5000 y = p_ptr->y + ddy[dir];
5001 x = p_ptr->x + ddx[dir];
5002 if (cave[y][x].m_idx)
5005 if (randint0(p_ptr->skill_dis) < 7)
5006 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
5008 teleport_player(30, 0L);
5013 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5021 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
5024 * currently this function allows pseudo-id of any object,
5025 * including silly ones like potions & scrolls, which always
5026 * get '{average}'. This should be changed, either to stop such
5027 * items from being pseudo-id'd, or to allow psychometry to
5028 * detect whether the unidentified potion/scroll/etc is
5029 * good (Cure Light Wounds, Restore Strength, etc) or
5030 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5032 bool psychometry(void)
5036 char o_name[MAX_NLEN];
5041 item_tester_no_ryoute = TRUE;
5042 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5043 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5045 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5047 /* Get the item (in the pack) */
5050 o_ptr = &inventory[item];
5053 /* Get the item (on the floor) */
5056 o_ptr = &o_list[0 - item];
5059 /* It is fully known, no information needed */
5060 if (object_is_known(o_ptr))
5062 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5066 /* Check for a feeling */
5067 feel = value_check_aux1(o_ptr);
5069 /* Get an object description */
5070 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5072 /* Skip non-feelings */
5075 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5080 msg_format("%sは%sという感じがする...",
5081 o_name, game_inscriptions[feel]);
5083 msg_format("You feel that the %s %s %s...",
5084 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5085 game_inscriptions[feel]);
5089 /* We have "felt" it */
5090 o_ptr->ident |= (IDENT_SENSE);
5093 o_ptr->feeling = feel;
5095 /* Player touches it */
5096 o_ptr->marked |= OM_TOUCHED;
5098 /* Combine / Reorder the pack (later) */
5099 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5101 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5103 /* Valid "tval" codes */
5104 switch (o_ptr->tval)
5132 /* Auto-inscription/destroy */
5133 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5135 /* Something happened */