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.
18 #include "monsterrace-hook.h"
21 #include "projection.h"
22 #include "spells-summon.h"
27 #include "spells-status.h"
28 #include "realm-hex.h"
29 #include "object-hook.h"
32 * @brief プレイヤー周辺の地形を感知する
35 * @param known 地形から危険フラグを外すならTRUE
36 * @return 効力があった場合TRUEを返す
38 static bool detect_feat_flag(POSITION range, int flag, bool known)
44 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
46 /* Scan the current panel */
47 for (y = 1; y < cur_hgt - 1; y++)
49 for (x = 1; x <= cur_wid - 1; x++)
51 int dist = distance(p_ptr->y, p_ptr->x, y, x);
52 if (dist > range) continue;
53 g_ptr = &grid_array[y][x];
58 /* Mark as detected */
59 if (dist <= range && known)
61 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
63 g_ptr->info &= ~(CAVE_UNSAFE);
70 if (cave_have_flag_grid(g_ptr, flag))
75 /* Hack -- Memorize */
76 g_ptr->info |= (CAVE_MARK);
89 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
91 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
92 * @return 効力があった場合TRUEを返す
94 bool detect_traps(POSITION range, bool known)
96 bool detect = detect_feat_flag(range, FF_TRAP, known);
98 if (known) p_ptr->dtrap = TRUE;
100 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
103 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
110 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
112 * @return 効力があった場合TRUEを返す
114 bool detect_doors(POSITION range)
116 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
118 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
121 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
128 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
130 * @return 効力があった場合TRUEを返す
132 bool detect_stairs(POSITION range)
134 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
136 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
139 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
146 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
148 * @return 効力があった場合TRUEを返す
150 bool detect_treasure(POSITION range)
152 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
154 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
157 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
164 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
166 * @return 効力があった場合TRUEを返す
168 bool detect_objects_gold(POSITION range)
172 POSITION range2 = range;
176 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
179 for (i = 1; i < o_max; i++)
181 object_type *o_ptr = &o_list[i];
183 /* Skip dead objects */
184 if (!o_ptr->k_idx) continue;
186 /* Skip held objects */
187 if (o_ptr->held_m_idx) continue;
192 /* Only detect nearby objects */
193 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
195 /* Detect "gold" objects */
196 if (o_ptr->tval == TV_GOLD)
198 o_ptr->marked |= OM_FOUND;
204 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
207 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
210 if (detect_monsters_string(range, "$"))
219 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
221 * @return 効力があった場合TRUEを返す
223 bool detect_objects_normal(POSITION range)
227 POSITION range2 = range;
231 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
234 for (i = 1; i < o_max; i++)
236 object_type *o_ptr = &o_list[i];
238 /* Skip dead objects */
239 if (!o_ptr->k_idx) continue;
241 /* Skip held objects */
242 if (o_ptr->held_m_idx) continue;
247 /* Only detect nearby objects */
248 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
250 /* Detect "real" objects */
251 if (o_ptr->tval != TV_GOLD)
253 o_ptr->marked |= OM_FOUND;
259 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
262 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
265 if (detect_monsters_string(range, "!=?|/`"))
274 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
276 * @return 効力があった場合TRUEを返す
279 * This will light up all spaces with "magic" items, including artifacts,
280 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
281 * and "enchanted" items of the "good" variety.
283 * It can probably be argued that this function is now too powerful.
286 bool detect_objects_magic(POSITION range)
288 OBJECT_TYPE_VALUE tv;
294 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
296 /* Scan all objects */
297 for (i = 1; i < o_max; i++)
299 object_type *o_ptr = &o_list[i];
301 /* Skip dead objects */
302 if (!o_ptr->k_idx) continue;
304 /* Skip held objects */
305 if (o_ptr->held_m_idx) continue;
310 /* Only detect nearby objects */
311 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
313 /* Examine the tval */
316 /* Artifacts, misc magic items, or enchanted wearables */
317 if (object_is_artifact(o_ptr) ||
318 object_is_ego(o_ptr) ||
319 (tv == TV_WHISTLE) ||
327 (tv == TV_LIFE_BOOK) ||
328 (tv == TV_SORCERY_BOOK) ||
329 (tv == TV_NATURE_BOOK) ||
330 (tv == TV_CHAOS_BOOK) ||
331 (tv == TV_DEATH_BOOK) ||
332 (tv == TV_TRUMP_BOOK) ||
333 (tv == TV_ARCANE_BOOK) ||
334 (tv == TV_CRAFT_BOOK) ||
335 (tv == TV_DAEMON_BOOK) ||
336 (tv == TV_CRUSADE_BOOK) ||
337 (tv == TV_MUSIC_BOOK) ||
338 (tv == TV_HISSATSU_BOOK) ||
339 (tv == TV_HEX_BOOK) ||
340 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
342 /* Memorize the item */
343 o_ptr->marked |= OM_FOUND;
350 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
359 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
361 * @return 効力があった場合TRUEを返す
363 bool detect_monsters_normal(POSITION range)
369 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
371 for (i = 1; i < m_max; i++)
373 monster_type *m_ptr = &m_list[i];
374 monster_race *r_ptr = &r_info[m_ptr->r_idx];
376 /* Skip dead monsters */
377 if (!m_ptr->r_idx) continue;
382 /* Only detect nearby monsters */
383 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
385 /* Detect all non-invisible monsters */
386 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
388 /* Repair visibility later */
389 repair_monsters = TRUE;
391 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
392 update_monster(i, FALSE);
397 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
400 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
407 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
409 * @return 効力があった場合TRUEを返す
411 bool detect_monsters_invis(POSITION range)
417 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
419 for (i = 1; i < m_max; i++)
421 monster_type *m_ptr = &m_list[i];
422 monster_race *r_ptr = &r_info[m_ptr->r_idx];
424 /* Skip dead monsters */
425 if (!m_ptr->r_idx) continue;
430 /* Only detect nearby monsters */
431 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
433 /* Detect invisible monsters */
434 if (r_ptr->flags2 & RF2_INVISIBLE)
436 /* Update monster recall window */
437 if (p_ptr->monster_race_idx == m_ptr->r_idx)
439 p_ptr->window |= (PW_MONSTER);
442 /* Repair visibility later */
443 repair_monsters = TRUE;
445 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
446 update_monster(i, FALSE);
451 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
454 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
460 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
462 * @return 効力があった場合TRUEを返す
464 bool detect_monsters_evil(POSITION range)
470 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
472 for (i = 1; i < m_max; i++)
474 monster_type *m_ptr = &m_list[i];
475 monster_race *r_ptr = &r_info[m_ptr->r_idx];
477 /* Skip dead monsters */
478 if (!m_ptr->r_idx) continue;
483 /* Only detect nearby monsters */
484 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
486 /* Detect evil monsters */
487 if (r_ptr->flags3 & RF3_EVIL)
489 if (is_original_ap(m_ptr))
491 /* Take note that they are evil */
492 r_ptr->r_flags3 |= (RF3_EVIL);
494 /* Update monster recall window */
495 if (p_ptr->monster_race_idx == m_ptr->r_idx)
497 p_ptr->window |= (PW_MONSTER);
501 /* Repair visibility later */
502 repair_monsters = TRUE;
504 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
505 update_monster(i, FALSE);
511 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
517 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
519 * @return 効力があった場合TRUEを返す
521 bool detect_monsters_nonliving(POSITION range)
527 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
529 for (i = 1; i < m_max; i++)
531 monster_type *m_ptr = &m_list[i];
533 /* Skip dead monsters */
534 if (!m_ptr->r_idx) continue;
539 /* Only detect nearby monsters */
540 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
542 /* Detect non-living monsters */
543 if (!monster_living(m_ptr->r_idx))
545 /* Update monster recall window */
546 if (p_ptr->monster_race_idx == m_ptr->r_idx)
548 p_ptr->window |= (PW_MONSTER);
551 /* Repair visibility later */
552 repair_monsters = TRUE;
554 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
555 update_monster(i, FALSE);
561 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
567 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
569 * @return 効力があった場合TRUEを返す
571 bool detect_monsters_mind(POSITION range)
577 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
579 for (i = 1; i < m_max; i++)
581 monster_type *m_ptr = &m_list[i];
582 monster_race *r_ptr = &r_info[m_ptr->r_idx];
584 /* Skip dead monsters */
585 if (!m_ptr->r_idx) continue;
590 /* Only detect nearby monsters */
591 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
593 /* Detect non-living monsters */
594 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
596 /* Update monster recall window */
597 if (p_ptr->monster_race_idx == m_ptr->r_idx)
599 p_ptr->window |= (PW_MONSTER);
602 /* Repair visibility later */
603 repair_monsters = TRUE;
605 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
606 update_monster(i, FALSE);
612 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
619 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
621 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
622 * @return 効力があった場合TRUEを返す
624 bool detect_monsters_string(POSITION range, concptr Match)
630 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
632 for (i = 1; i < m_max; i++)
634 monster_type *m_ptr = &m_list[i];
635 monster_race *r_ptr = &r_info[m_ptr->r_idx];
637 /* Skip dead monsters */
638 if (!m_ptr->r_idx) continue;
643 /* Only detect nearby monsters */
644 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
646 /* Detect monsters with the same symbol */
647 if (my_strchr(Match, r_ptr->d_char))
649 /* Update monster recall window */
650 if (p_ptr->monster_race_idx == m_ptr->r_idx)
652 p_ptr->window |= (PW_MONSTER);
655 /* Repair visibility later */
656 repair_monsters = TRUE;
658 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
659 update_monster(i, FALSE);
664 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
667 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
673 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
675 * @param match_flag 感知フラグ
676 * @return 効力があった場合TRUEを返す
678 bool detect_monsters_xxx(POSITION range, u32b match_flag)
683 concptr desc_monsters = _("変なモンスター", "weird monsters");
685 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
687 for (i = 1; i < m_max; i++)
689 monster_type *m_ptr = &m_list[i];
690 monster_race *r_ptr = &r_info[m_ptr->r_idx];
692 /* Skip dead monsters */
693 if (!m_ptr->r_idx) continue;
698 /* Only detect nearby monsters */
699 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
701 /* Detect evil monsters */
702 if (r_ptr->flags3 & (match_flag))
704 if (is_original_ap(m_ptr))
706 /* Take note that they are something */
707 r_ptr->r_flags3 |= (match_flag);
709 /* Update monster recall window */
710 if (p_ptr->monster_race_idx == m_ptr->r_idx)
712 p_ptr->window |= (PW_MONSTER);
716 /* Repair visibility later */
717 repair_monsters = TRUE;
719 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
720 update_monster(i, FALSE);
729 desc_monsters = _("デーモン", "demons");
732 desc_monsters = _("アンデッド", "the undead");
736 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
744 * @brief 全感知処理 / Detect everything
746 * @return 効力があった場合TRUEを返す
748 bool detect_all(POSITION range)
752 /* Detect everything */
753 if (detect_traps(range, TRUE)) detect = TRUE;
754 if (detect_doors(range)) detect = TRUE;
755 if (detect_stairs(range)) detect = TRUE;
757 /* There are too many hidden treasure. So... */
758 /* if (detect_treasure(range)) detect = TRUE; */
760 if (detect_objects_gold(range)) detect = TRUE;
761 if (detect_objects_normal(range)) detect = TRUE;
762 if (detect_monsters_invis(range)) detect = TRUE;
763 if (detect_monsters_normal(range)) detect = TRUE;
769 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
772 * @return 効力があった場合TRUEを返す
775 * Note that affected monsters are NOT auto-tracked by this usage.
777 * To avoid misbehavior when monster deaths have side-effects,
778 * this is done in two passes. -- JDL
781 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
785 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
786 bool obvious = FALSE;
789 /* Mark all (nearby) monsters */
790 for (i = 1; i < m_max; i++)
792 monster_type *m_ptr = &m_list[i];
794 /* Paranoia -- Skip dead monsters */
795 if (!m_ptr->r_idx) continue;
800 /* Require line of sight */
801 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
803 /* Mark the monster */
804 m_ptr->mflag |= (MFLAG_TEMP);
807 /* Affect all marked monsters */
808 for (i = 1; i < m_max; i++)
810 monster_type *m_ptr = &m_list[i];
812 /* Skip unmarked monsters */
813 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
816 m_ptr->mflag &= ~(MFLAG_TEMP);
821 /* Jump directly to the target monster */
822 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
829 * @brief 視界内モンスターを加速する処理 / Speed monsters
830 * @return 効力があった場合TRUEを返す
832 bool speed_monsters(void)
834 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
838 * @brief 視界内モンスターを加速する処理 / Slow monsters
839 * @return 効力があった場合TRUEを返す
841 bool slow_monsters(int power)
843 return (project_all_los(GF_OLD_SLOW, power));
847 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
848 * @return 効力があった場合TRUEを返す
850 bool sleep_monsters(int power)
852 return (project_all_los(GF_OLD_SLEEP, power));
856 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
857 * @return 効力があった場合TRUEを返す
859 bool banish_evil(int dist)
861 return (project_all_los(GF_AWAY_EVIL, dist));
865 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
866 * @return 効力があった場合TRUEを返す
868 bool turn_undead(void)
870 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
872 chg_virtue(V_UNLIFE, -1);
877 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
878 * @return 効力があった場合TRUEを返す
880 bool dispel_undead(HIT_POINT dam)
882 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
884 chg_virtue(V_UNLIFE, -2);
889 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
890 * @return 効力があった場合TRUEを返す
892 bool dispel_evil(HIT_POINT dam)
894 return (project_all_los(GF_DISP_EVIL, dam));
898 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
899 * @return 効力があった場合TRUEを返す
901 bool dispel_good(HIT_POINT dam)
903 return (project_all_los(GF_DISP_GOOD, dam));
907 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
908 * @return 効力があった場合TRUEを返す
910 bool dispel_monsters(HIT_POINT dam)
912 return (project_all_los(GF_DISP_ALL, dam));
915 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
918 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
919 int k = 3 * creature_ptr->lev;
920 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
921 if (set_poisoned(0)) ident = TRUE;
922 if (set_afraid(0)) ident = TRUE;
923 if (hp_player(50)) ident = TRUE;
924 if (set_stun(0)) ident = TRUE;
925 if (set_cut(0)) ident = TRUE;
929 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
931 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
932 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
933 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
934 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))
936 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
942 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
943 * @return 効力があった場合TRUEを返す
945 bool dispel_living(HIT_POINT dam)
947 return (project_all_los(GF_DISP_LIVING, dam));
951 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
952 * @return 効力があった場合TRUEを返す
954 bool dispel_demons(HIT_POINT dam)
956 return (project_all_los(GF_DISP_DEMON, dam));
960 * @brief 視界内のモンスターに「聖戦」効果を与える処理
961 * @return 効力があった場合TRUEを返す
965 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
969 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
970 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
973 void aggravate_monsters(MONSTER_IDX who)
979 /* Aggravate everyone nearby */
980 for (i = 1; i < m_max; i++)
982 monster_type *m_ptr = &m_list[i];
984 /* Paranoia -- Skip dead monsters */
985 if (!m_ptr->r_idx) continue;
987 /* Skip aggravating monster (or player) */
988 if (i == who) continue;
990 /* Wake up nearby sleeping monsters */
991 if (m_ptr->cdis < MAX_SIGHT * 2)
994 if (MON_CSLEEP(m_ptr))
996 (void)set_monster_csleep(i, 0);
999 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1002 /* Speed up monsters in line of sight */
1003 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1007 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1013 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1014 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1015 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1020 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1021 * @param m_idx 抹殺するモンスターID
1022 * @param power 抹殺の威力
1023 * @param player_cast プレイヤーの魔法によるものならば TRUE
1024 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1025 * @param spell_name 抹殺効果を起こした魔法の名前
1026 * @return 効力があった場合TRUEを返す
1028 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1030 int msec = delay_factor * delay_factor * delay_factor;
1031 monster_type *m_ptr = &m_list[m_idx];
1032 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1033 bool resist = FALSE;
1035 if (is_pet(m_ptr) && !player_cast) return FALSE;
1037 /* Hack -- Skip Unique Monsters or Quest Monsters */
1038 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1039 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1040 else if (m_idx == p_ptr->riding) resist = TRUE;
1041 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1042 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1043 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1047 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1049 GAME_TEXT m_name[MAX_NLEN];
1051 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1052 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1055 delete_monster_idx(m_idx);
1058 if (resist && player_cast)
1060 bool see_m = is_seen(m_ptr);
1061 GAME_TEXT m_name[MAX_NLEN];
1063 monster_desc(m_name, m_ptr, 0);
1066 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1068 if (MON_CSLEEP(m_ptr))
1070 (void)set_monster_csleep(m_idx, 0);
1073 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1076 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1080 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1084 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1089 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1092 /* Visual feedback */
1093 move_cursor_relative(p_ptr->y, p_ptr->x);
1095 p_ptr->redraw |= (PR_HP);
1096 p_ptr->window |= (PW_PLAYER);
1101 Term_xtra(TERM_XTRA_DELAY, msec);
1108 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1109 * @param power 抹殺の威力
1110 * @param player_cast プレイヤーの魔法によるものならば TRUE
1111 * @return 効力があった場合TRUEを返す
1113 bool symbol_genocide(int power, bool player_cast)
1117 bool result = FALSE;
1119 /* Prevent genocide in quest levels */
1120 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1122 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1126 /* Mega-Hack -- Get a monster symbol */
1127 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1129 /* Delete the monsters of that "type" */
1130 for (i = 1; i < m_max; i++)
1132 monster_type *m_ptr = &m_list[i];
1133 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1135 /* Paranoia -- Skip dead monsters */
1136 if (!m_ptr->r_idx) continue;
1138 /* Skip "wrong" monsters */
1139 if (r_ptr->d_char != typ) continue;
1141 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1146 chg_virtue(V_VITALITY, -2);
1147 chg_virtue(V_CHANCE, -1);
1155 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1156 * @param power 抹殺の威力
1157 * @param player_cast プレイヤーの魔法によるものならば TRUE
1158 * @return 効力があった場合TRUEを返す
1160 bool mass_genocide(int power, bool player_cast)
1163 bool result = FALSE;
1165 /* Prevent mass genocide in quest levels */
1166 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1171 /* Delete the (nearby) monsters */
1172 for (i = 1; i < m_max; i++)
1174 monster_type *m_ptr = &m_list[i];
1176 /* Paranoia -- Skip dead monsters */
1177 if (!m_ptr->r_idx) continue;
1179 /* Skip distant monsters */
1180 if (m_ptr->cdis > MAX_SIGHT) continue;
1183 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1188 chg_virtue(V_VITALITY, -2);
1189 chg_virtue(V_CHANCE, -1);
1197 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1198 * @param power 抹殺の威力
1199 * @param player_cast プレイヤーの魔法によるものならば TRUE
1200 * @return 効力があった場合TRUEを返す
1202 bool mass_genocide_undead(int power, bool player_cast)
1205 bool result = FALSE;
1207 /* Prevent mass genocide in quest levels */
1208 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1213 /* Delete the (nearby) monsters */
1214 for (i = 1; i < m_max; i++)
1216 monster_type *m_ptr = &m_list[i];
1217 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1219 /* Paranoia -- Skip dead monsters */
1220 if (!m_ptr->r_idx) continue;
1222 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1224 /* Skip distant monsters */
1225 if (m_ptr->cdis > MAX_SIGHT) continue;
1228 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1233 chg_virtue(V_UNLIFE, -2);
1234 chg_virtue(V_CHANCE, -1);
1242 * @brief 周辺モンスターを調査する / Probe nearby monsters
1243 * @return 効力があった場合TRUEを返す
1248 int speed; /* TODO */
1259 /* Probe all (nearby) monsters */
1260 for (i = 1; i < m_max; i++)
1262 monster_type *m_ptr = &m_list[i];
1263 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1265 /* Paranoia -- Skip dead monsters */
1266 if (!m_ptr->r_idx) continue;
1268 /* Require line of sight */
1269 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1271 /* Probe visible monsters */
1274 GAME_TEXT m_name[MAX_NLEN];
1276 /* Start the message */
1279 msg_print(_("調査中...", "Probing..."));
1284 if (!is_original_ap(m_ptr))
1286 if (m_ptr->mflag2 & MFLAG2_KAGE)
1287 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1289 m_ptr->ap_r_idx = m_ptr->r_idx;
1290 lite_spot(m_ptr->fy, m_ptr->fx);
1292 /* Get "the monster" or "something" */
1293 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1295 speed = m_ptr->mspeed - 110;
1296 if (MON_FAST(m_ptr)) speed += 10;
1297 if (MON_SLOW(m_ptr)) speed -= 10;
1298 if (ironman_nightmare) speed += 5;
1300 /* Get the monster's alignment */
1301 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1302 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1303 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1304 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1305 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1306 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1307 else align = _("中立", "neutral");
1309 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1310 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1312 if (r_ptr->next_r_idx)
1314 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1318 strcat(buf, "xxx ");
1321 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1322 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1323 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1324 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1325 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1326 buf[strlen(buf)-1] = '\0';
1329 /* HACK : Add the line to message buffer */
1332 p_ptr->window |= (PW_MESSAGE);
1335 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1338 Term_erase(0, 0, 255);
1340 /* Learn everything about this monster */
1341 if (lore_do_probe(m_ptr->r_idx))
1343 /* Get base name of monster */
1344 strcpy(buf, (r_name + r_ptr->name));
1347 /* Note that we learnt some new flags -Mogami- */
1348 msg_format("%sについてさらに詳しくなった気がする。", buf);
1353 /* Note that we learnt some new flags -Mogami- */
1354 msg_format("You now know more about %s.", buf);
1356 /* Clear -more- prompt */
1371 chg_virtue(V_KNOWLEDGE, 1);
1372 msg_print(_("これで全部です。", "That's all."));
1380 * @brief *破壊*処理を行う / The spell of destruction
1381 * @param y1 破壊の中心Y座標
1382 * @param x1 破壊の中心X座標
1384 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1385 * @return 効力があった場合TRUEを返す
1388 * This spell "deletes" monsters (instead of "killing" them).
1390 * Later we may use one function for both "destruction" and
1391 * "earthquake" by using the "full" to select "destruction".
1394 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1401 /* Prevent destruction of quest levels and town */
1402 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1407 /* Lose monster light */
1408 if (!in_generate) clear_mon_lite();
1410 /* Big area of affect */
1411 for (y = (y1 - r); y <= (y1 + r); y++)
1413 for (x = (x1 - r); x <= (x1 + r); x++)
1415 /* Skip illegal grids */
1416 if (!in_bounds(y, x)) continue;
1418 /* Extract the distance */
1419 k = distance(y1, x1, y, x);
1421 /* Stay in the circle of death */
1422 if (k > r) continue;
1423 g_ptr = &grid_array[y][x];
1425 /* Lose room and vault */
1426 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1428 /* Lose light and knowledge */
1429 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1431 if (!in_generate) /* Normal */
1434 g_ptr->info &= ~(CAVE_UNSAFE);
1436 /* Hack -- Notice player affect */
1437 if (player_bold(y, x))
1439 /* Hurt the player later */
1442 /* Do not hurt this grid */
1447 /* Hack -- Skip the epicenter */
1448 if ((y == y1) && (x == x1)) continue;
1452 monster_type *m_ptr = &m_list[g_ptr->m_idx];
1453 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1455 if (in_generate) /* In generation */
1457 /* Delete the monster (if any) */
1458 delete_monster(y, x);
1460 else if (r_ptr->flags1 & RF1_QUESTOR)
1462 /* Heal the monster */
1463 m_ptr->hp = m_ptr->maxhp;
1465 /* Try to teleport away quest monsters */
1466 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1470 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1472 GAME_TEXT m_name[MAX_NLEN];
1474 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1475 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1478 /* Delete the monster (if any) */
1479 delete_monster(y, x);
1483 /* During generation, destroyed artifacts are "preserved" */
1484 if (preserve_mode || in_generate)
1486 OBJECT_IDX this_o_idx, next_o_idx = 0;
1488 /* Scan all objects in the grid */
1489 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1492 o_ptr = &o_list[this_o_idx];
1494 /* Acquire next object */
1495 next_o_idx = o_ptr->next_o_idx;
1497 /* Hack -- Preserve unknown artifacts */
1498 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1500 /* Mega-Hack -- Preserve the artifact */
1501 a_info[o_ptr->name1].cur_num = 0;
1503 if (in_generate && cheat_peek)
1505 GAME_TEXT o_name[MAX_NLEN];
1506 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1507 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1510 else if (in_generate && cheat_peek && o_ptr->art_name)
1512 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1513 "One of the random artifacts was *destroyed* during generation."));
1518 delete_object(y, x);
1520 /* Destroy "non-permanent" grids */
1521 if (!cave_perma_grid(g_ptr))
1523 /* Wall (or floor) type */
1526 if (!in_generate) /* Normal */
1530 /* Create granite wall */
1531 cave_set_feat(y, x, feat_granite);
1535 /* Create quartz vein */
1536 cave_set_feat(y, x, feat_quartz_vein);
1540 /* Create magma vein */
1541 cave_set_feat(y, x, feat_magma_vein);
1546 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1549 else /* In generation */
1553 /* Create granite wall */
1554 place_extra_grid(g_ptr);
1558 /* Create quartz vein */
1559 g_ptr->feat = feat_quartz_vein;
1563 /* Create magma vein */
1564 g_ptr->feat = feat_magma_vein;
1569 place_floor_grid(g_ptr);
1572 /* Clear garbage of hidden trap or door */
1581 /* Process "re-glowing" */
1582 for (y = (y1 - r); y <= (y1 + r); y++)
1584 for (x = (x1 - r); x <= (x1 + r); x++)
1586 /* Skip illegal grids */
1587 if (!in_bounds(y, x)) continue;
1589 /* Extract the distance */
1590 k = distance(y1, x1, y, x);
1592 /* Stay in the circle of death */
1593 if (k > r) continue;
1594 g_ptr = &grid_array[y][x];
1596 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1597 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1603 for (i = 0; i < 9; i++)
1605 yy = y + ddy_ddd[i];
1606 xx = x + ddx_ddd[i];
1607 if (!in_bounds2(yy, xx)) continue;
1608 cc_ptr = &grid_array[yy][xx];
1609 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1611 g_ptr->info |= CAVE_GLOW;
1619 /* Hack -- Affect player */
1622 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1624 /* Blind the player */
1625 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1628 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1634 /* Mega-Hack -- Forget the view and lite */
1635 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1636 p_ptr->redraw |= (PR_MAP);
1637 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1639 if (p_ptr->special_defense & NINJA_S_STEALTH)
1641 if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1651 * @brief 地震処理(サブルーチン) /
1652 * Induce an "earthquake" of the given radius at the given location.
1653 * @return 効力があった場合TRUEを返す
1657 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1661 * This will turn some walls into floors and some floors into walls.
1663 * The player will take damage and "jump" into a safe grid if possible,
1664 * otherwise, he will "tunnel" through the rubble instantaneously.
1666 * Monsters will take damage, and "jump" into a safe grid if possible,
1667 * otherwise they will be "buried" in the rubble, disappearing from
1668 * the level in the same way that they do when genocided.
1670 * Note that thus the player and monsters (except eaters of walls and
1671 * passers through walls) will never occupy the same grid as a wall.
1672 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1673 * for a single turn, unless that monster can pass_walls or kill_walls.
1674 * This has allowed massive simplification of the "monster" code.
1677 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1681 POSITION y, x, yy, xx, dy, dx;
1684 POSITION sy = 0, sx = 0;
1689 /* Prevent destruction of quest levels and town */
1690 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1695 /* Paranoia -- Enforce maximum range */
1698 /* Clear the "maximal blast" area */
1699 for (y = 0; y < 32; y++)
1701 for (x = 0; x < 32; x++)
1707 /* Check around the epicenter */
1708 for (dy = -r; dy <= r; dy++)
1710 for (dx = -r; dx <= r; dx++)
1712 /* Extract the location */
1716 /* Skip illegal grids */
1717 if (!in_bounds(yy, xx)) continue;
1719 /* Skip distant grids */
1720 if (distance(cy, cx, yy, xx) > r) continue;
1721 g_ptr = &grid_array[yy][xx];
1723 /* Lose room and vault / Lose light and knowledge */
1724 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1725 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1727 /* Skip the epicenter */
1728 if (!dx && !dy) continue;
1730 /* Skip most grids */
1731 if (randint0(100) < 85) continue;
1733 /* Damage this grid */
1734 map[16+yy-cy][16+xx-cx] = TRUE;
1736 /* Hack -- Take note of player damage */
1737 if (player_bold(yy, xx)) hurt = TRUE;
1741 /* First, affect the player (if necessary) */
1742 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1744 /* Check around the player */
1745 for (i = 0; i < 8; i++)
1747 /* Access the location */
1748 y = p_ptr->y + ddy_ddd[i];
1749 x = p_ptr->x + ddx_ddd[i];
1751 /* Skip non-empty grids */
1752 if (!cave_empty_bold(y, x)) continue;
1754 /* Important -- Skip "quake" grids */
1755 if (map[16+y-cy][16+x-cx]) continue;
1757 if (grid_array[y][x].m_idx) continue;
1759 /* Count "safe" grids */
1762 /* Randomize choice */
1763 if (randint0(sn) > 0) continue;
1765 /* Save the safe location */
1769 /* Random message */
1770 switch (randint1(3))
1774 msg_print(_("ダンジョンの壁が崩れた!", "The grid_array ceiling collapses!"));
1779 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The grid_array floor twists in an unnatural way!"));
1784 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The grid_array quakes! You are pummeled with debris!"));
1789 /* Hurt the player a lot */
1792 /* Message and damage */
1793 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1797 /* Destroy the grid, and push the player to safety */
1800 /* Calculate results */
1801 switch (randint1(3))
1805 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1811 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1812 damage = damroll(10, 4);
1813 (void)set_stun(p_ptr->stun + randint1(50));
1818 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1819 damage = damroll(10, 4);
1820 (void)set_stun(p_ptr->stun + randint1(50));
1825 /* Move the player to the safe location */
1826 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1829 /* Important -- no wall on player */
1830 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1838 GAME_TEXT m_name[MAX_NLEN];
1839 monster_type *m_ptr = &m_list[m_idx];
1841 /* Get the monster's real name */
1842 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1844 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1848 killer = _("地震", "an earthquake");
1851 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1855 /* Examine the quaked region */
1856 for (dy = -r; dy <= r; dy++)
1858 for (dx = -r; dx <= r; dx++)
1860 /* Extract the location */
1864 /* Skip unaffected grids */
1865 if (!map[16+yy-cy][16+xx-cx]) continue;
1866 g_ptr = &grid_array[yy][xx];
1868 if (g_ptr->m_idx == p_ptr->riding) continue;
1870 /* Process monsters */
1873 monster_type *m_ptr = &m_list[g_ptr->m_idx];
1874 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1876 /* Quest monsters */
1877 if (r_ptr->flags1 & RF1_QUESTOR)
1879 /* No wall on quest monsters */
1880 map[16+yy-cy][16+xx-cx] = FALSE;
1885 /* Most monsters cannot co-exist with rock */
1886 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1887 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1889 GAME_TEXT m_name[MAX_NLEN];
1891 /* Assume not safe */
1894 /* Monster can move to escape the wall */
1895 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1897 /* Look for safety */
1898 for (i = 0; i < 8; i++)
1900 y = yy + ddy_ddd[i];
1901 x = xx + ddx_ddd[i];
1903 /* Skip non-empty grids */
1904 if (!cave_empty_bold(y, x)) continue;
1906 /* Hack -- no safety on glyph of warding */
1907 if (is_glyph_grid(&grid_array[y][x])) continue;
1908 if (is_explosive_rune_grid(&grid_array[y][x])) continue;
1910 /* ... nor on the Pattern */
1911 if (pattern_tile(y, x)) continue;
1913 /* Important -- Skip "quake" grids */
1914 if (map[16+y-cy][16+x-cx]) continue;
1916 if (grid_array[y][x].m_idx) continue;
1917 if (player_bold(y, x)) continue;
1919 /* Count "safe" grids */
1922 /* Randomize choice */
1923 if (randint0(sn) > 0) continue;
1925 /* Save the safe grid */
1930 monster_desc(m_name, m_ptr, 0);
1932 /* Scream in pain */
1933 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1935 /* Take damage from the quake */
1936 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1938 /* Monster is certainly awake */
1939 (void)set_monster_csleep(g_ptr->m_idx, 0);
1941 /* Apply damage directly */
1942 m_ptr->hp -= damage;
1944 /* Delete (not kill) "dead" monsters */
1947 if (!ignore_unview || is_seen(m_ptr))
1948 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1952 if (record_named_pet && is_pet(&m_list[g_ptr->m_idx]) && m_list[g_ptr->m_idx].nickname)
1954 char m2_name[MAX_NLEN];
1956 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1957 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1961 delete_monster(yy, xx);
1963 /* No longer safe */
1967 /* Hack -- Escape from the rock */
1970 IDX m_idx_aux = grid_array[yy][xx].m_idx;
1972 /* Update the old location */
1973 grid_array[yy][xx].m_idx = 0;
1975 /* Update the new location */
1976 grid_array[sy][sx].m_idx = m_idx_aux;
1978 /* Move the monster */
1982 update_monster(m_idx, TRUE);
1991 /* Lose monster light */
1994 /* Examine the quaked region */
1995 for (dy = -r; dy <= r; dy++)
1997 for (dx = -r; dx <= r; dx++)
1999 /* Extract the location */
2003 /* Skip unaffected grids */
2004 if (!map[16+yy-cy][16+xx-cx]) continue;
2006 g_ptr = &grid_array[yy][xx];
2008 /* Paranoia -- never affect player */
2009 /* if (player_bold(yy, xx)) continue; */
2011 /* Destroy location (if valid) */
2012 if (cave_valid_bold(yy, xx))
2014 delete_object(yy, xx);
2016 /* Wall (or floor) type */
2017 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2022 /* Create granite wall */
2023 cave_set_feat(yy, xx, feat_granite);
2029 /* Create quartz vein */
2030 cave_set_feat(yy, xx, feat_quartz_vein);
2036 /* Create magma vein */
2037 cave_set_feat(yy, xx, feat_magma_vein);
2044 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2050 /* Process "re-glowing" */
2051 for (dy = -r; dy <= r; dy++)
2053 for (dx = -r; dx <= r; dx++)
2055 /* Extract the location */
2059 /* Skip illegal grids */
2060 if (!in_bounds(yy, xx)) continue;
2062 /* Skip distant grids */
2063 if (distance(cy, cx, yy, xx) > r) continue;
2064 g_ptr = &grid_array[yy][xx];
2066 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2067 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2073 for (ii = 0; ii < 9; ii++)
2075 yyy = yy + ddy_ddd[ii];
2076 xxx = xx + ddx_ddd[ii];
2077 if (!in_bounds2(yyy, xxx)) continue;
2078 cc_ptr = &grid_array[yyy][xxx];
2079 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2081 g_ptr->info |= CAVE_GLOW;
2089 /* Mega-Hack -- Forget the view and lite */
2090 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2091 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2092 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2094 if (p_ptr->special_defense & NINJA_S_STEALTH)
2096 if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2104 * @brief 地震処理(プレイヤーの中心発動) /
2105 * Induce an "earthquake" of the given radius at the given location.
2106 * @return 効力があった場合TRUEを返す
2111 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2113 return earthquake_aux(cy, cx, r, 0);
2120 void discharge_minion(void)
2125 for (i = 1; i < m_max; i++)
2127 monster_type *m_ptr = &m_list[i];
2128 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2129 if (m_ptr->nickname) okay = FALSE;
2131 if (!okay || p_ptr->riding)
2133 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2136 for (i = 1; i < m_max; i++)
2139 monster_type *m_ptr = &m_list[i];
2140 monster_race *r_ptr;
2142 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2143 r_ptr = &r_info[m_ptr->r_idx];
2145 /* Uniques resist discharging */
2146 if (r_ptr->flags1 & RF1_UNIQUE)
2148 GAME_TEXT m_name[MAX_NLEN];
2149 monster_desc(m_name, m_ptr, 0x00);
2150 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2151 delete_monster_idx(i);
2154 dam = m_ptr->maxhp / 2;
2155 if (dam > 100) dam = (dam - 100) / 2 + 100;
2156 if (dam > 400) dam = (dam - 400) / 2 + 400;
2157 if (dam > 800) dam = 800;
2158 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2159 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2161 if (record_named_pet && m_ptr->nickname)
2163 GAME_TEXT m_name[MAX_NLEN];
2165 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2166 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2169 delete_monster_idx(i);
2175 * @brief 部屋全体を照らすサブルーチン
2179 * This routine clears the entire "temp" set.
2180 * This routine will Perma-Lite all "temp" grids.
2181 * This routine is used (only) by "lite_room()"
2182 * Dark grids are illuminated.
2183 * Also, process all affected monsters.
2185 * SMART monsters always wake up when illuminated
2186 * NORMAL monsters wake up 1/4 the time when illuminated
2187 * STUPID monsters wake up 1/10 the time when illuminated
2190 static void cave_temp_room_lite(void)
2194 /* Clear them all */
2195 for (i = 0; i < temp_n; i++)
2197 POSITION y = temp_y[i];
2198 POSITION x = temp_x[i];
2200 grid_type *g_ptr = &grid_array[y][x];
2202 /* No longer in the array */
2203 g_ptr->info &= ~(CAVE_TEMP);
2205 /* Update only non-CAVE_GLOW grids */
2206 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2209 g_ptr->info |= (CAVE_GLOW);
2211 /* Process affected monsters */
2215 monster_type *m_ptr = &m_list[g_ptr->m_idx];
2216 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2217 update_monster(g_ptr->m_idx, FALSE);
2219 /* Stupid monsters rarely wake up */
2220 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2222 /* Smart monsters always wake up */
2223 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2225 /* Sometimes monsters wake up */
2226 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2229 (void)set_monster_csleep(g_ptr->m_idx, 0);
2231 /* Notice the "waking up" */
2234 GAME_TEXT m_name[MAX_NLEN];
2235 monster_desc(m_name, m_ptr, 0);
2236 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2243 update_local_illumination(y, x);
2253 * @brief 部屋全体を暗くするサブルーチン
2257 * This routine clears the entire "temp" set.
2258 * This routine will "darken" all "temp" grids.
2259 * In addition, some of these grids will be "unmarked".
2260 * This routine is used (only) by "unlite_room()"
2261 * Also, process all affected monsters
2264 static void cave_temp_room_unlite(void)
2268 /* Clear them all */
2269 for (i = 0; i < temp_n; i++)
2271 POSITION y = temp_y[i];
2272 POSITION x = temp_x[i];
2275 grid_type *g_ptr = &grid_array[y][x];
2276 bool do_dark = !is_mirror_grid(g_ptr);
2278 /* No longer in the array */
2279 g_ptr->info &= ~(CAVE_TEMP);
2281 /* Darken the grid */
2284 if (dun_level || !is_daytime())
2286 for (j = 0; j < 9; j++)
2288 POSITION by = y + ddy_ddd[j];
2289 POSITION bx = x + ddx_ddd[j];
2291 if (in_bounds2(by, bx))
2293 grid_type *cc_ptr = &grid_array[by][bx];
2295 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2303 if (!do_dark) continue;
2306 g_ptr->info &= ~(CAVE_GLOW);
2308 /* Hack -- Forget "boring" grids */
2309 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2311 /* Forget the grid */
2312 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2316 /* Process affected monsters */
2319 update_monster(g_ptr->m_idx, FALSE);
2323 update_local_illumination(y, x);
2333 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2336 * @param pass_bold 地形条件を返す関数ポインタ
2339 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2346 for (i = 0; i < 16; i++)
2348 y = cy + ddy_cdd[i % 8];
2349 x = cx + ddx_cdd[i % 8];
2351 /* Found a wall, break the length */
2352 if (!pass_bold(y, x))
2354 /* Track best length */
2368 return (MAX(len, blen));
2372 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2375 * @param pass_bold 地形条件を返す関数ポインタ
2378 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2384 for (i = 0; i < 8; i++)
2386 y = cy + ddy_ddd[i];
2387 x = cx + ddx_ddd[i];
2389 if (!pass_bold(y, x)) c++;
2397 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2398 * @param y 部屋内のy座標1点
2399 * @param x 部屋内のx座標1点
2400 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2401 * @param pass_bold 地形条件を返す関数ポインタ
2404 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2407 g_ptr = &grid_array[y][x];
2409 /* Avoid infinite recursion */
2410 if (g_ptr->info & (CAVE_TEMP)) return;
2412 /* Do not "leave" the current room */
2413 if (!(g_ptr->info & (CAVE_ROOM)))
2415 if (only_room) return;
2418 if (!in_bounds2(y, x)) return;
2420 /* Do not exceed the maximum spell range */
2421 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2423 /* Verify this grid */
2425 * The reason why it is ==6 instead of >5 is that 8 is impossible
2426 * due to the check for cave_bold above.
2427 * 7 lights dead-end corridors (you need to do this for the
2428 * checkboard interesting rooms, so that the boundary is lit
2430 * This leaves only a check for 6 bounding walls!
2432 if (in_bounds(y, x) && pass_bold(y, x) &&
2433 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2436 /* Paranoia -- verify space */
2437 if (temp_n == TEMP_MAX) return;
2439 /* Mark the grid as "seen" */
2440 g_ptr->info |= (CAVE_TEMP);
2442 /* Add it to the "seen" set */
2449 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2452 * @return 光を通すならばtrueを返す。
2454 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2456 return cave_los_bold(y, x);
2460 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2465 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2467 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2471 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2474 * @return 射線を通すならばtrueを返す。
2476 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2478 return cave_have_flag_bold(y, x, FF_PROJECT);
2483 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2488 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2490 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2495 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2500 void lite_room(POSITION y1, POSITION x1)
2505 /* Add the initial grid */
2506 cave_temp_lite_room_aux(y1, x1);
2508 /* While grids are in the queue, add their neighbors */
2509 for (i = 0; i < temp_n; i++)
2511 x = temp_x[i], y = temp_y[i];
2513 /* Walls get lit, but stop light */
2514 if (!cave_pass_lite_bold(y, x)) continue;
2516 /* Spread adjacent */
2517 cave_temp_lite_room_aux(y + 1, x);
2518 cave_temp_lite_room_aux(y - 1, x);
2519 cave_temp_lite_room_aux(y, x + 1);
2520 cave_temp_lite_room_aux(y, x - 1);
2522 /* Spread diagonal */
2523 cave_temp_lite_room_aux(y + 1, x + 1);
2524 cave_temp_lite_room_aux(y - 1, x - 1);
2525 cave_temp_lite_room_aux(y - 1, x + 1);
2526 cave_temp_lite_room_aux(y + 1, x - 1);
2529 /* Now, lite them all up at once */
2530 cave_temp_room_lite();
2532 if (p_ptr->special_defense & NINJA_S_STEALTH)
2534 if (grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2540 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2545 void unlite_room(POSITION y1, POSITION x1)
2550 /* Add the initial grid */
2551 cave_temp_unlite_room_aux(y1, x1);
2553 /* Spread, breadth first */
2554 for (i = 0; i < temp_n; i++)
2556 x = temp_x[i], y = temp_y[i];
2558 /* Walls get dark, but stop darkness */
2559 if (!cave_pass_dark_bold(y, x)) continue;
2561 /* Spread adjacent */
2562 cave_temp_unlite_room_aux(y + 1, x);
2563 cave_temp_unlite_room_aux(y - 1, x);
2564 cave_temp_unlite_room_aux(y, x + 1);
2565 cave_temp_unlite_room_aux(y, x - 1);
2567 /* Spread diagonal */
2568 cave_temp_unlite_room_aux(y + 1, x + 1);
2569 cave_temp_unlite_room_aux(y - 1, x - 1);
2570 cave_temp_unlite_room_aux(y - 1, x + 1);
2571 cave_temp_unlite_room_aux(y + 1, x - 1);
2574 /* Now, darken them all at once */
2575 cave_temp_room_unlite();
2578 bool starlight(bool magic)
2580 HIT_POINT num = damroll(5, 3);
2581 POSITION y = 0, x = 0;
2585 if (!p_ptr->blind && !magic)
2587 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2589 for (k = 0; k < num; k++)
2595 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2596 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2597 if (!player_bold(y, x)) break;
2600 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2601 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2609 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2612 * @return 作用が実際にあった場合TRUEを返す
2614 bool lite_area(HIT_POINT dam, POSITION rad)
2616 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2618 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2620 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2626 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2629 /* Hook into the "project()" function */
2630 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2632 lite_room(p_ptr->y, p_ptr->x);
2640 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2643 * @return 作用が実際にあった場合TRUEを返す
2645 bool unlite_area(HIT_POINT dam, POSITION rad)
2647 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2649 /* Hack -- Message */
2652 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2655 /* Hook into the "project()" function */
2656 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2658 unlite_room(p_ptr->y, p_ptr->x);
2667 * @brief ボール系スペルの発動 / Cast a ball spell
2669 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2672 * @return 作用が実際にあった場合TRUEを返す
2675 * Stop if we hit a monster, act as a "ball"
2676 * Allow "target" mode to pass over monsters
2677 * Affect grids, objects, and monsters
2680 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2684 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2686 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2687 /* Use the given direction */
2688 tx = p_ptr->x + 99 * ddx[dir];
2689 ty = p_ptr->y + 99 * ddy[dir];
2691 /* Hack -- Use an actual "target" */
2692 if ((dir == 5) && target_okay())
2694 flg &= ~(PROJECT_STOP);
2699 /* Analyze the "dir" and the "target". Hurt items on floor. */
2700 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2704 * @brief ブレス系スペルの発動 / Cast a breath spell
2706 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2709 * @return 作用が実際にあった場合TRUEを返す
2712 * Stop if we hit a monster, act as a "ball"
2713 * Allow "target" mode to pass over monsters
2714 * Affect grids, objects, and monsters
2717 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2719 return fire_ball(typ, dir, dam, -rad);
2724 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2726 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2729 * @return 作用が実際にあった場合TRUEを返す
2732 * Stop if we hit a monster, act as a "ball"
2733 * Allow "target" mode to pass over monsters
2734 * Affect grids, objects, and monsters
2737 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2740 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2742 /* Use the given direction */
2743 tx = p_ptr->x + 99 * ddx[dir];
2744 ty = p_ptr->y + 99 * ddy[dir];
2746 /* Hack -- Use an actual "target" */
2747 if ((dir == 5) && target_okay())
2753 /* Analyze the "dir" and the "target". Hurt items on floor. */
2754 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2759 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2761 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2764 * @return 作用が実際にあった場合TRUEを返す
2767 * Stop if we hit a monster, act as a "ball"
2768 * Allow "target" mode to pass over monsters
2769 * Affect grids, objects, and monsters
2772 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2775 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2777 /* Use the given direction */
2778 tx = p_ptr->x + 99 * ddx[dir];
2779 ty = p_ptr->y + 99 * ddy[dir];
2781 /* Hack -- Use an actual "target" */
2782 if ((dir == 5) && target_okay())
2784 flg &= ~(PROJECT_STOP);
2789 /* Analyze the "dir" and the "target". Hurt items on floor. */
2790 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2795 * @brief メテオ系スペルの発動 / Cast a meteor spell
2796 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2802 * @return 作用が実際にあった場合TRUEを返す
2805 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2806 * player, or outside source, that starts out at an arbitrary location, and
2807 * leaving no trail from the "caster" to the target. This function is
2808 * especially useful for bombardments and similar. -LM-
2809 * Option to hurt the player.
2812 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2814 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2816 /* Analyze the "target" and the caster. */
2817 return (project(who, rad, y, x, dam, typ, flg, -1));
2822 * @brief ブラスト系スペルの発動 / Cast a blast spell
2824 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2829 * @return 作用が実際にあった場合TRUEを返す
2831 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2835 POSITION ty, tx, y, x;
2838 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2843 /* Use the given direction */
2846 ly = ty = p_ptr->y + 20 * ddy[dir];
2847 lx = tx = p_ptr->x + 20 * ddx[dir];
2850 /* Use an actual "target" */
2851 else /* if (dir == 5) */
2856 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2857 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2860 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2863 for (i = 0; i < num; i++)
2867 /* Get targets for some bolts */
2868 y = rand_spread(ly, ld * dev / 20);
2869 x = rand_spread(lx, ld * dev / 20);
2871 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2874 /* Analyze the "dir" and the "target". */
2875 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2886 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2887 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2888 * @return 作用が実際にあった場合TRUEを返す
2890 bool teleport_swap(DIRECTION dir)
2894 monster_type* m_ptr;
2895 monster_race* r_ptr;
2897 if ((dir == 5) && target_okay())
2904 tx = p_ptr->x + ddx[dir];
2905 ty = p_ptr->y + ddy[dir];
2907 g_ptr = &grid_array[ty][tx];
2909 if (p_ptr->anti_tele)
2911 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2915 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2917 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2921 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2923 msg_print(_("失敗した。", "Failed to swap."));
2927 m_ptr = &m_list[g_ptr->m_idx];
2928 r_ptr = &r_info[m_ptr->r_idx];
2930 (void)set_monster_csleep(g_ptr->m_idx, 0);
2932 if (r_ptr->flagsr & RFR_RES_TELE)
2934 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2935 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2939 sound(SOUND_TELEPORT);
2941 /* Swap the player and monster */
2942 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2950 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2952 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2955 * @return 作用が実際にあった場合TRUEを返す
2957 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2961 /* Pass through the target if needed */
2962 flg |= (PROJECT_THRU);
2964 /* Use the given direction */
2965 tx = p_ptr->x + ddx[dir];
2966 ty = p_ptr->y + ddy[dir];
2968 /* Hack -- Use an actual "target" */
2969 if ((dir == 5) && target_okay())
2975 /* Analyze the "dir" and the "target", do NOT explode */
2976 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2981 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2983 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2985 * @return 作用が実際にあった場合TRUEを返す
2988 * Stop if we hit a monster, as a "bolt".
2989 * Affect monsters and grids (not objects).
2992 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2994 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2995 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2996 return (project_hook(typ, dir, dam, flg));
3001 * @brief ビーム系スペルの発動 / Cast a beam spell.
3003 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3005 * @return 作用が実際にあった場合TRUEを返す
3008 * Pass through monsters, as a "beam".
3009 * Affect monsters, grids and objects.
3012 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3014 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3015 return (project_hook(typ, dir, dam, flg));
3020 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3021 * @param prob ビーム化する確率(%)
3023 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3025 * @return 作用が実際にあった場合TRUEを返す
3028 * Pass through monsters, as a "beam".
3029 * Affect monsters, grids and objects.
3032 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3034 if (randint0(100) < prob)
3036 return (fire_beam(typ, dir, dam));
3040 return (fire_bolt(typ, dir, dam));
3045 * @brief LITE_WEAK属性による光源ビーム処理
3046 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3048 * @return 作用が実際にあった場合TRUEを返す
3050 bool lite_line(DIRECTION dir, HIT_POINT dam)
3052 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3053 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3058 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3060 * @return 作用が実際にあった場合TRUEを返す
3062 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3064 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3065 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3070 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3072 * @return 作用が実際にあった場合TRUEを返す
3074 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3076 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3077 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3082 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3083 * @return 作用が実際にあった場合TRUEを返す
3085 bool wizard_lock(DIRECTION dir)
3087 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3088 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3093 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3094 * @return 作用が実際にあった場合TRUEを返す
3096 bool destroy_door(DIRECTION dir)
3098 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3099 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3104 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3105 * @return 作用が実際にあった場合TRUEを返す
3107 bool disarm_trap(DIRECTION dir)
3109 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3110 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3116 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3117 * @param plev プレイヤーレベル(効力はplev*200)
3118 * @return 作用が実際にあった場合TRUEを返す
3120 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3122 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3123 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3127 * @brief モンスター用テレポート処理
3128 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3129 * @param distance 移動距離
3130 * @return 作用が実際にあった場合TRUEを返す
3132 bool teleport_monster(DIRECTION dir, int distance)
3134 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3135 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3139 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3140 * @return 作用が実際にあった場合TRUEを返す
3142 bool door_creation(void)
3144 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3145 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3149 * @brief トラップ生成処理(起点から周囲1マス)
3152 * @return 作用が実際にあった場合TRUEを返す
3154 bool trap_creation(POSITION y, POSITION x)
3156 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3157 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3161 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3162 * @return 作用が実際にあった場合TRUEを返す
3164 bool tree_creation(void)
3166 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3167 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3171 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3172 * @return 作用が実際にあった場合TRUEを返す
3174 bool glyph_creation(void)
3176 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3177 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3181 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3182 * @return 作用が実際にあった場合TRUEを返す
3184 bool wall_stone(void)
3186 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3187 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3188 p_ptr->update |= (PU_FLOW);
3189 p_ptr->redraw |= (PR_MAP);
3194 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3195 * @return 作用が実際にあった場合TRUEを返す
3197 bool destroy_doors_touch(void)
3199 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3200 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3204 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3205 * @return 作用が実際にあった場合TRUEを返す
3207 bool disarm_traps_touch(void)
3209 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3210 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3214 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3215 * @return 作用が実際にあった場合TRUEを返す
3217 bool sleep_monsters_touch(void)
3219 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3220 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3225 * @brief 死者復活処理(起点より周囲5マス)
3226 * @param who 術者モンスターID(0ならばプレイヤー)
3229 * @return 作用が実際にあった場合TRUEを返す
3231 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3233 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3234 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3239 * @return 作用が実際にあった場合TRUEを返す
3241 void call_chaos(void)
3243 int Chaos_type, dummy, dir;
3244 PLAYER_LEVEL plev = p_ptr->lev;
3245 bool line_chaos = FALSE;
3247 int hurt_types[31] =
3249 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3250 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3251 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3252 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3253 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3254 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3255 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3256 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3259 Chaos_type = hurt_types[randint0(31)];
3260 if (one_in_(4)) line_chaos = TRUE;
3264 for (dummy = 1; dummy < 10; dummy++)
3269 fire_beam(Chaos_type, dummy, 150);
3271 fire_ball(Chaos_type, dummy, 150, 2);
3275 else if (one_in_(3))
3277 fire_ball(Chaos_type, 0, 500, 8);
3281 if (!get_aim_dir(&dir)) return;
3283 fire_beam(Chaos_type, dir, 250);
3285 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3290 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3291 * @param stop_ty 再帰処理停止フラグ
3293 * @return 作用が実際にあった場合TRUEを返す
3296 * rr9: Stop the nasty things when a Cyberdemon is summoned
3297 * or the player gets paralyzed.
3300 bool activate_ty_curse(bool stop_ty, int *count)
3303 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3307 switch (randint1(34))
3312 msg_print(_("地面が揺れた...", "The ground trembles..."));
3313 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3314 if (!one_in_(6)) break;
3319 HIT_POINT dam = damroll(10, 10);
3320 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3321 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3322 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3323 if (!one_in_(6)) break;
3328 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3329 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3330 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3331 if (!one_in_(6)) break;
3334 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3338 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3339 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3341 if (!one_in_(6)) break;
3342 case 1: case 2: case 3: case 16: case 17:
3343 aggravate_monsters(0);
3344 if (!one_in_(6)) break;
3345 case 4: case 5: case 6:
3346 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3347 if (!one_in_(6)) break;
3348 case 7: case 8: case 9: case 18:
3349 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
3350 if (!one_in_(6)) break;
3351 case 10: case 11: case 12:
3352 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3353 lose_exp(p_ptr->exp / 16);
3354 if (!one_in_(6)) break;
3355 case 13: case 14: case 15: case 19: case 20:
3356 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3362 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3363 if (p_ptr->free_act)
3364 set_paralyzed(p_ptr->paralyzed + randint1(3));
3366 set_paralyzed(p_ptr->paralyzed + randint1(13));
3369 if (!one_in_(6)) break;
3370 case 21: case 22: case 23:
3371 (void)do_dec_stat(randint0(6));
3372 if (!one_in_(6)) break;
3374 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3376 if (!one_in_(6)) break;
3379 * Only summon Cyberdemons deep in the dungeon.
3381 if ((dun_level > 65) && !stop_ty)
3383 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3387 if (!one_in_(6)) break;
3393 (void)do_dec_stat(i);
3401 while (one_in_(3) && !stop_ty);
3407 * @brief HI_SUMMON(上級召喚)処理発動
3410 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3411 * @return 作用が実際にあった場合TRUEを返す
3413 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3418 BIT_FLAGS mode = PM_ALLOW_GROUP;
3425 mode |= PM_FORCE_FRIENDLY;
3429 mode |= PM_FORCE_PET;
3434 if (!pet) mode |= PM_NO_PET;
3436 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3438 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3440 switch (randint1(25) + (dun_level / 20))
3443 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
3446 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
3449 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
3452 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
3455 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
3458 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
3461 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
3464 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
3468 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
3472 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
3475 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3476 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
3479 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3480 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
3483 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
3486 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3487 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
3495 * @brief 周辺破壊効果(プレイヤー中心)
3496 * @return 作用が実際にあった場合TRUEを返す
3498 void wall_breaker(void)
3501 POSITION y = 0, x = 0;
3502 int attempts = 1000;
3504 if (randint1(80 + p_ptr->lev) < 70)
3508 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3510 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3512 if (!player_bold(y, x)) break;
3515 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3516 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3518 else if (randint1(100) > 30)
3520 earthquake(p_ptr->y, p_ptr->x, 1);
3524 int num = damroll(5, 3);
3526 for (i = 0; i < num; i++)
3530 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3532 if (!player_bold(y, x)) break;
3535 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3536 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3543 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3545 * @return 作用が実際にあった場合TRUEを返す
3547 bool confuse_monsters(HIT_POINT dam)
3549 return (project_all_los(GF_OLD_CONF, dam));
3554 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3556 * @return 作用が実際にあった場合TRUEを返す
3558 bool charm_monsters(HIT_POINT dam)
3560 return (project_all_los(GF_CHARM, dam));
3565 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3567 * @return 作用が実際にあった場合TRUEを返す
3569 bool charm_animals(HIT_POINT dam)
3571 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3576 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3578 * @return 作用が実際にあった場合TRUEを返す
3580 bool stun_monsters(HIT_POINT dam)
3582 return (project_all_los(GF_STUN, dam));
3587 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3589 * @return 作用が実際にあった場合TRUEを返す
3591 bool stasis_monsters(HIT_POINT dam)
3593 return (project_all_los(GF_STASIS, dam));
3598 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3600 * @return 作用が実際にあった場合TRUEを返す
3602 bool mindblast_monsters(HIT_POINT dam)
3604 return (project_all_los(GF_PSI, dam));
3609 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3610 * @param dist 効力(距離)
3611 * @return 作用が実際にあった場合TRUEを返す
3613 bool banish_monsters(int dist)
3615 return (project_all_los(GF_AWAY_ALL, dist));
3620 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3622 * @return 作用が実際にあった場合TRUEを返す
3624 bool turn_evil(HIT_POINT dam)
3626 return (project_all_los(GF_TURN_EVIL, dam));
3631 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3633 * @return 作用が実際にあった場合TRUEを返す
3635 bool turn_monsters(HIT_POINT dam)
3637 return (project_all_los(GF_TURN_ALL, dam));
3642 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3643 * @return 作用が実際にあった場合TRUEを返す
3645 bool deathray_monsters(void)
3647 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3651 * @brief チャーム・モンスター(1体)
3652 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3654 * @return 作用が実際にあった場合TRUEを返す
3656 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3658 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3659 return (project_hook(GF_CHARM, dir, plev, flg));
3663 * @brief アンデッド支配(1体)
3664 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3666 * @return 作用が実際にあった場合TRUEを返す
3668 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3670 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3671 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3676 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3678 * @return 作用が実際にあった場合TRUEを返す
3680 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3682 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3683 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3688 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3690 * @return 作用が実際にあった場合TRUEを返す
3692 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3694 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3695 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3701 * @param success 判定成功上の処理ならばTRUE
3702 * @return 作用が実際にあった場合TRUEを返す
3704 bool kawarimi(bool success)
3707 object_type *q_ptr = &forge;
3710 if (p_ptr->is_dead) return FALSE;
3711 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3712 if (randint0(200) < p_ptr->stun) return FALSE;
3714 if (!success && one_in_(3))
3716 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3717 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3718 p_ptr->redraw |= (PR_STATUS);
3725 teleport_player(10 + randint1(90), 0L);
3727 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3729 q_ptr->pval = MON_NINJA;
3730 (void)drop_near(q_ptr, -1, y, x);
3732 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3733 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3735 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3736 p_ptr->redraw |= (PR_STATUS);
3744 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3745 * @param mdeath 目標モンスターが死亡したかを返す
3746 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3748 bool rush_attack(bool *mdeath)
3755 bool tmp_mdeath = FALSE;
3758 if (mdeath) *mdeath = FALSE;
3761 if (!get_aim_dir(&dir)) return FALSE;
3763 /* Use the given direction */
3764 tx = p_ptr->x + project_length * ddx[dir];
3765 ty = p_ptr->y + project_length * ddy[dir];
3767 /* Hack -- Use an actual "target" */
3768 if ((dir == 5) && target_okay())
3774 if (in_bounds(ty, tx)) tm_idx = grid_array[ty][tx].m_idx;
3776 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3779 /* No need to move */
3780 if (!path_n) return TRUE;
3782 /* Use ty and tx as to-move point */
3786 /* Project along the path */
3787 for (i = 0; i < path_n; i++)
3789 monster_type *m_ptr;
3791 int ny = GRID_Y(path_g[i]);
3792 int nx = GRID_X(path_g[i]);
3794 if (cave_empty_bold(ny, nx) && player_can_enter(grid_array[ny][nx].feat, 0))
3799 /* Go to next grid */
3803 if (!grid_array[ny][nx].m_idx)
3807 msg_print(_("失敗!", "Failed!"));
3811 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3818 /* Move player before updating the monster */
3819 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3820 update_monster(grid_array[ny][nx].m_idx, TRUE);
3822 /* Found a monster */
3823 m_ptr = &m_list[grid_array[ny][nx].m_idx];
3825 if (tm_idx != grid_array[ny][nx].m_idx)
3828 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3830 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3833 else if (!player_bold(ty, tx))
3835 /* Hold the monster name */
3836 GAME_TEXT m_name[MAX_NLEN];
3838 /* Get the monster name (BEFORE polymorphing) */
3839 monster_desc(m_name, m_ptr, 0);
3840 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3843 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3845 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3850 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3852 if (mdeath) *mdeath = tmp_mdeath;
3858 * @brief 全鏡の消去 / Remove all mirrors in this floor
3859 * @param explode 爆発処理を伴うならばTRUE
3862 void remove_all_mirrors(bool explode)
3866 for (x = 0; x < cur_wid; x++)
3868 for (y = 0; y < cur_hgt; y++)
3870 if (is_mirror_grid(&grid_array[y][x]))
3872 remove_mirror(y, x);
3874 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3875 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3882 * @brief 『一つの指輪』の効果処理 /
3883 * Hack -- activate the ring of power
3884 * @param dir 発動の方向ID
3887 void ring_of_power(DIRECTION dir)
3889 /* Pick a random effect */
3890 switch (randint1(10))
3895 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3898 /* Decrease all stats (permanently) */
3899 (void)dec_stat(A_STR, 50, TRUE);
3900 (void)dec_stat(A_INT, 50, TRUE);
3901 (void)dec_stat(A_WIS, 50, TRUE);
3902 (void)dec_stat(A_DEX, 50, TRUE);
3903 (void)dec_stat(A_CON, 50, TRUE);
3904 (void)dec_stat(A_CHR, 50, TRUE);
3906 /* Lose some experience (permanently) */
3907 p_ptr->exp -= (p_ptr->exp / 4);
3908 p_ptr->max_exp -= (p_ptr->exp / 4);
3916 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3917 dispel_monsters(1000);
3925 fire_ball(GF_MANA, dir, 600, 3);
3934 fire_bolt(GF_MANA, dir, 500);
3941 * @brief 運命の輪、並びにカオス的な効果の発動
3942 * @param spell ランダムな効果を選択するための基準ID
3945 void wild_magic(int spell)
3948 int type = SUMMON_MOLD + randint0(6);
3950 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3951 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3953 switch (randint1(spell) + randint1(8) + 1)
3958 teleport_player(10, TELEPORT_PASSIVE);
3963 teleport_player(100, TELEPORT_PASSIVE);
3967 teleport_player(200, TELEPORT_PASSIVE);
3977 lite_area(damroll(2, 3), 2);
3980 destroy_doors_touch();
3985 sleep_monsters_touch();
3989 trap_creation(p_ptr->y, p_ptr->x);
3998 aggravate_monsters(0);
4001 earthquake(p_ptr->y, p_ptr->x, 5);
4005 (void)gain_random_mutation(0);
4009 apply_disenchant(1);
4015 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4022 while (counter++ < 8)
4024 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
4029 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4032 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4037 (void)activate_ty_curse(FALSE, &count);
4046 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4047 * / Drop 10+1d10 meteor ball at random places near the player
4052 void cast_meteor(HIT_POINT dam, POSITION rad)
4055 int b = 10 + randint1(10);
4057 for (i = 0; i < b; i++)
4059 POSITION y = 0, x = 0;
4062 for (count = 0; count <= 20; count++)
4066 x = p_ptr->x - 8 + randint0(17);
4067 y = p_ptr->y - 8 + randint0(17);
4069 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4070 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4072 /* Approximate distance */
4073 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4075 if (d >= 9) continue;
4077 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4078 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4080 /* Valid position */
4084 if (count > 20) continue;
4086 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4092 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4095 * @return ターゲットを指定し、実行したならばTRUEを返す。
4097 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4099 POSITION x, y, tx, ty;
4103 int b = 10 + randint1(10);
4105 if (!get_aim_dir(&dir)) return FALSE;
4107 /* Use the given direction */
4108 tx = p_ptr->x + 99 * ddx[dir];
4109 ty = p_ptr->y + 99 * ddy[dir];
4111 /* Hack -- Use an actual "target" */
4112 if ((dir == 5) && target_okay())
4123 /* Hack -- Stop at the target */
4124 if ((y == ty) && (x == tx)) break;
4128 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4130 /* Stop at maximum range */
4131 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4133 /* Stopped by walls/doors */
4134 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4136 /* Stopped by monsters */
4137 if ((dir != 5) && grid_array[ny][nx].m_idx != 0) break;
4139 /* Save the new location */
4146 for (i = 0; i < b; i++)
4148 int count = 20, d = 0;
4154 x = tx - 5 + randint0(11);
4155 y = ty - 5 + randint0(11);
4157 dx = (tx > x) ? (tx - x) : (x - tx);
4158 dy = (ty > y) ? (ty - y) : (y - ty);
4160 /* Approximate distance */
4161 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4162 /* Within the radius */
4166 if (count < 0) continue;
4168 /* Cannot penetrate perm walls */
4169 if (!in_bounds(y, x) ||
4170 cave_stop_disintegration(y, x) ||
4171 !in_disintegration_range(ty, tx, y, x))
4174 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4181 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4185 * This spell should become more useful (more controlled) as the\n
4186 * player gains experience levels. Thus, add 1/5 of the player's\n
4187 * level to the die roll. This eliminates the worst effects later on,\n
4188 * while keeping the results quite random. It also allows some potent\n
4189 * effects only at high level.
4191 void cast_wonder(DIRECTION dir)
4193 PLAYER_LEVEL plev = p_ptr->lev;
4194 int die = randint1(100) + plev / 5;
4195 int vir = virtue_number(V_CHANCE);
4199 if (p_ptr->virtues[vir - 1] > 0)
4201 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4205 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4210 chg_virtue(V_CHANCE, 1);
4214 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4217 if (die < 8) clone_monster(dir);
4218 else if (die < 14) speed_monster(dir, plev);
4219 else if (die < 26) heal_monster(dir, damroll(4, 6));
4220 else if (die < 31) poly_monster(dir, plev);
4222 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4223 damroll(3 + ((plev - 1) / 5), 4));
4224 else if (die < 41) confuse_monster(dir, plev);
4225 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4226 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4228 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4229 damroll(3 + ((plev - 5) / 4), 8));
4231 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4232 damroll(5 + ((plev - 5) / 4), 8));
4234 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4235 damroll(6 + ((plev - 5) / 4), 8));
4237 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4238 damroll(8 + ((plev - 5) / 4), 8));
4239 else if (die < 76) hypodynamic_bolt(dir, 75);
4240 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4241 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4242 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4243 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4244 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4247 earthquake(p_ptr->y, p_ptr->x, 12);
4251 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4255 symbol_genocide(plev + 50, TRUE);
4257 else if (die < 110) dispel_monsters(120);
4260 dispel_monsters(150);
4261 slow_monsters(plev);
4262 sleep_monsters(plev);
4269 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4273 void cast_invoke_spirits(DIRECTION dir)
4275 PLAYER_LEVEL plev = p_ptr->lev;
4276 int die = randint1(100) + plev / 5;
4277 int vir = virtue_number(V_CHANCE);
4281 if (p_ptr->virtues[vir - 1] > 0)
4283 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4287 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4291 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4293 chg_virtue(V_CHANCE, 1);
4297 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4302 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4303 "Oh no! Mouldering forms rise from the earth around you!"));
4305 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
4306 chg_virtue(V_UNLIFE, 1);
4310 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4312 set_afraid(p_ptr->afraid + randint1(4) + 4);
4316 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4317 "Your head is invaded by a horde of gibbering spectral voices..."));
4319 set_confused(p_ptr->confused + randint1(4) + 4);
4323 poly_monster(dir, plev);
4327 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4328 damroll(3 + ((plev - 1) / 5), 4));
4332 confuse_monster(dir, plev);
4336 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4340 (void)lite_line(dir, damroll(6, 8));
4344 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4345 damroll(3 + ((plev - 5) / 4), 8));
4349 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4350 damroll(5 + ((plev - 5) / 4), 8));
4354 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4355 damroll(6 + ((plev - 5) / 4), 8));
4359 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4360 damroll(8 + ((plev - 5) / 4), 8));
4364 hypodynamic_bolt(dir, 75);
4368 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4372 fire_ball(GF_ACID, dir, 40 + plev, 2);
4376 fire_ball(GF_ICE, dir, 70 + plev, 3);
4380 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4384 hypodynamic_bolt(dir, 100 + plev);
4388 earthquake(p_ptr->y, p_ptr->x, 12);
4392 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4396 symbol_genocide(plev + 50, TRUE);
4400 dispel_monsters(120);
4404 dispel_monsters(150);
4405 slow_monsters(plev);
4406 sleep_monsters(plev);
4412 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4413 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4418 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4421 void cast_shuffle(void)
4423 PLAYER_LEVEL plev = p_ptr->lev;
4426 int vir = virtue_number(V_CHANCE);
4429 /* Card sharks and high mages get a level bonus */
4430 if ((p_ptr->pclass == CLASS_ROGUE) ||
4431 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4432 (p_ptr->pclass == CLASS_SORCERER))
4433 die = (randint1(110)) + plev / 5;
4435 die = randint1(120);
4440 if (p_ptr->virtues[vir - 1] > 0)
4442 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4446 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4450 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4453 chg_virtue(V_CHANCE, 1);
4457 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4459 for (i = 0; i < randint1(3); i++)
4460 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4464 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4465 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
4470 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4471 activate_ty_curse(FALSE, &count);
4475 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4476 aggravate_monsters(0);
4480 msg_print(_("《愚者》だ。", "It's the Fool."));
4486 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4487 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4491 msg_print(_("《月》だ。", "It's the Moon."));
4496 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4497 wild_magic(randint0(32));
4501 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4502 teleport_player(10, TELEPORT_PASSIVE);
4506 msg_print(_("《正義》だ。", "It's Justice."));
4507 set_blessed(p_ptr->lev, FALSE);
4511 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4512 teleport_player(100, TELEPORT_PASSIVE);
4516 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4517 teleport_player(200, TELEPORT_PASSIVE);
4521 msg_print(_("《塔》だ。", "It's the Tower."));
4526 msg_print(_("《節制》だ。", "It's Temperance."));
4527 sleep_monsters_touch();
4531 msg_print(_("《塔》だ。", "It's the Tower."));
4533 earthquake(p_ptr->y, p_ptr->x, 5);
4537 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4538 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4542 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4543 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4547 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4548 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4552 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4553 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4557 msg_print(_("《恋人》だ。", "It's the Lovers."));
4559 if (get_aim_dir(&dir))
4560 charm_monster(dir, MIN(p_ptr->lev, 20));
4564 msg_print(_("《隠者》だ。", "It's the Hermit."));
4569 msg_print(_("《審判》だ。", "It's the Judgement."));
4570 roll_hitdice(p_ptr, 0L);
4571 lose_all_mutations();
4575 msg_print(_("《太陽》だ。", "It's the Sun."));
4576 chg_virtue(V_KNOWLEDGE, 1);
4577 chg_virtue(V_ENLIGHTEN, 1);
4582 msg_print(_("《世界》だ。", "It's the World."));
4583 if (p_ptr->exp < PY_MAX_EXP)
4585 s32b ee = (p_ptr->exp / 25) + 1;
4586 if (ee > 5000) ee = 5000;
4587 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4594 * @brief 口を使う継続的な処理を中断する
4597 void stop_mouth(void)
4599 if (music_singing_any()) stop_singing(p_ptr);
4600 if (hex_spelling_any()) stop_hex_spell_all();
4604 bool_hack vampirism(void)
4611 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4613 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4617 /* Only works on adjacent monsters */
4618 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4619 y = p_ptr->y + ddy[dir];
4620 x = p_ptr->x + ddx[dir];
4621 g_ptr = &grid_array[y][x];
4625 if (!(g_ptr->m_idx))
4627 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4631 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4633 dummy = p_ptr->lev * 2;
4635 if (hypodynamic_bolt(dir, dummy))
4637 if (p_ptr->food < PY_FOOD_FULL)
4638 /* No heal if we are "full" */
4639 (void)hp_player(dummy);
4641 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4643 /* Gain nutritional sustenance: 150/hp drained */
4644 /* A Food ration gives 5000 food points (by contrast) */
4645 /* Don't ever get more than "Full" this way */
4646 /* But if we ARE Gorged, it won't cure us */
4647 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4648 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4649 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4652 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4656 bool panic_hit(void)
4661 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4662 y = p_ptr->y + ddy[dir];
4663 x = p_ptr->x + ddx[dir];
4664 if (grid_array[y][x].m_idx)
4667 if (randint0(p_ptr->skill_dis) < 7)
4668 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4670 teleport_player(30, 0L);
4675 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4683 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4686 * currently this function allows pseudo-id of any object,
4687 * including silly ones like potions & scrolls, which always
4688 * get '{average}'. This should be changed, either to stop such
4689 * items from being pseudo-id'd, or to allow psychometry to
4690 * detect whether the unidentified potion/scroll/etc is
4691 * good (Cure Light Wounds, Restore Strength, etc) or
4692 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4694 bool psychometry(void)
4698 GAME_TEXT o_name[MAX_NLEN];
4703 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4704 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4706 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4707 if (!o_ptr) return (FALSE);
4709 /* It is fully known, no information needed */
4710 if (object_is_known(o_ptr))
4712 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4716 /* Check for a feeling */
4717 feel = value_check_aux1(o_ptr);
4719 /* Get an object description */
4720 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4722 /* Skip non-feelings */
4725 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4730 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4732 msg_format("You feel that the %s %s %s...",
4733 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4737 o_ptr->ident |= (IDENT_SENSE);
4738 o_ptr->feeling = feel;
4739 o_ptr->marked |= OM_TOUCHED;
4741 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4742 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4744 /* Valid "tval" codes */
4745 switch (o_ptr->tval)
4773 /* Auto-inscription/destroy */
4774 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4776 /* Something happened */
4781 bool draconian_breath(player_type *creature_ptr)
4784 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4785 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4787 if (!get_aim_dir(&dir)) return FALSE;
4789 if (randint1(100) < creature_ptr->lev)
4791 switch (creature_ptr->pclass)
4794 case CLASS_BERSERKER:
4797 case CLASS_IMITATOR:
4803 Type_desc = _("エレメント", "the elements");
4808 Type_desc = _("破片", "shards");
4812 case CLASS_WARRIOR_MAGE:
4813 case CLASS_HIGH_MAGE:
4814 case CLASS_SORCERER:
4815 case CLASS_MAGIC_EATER:
4816 case CLASS_RED_MAGE:
4817 case CLASS_BLUE_MAGE:
4818 case CLASS_MIRROR_MASTER:
4822 Type_desc = _("魔力", "mana");
4826 Type = GF_DISENCHANT;
4827 Type_desc = _("劣化", "disenchantment");
4830 case CLASS_CHAOS_WARRIOR:
4833 Type = GF_CONFUSION;
4834 Type_desc = _("混乱", "confusion");
4839 Type_desc = _("カオス", "chaos");
4844 case CLASS_FORCETRAINER:
4847 Type = GF_CONFUSION;
4848 Type_desc = _("混乱", "confusion");
4853 Type_desc = _("轟音", "sound");
4856 case CLASS_MINDCRAFTER:
4859 Type = GF_CONFUSION;
4860 Type_desc = _("混乱", "confusion");
4865 Type_desc = _("精神エネルギー", "mental energy");
4872 Type = GF_HELL_FIRE;
4873 Type_desc = _("地獄の劫火", "hellfire");
4877 Type = GF_HOLY_FIRE;
4878 Type_desc = _("聖なる炎", "holy fire");
4886 Type_desc = _("暗黒", "darkness");
4891 Type_desc = _("毒", "poison");
4898 Type_desc = _("轟音", "sound");
4902 Type = GF_CONFUSION;
4903 Type_desc = _("混乱", "confusion");
4910 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4912 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4916 bool android_inside_weapon(player_type *creature_ptr)
4919 if (!get_aim_dir(&dir)) return FALSE;
4920 if (creature_ptr->lev < 10)
4922 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4923 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4925 else if (creature_ptr->lev < 25)
4927 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4928 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4930 else if (creature_ptr->lev < 35)
4932 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4933 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4935 else if (creature_ptr->lev < 45)
4937 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4938 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4942 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4943 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4948 bool create_ration(player_type *crature_ptr)
4954 /* Create the food ration */
4955 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4957 /* Drop the object from heaven */
4958 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4959 msg_print(_("食事を料理して作った。", "You cook some food."));
4963 void hayagake(player_type *creature_ptr)
4965 if (creature_ptr->action == ACTION_HAYAGAKE)
4967 set_action(ACTION_NONE);
4971 grid_type *g_ptr = &grid_array[creature_ptr->y][creature_ptr->x];
4972 feature_type *f_ptr = &f_info[g_ptr->feat];
4974 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4975 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4977 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4981 set_action(ACTION_HAYAGAKE);
4984 creature_ptr->energy_use = 0;
4987 bool double_attack(player_type *creature_ptr)
4992 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4993 y = creature_ptr->y + ddy[dir];
4994 x = creature_ptr->x + ddx[dir];
4995 if (grid_array[y][x].m_idx)
4998 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4999 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
5001 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
5002 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
5004 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
5005 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
5008 if (grid_array[y][x].m_idx)
5013 creature_ptr->energy_need += ENERGY_NEED();
5017 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5023 bool comvert_hp_to_mp(player_type *creature_ptr)
5025 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5028 creature_ptr->csp += gain_sp;
5029 if (creature_ptr->csp > creature_ptr->msp)
5031 creature_ptr->csp = creature_ptr->msp;
5032 creature_ptr->csp_frac = 0;
5037 msg_print(_("変換に失敗した。", "You failed to convert."));
5039 creature_ptr->redraw |= (PR_HP | PR_MANA);
5043 bool comvert_mp_to_hp(player_type *creature_ptr)
5045 if (creature_ptr->csp >= creature_ptr->lev / 5)
5047 creature_ptr->csp -= creature_ptr->lev / 5;
5048 hp_player(creature_ptr->lev);
5052 msg_print(_("変換に失敗した。", "You failed to convert."));
5054 creature_ptr->redraw |= (PR_HP | PR_MANA);
5058 bool demonic_breath(player_type *creature_ptr)
5061 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5062 if (!get_aim_dir(&dir)) return FALSE;
5064 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5065 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5069 bool mirror_concentration(player_type *creature_ptr)
5073 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5076 if (is_mirror_grid(&grid_array[creature_ptr->y][creature_ptr->x]))
5078 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5080 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5081 if (creature_ptr->csp >= creature_ptr->msp)
5083 creature_ptr->csp = creature_ptr->msp;
5084 creature_ptr->csp_frac = 0;
5086 creature_ptr->redraw |= (PR_MANA);
5090 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5095 bool sword_dancing(player_type *creature_ptr)
5098 POSITION y = 0, x = 0;
5102 for (i = 0; i < 6; i++)
5105 y = creature_ptr->y + ddy_ddd[dir];
5106 x = creature_ptr->x + ddx_ddd[dir];
5107 g_ptr = &grid_array[y][x];
5109 /* Hack -- attack monsters */
5114 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5120 bool confusing_light(player_type *creature_ptr)
5122 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5123 slow_monsters(creature_ptr->lev);
5124 stun_monsters(creature_ptr->lev * 4);
5125 confuse_monsters(creature_ptr->lev * 4);
5126 turn_monsters(creature_ptr->lev * 4);
5127 stasis_monsters(creature_ptr->lev * 4);
5131 bool rodeo(player_type *creature_ptr)
5133 GAME_TEXT m_name[MAX_NLEN];
5134 monster_type *m_ptr;
5135 monster_race *r_ptr;
5138 if (creature_ptr->riding)
5140 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5143 if (!do_riding(TRUE)) return TRUE;
5145 m_ptr = &m_list[creature_ptr->riding];
5146 r_ptr = &r_info[m_ptr->r_idx];
5147 monster_desc(m_name, m_ptr, 0);
5148 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5150 if (is_pet(m_ptr)) return TRUE;
5152 rlev = r_ptr->level;
5154 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5155 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5156 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5157 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5158 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5159 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5161 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5166 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5170 /* 落馬処理に失敗してもとにかく乗馬解除 */
5171 creature_ptr->riding = 0;
5176 bool clear_mind(player_type *creature_ptr)
5180 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5183 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5185 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5186 if (creature_ptr->csp >= creature_ptr->msp)
5188 creature_ptr->csp = creature_ptr->msp;
5189 creature_ptr->csp_frac = 0;
5191 creature_ptr->redraw |= (PR_MANA);
5195 bool concentration(player_type *creature_ptr)
5197 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5201 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5204 if (creature_ptr->special_defense & KATA_MASK)
5206 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5209 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5211 creature_ptr->csp += creature_ptr->msp / 2;
5212 if (creature_ptr->csp >= max_csp)
5214 creature_ptr->csp = max_csp;
5215 creature_ptr->csp_frac = 0;
5217 creature_ptr->redraw |= (PR_MANA);