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.
26 #include "monsterrace-hook.h"
30 #include "spells-summon.h"
35 #include "spells-status.h"
36 #include "spells-floor.h"
37 #include "realm-hex.h"
39 #include "object-flavor.h"
40 #include "object-hook.h"
41 #include "monster-status.h"
42 #include "player-move.h"
43 #include "player-status.h"
44 #include "player-effects.h"
45 #include "player-skill.h"
48 #include "floor-events.h"
50 #include "view-mainwindow.h"
51 #include "objectkind.h"
52 #include "monsterrace.h"
53 #include "targeting.h"
54 #include "realm-song.h"
57 * @brief プレイヤー周辺の地形を感知する
60 * @param known 地形から危険フラグを外すならTRUE
61 * @return 効力があった場合TRUEを返す
63 static bool detect_feat_flag(POSITION range, int flag, bool known)
69 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
71 /* Scan the current panel */
72 for (y = 1; y < current_floor_ptr->height - 1; y++)
74 for (x = 1; x <= current_floor_ptr->width - 1; x++)
76 int dist = distance(p_ptr->y, p_ptr->x, y, x);
77 if (dist > range) continue;
78 g_ptr = ¤t_floor_ptr->grid_array[y][x];
83 /* Mark as detected */
84 if (dist <= range && known)
86 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
88 g_ptr->info &= ~(CAVE_UNSAFE);
95 if (cave_have_flag_grid(g_ptr, flag))
100 /* Hack -- Memorize */
101 g_ptr->info |= (CAVE_MARK);
114 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
116 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
117 * @return 効力があった場合TRUEを返す
119 bool detect_traps(POSITION range, bool known)
121 bool detect = detect_feat_flag(range, FF_TRAP, known);
123 if (known) p_ptr->dtrap = TRUE;
125 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
128 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
135 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
137 * @return 効力があった場合TRUEを返す
139 bool detect_doors(POSITION range)
141 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
143 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
146 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
153 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
155 * @return 効力があった場合TRUEを返す
157 bool detect_stairs(POSITION range)
159 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
161 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
164 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
171 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
173 * @return 効力があった場合TRUEを返す
175 bool detect_treasure(POSITION range)
177 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
179 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
182 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
189 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
191 * @return 効力があった場合TRUEを返す
193 bool detect_objects_gold(POSITION range)
197 POSITION range2 = range;
201 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
204 for (i = 1; i < current_floor_ptr->o_max; i++)
206 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
208 /* Skip dead objects */
209 if (!o_ptr->k_idx) continue;
211 /* Skip held objects */
212 if (o_ptr->held_m_idx) continue;
217 /* Only detect nearby objects */
218 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
220 /* Detect "gold" objects */
221 if (o_ptr->tval == TV_GOLD)
223 o_ptr->marked |= OM_FOUND;
229 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
232 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
235 if (detect_monsters_string(range, "$"))
244 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
246 * @return 効力があった場合TRUEを返す
248 bool detect_objects_normal(POSITION range)
252 POSITION range2 = range;
256 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
259 for (i = 1; i < current_floor_ptr->o_max; i++)
261 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
263 /* Skip dead objects */
264 if (!o_ptr->k_idx) continue;
266 /* Skip held objects */
267 if (o_ptr->held_m_idx) continue;
272 /* Only detect nearby objects */
273 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
275 /* Detect "real" objects */
276 if (o_ptr->tval != TV_GOLD)
278 o_ptr->marked |= OM_FOUND;
284 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
287 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
290 if (detect_monsters_string(range, "!=?|/`"))
299 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
301 * @return 効力があった場合TRUEを返す
304 * This will light up all spaces with "magic" items, including artifacts,
305 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
306 * and "enchanted" items of the "good" variety.
308 * It can probably be argued that this function is now too powerful.
311 bool detect_objects_magic(POSITION range)
313 OBJECT_TYPE_VALUE tv;
319 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
321 /* Scan all objects */
322 for (i = 1; i < current_floor_ptr->o_max; i++)
324 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
326 /* Skip dead objects */
327 if (!o_ptr->k_idx) continue;
329 /* Skip held objects */
330 if (o_ptr->held_m_idx) continue;
335 /* Only detect nearby objects */
336 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
338 /* Examine the tval */
341 /* Artifacts, misc magic items, or enchanted wearables */
342 if (object_is_artifact(o_ptr) ||
343 object_is_ego(o_ptr) ||
344 (tv == TV_WHISTLE) ||
352 (tv == TV_LIFE_BOOK) ||
353 (tv == TV_SORCERY_BOOK) ||
354 (tv == TV_NATURE_BOOK) ||
355 (tv == TV_CHAOS_BOOK) ||
356 (tv == TV_DEATH_BOOK) ||
357 (tv == TV_TRUMP_BOOK) ||
358 (tv == TV_ARCANE_BOOK) ||
359 (tv == TV_CRAFT_BOOK) ||
360 (tv == TV_DAEMON_BOOK) ||
361 (tv == TV_CRUSADE_BOOK) ||
362 (tv == TV_MUSIC_BOOK) ||
363 (tv == TV_HISSATSU_BOOK) ||
364 (tv == TV_HEX_BOOK) ||
365 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
367 /* Memorize the item */
368 o_ptr->marked |= OM_FOUND;
375 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
384 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
386 * @return 効力があった場合TRUEを返す
388 bool detect_monsters_normal(POSITION range)
394 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
396 for (i = 1; i < current_floor_ptr->m_max; i++)
398 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
399 monster_race *r_ptr = &r_info[m_ptr->r_idx];
400 if (!monster_is_valid(m_ptr)) continue;
405 /* Only detect nearby monsters */
406 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
408 /* Detect all non-invisible monsters */
409 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
411 /* Repair visibility later */
412 repair_monsters = TRUE;
414 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
415 update_monster(i, FALSE);
420 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
423 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
430 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
432 * @return 効力があった場合TRUEを返す
434 bool detect_monsters_invis(POSITION range)
440 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
442 for (i = 1; i < current_floor_ptr->m_max; i++)
444 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
445 monster_race *r_ptr = &r_info[m_ptr->r_idx];
447 if (!monster_is_valid(m_ptr)) continue;
452 /* Only detect nearby monsters */
453 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
455 /* Detect invisible monsters */
456 if (r_ptr->flags2 & RF2_INVISIBLE)
458 /* Update monster recall window */
459 if (p_ptr->monster_race_idx == m_ptr->r_idx)
461 p_ptr->window |= (PW_MONSTER);
464 /* Repair visibility later */
465 repair_monsters = TRUE;
467 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
468 update_monster(i, FALSE);
473 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
476 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
482 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
484 * @return 効力があった場合TRUEを返す
486 bool detect_monsters_evil(POSITION range)
492 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
494 for (i = 1; i < current_floor_ptr->m_max; i++)
496 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
497 monster_race *r_ptr = &r_info[m_ptr->r_idx];
498 if (!monster_is_valid(m_ptr)) continue;
503 /* Only detect nearby monsters */
504 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
506 /* Detect evil monsters */
507 if (r_ptr->flags3 & RF3_EVIL)
509 if (is_original_ap(m_ptr))
511 /* Take note that they are evil */
512 r_ptr->r_flags3 |= (RF3_EVIL);
514 /* Update monster recall window */
515 if (p_ptr->monster_race_idx == m_ptr->r_idx)
517 p_ptr->window |= (PW_MONSTER);
521 /* Repair visibility later */
522 repair_monsters = TRUE;
524 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
525 update_monster(i, FALSE);
531 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
537 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
539 * @return 効力があった場合TRUEを返す
541 bool detect_monsters_nonliving(POSITION range)
547 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
549 for (i = 1; i < current_floor_ptr->m_max; i++)
551 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
552 if (!monster_is_valid(m_ptr)) continue;
557 /* Only detect nearby monsters */
558 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
560 /* Detect non-living monsters */
561 if (!monster_living(m_ptr->r_idx))
563 /* Update monster recall window */
564 if (p_ptr->monster_race_idx == m_ptr->r_idx)
566 p_ptr->window |= (PW_MONSTER);
569 /* Repair visibility later */
570 repair_monsters = TRUE;
572 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
573 update_monster(i, FALSE);
579 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
585 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
587 * @return 効力があった場合TRUEを返す
589 bool detect_monsters_mind(POSITION range)
595 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
597 for (i = 1; i < current_floor_ptr->m_max; i++)
599 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
600 monster_race *r_ptr = &r_info[m_ptr->r_idx];
601 if (!monster_is_valid(m_ptr)) continue;
606 /* Only detect nearby monsters */
607 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
609 /* Detect non-living monsters */
610 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
612 /* Update monster recall window */
613 if (p_ptr->monster_race_idx == m_ptr->r_idx)
615 p_ptr->window |= (PW_MONSTER);
618 /* Repair visibility later */
619 repair_monsters = TRUE;
621 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
622 update_monster(i, FALSE);
628 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
635 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
637 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
638 * @return 効力があった場合TRUEを返す
640 bool detect_monsters_string(POSITION range, concptr Match)
646 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
648 for (i = 1; i < current_floor_ptr->m_max; i++)
650 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
651 monster_race *r_ptr = &r_info[m_ptr->r_idx];
652 if (!monster_is_valid(m_ptr)) continue;
657 /* Only detect nearby monsters */
658 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
660 /* Detect monsters with the same symbol */
661 if (my_strchr(Match, r_ptr->d_char))
663 /* Update monster recall window */
664 if (p_ptr->monster_race_idx == m_ptr->r_idx)
666 p_ptr->window |= (PW_MONSTER);
669 /* Repair visibility later */
670 repair_monsters = TRUE;
672 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
673 update_monster(i, FALSE);
678 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
681 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
687 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
689 * @param match_flag 感知フラグ
690 * @return 効力があった場合TRUEを返す
692 bool detect_monsters_xxx(POSITION range, u32b match_flag)
697 concptr desc_monsters = _("変なモンスター", "weird monsters");
699 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
701 for (i = 1; i < current_floor_ptr->m_max; i++)
703 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
704 monster_race *r_ptr = &r_info[m_ptr->r_idx];
705 if (!monster_is_valid(m_ptr)) continue;
710 /* Only detect nearby monsters */
711 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
713 /* Detect evil monsters */
714 if (r_ptr->flags3 & (match_flag))
716 if (is_original_ap(m_ptr))
718 /* Take note that they are something */
719 r_ptr->r_flags3 |= (match_flag);
721 /* Update monster recall window */
722 if (p_ptr->monster_race_idx == m_ptr->r_idx)
724 p_ptr->window |= (PW_MONSTER);
728 /* Repair visibility later */
729 repair_monsters = TRUE;
731 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
732 update_monster(i, FALSE);
741 desc_monsters = _("デーモン", "demons");
744 desc_monsters = _("アンデッド", "the undead");
748 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
756 * @brief 全感知処理 / Detect everything
758 * @return 効力があった場合TRUEを返す
760 bool detect_all(POSITION range)
764 /* Detect everything */
765 if (detect_traps(range, TRUE)) detect = TRUE;
766 if (detect_doors(range)) detect = TRUE;
767 if (detect_stairs(range)) detect = TRUE;
769 /* There are too many hidden treasure. So... */
770 /* if (detect_treasure(range)) detect = TRUE; */
772 if (detect_objects_gold(range)) detect = TRUE;
773 if (detect_objects_normal(range)) detect = TRUE;
774 if (detect_monsters_invis(range)) detect = TRUE;
775 if (detect_monsters_normal(range)) detect = TRUE;
781 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
784 * @return 効力があった場合TRUEを返す
787 * Note that affected monsters are NOT auto-tracked by this usage.
789 * To avoid misbehavior when monster deaths have side-effects,
790 * this is done in two passes. -- JDL
793 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
797 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
798 bool obvious = FALSE;
800 /* Mark all (nearby) monsters */
801 for (i = 1; i < current_floor_ptr->m_max; i++)
803 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
804 if (!monster_is_valid(m_ptr)) 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_LOS);
816 /* Affect all marked monsters */
817 for (i = 1; i < current_floor_ptr->m_max; i++)
819 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
821 /* Skip unmarked monsters */
822 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
825 m_ptr->mflag &= ~(MFLAG_LOS);
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_all_los(GF_OLD_SPEED, p_ptr->lev));
847 * @brief 視界内モンスターを加速する処理 / Slow monsters
848 * @return 効力があった場合TRUEを返す
850 bool slow_monsters(int power)
852 return (project_all_los(GF_OLD_SLOW, power));
856 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
857 * @return 効力があった場合TRUEを返す
859 bool sleep_monsters(int power)
861 return (project_all_los(GF_OLD_SLEEP, power));
865 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
866 * @return 効力があった場合TRUEを返す
868 bool banish_evil(int dist)
870 return (project_all_los(GF_AWAY_EVIL, dist));
874 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
875 * @return 効力があった場合TRUEを返す
877 bool turn_undead(void)
879 bool tester = (project_all_los(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_all_los(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_all_los(GF_DISP_EVIL, dam));
907 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
908 * @return 効力があった場合TRUEを返す
910 bool dispel_good(HIT_POINT dam)
912 return (project_all_los(GF_DISP_GOOD, dam));
916 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
917 * @return 効力があった場合TRUEを返す
919 bool dispel_monsters(HIT_POINT dam)
921 return (project_all_los(GF_DISP_ALL, dam));
924 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
927 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
928 int k = 3 * creature_ptr->lev;
929 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
930 if (set_poisoned(0)) ident = TRUE;
931 if (set_afraid(0)) ident = TRUE;
932 if (hp_player(50)) ident = TRUE;
933 if (set_stun(0)) ident = TRUE;
934 if (set_cut(0)) ident = TRUE;
938 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
940 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
941 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
942 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
943 if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE))
945 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
951 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
952 * @return 効力があった場合TRUEを返す
954 bool dispel_living(HIT_POINT dam)
956 return (project_all_los(GF_DISP_LIVING, dam));
960 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
961 * @return 効力があった場合TRUEを返す
963 bool dispel_demons(HIT_POINT dam)
965 return (project_all_los(GF_DISP_DEMON, dam));
969 * @brief 視界内のモンスターに「聖戦」効果を与える処理
970 * @return 効力があった場合TRUEを返す
974 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
978 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
979 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
982 void aggravate_monsters(MONSTER_IDX who)
988 /* Aggravate everyone nearby */
989 for (i = 1; i < current_floor_ptr->m_max; i++)
991 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
992 if (!monster_is_valid(m_ptr)) continue;
994 /* Skip aggravating monster (or player) */
995 if (i == who) continue;
997 /* Wake up nearby sleeping monsters */
998 if (m_ptr->cdis < MAX_SIGHT * 2)
1001 if (MON_CSLEEP(m_ptr))
1003 (void)set_monster_csleep(i, 0);
1006 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1009 /* Speed up monsters in line of sight */
1010 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1014 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1020 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1021 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1022 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1027 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1028 * @param m_idx 抹殺するモンスターID
1029 * @param power 抹殺の威力
1030 * @param player_cast プレイヤーの魔法によるものならば TRUE
1031 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1032 * @param spell_name 抹殺効果を起こした魔法の名前
1033 * @return 効力があった場合TRUEを返す
1035 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1037 int msec = delay_factor * delay_factor * delay_factor;
1038 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1039 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1040 bool resist = FALSE;
1042 if (is_pet(m_ptr) && !player_cast) return FALSE;
1044 /* Hack -- Skip Unique Monsters or Quest Monsters */
1045 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1046 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1047 else if (m_idx == p_ptr->riding) resist = TRUE;
1048 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1049 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1050 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1054 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1056 GAME_TEXT m_name[MAX_NLEN];
1058 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1059 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1062 delete_monster_idx(m_idx);
1065 if (resist && player_cast)
1067 bool see_m = is_seen(m_ptr);
1068 GAME_TEXT m_name[MAX_NLEN];
1070 monster_desc(m_name, m_ptr, 0);
1073 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1075 if (MON_CSLEEP(m_ptr))
1077 (void)set_monster_csleep(m_idx, 0);
1080 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1083 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1087 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1091 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1096 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1099 /* Visual feedback */
1100 move_cursor_relative(p_ptr->y, p_ptr->x);
1102 p_ptr->redraw |= (PR_HP);
1103 p_ptr->window |= (PW_PLAYER);
1108 Term_xtra(TERM_XTRA_DELAY, msec);
1115 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1116 * @param power 抹殺の威力
1117 * @param player_cast プレイヤーの魔法によるものならば TRUE
1118 * @return 効力があった場合TRUEを返す
1120 bool symbol_genocide(int power, bool player_cast)
1124 bool result = FALSE;
1126 /* Prevent genocide in quest levels */
1127 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1129 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1133 /* Mega-Hack -- Get a monster symbol */
1134 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1136 /* Delete the monsters of that "type" */
1137 for (i = 1; i < current_floor_ptr->m_max; i++)
1139 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1140 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1141 if (!monster_is_valid(m_ptr)) continue;
1143 /* Skip "wrong" monsters */
1144 if (r_ptr->d_char != typ) continue;
1146 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1151 chg_virtue(V_VITALITY, -2);
1152 chg_virtue(V_CHANCE, -1);
1160 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1161 * @param power 抹殺の威力
1162 * @param player_cast プレイヤーの魔法によるものならば TRUE
1163 * @return 効力があった場合TRUEを返す
1165 bool mass_genocide(int power, bool player_cast)
1168 bool result = FALSE;
1170 /* Prevent mass genocide in quest levels */
1171 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1176 /* Delete the (nearby) monsters */
1177 for (i = 1; i < current_floor_ptr->m_max; i++)
1179 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1180 if (!monster_is_valid(m_ptr)) continue;
1182 /* Skip distant monsters */
1183 if (m_ptr->cdis > MAX_SIGHT) continue;
1186 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1191 chg_virtue(V_VITALITY, -2);
1192 chg_virtue(V_CHANCE, -1);
1200 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1201 * @param power 抹殺の威力
1202 * @param player_cast プレイヤーの魔法によるものならば TRUE
1203 * @return 効力があった場合TRUEを返す
1205 bool mass_genocide_undead(int power, bool player_cast)
1208 bool result = FALSE;
1210 /* Prevent mass genocide in quest levels */
1211 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1216 /* Delete the (nearby) monsters */
1217 for (i = 1; i < current_floor_ptr->m_max; i++)
1219 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1220 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1221 if (!monster_is_valid(m_ptr)) continue;
1223 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1225 /* Skip distant monsters */
1226 if (m_ptr->cdis > MAX_SIGHT) continue;
1229 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1234 chg_virtue(V_UNLIFE, -2);
1235 chg_virtue(V_CHANCE, -1);
1243 * @brief 周辺モンスターを調査する / Probe nearby monsters
1244 * @return 効力があった場合TRUEを返す
1249 int speed; /* TODO */
1260 /* Probe all (nearby) monsters */
1261 for (i = 1; i < current_floor_ptr->m_max; i++)
1263 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1264 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1265 if (!monster_is_valid(m_ptr)) continue;
1267 /* Require line of sight */
1268 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1270 /* Probe visible monsters */
1273 GAME_TEXT m_name[MAX_NLEN];
1275 /* Start the message */
1278 msg_print(_("調査中...", "Probing..."));
1283 if (!is_original_ap(m_ptr))
1285 if (m_ptr->mflag2 & MFLAG2_KAGE)
1286 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1288 m_ptr->ap_r_idx = m_ptr->r_idx;
1289 lite_spot(m_ptr->fy, m_ptr->fx);
1291 /* Get "the monster" or "something" */
1292 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1294 speed = m_ptr->mspeed - 110;
1295 if (MON_FAST(m_ptr)) speed += 10;
1296 if (MON_SLOW(m_ptr)) speed -= 10;
1297 if (ironman_nightmare) speed += 5;
1299 /* Get the monster's alignment */
1300 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1301 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1302 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1303 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1304 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1305 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1306 else align = _("中立", "neutral");
1308 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1309 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1311 if (r_ptr->next_r_idx)
1313 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1317 strcat(buf, "xxx ");
1320 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1321 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1322 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1323 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1324 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1325 buf[strlen(buf)-1] = '\0';
1328 /* HACK : Add the line to message buffer */
1331 p_ptr->window |= (PW_MESSAGE);
1334 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1337 Term_erase(0, 0, 255);
1339 /* Learn everything about this monster */
1340 if (lore_do_probe(m_ptr->r_idx))
1342 /* Get base name of monster */
1343 strcpy(buf, (r_name + r_ptr->name));
1346 /* Note that we learnt some new flags -Mogami- */
1347 msg_format("%sについてさらに詳しくなった気がする。", buf);
1352 /* Note that we learnt some new flags -Mogami- */
1353 msg_format("You now know more about %s.", buf);
1355 /* Clear -more- prompt */
1370 chg_virtue(V_KNOWLEDGE, 1);
1371 msg_print(_("これで全部です。", "That's all."));
1379 * @brief *破壊*処理を行う / The spell of destruction
1380 * @param y1 破壊の中心Y座標
1381 * @param x1 破壊の中心X座標
1383 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1384 * @return 効力があった場合TRUEを返す
1387 * This spell "deletes" monsters (instead of "killing" them).
1389 * Later we may use one function for both "destruction" and
1390 * "earthquake" by using the "full" to select "destruction".
1393 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1400 /* Prevent destruction of quest levels and town */
1401 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1406 /* Lose monster light */
1407 if (!in_generate) clear_mon_lite();
1409 /* Big area of affect */
1410 for (y = (y1 - r); y <= (y1 + r); y++)
1412 for (x = (x1 - r); x <= (x1 + r); x++)
1414 /* Skip illegal grids */
1415 if (!in_bounds(y, x)) continue;
1417 /* Extract the distance */
1418 k = distance(y1, x1, y, x);
1420 /* Stay in the circle of death */
1421 if (k > r) continue;
1422 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1424 /* Lose room and vault */
1425 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1427 /* Lose light and knowledge */
1428 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1430 if (!in_generate) /* Normal */
1433 g_ptr->info &= ~(CAVE_UNSAFE);
1435 /* Hack -- Notice player affect */
1436 if (player_bold(y, x))
1438 /* Hurt the player later */
1441 /* Do not hurt this grid */
1446 /* Hack -- Skip the epicenter */
1447 if ((y == y1) && (x == x1)) continue;
1451 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1452 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1454 if (in_generate) /* In generation */
1456 /* Delete the monster (if any) */
1457 delete_monster(y, x);
1459 else if (r_ptr->flags1 & RF1_QUESTOR)
1461 /* Heal the monster */
1462 m_ptr->hp = m_ptr->maxhp;
1464 /* Try to teleport away quest monsters */
1465 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1469 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1471 GAME_TEXT m_name[MAX_NLEN];
1473 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1474 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1477 /* Delete the monster (if any) */
1478 delete_monster(y, x);
1482 /* During generation, destroyed artifacts are "preserved" */
1483 if (preserve_mode || in_generate)
1485 OBJECT_IDX this_o_idx, next_o_idx = 0;
1487 /* Scan all objects in the grid */
1488 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1491 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1492 next_o_idx = o_ptr->next_o_idx;
1494 /* Hack -- Preserve unknown artifacts */
1495 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1497 /* Mega-Hack -- Preserve the artifact */
1498 a_info[o_ptr->name1].cur_num = 0;
1500 if (in_generate && cheat_peek)
1502 GAME_TEXT o_name[MAX_NLEN];
1503 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1504 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1507 else if (in_generate && cheat_peek && o_ptr->art_name)
1509 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1510 "One of the random artifacts was *destroyed* during generation."));
1515 delete_object(y, x);
1517 /* Destroy "non-permanent" grids */
1518 if (!cave_perma_grid(g_ptr))
1520 /* Wall (or floor) type */
1523 if (!in_generate) /* Normal */
1527 /* Create granite wall */
1528 cave_set_feat(y, x, feat_granite);
1532 /* Create quartz vein */
1533 cave_set_feat(y, x, feat_quartz_vein);
1537 /* Create magma vein */
1538 cave_set_feat(y, x, feat_magma_vein);
1543 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1546 else /* In generation */
1550 /* Create granite wall */
1551 place_extra_grid(g_ptr);
1555 /* Create quartz vein */
1556 g_ptr->feat = feat_quartz_vein;
1560 /* Create magma vein */
1561 g_ptr->feat = feat_magma_vein;
1566 place_floor_grid(g_ptr);
1569 /* Clear garbage of hidden trap or door */
1578 /* Process "re-glowing" */
1579 for (y = (y1 - r); y <= (y1 + r); y++)
1581 for (x = (x1 - r); x <= (x1 + r); x++)
1583 /* Skip illegal grids */
1584 if (!in_bounds(y, x)) continue;
1586 /* Extract the distance */
1587 k = distance(y1, x1, y, x);
1589 /* Stay in the circle of death */
1590 if (k > r) continue;
1591 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1593 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1594 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1600 for (i = 0; i < 9; i++)
1602 yy = y + ddy_ddd[i];
1603 xx = x + ddx_ddd[i];
1604 if (!in_bounds2(yy, xx)) continue;
1605 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1606 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1608 g_ptr->info |= CAVE_GLOW;
1616 /* Hack -- Affect player */
1619 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1621 /* Blind the player */
1622 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1625 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1631 /* Mega-Hack -- Forget the view and lite */
1632 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1633 p_ptr->redraw |= (PR_MAP);
1634 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1636 if (p_ptr->special_defense & NINJA_S_STEALTH)
1638 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1648 * @brief 地震処理(サブルーチン) /
1649 * Induce an "earthquake" of the given radius at the given location.
1650 * @return 効力があった場合TRUEを返す
1654 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1658 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1660 * The player will take damage and "jump" into a safe grid if possible,
1661 * otherwise, he will "tunnel" through the rubble instantaneously.
1663 * Monsters will take damage, and "jump" into a safe grid if possible,
1664 * otherwise they will be "buried" in the rubble, disappearing from
1665 * the level in the same way that they do when genocided.
1667 * Note that thus the player and monsters (except eaters of walls and
1668 * passers through walls) will never occupy the same grid as a wall.
1669 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1670 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1671 * This has allowed massive simplification of the "monster" code.
1674 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1678 POSITION y, x, yy, xx, dy, dx;
1681 POSITION sy = 0, sx = 0;
1686 /* Prevent destruction of quest levels and town */
1687 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1692 /* Paranoia -- Enforce maximum range */
1695 /* Clear the "maximal blast" area */
1696 for (y = 0; y < 32; y++)
1698 for (x = 0; x < 32; x++)
1704 /* Check around the epicenter */
1705 for (dy = -r; dy <= r; dy++)
1707 for (dx = -r; dx <= r; dx++)
1709 /* Extract the location */
1713 /* Skip illegal grids */
1714 if (!in_bounds(yy, xx)) continue;
1716 /* Skip distant grids */
1717 if (distance(cy, cx, yy, xx) > r) continue;
1718 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1720 /* Lose room and vault / Lose light and knowledge */
1721 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1722 g_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 y = p_ptr->y + ddy_ddd[i];
1745 x = p_ptr->x + ddx_ddd[i];
1747 /* Skip non-empty grids */
1748 if (!cave_empty_bold(y, x)) continue;
1750 /* Important -- Skip "quake" grids */
1751 if (map[16+y-cy][16+x-cx]) continue;
1753 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1755 /* Count "safe" grids */
1758 /* Randomize choice */
1759 if (randint0(sn) > 0) continue;
1761 /* Save the safe location */
1765 /* Random message */
1766 switch (randint1(3))
1770 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1775 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1780 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1785 /* Hurt the player a lot */
1788 /* Message and damage */
1789 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1793 /* Destroy the grid, and push the player to safety */
1796 /* Calculate results */
1797 switch (randint1(3))
1801 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1807 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1808 damage = damroll(10, 4);
1809 (void)set_stun(p_ptr->stun + randint1(50));
1814 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1815 damage = damroll(10, 4);
1816 (void)set_stun(p_ptr->stun + randint1(50));
1821 /* Move the player to the safe location */
1822 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1825 /* Important -- no wall on player */
1826 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1834 GAME_TEXT m_name[MAX_NLEN];
1835 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1836 monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
1837 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1841 killer = _("地震", "an earthquake");
1844 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1848 /* Examine the quaked region */
1849 for (dy = -r; dy <= r; dy++)
1851 for (dx = -r; dx <= r; dx++)
1853 /* Extract the location */
1857 /* Skip unaffected grids */
1858 if (!map[16+yy-cy][16+xx-cx]) continue;
1859 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1861 if (g_ptr->m_idx == p_ptr->riding) continue;
1863 /* Process monsters */
1866 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1867 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1869 /* Quest monsters */
1870 if (r_ptr->flags1 & RF1_QUESTOR)
1872 /* No wall on quest monsters */
1873 map[16+yy-cy][16+xx-cx] = FALSE;
1878 /* Most monsters cannot co-exist with rock */
1879 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1880 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1882 GAME_TEXT m_name[MAX_NLEN];
1884 /* Assume not safe */
1887 /* Monster can move to escape the wall */
1888 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1890 /* Look for safety */
1891 for (i = 0; i < 8; i++)
1893 y = yy + ddy_ddd[i];
1894 x = xx + ddx_ddd[i];
1896 /* Skip non-empty grids */
1897 if (!cave_empty_bold(y, x)) continue;
1899 /* Hack -- no safety on glyph of warding */
1900 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1901 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1903 /* ... nor on the Pattern */
1904 if (pattern_tile(y, x)) continue;
1906 /* Important -- Skip "quake" grids */
1907 if (map[16+y-cy][16+x-cx]) continue;
1909 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1910 if (player_bold(y, x)) continue;
1912 /* Count "safe" grids */
1915 /* Randomize choice */
1916 if (randint0(sn) > 0) continue;
1918 /* Save the safe grid */
1923 monster_desc(m_name, m_ptr, 0);
1925 /* Scream in pain */
1926 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1928 /* Take damage from the quake */
1929 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1931 /* Monster is certainly awake */
1932 (void)set_monster_csleep(g_ptr->m_idx, 0);
1934 /* Apply damage directly */
1935 m_ptr->hp -= damage;
1937 /* Delete (not kill) "dead" monsters */
1940 if (!ignore_unview || is_seen(m_ptr))
1941 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1945 if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1947 char m2_name[MAX_NLEN];
1949 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1950 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1954 delete_monster(yy, xx);
1956 /* No longer safe */
1960 /* Hack -- Escape from the rock */
1963 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1965 /* Update the old location */
1966 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1968 /* Update the new location */
1969 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1971 /* Move the monster */
1975 update_monster(m_idx, TRUE);
1984 /* Lose monster light */
1987 /* Examine the quaked region */
1988 for (dy = -r; dy <= r; dy++)
1990 for (dx = -r; dx <= r; dx++)
1992 /* Extract the location */
1996 /* Skip unaffected grids */
1997 if (!map[16+yy-cy][16+xx-cx]) continue;
1999 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2001 /* Paranoia -- never affect player */
2002 /* if (player_bold(yy, xx)) continue; */
2004 /* Destroy location (if valid) */
2005 if (cave_valid_bold(yy, xx))
2007 delete_object(yy, xx);
2009 /* Wall (or floor) type */
2010 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2015 /* Create granite wall */
2016 cave_set_feat(yy, xx, feat_granite);
2022 /* Create quartz vein */
2023 cave_set_feat(yy, xx, feat_quartz_vein);
2029 /* Create magma vein */
2030 cave_set_feat(yy, xx, feat_magma_vein);
2037 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2043 /* Process "re-glowing" */
2044 for (dy = -r; dy <= r; dy++)
2046 for (dx = -r; dx <= r; dx++)
2048 /* Extract the location */
2052 /* Skip illegal grids */
2053 if (!in_bounds(yy, xx)) continue;
2055 /* Skip distant grids */
2056 if (distance(cy, cx, yy, xx) > r) continue;
2057 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2059 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2060 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2066 for (ii = 0; ii < 9; ii++)
2068 yyy = yy + ddy_ddd[ii];
2069 xxx = xx + ddx_ddd[ii];
2070 if (!in_bounds2(yyy, xxx)) continue;
2071 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2072 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2074 g_ptr->info |= CAVE_GLOW;
2082 /* Mega-Hack -- Forget the view and lite */
2083 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2084 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2085 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2087 if (p_ptr->special_defense & NINJA_S_STEALTH)
2089 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2097 * @brief 地震処理(プレイヤーの中心発動) /
2098 * Induce an "earthquake" of the given radius at the given location.
2099 * @return 効力があった場合TRUEを返す
2104 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2106 return earthquake_aux(cy, cx, r, 0);
2113 void discharge_minion(void)
2118 for (i = 1; i < current_floor_ptr->m_max; i++)
2120 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2121 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2122 if (m_ptr->nickname) okay = FALSE;
2124 if (!okay || p_ptr->riding)
2126 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2129 for (i = 1; i < current_floor_ptr->m_max; i++)
2132 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2133 monster_race *r_ptr;
2135 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2136 r_ptr = &r_info[m_ptr->r_idx];
2138 /* Uniques resist discharging */
2139 if (r_ptr->flags1 & RF1_UNIQUE)
2141 GAME_TEXT m_name[MAX_NLEN];
2142 monster_desc(m_name, m_ptr, 0x00);
2143 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2144 delete_monster_idx(i);
2147 dam = m_ptr->maxhp / 2;
2148 if (dam > 100) dam = (dam - 100) / 2 + 100;
2149 if (dam > 400) dam = (dam - 400) / 2 + 400;
2150 if (dam > 800) dam = 800;
2151 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2152 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2154 if (record_named_pet && m_ptr->nickname)
2156 GAME_TEXT m_name[MAX_NLEN];
2158 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2159 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2162 delete_monster_idx(i);
2168 * @brief 部屋全体を照らすサブルーチン
2172 * This routine clears the entire "temp" set.
2173 * This routine will Perma-Lite all "temp" grids.
2174 * This routine is used (only) by "lite_room()"
2175 * Dark grids are illuminated.
2176 * Also, process all affected monsters.
2178 * SMART monsters always wake up when illuminated
2179 * NORMAL monsters wake up 1/4 the time when illuminated
2180 * STUPID monsters wake up 1/10 the time when illuminated
2183 static void cave_temp_room_lite(void)
2187 /* Clear them all */
2188 for (i = 0; i < tmp_pos.n; i++)
2190 POSITION y = tmp_pos.y[i];
2191 POSITION x = tmp_pos.x[i];
2193 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2195 /* No longer in the array */
2196 g_ptr->info &= ~(CAVE_TEMP);
2198 /* Update only non-CAVE_GLOW grids */
2199 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2202 g_ptr->info |= (CAVE_GLOW);
2204 /* Process affected monsters */
2207 PERCENTAGE chance = 25;
2208 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2209 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2210 update_monster(g_ptr->m_idx, FALSE);
2212 /* Stupid monsters rarely wake up */
2213 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2215 /* Smart monsters always wake up */
2216 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2218 /* Sometimes monsters wake up */
2219 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2222 (void)set_monster_csleep(g_ptr->m_idx, 0);
2224 /* Notice the "waking up" */
2227 GAME_TEXT m_name[MAX_NLEN];
2228 monster_desc(m_name, m_ptr, 0);
2229 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2236 update_local_illumination(y, x);
2246 * @brief 部屋全体を暗くするサブルーチン
2250 * This routine clears the entire "temp" set.
2251 * This routine will "darken" all "temp" grids.
2252 * In addition, some of these grids will be "unmarked".
2253 * This routine is used (only) by "unlite_room()"
2254 * Also, process all affected monsters
2257 static void cave_temp_room_unlite(void)
2261 /* Clear them all */
2262 for (i = 0; i < tmp_pos.n; i++)
2264 POSITION y = tmp_pos.y[i];
2265 POSITION x = tmp_pos.x[i];
2268 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2269 bool do_dark = !is_mirror_grid(g_ptr);
2271 /* No longer in the array */
2272 g_ptr->info &= ~(CAVE_TEMP);
2274 /* Darken the grid */
2277 if (current_floor_ptr->dun_level || !is_daytime())
2279 for (j = 0; j < 9; j++)
2281 POSITION by = y + ddy_ddd[j];
2282 POSITION bx = x + ddx_ddd[j];
2284 if (in_bounds2(by, bx))
2286 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2288 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2296 if (!do_dark) continue;
2299 g_ptr->info &= ~(CAVE_GLOW);
2301 /* Hack -- Forget "boring" grids */
2302 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2304 /* Forget the grid */
2305 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2309 /* Process affected monsters */
2312 update_monster(g_ptr->m_idx, FALSE);
2316 update_local_illumination(y, x);
2326 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2329 * @param pass_bold 地形条件を返す関数ポインタ
2332 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2339 for (i = 0; i < 16; i++)
2341 y = cy + ddy_cdd[i % 8];
2342 x = cx + ddx_cdd[i % 8];
2344 /* Found a wall, break the length */
2345 if (!pass_bold(y, x))
2347 /* Track best length */
2361 return (MAX(len, blen));
2365 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2368 * @param pass_bold 地形条件を返す関数ポインタ
2371 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2377 for (i = 0; i < 8; i++)
2379 y = cy + ddy_ddd[i];
2380 x = cx + ddx_ddd[i];
2382 if (!pass_bold(y, x)) c++;
2390 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2391 * @param y 部屋内のy座標1点
2392 * @param x 部屋内のx座標1点
2393 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2394 * @param pass_bold 地形条件を返す関数ポインタ
2397 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2400 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2402 /* Avoid infinite recursion */
2403 if (g_ptr->info & (CAVE_TEMP)) return;
2405 /* Do not "leave" the current room */
2406 if (!(g_ptr->info & (CAVE_ROOM)))
2408 if (only_room) return;
2411 if (!in_bounds2(y, x)) return;
2413 /* Do not exceed the maximum spell range */
2414 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2416 /* Verify this grid */
2418 * The reason why it is ==6 instead of >5 is that 8 is impossible
2419 * due to the check for cave_bold above.
2420 * 7 lights dead-end corridors (you need to do this for the
2421 * checkboard interesting rooms, so that the boundary is lit
2423 * This leaves only a check for 6 bounding walls!
2425 if (in_bounds(y, x) && pass_bold(y, x) &&
2426 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2429 /* Paranoia -- verify space */
2430 if (tmp_pos.n == TEMP_MAX) return;
2432 /* Mark the grid as "seen" */
2433 g_ptr->info |= (CAVE_TEMP);
2435 /* Add it to the "seen" set */
2436 tmp_pos.y[tmp_pos.n] = y;
2437 tmp_pos.x[tmp_pos.n] = x;
2442 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2445 * @return 光を通すならばtrueを返す。
2447 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2449 return cave_los_bold(y, x);
2453 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2458 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2460 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2464 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2467 * @return 射線を通すならばtrueを返す。
2469 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2471 return cave_have_flag_bold(y, x, FF_PROJECT);
2476 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2481 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2483 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2488 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2493 void lite_room(POSITION y1, POSITION x1)
2498 /* Add the initial grid */
2499 cave_temp_lite_room_aux(y1, x1);
2501 /* While grids are in the queue, add their neighbors */
2502 for (i = 0; i < tmp_pos.n; i++)
2504 x = tmp_pos.x[i], y = tmp_pos.y[i];
2506 /* Walls get lit, but stop light */
2507 if (!cave_pass_lite_bold(y, x)) continue;
2509 /* Spread adjacent */
2510 cave_temp_lite_room_aux(y + 1, x);
2511 cave_temp_lite_room_aux(y - 1, x);
2512 cave_temp_lite_room_aux(y, x + 1);
2513 cave_temp_lite_room_aux(y, x - 1);
2515 /* Spread diagonal */
2516 cave_temp_lite_room_aux(y + 1, x + 1);
2517 cave_temp_lite_room_aux(y - 1, x - 1);
2518 cave_temp_lite_room_aux(y - 1, x + 1);
2519 cave_temp_lite_room_aux(y + 1, x - 1);
2522 /* Now, lite them all up at once */
2523 cave_temp_room_lite();
2525 if (p_ptr->special_defense & NINJA_S_STEALTH)
2527 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2533 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2538 void unlite_room(POSITION y1, POSITION x1)
2543 /* Add the initial grid */
2544 cave_temp_unlite_room_aux(y1, x1);
2546 /* Spread, breadth first */
2547 for (i = 0; i < tmp_pos.n; i++)
2549 x = tmp_pos.x[i], y = tmp_pos.y[i];
2551 /* Walls get dark, but stop darkness */
2552 if (!cave_pass_dark_bold(y, x)) continue;
2554 /* Spread adjacent */
2555 cave_temp_unlite_room_aux(y + 1, x);
2556 cave_temp_unlite_room_aux(y - 1, x);
2557 cave_temp_unlite_room_aux(y, x + 1);
2558 cave_temp_unlite_room_aux(y, x - 1);
2560 /* Spread diagonal */
2561 cave_temp_unlite_room_aux(y + 1, x + 1);
2562 cave_temp_unlite_room_aux(y - 1, x - 1);
2563 cave_temp_unlite_room_aux(y - 1, x + 1);
2564 cave_temp_unlite_room_aux(y + 1, x - 1);
2567 /* Now, darken them all at once */
2568 cave_temp_room_unlite();
2571 bool starlight(bool magic)
2573 HIT_POINT num = damroll(5, 3);
2574 POSITION y = 0, x = 0;
2578 if (!p_ptr->blind && !magic)
2580 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2582 for (k = 0; k < num; k++)
2588 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2589 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2590 if (!player_bold(y, x)) break;
2593 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2594 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2602 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2605 * @return 作用が実際にあった場合TRUEを返す
2607 bool lite_area(HIT_POINT dam, POSITION rad)
2609 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2611 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2613 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2619 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2622 /* Hook into the "project()" function */
2623 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2625 lite_room(p_ptr->y, p_ptr->x);
2633 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2636 * @return 作用が実際にあった場合TRUEを返す
2638 bool unlite_area(HIT_POINT dam, POSITION rad)
2640 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2644 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2647 /* Hook into the "project()" function */
2648 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2650 unlite_room(p_ptr->y, p_ptr->x);
2659 * @brief ボール系スペルの発動 / Cast a ball spell
2661 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2664 * @return 作用が実際にあった場合TRUEを返す
2667 * Stop if we hit a monster, act as a "ball"
2668 * Allow "target" mode to pass over monsters
2669 * Affect grids, objects, and monsters
2672 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2676 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2678 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2679 /* Use the given direction */
2680 tx = p_ptr->x + 99 * ddx[dir];
2681 ty = p_ptr->y + 99 * ddy[dir];
2683 /* Hack -- Use an actual "target" */
2684 if ((dir == 5) && target_okay())
2686 flg &= ~(PROJECT_STOP);
2691 /* Analyze the "dir" and the "target". Hurt items on floor. */
2692 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2696 * @brief ブレス系スペルの発動 / Cast a breath spell
2698 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2701 * @return 作用が実際にあった場合TRUEを返す
2704 * Stop if we hit a monster, act as a "ball"
2705 * Allow "target" mode to pass over monsters
2706 * Affect grids, objects, and monsters
2709 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2711 return fire_ball(typ, dir, dam, -rad);
2716 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2718 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2721 * @return 作用が実際にあった場合TRUEを返す
2724 * Stop if we hit a monster, act as a "ball"
2725 * Allow "target" mode to pass over monsters
2726 * Affect grids, objects, and monsters
2729 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2732 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2734 /* Use the given direction */
2735 tx = p_ptr->x + 99 * ddx[dir];
2736 ty = p_ptr->y + 99 * ddy[dir];
2738 /* Hack -- Use an actual "target" */
2739 if ((dir == 5) && target_okay())
2745 /* Analyze the "dir" and the "target". Hurt items on floor. */
2746 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2751 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2753 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2756 * @return 作用が実際にあった場合TRUEを返す
2759 * Stop if we hit a monster, act as a "ball"
2760 * Allow "target" mode to pass over monsters
2761 * Affect grids, objects, and monsters
2764 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2767 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2769 /* Use the given direction */
2770 tx = p_ptr->x + 99 * ddx[dir];
2771 ty = p_ptr->y + 99 * ddy[dir];
2773 /* Hack -- Use an actual "target" */
2774 if ((dir == 5) && target_okay())
2776 flg &= ~(PROJECT_STOP);
2781 /* Analyze the "dir" and the "target". Hurt items on floor. */
2782 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2787 * @brief メテオ系スペルの発動 / Cast a meteor spell
2788 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2794 * @return 作用が実際にあった場合TRUEを返す
2797 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2798 * player, or outside source, that starts out at an arbitrary location, and
2799 * leaving no trail from the "caster" to the target. This function is
2800 * especially useful for bombardments and similar. -LM-
2801 * Option to hurt the player.
2804 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2806 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2808 /* Analyze the "target" and the caster. */
2809 return (project(who, rad, y, x, dam, typ, flg, -1));
2814 * @brief ブラスト系スペルの発動 / Cast a blast spell
2816 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2821 * @return 作用が実際にあった場合TRUEを返す
2823 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2827 POSITION ty, tx, y, x;
2830 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2835 /* Use the given direction */
2838 ly = ty = p_ptr->y + 20 * ddy[dir];
2839 lx = tx = p_ptr->x + 20 * ddx[dir];
2842 /* Use an actual "target" */
2843 else /* if (dir == 5) */
2848 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2849 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2852 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2855 for (i = 0; i < num; i++)
2859 /* Get targets for some bolts */
2860 y = rand_spread(ly, ld * dev / 20);
2861 x = rand_spread(lx, ld * dev / 20);
2863 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2866 /* Analyze the "dir" and the "target". */
2867 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2878 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2879 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2880 * @return 作用が実際にあった場合TRUEを返す
2882 bool teleport_swap(DIRECTION dir)
2886 monster_type* m_ptr;
2887 monster_race* r_ptr;
2889 if ((dir == 5) && target_okay())
2896 tx = p_ptr->x + ddx[dir];
2897 ty = p_ptr->y + ddy[dir];
2899 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2901 if (p_ptr->anti_tele)
2903 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2907 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2909 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2913 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2915 msg_print(_("失敗した。", "Failed to swap."));
2919 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2920 r_ptr = &r_info[m_ptr->r_idx];
2922 (void)set_monster_csleep(g_ptr->m_idx, 0);
2924 if (r_ptr->flagsr & RFR_RES_TELE)
2926 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2927 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2931 sound(SOUND_TELEPORT);
2933 /* Swap the player and monster */
2934 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2942 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2944 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2947 * @return 作用が実際にあった場合TRUEを返す
2949 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2953 /* Pass through the target if needed */
2954 flg |= (PROJECT_THRU);
2956 /* Use the given direction */
2957 tx = p_ptr->x + ddx[dir];
2958 ty = p_ptr->y + ddy[dir];
2960 /* Hack -- Use an actual "target" */
2961 if ((dir == 5) && target_okay())
2967 /* Analyze the "dir" and the "target", do NOT explode */
2968 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2973 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2975 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2977 * @return 作用が実際にあった場合TRUEを返す
2980 * Stop if we hit a monster, as a "bolt".
2981 * Affect monsters and grids (not objects).
2984 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2986 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2987 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2988 return (project_hook(typ, dir, dam, flg));
2993 * @brief ビーム系スペルの発動 / Cast a beam spell.
2995 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2997 * @return 作用が実際にあった場合TRUEを返す
3000 * Pass through monsters, as a "beam".
3001 * Affect monsters, grids and objects.
3004 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3006 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3007 return (project_hook(typ, dir, dam, flg));
3012 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3013 * @param prob ビーム化する確率(%)
3015 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3017 * @return 作用が実際にあった場合TRUEを返す
3020 * Pass through monsters, as a "beam".
3021 * Affect monsters, grids and objects.
3024 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3026 if (randint0(100) < prob)
3028 return (fire_beam(typ, dir, dam));
3032 return (fire_bolt(typ, dir, dam));
3037 * @brief LITE_WEAK属性による光源ビーム処理
3038 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3040 * @return 作用が実際にあった場合TRUEを返す
3042 bool lite_line(DIRECTION dir, HIT_POINT dam)
3044 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3045 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3050 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3052 * @return 作用が実際にあった場合TRUEを返す
3054 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3056 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3057 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3062 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3064 * @return 作用が実際にあった場合TRUEを返す
3066 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3068 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3069 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3074 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3075 * @return 作用が実際にあった場合TRUEを返す
3077 bool wizard_lock(DIRECTION dir)
3079 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3080 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3085 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3086 * @return 作用が実際にあった場合TRUEを返す
3088 bool destroy_door(DIRECTION dir)
3090 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3091 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3096 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3097 * @return 作用が実際にあった場合TRUEを返す
3099 bool disarm_trap(DIRECTION dir)
3101 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3102 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3108 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3109 * @param plev プレイヤーレベル(効力はplev*200)
3110 * @return 作用が実際にあった場合TRUEを返す
3112 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3114 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3115 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3119 * @brief モンスター用テレポート処理
3120 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3121 * @param distance 移動距離
3122 * @return 作用が実際にあった場合TRUEを返す
3124 bool teleport_monster(DIRECTION dir, int distance)
3126 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3127 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3131 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3132 * @return 作用が実際にあった場合TRUEを返す
3134 bool door_creation(void)
3136 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3137 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3141 * @brief トラップ生成処理(起点から周囲1マス)
3144 * @return 作用が実際にあった場合TRUEを返す
3146 bool trap_creation(POSITION y, POSITION x)
3148 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3149 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3153 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3154 * @return 作用が実際にあった場合TRUEを返す
3156 bool tree_creation(void)
3158 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3159 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3163 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3164 * @return 作用が実際にあった場合TRUEを返す
3166 bool glyph_creation(void)
3168 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3169 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3173 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3174 * @return 作用が実際にあった場合TRUEを返す
3176 bool wall_stone(void)
3178 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3179 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3180 p_ptr->update |= (PU_FLOW);
3181 p_ptr->redraw |= (PR_MAP);
3186 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3187 * @return 作用が実際にあった場合TRUEを返す
3189 bool destroy_doors_touch(void)
3191 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3192 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3196 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3197 * @return 作用が実際にあった場合TRUEを返す
3199 bool disarm_traps_touch(void)
3201 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3202 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3206 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3207 * @return 作用が実際にあった場合TRUEを返す
3209 bool sleep_monsters_touch(void)
3211 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3212 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3217 * @brief 死者復活処理(起点より周囲5マス)
3218 * @param who 術者モンスターID(0ならばプレイヤー)
3221 * @return 作用が実際にあった場合TRUEを返す
3223 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3225 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3226 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3231 * @return 作用が実際にあった場合TRUEを返す
3233 void call_chaos(void)
3235 int Chaos_type, dummy, dir;
3236 PLAYER_LEVEL plev = p_ptr->lev;
3237 bool line_chaos = FALSE;
3239 int hurt_types[31] =
3241 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3242 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3243 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3244 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3245 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3246 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3247 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3248 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3251 Chaos_type = hurt_types[randint0(31)];
3252 if (one_in_(4)) line_chaos = TRUE;
3256 for (dummy = 1; dummy < 10; dummy++)
3261 fire_beam(Chaos_type, dummy, 150);
3263 fire_ball(Chaos_type, dummy, 150, 2);
3267 else if (one_in_(3))
3269 fire_ball(Chaos_type, 0, 500, 8);
3273 if (!get_aim_dir(&dir)) return;
3275 fire_beam(Chaos_type, dir, 250);
3277 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3282 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3283 * @param stop_ty 再帰処理停止フラグ
3285 * @return 作用が実際にあった場合TRUEを返す
3288 * rr9: Stop the nasty things when a Cyberdemon is summoned
3289 * or the player gets paralyzed.
3292 bool activate_ty_curse(bool stop_ty, int *count)
3295 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3299 switch (randint1(34))
3304 msg_print(_("地面が揺れた...", "The ground trembles..."));
3305 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3306 if (!one_in_(6)) break;
3311 HIT_POINT dam = damroll(10, 10);
3312 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3313 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3314 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3315 if (!one_in_(6)) break;
3320 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3321 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3322 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3323 if (!one_in_(6)) break;
3326 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3330 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3331 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3333 if (!one_in_(6)) break;
3334 case 1: case 2: case 3: case 16: case 17:
3335 aggravate_monsters(0);
3336 if (!one_in_(6)) break;
3337 case 4: case 5: case 6:
3338 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3339 if (!one_in_(6)) break;
3340 case 7: case 8: case 9: case 18:
3341 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3342 if (!one_in_(6)) break;
3343 case 10: case 11: case 12:
3344 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3345 lose_exp(p_ptr->exp / 16);
3346 if (!one_in_(6)) break;
3347 case 13: case 14: case 15: case 19: case 20:
3348 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3354 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3355 if (p_ptr->free_act)
3356 set_paralyzed(p_ptr->paralyzed + randint1(3));
3358 set_paralyzed(p_ptr->paralyzed + randint1(13));
3361 if (!one_in_(6)) break;
3362 case 21: case 22: case 23:
3363 (void)do_dec_stat(randint0(6));
3364 if (!one_in_(6)) break;
3366 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3368 if (!one_in_(6)) break;
3371 * Only summon Cyberdemons deep in the dungeon.
3373 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3375 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3379 if (!one_in_(6)) break;
3385 (void)do_dec_stat(i);
3393 while (one_in_(3) && !stop_ty);
3399 * @brief HI_SUMMON(上級召喚)処理発動
3402 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3403 * @return 作用が実際にあった場合TRUEを返す
3405 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3410 BIT_FLAGS mode = PM_ALLOW_GROUP;
3417 mode |= PM_FORCE_FRIENDLY;
3421 mode |= PM_FORCE_PET;
3426 if (!pet) mode |= PM_NO_PET;
3428 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3430 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3432 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3435 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3438 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3441 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3444 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3447 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3450 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3453 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3456 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3460 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3464 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3467 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3468 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3471 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3472 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3475 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3478 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3479 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3487 * @brief 周辺破壊効果(プレイヤー中心)
3488 * @return 作用が実際にあった場合TRUEを返す
3490 void wall_breaker(void)
3493 POSITION y = 0, x = 0;
3494 int attempts = 1000;
3496 if (randint1(80 + p_ptr->lev) < 70)
3500 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3502 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3504 if (!player_bold(y, x)) break;
3507 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3508 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3510 else if (randint1(100) > 30)
3512 earthquake(p_ptr->y, p_ptr->x, 1);
3516 int num = damroll(5, 3);
3518 for (i = 0; i < num; i++)
3522 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3524 if (!player_bold(y, x)) break;
3527 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3528 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3535 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3537 * @return 作用が実際にあった場合TRUEを返す
3539 bool confuse_monsters(HIT_POINT dam)
3541 return (project_all_los(GF_OLD_CONF, dam));
3546 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3548 * @return 作用が実際にあった場合TRUEを返す
3550 bool charm_monsters(HIT_POINT dam)
3552 return (project_all_los(GF_CHARM, dam));
3557 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3559 * @return 作用が実際にあった場合TRUEを返す
3561 bool charm_animals(HIT_POINT dam)
3563 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3568 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3570 * @return 作用が実際にあった場合TRUEを返す
3572 bool stun_monsters(HIT_POINT dam)
3574 return (project_all_los(GF_STUN, dam));
3579 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3581 * @return 作用が実際にあった場合TRUEを返す
3583 bool stasis_monsters(HIT_POINT dam)
3585 return (project_all_los(GF_STASIS, dam));
3590 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3592 * @return 作用が実際にあった場合TRUEを返す
3594 bool mindblast_monsters(HIT_POINT dam)
3596 return (project_all_los(GF_PSI, dam));
3601 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3602 * @param dist 効力(距離)
3603 * @return 作用が実際にあった場合TRUEを返す
3605 bool banish_monsters(int dist)
3607 return (project_all_los(GF_AWAY_ALL, dist));
3612 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3614 * @return 作用が実際にあった場合TRUEを返す
3616 bool turn_evil(HIT_POINT dam)
3618 return (project_all_los(GF_TURN_EVIL, dam));
3623 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3625 * @return 作用が実際にあった場合TRUEを返す
3627 bool turn_monsters(HIT_POINT dam)
3629 return (project_all_los(GF_TURN_ALL, dam));
3634 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3635 * @return 作用が実際にあった場合TRUEを返す
3637 bool deathray_monsters(void)
3639 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3643 * @brief チャーム・モンスター(1体)
3644 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3646 * @return 作用が実際にあった場合TRUEを返す
3648 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3650 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3651 return (project_hook(GF_CHARM, dir, plev, flg));
3655 * @brief アンデッド支配(1体)
3656 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3658 * @return 作用が実際にあった場合TRUEを返す
3660 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3662 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3663 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3668 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3670 * @return 作用が実際にあった場合TRUEを返す
3672 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3674 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3675 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3680 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3682 * @return 作用が実際にあった場合TRUEを返す
3684 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3686 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3687 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3693 * @param success 判定成功上の処理ならばTRUE
3694 * @return 作用が実際にあった場合TRUEを返す
3696 bool kawarimi(bool success)
3699 object_type *q_ptr = &forge;
3702 if (p_ptr->is_dead) return FALSE;
3703 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3704 if (randint0(200) < p_ptr->stun) return FALSE;
3706 if (!success && one_in_(3))
3708 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3709 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3710 p_ptr->redraw |= (PR_STATUS);
3717 teleport_player(10 + randint1(90), 0L);
3719 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3721 q_ptr->pval = MON_NINJA;
3722 (void)drop_near(q_ptr, -1, y, x);
3724 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3725 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3727 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3728 p_ptr->redraw |= (PR_STATUS);
3736 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3737 * @param mdeath 目標モンスターが死亡したかを返す
3738 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3740 bool rush_attack(bool *mdeath)
3747 bool tmp_mdeath = FALSE;
3750 if (mdeath) *mdeath = FALSE;
3753 if (!get_aim_dir(&dir)) return FALSE;
3755 /* Use the given direction */
3756 tx = p_ptr->x + project_length * ddx[dir];
3757 ty = p_ptr->y + project_length * ddy[dir];
3759 /* Hack -- Use an actual "target" */
3760 if ((dir == 5) && target_okay())
3766 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3768 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3771 /* No need to move */
3772 if (!path_n) return TRUE;
3774 /* Use ty and tx as to-move point */
3778 /* Project along the path */
3779 for (i = 0; i < path_n; i++)
3781 monster_type *m_ptr;
3783 int ny = GRID_Y(path_g[i]);
3784 int nx = GRID_X(path_g[i]);
3786 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3791 /* Go to next grid */
3795 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3799 msg_print(_("失敗!", "Failed!"));
3803 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3810 /* Move player before updating the monster */
3811 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3812 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3814 /* Found a monster */
3815 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3817 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3820 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3822 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3825 else if (!player_bold(ty, tx))
3827 /* Hold the monster name */
3828 GAME_TEXT m_name[MAX_NLEN];
3830 /* Get the monster name (BEFORE polymorphing) */
3831 monster_desc(m_name, m_ptr, 0);
3832 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3835 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3837 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3842 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3844 if (mdeath) *mdeath = tmp_mdeath;
3850 * @brief 全鏡の消去 / Remove all mirrors in this floor
3851 * @param explode 爆発処理を伴うならばTRUE
3854 void remove_all_mirrors(bool explode)
3858 for (x = 0; x < current_floor_ptr->width; x++)
3860 for (y = 0; y < current_floor_ptr->height; y++)
3862 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3864 remove_mirror(y, x);
3866 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3867 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3874 * @brief 『一つの指輪』の効果処理 /
3875 * Hack -- activate the ring of power
3876 * @param dir 発動の方向ID
3879 void ring_of_power(DIRECTION dir)
3881 /* Pick a random effect */
3882 switch (randint1(10))
3887 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3890 /* Decrease all stats (permanently) */
3891 (void)dec_stat(A_STR, 50, TRUE);
3892 (void)dec_stat(A_INT, 50, TRUE);
3893 (void)dec_stat(A_WIS, 50, TRUE);
3894 (void)dec_stat(A_DEX, 50, TRUE);
3895 (void)dec_stat(A_CON, 50, TRUE);
3896 (void)dec_stat(A_CHR, 50, TRUE);
3898 /* Lose some experience (permanently) */
3899 p_ptr->exp -= (p_ptr->exp / 4);
3900 p_ptr->max_exp -= (p_ptr->exp / 4);
3908 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3909 dispel_monsters(1000);
3917 fire_ball(GF_MANA, dir, 600, 3);
3926 fire_bolt(GF_MANA, dir, 500);
3933 * @brief 運命の輪、並びにカオス的な効果の発動
3934 * @param spell ランダムな効果を選択するための基準ID
3937 void wild_magic(int spell)
3940 int type = SUMMON_MOLD + randint0(6);
3942 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3943 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3945 switch (randint1(spell) + randint1(8) + 1)
3950 teleport_player(10, TELEPORT_PASSIVE);
3955 teleport_player(100, TELEPORT_PASSIVE);
3959 teleport_player(200, TELEPORT_PASSIVE);
3969 lite_area(damroll(2, 3), 2);
3972 destroy_doors_touch();
3977 sleep_monsters_touch();
3981 trap_creation(p_ptr->y, p_ptr->x);
3990 aggravate_monsters(0);
3993 earthquake(p_ptr->y, p_ptr->x, 5);
3997 (void)gain_mutation(p_ptr, 0);
4001 apply_disenchant(1);
4007 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4014 while (counter++ < 8)
4016 (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4021 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4024 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4029 (void)activate_ty_curse(FALSE, &count);
4038 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4039 * / Drop 10+1d10 meteor ball at random places near the player
4044 void cast_meteor(HIT_POINT dam, POSITION rad)
4047 int b = 10 + randint1(10);
4049 for (i = 0; i < b; i++)
4051 POSITION y = 0, x = 0;
4054 for (count = 0; count <= 20; count++)
4058 x = p_ptr->x - 8 + randint0(17);
4059 y = p_ptr->y - 8 + randint0(17);
4061 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4062 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4064 /* Approximate distance */
4065 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4067 if (d >= 9) continue;
4069 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4070 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4072 /* Valid position */
4076 if (count > 20) continue;
4078 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4084 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4087 * @return ターゲットを指定し、実行したならばTRUEを返す。
4089 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4091 POSITION x, y, tx, ty;
4095 int b = 10 + randint1(10);
4097 if (!get_aim_dir(&dir)) return FALSE;
4099 /* Use the given direction */
4100 tx = p_ptr->x + 99 * ddx[dir];
4101 ty = p_ptr->y + 99 * ddy[dir];
4103 /* Hack -- Use an actual "target" */
4104 if ((dir == 5) && target_okay())
4115 /* Hack -- Stop at the target */
4116 if ((y == ty) && (x == tx)) break;
4120 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4122 /* Stop at maximum range */
4123 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4125 /* Stopped by walls/doors */
4126 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4128 /* Stopped by monsters */
4129 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4131 /* Save the new location */
4138 for (i = 0; i < b; i++)
4140 int count = 20, d = 0;
4146 x = tx - 5 + randint0(11);
4147 y = ty - 5 + randint0(11);
4149 dx = (tx > x) ? (tx - x) : (x - tx);
4150 dy = (ty > y) ? (ty - y) : (y - ty);
4152 /* Approximate distance */
4153 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4154 /* Within the radius */
4158 if (count < 0) continue;
4160 /* Cannot penetrate perm walls */
4161 if (!in_bounds(y, x) ||
4162 cave_stop_disintegration(y, x) ||
4163 !in_disintegration_range(ty, tx, y, x))
4166 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4173 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4177 * This spell should become more useful (more controlled) as the\n
4178 * player gains experience levels. Thus, add 1/5 of the player's\n
4179 * level to the die roll. This eliminates the worst effects later on,\n
4180 * while keeping the results quite random. It also allows some potent\n
4181 * effects only at high level.
4183 void cast_wonder(DIRECTION dir)
4185 PLAYER_LEVEL plev = p_ptr->lev;
4186 int die = randint1(100) + plev / 5;
4187 int vir = virtue_number(V_CHANCE);
4191 if (p_ptr->virtues[vir - 1] > 0)
4193 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4197 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4202 chg_virtue(V_CHANCE, 1);
4206 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4209 if (die < 8) clone_monster(dir);
4210 else if (die < 14) speed_monster(dir, plev);
4211 else if (die < 26) heal_monster(dir, damroll(4, 6));
4212 else if (die < 31) poly_monster(dir, plev);
4214 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4215 damroll(3 + ((plev - 1) / 5), 4));
4216 else if (die < 41) confuse_monster(dir, plev);
4217 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4218 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4220 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4221 damroll(3 + ((plev - 5) / 4), 8));
4223 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4224 damroll(5 + ((plev - 5) / 4), 8));
4226 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4227 damroll(6 + ((plev - 5) / 4), 8));
4229 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4230 damroll(8 + ((plev - 5) / 4), 8));
4231 else if (die < 76) hypodynamic_bolt(dir, 75);
4232 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4233 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4234 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4235 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4236 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4239 earthquake(p_ptr->y, p_ptr->x, 12);
4243 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4247 symbol_genocide(plev + 50, TRUE);
4249 else if (die < 110) dispel_monsters(120);
4252 dispel_monsters(150);
4253 slow_monsters(plev);
4254 sleep_monsters(plev);
4261 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4265 void cast_invoke_spirits(DIRECTION dir)
4267 PLAYER_LEVEL plev = p_ptr->lev;
4268 int die = randint1(100) + plev / 5;
4269 int vir = virtue_number(V_CHANCE);
4273 if (p_ptr->virtues[vir - 1] > 0)
4275 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4279 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4283 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4285 chg_virtue(V_CHANCE, 1);
4289 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4294 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4295 "Oh no! Mouldering forms rise from the earth around you!"));
4297 (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4298 chg_virtue(V_UNLIFE, 1);
4302 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4304 set_afraid(p_ptr->afraid + randint1(4) + 4);
4308 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4309 "Your head is invaded by a horde of gibbering spectral voices..."));
4311 set_confused(p_ptr->confused + randint1(4) + 4);
4315 poly_monster(dir, plev);
4319 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4320 damroll(3 + ((plev - 1) / 5), 4));
4324 confuse_monster(dir, plev);
4328 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4332 (void)lite_line(dir, damroll(6, 8));
4336 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4337 damroll(3 + ((plev - 5) / 4), 8));
4341 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4342 damroll(5 + ((plev - 5) / 4), 8));
4346 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4347 damroll(6 + ((plev - 5) / 4), 8));
4351 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4352 damroll(8 + ((plev - 5) / 4), 8));
4356 hypodynamic_bolt(dir, 75);
4360 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4364 fire_ball(GF_ACID, dir, 40 + plev, 2);
4368 fire_ball(GF_ICE, dir, 70 + plev, 3);
4372 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4376 hypodynamic_bolt(dir, 100 + plev);
4380 earthquake(p_ptr->y, p_ptr->x, 12);
4384 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4388 symbol_genocide(plev + 50, TRUE);
4392 dispel_monsters(120);
4396 dispel_monsters(150);
4397 slow_monsters(plev);
4398 sleep_monsters(plev);
4404 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4405 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4410 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4413 void cast_shuffle(void)
4415 PLAYER_LEVEL plev = p_ptr->lev;
4418 int vir = virtue_number(V_CHANCE);
4421 /* Card sharks and high mages get a level bonus */
4422 if ((p_ptr->pclass == CLASS_ROGUE) ||
4423 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4424 (p_ptr->pclass == CLASS_SORCERER))
4425 die = (randint1(110)) + plev / 5;
4427 die = randint1(120);
4432 if (p_ptr->virtues[vir - 1] > 0)
4434 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4438 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4442 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4445 chg_virtue(V_CHANCE, 1);
4449 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4451 for (i = 0; i < randint1(3); i++)
4452 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4456 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4457 summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4462 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4463 activate_ty_curse(FALSE, &count);
4467 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4468 aggravate_monsters(0);
4472 msg_print(_("《愚者》だ。", "It's the Fool."));
4478 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4479 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4483 msg_print(_("《月》だ。", "It's the Moon."));
4488 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4489 wild_magic(randint0(32));
4493 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4494 teleport_player(10, TELEPORT_PASSIVE);
4498 msg_print(_("《正義》だ。", "It's Justice."));
4499 set_blessed(p_ptr->lev, FALSE);
4503 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4504 teleport_player(100, TELEPORT_PASSIVE);
4508 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4509 teleport_player(200, TELEPORT_PASSIVE);
4513 msg_print(_("《塔》だ。", "It's the Tower."));
4518 msg_print(_("《節制》だ。", "It's Temperance."));
4519 sleep_monsters_touch();
4523 msg_print(_("《塔》だ。", "It's the Tower."));
4525 earthquake(p_ptr->y, p_ptr->x, 5);
4529 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4530 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4534 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4535 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4539 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4540 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4544 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4545 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4549 msg_print(_("《恋人》だ。", "It's the Lovers."));
4551 if (get_aim_dir(&dir))
4552 charm_monster(dir, MIN(p_ptr->lev, 20));
4556 msg_print(_("《隠者》だ。", "It's the Hermit."));
4561 msg_print(_("《審判》だ。", "It's the Judgement."));
4562 roll_hitdice(p_ptr, 0L);
4563 lose_all_mutations();
4567 msg_print(_("《太陽》だ。", "It's the Sun."));
4568 chg_virtue(V_KNOWLEDGE, 1);
4569 chg_virtue(V_ENLIGHTEN, 1);
4574 msg_print(_("《世界》だ。", "It's the World."));
4575 if (p_ptr->exp < PY_MAX_EXP)
4577 s32b ee = (p_ptr->exp / 25) + 1;
4578 if (ee > 5000) ee = 5000;
4579 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4586 * @brief 口を使う継続的な処理を中断する
4589 void stop_mouth(void)
4591 if (music_singing_any()) stop_singing(p_ptr);
4592 if (hex_spelling_any()) stop_hex_spell_all();
4596 bool_hack vampirism(void)
4603 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4605 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4609 /* Only works on adjacent monsters */
4610 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4611 y = p_ptr->y + ddy[dir];
4612 x = p_ptr->x + ddx[dir];
4613 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4617 if (!(g_ptr->m_idx))
4619 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4623 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4625 dummy = p_ptr->lev * 2;
4627 if (hypodynamic_bolt(dir, dummy))
4629 if (p_ptr->food < PY_FOOD_FULL)
4630 /* No heal if we are "full" */
4631 (void)hp_player(dummy);
4633 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4635 /* Gain nutritional sustenance: 150/hp drained */
4636 /* A Food ration gives 5000 food points (by contrast) */
4637 /* Don't ever get more than "Full" this way */
4638 /* But if we ARE Gorged, it won't cure us */
4639 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4640 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4641 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4644 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4648 bool panic_hit(void)
4653 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4654 y = p_ptr->y + ddy[dir];
4655 x = p_ptr->x + ddx[dir];
4656 if (current_floor_ptr->grid_array[y][x].m_idx)
4659 if (randint0(p_ptr->skill_dis) < 7)
4660 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4662 teleport_player(30, 0L);
4667 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4675 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
4678 * currently this function allows pseudo-id of any object,
4679 * including silly ones like potions & scrolls, which always
4680 * get '{average}'. This should be changed, either to stop such
4681 * items from being pseudo-id'd, or to allow psychometry to
4682 * detect whether the unidentified potion/scroll/etc is
4683 * good (Cure Light Wounds, Restore Strength, etc) or
4684 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4686 bool psychometry(void)
4690 GAME_TEXT o_name[MAX_NLEN];
4695 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4696 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4698 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4699 if (!o_ptr) return (FALSE);
4701 /* It is fully known, no information needed */
4702 if (object_is_known(o_ptr))
4704 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4708 /* Check for a feeling */
4709 feel = value_check_aux1(o_ptr);
4711 /* Get an object description */
4712 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4714 /* Skip non-feelings */
4717 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4722 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4724 msg_format("You feel that the %s %s %s...",
4725 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4729 o_ptr->ident |= (IDENT_SENSE);
4730 o_ptr->feeling = feel;
4731 o_ptr->marked |= OM_TOUCHED;
4733 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4734 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4736 /* Valid "tval" codes */
4737 switch (o_ptr->tval)
4765 /* Auto-inscription/destroy */
4766 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4768 /* Something happened */
4773 bool draconian_breath(player_type *creature_ptr)
4776 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4777 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4779 if (!get_aim_dir(&dir)) return FALSE;
4781 if (randint1(100) < creature_ptr->lev)
4783 switch (creature_ptr->pclass)
4786 case CLASS_BERSERKER:
4789 case CLASS_IMITATOR:
4795 Type_desc = _("エレメント", "the elements");
4800 Type_desc = _("破片", "shards");
4804 case CLASS_WARRIOR_MAGE:
4805 case CLASS_HIGH_MAGE:
4806 case CLASS_SORCERER:
4807 case CLASS_MAGIC_EATER:
4808 case CLASS_RED_MAGE:
4809 case CLASS_BLUE_MAGE:
4810 case CLASS_MIRROR_MASTER:
4814 Type_desc = _("魔力", "mana");
4818 Type = GF_DISENCHANT;
4819 Type_desc = _("劣化", "disenchantment");
4822 case CLASS_CHAOS_WARRIOR:
4825 Type = GF_CONFUSION;
4826 Type_desc = _("混乱", "confusion");
4831 Type_desc = _("カオス", "chaos");
4836 case CLASS_FORCETRAINER:
4839 Type = GF_CONFUSION;
4840 Type_desc = _("混乱", "confusion");
4845 Type_desc = _("轟音", "sound");
4848 case CLASS_MINDCRAFTER:
4851 Type = GF_CONFUSION;
4852 Type_desc = _("混乱", "confusion");
4857 Type_desc = _("精神エネルギー", "mental energy");
4864 Type = GF_HELL_FIRE;
4865 Type_desc = _("地獄の劫火", "hellfire");
4869 Type = GF_HOLY_FIRE;
4870 Type_desc = _("聖なる炎", "holy fire");
4878 Type_desc = _("暗黒", "darkness");
4883 Type_desc = _("毒", "poison");
4890 Type_desc = _("轟音", "sound");
4894 Type = GF_CONFUSION;
4895 Type_desc = _("混乱", "confusion");
4902 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4904 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4908 bool android_inside_weapon(player_type *creature_ptr)
4911 if (!get_aim_dir(&dir)) return FALSE;
4912 if (creature_ptr->lev < 10)
4914 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4915 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4917 else if (creature_ptr->lev < 25)
4919 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4920 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4922 else if (creature_ptr->lev < 35)
4924 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4925 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4927 else if (creature_ptr->lev < 45)
4929 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4930 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4934 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4935 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4940 bool create_ration(player_type *crature_ptr)
4946 /* Create the food ration */
4947 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4949 /* Drop the object from heaven */
4950 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4951 msg_print(_("食事を料理して作った。", "You cook some food."));
4955 void hayagake(player_type *creature_ptr)
4957 if (creature_ptr->action == ACTION_HAYAGAKE)
4959 set_action(ACTION_NONE);
4963 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4964 feature_type *f_ptr = &f_info[g_ptr->feat];
4966 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4967 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4969 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4973 set_action(ACTION_HAYAGAKE);
4976 creature_ptr->energy_use = 0;
4979 bool double_attack(player_type *creature_ptr)
4984 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4985 y = creature_ptr->y + ddy[dir];
4986 x = creature_ptr->x + ddx[dir];
4987 if (current_floor_ptr->grid_array[y][x].m_idx)
4990 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4991 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4993 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4994 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4996 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4997 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
5000 if (current_floor_ptr->grid_array[y][x].m_idx)
5005 creature_ptr->energy_need += ENERGY_NEED();
5009 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5015 bool comvert_hp_to_mp(player_type *creature_ptr)
5017 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5020 creature_ptr->csp += gain_sp;
5021 if (creature_ptr->csp > creature_ptr->msp)
5023 creature_ptr->csp = creature_ptr->msp;
5024 creature_ptr->csp_frac = 0;
5029 msg_print(_("変換に失敗した。", "You failed to convert."));
5031 creature_ptr->redraw |= (PR_HP | PR_MANA);
5035 bool comvert_mp_to_hp(player_type *creature_ptr)
5037 if (creature_ptr->csp >= creature_ptr->lev / 5)
5039 creature_ptr->csp -= creature_ptr->lev / 5;
5040 hp_player(creature_ptr->lev);
5044 msg_print(_("変換に失敗した。", "You failed to convert."));
5046 creature_ptr->redraw |= (PR_HP | PR_MANA);
5050 bool demonic_breath(player_type *creature_ptr)
5053 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5054 if (!get_aim_dir(&dir)) return FALSE;
5056 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5057 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5061 bool mirror_concentration(player_type *creature_ptr)
5065 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5068 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5070 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5072 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5073 if (creature_ptr->csp >= creature_ptr->msp)
5075 creature_ptr->csp = creature_ptr->msp;
5076 creature_ptr->csp_frac = 0;
5078 creature_ptr->redraw |= (PR_MANA);
5082 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5087 bool sword_dancing(player_type *creature_ptr)
5090 POSITION y = 0, x = 0;
5094 for (i = 0; i < 6; i++)
5097 y = creature_ptr->y + ddy_ddd[dir];
5098 x = creature_ptr->x + ddx_ddd[dir];
5099 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5101 /* Hack -- attack monsters */
5106 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5112 bool confusing_light(player_type *creature_ptr)
5114 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5115 slow_monsters(creature_ptr->lev);
5116 stun_monsters(creature_ptr->lev * 4);
5117 confuse_monsters(creature_ptr->lev * 4);
5118 turn_monsters(creature_ptr->lev * 4);
5119 stasis_monsters(creature_ptr->lev * 4);
5123 bool rodeo(player_type *creature_ptr)
5125 GAME_TEXT m_name[MAX_NLEN];
5126 monster_type *m_ptr;
5127 monster_race *r_ptr;
5130 if (creature_ptr->riding)
5132 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5135 if (!do_riding(TRUE)) return TRUE;
5137 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5138 r_ptr = &r_info[m_ptr->r_idx];
5139 monster_desc(m_name, m_ptr, 0);
5140 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5142 if (is_pet(m_ptr)) return TRUE;
5144 rlev = r_ptr->level;
5146 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5147 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5148 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5149 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5150 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5151 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5153 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5158 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5160 /* 落馬処理に失敗してもとにかく乗馬解除 */
5161 creature_ptr->riding = 0;
5166 bool clear_mind(player_type *creature_ptr)
5170 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5173 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5175 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5176 if (creature_ptr->csp >= creature_ptr->msp)
5178 creature_ptr->csp = creature_ptr->msp;
5179 creature_ptr->csp_frac = 0;
5181 creature_ptr->redraw |= (PR_MANA);
5185 bool concentration(player_type *creature_ptr)
5187 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5191 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5194 if (creature_ptr->special_defense & KATA_MASK)
5196 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5199 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5201 creature_ptr->csp += creature_ptr->msp / 2;
5202 if (creature_ptr->csp >= max_csp)
5204 creature_ptr->csp = max_csp;
5205 creature_ptr->csp_frac = 0;
5207 creature_ptr->redraw |= (PR_MANA);