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"
31 * @brief プレイヤー周辺の地形を感知する
34 * @param known 地形から危険フラグを外すならTRUE
35 * @return 効力があった場合TRUEを返す
37 static bool detect_feat_flag(POSITION range, int flag, bool known)
43 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
45 /* Scan the current panel */
46 for (y = 1; y < cur_hgt - 1; y++)
48 for (x = 1; x <= cur_wid - 1; x++)
50 int dist = distance(p_ptr->y, p_ptr->x, y, x);
51 if (dist > range) continue;
57 /* Mark as detected */
58 if (dist <= range && known)
60 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
62 c_ptr->info &= ~(CAVE_UNSAFE);
69 if (cave_have_flag_grid(c_ptr, flag))
74 /* Hack -- Memorize */
75 c_ptr->info |= (CAVE_MARK);
88 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
90 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
91 * @return 効力があった場合TRUEを返す
93 bool detect_traps(POSITION range, bool known)
95 bool detect = detect_feat_flag(range, FF_TRAP, known);
97 if (known) p_ptr->dtrap = TRUE;
99 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
102 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
109 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
111 * @return 効力があった場合TRUEを返す
113 bool detect_doors(POSITION range)
115 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
117 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
120 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
127 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
129 * @return 効力があった場合TRUEを返す
131 bool detect_stairs(POSITION range)
133 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
135 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
138 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
145 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
147 * @return 効力があった場合TRUEを返す
149 bool detect_treasure(POSITION range)
151 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
153 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
156 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
163 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
165 * @return 効力があった場合TRUEを返す
167 bool detect_objects_gold(POSITION range)
171 POSITION range2 = range;
175 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
178 for (i = 1; i < o_max; i++)
180 object_type *o_ptr = &o_list[i];
182 /* Skip dead objects */
183 if (!o_ptr->k_idx) continue;
185 /* Skip held objects */
186 if (o_ptr->held_m_idx) continue;
191 /* Only detect nearby objects */
192 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
194 /* Detect "gold" objects */
195 if (o_ptr->tval == TV_GOLD)
197 o_ptr->marked |= OM_FOUND;
203 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
206 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
209 if (detect_monsters_string(range, "$"))
218 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
220 * @return 効力があった場合TRUEを返す
222 bool detect_objects_normal(POSITION range)
226 POSITION range2 = range;
230 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
233 for (i = 1; i < o_max; i++)
235 object_type *o_ptr = &o_list[i];
237 /* Skip dead objects */
238 if (!o_ptr->k_idx) continue;
240 /* Skip held objects */
241 if (o_ptr->held_m_idx) continue;
246 /* Only detect nearby objects */
247 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
249 /* Detect "real" objects */
250 if (o_ptr->tval != TV_GOLD)
252 o_ptr->marked |= OM_FOUND;
258 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
261 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
264 if (detect_monsters_string(range, "!=?|/`"))
273 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
275 * @return 効力があった場合TRUEを返す
278 * This will light up all spaces with "magic" items, including artifacts,
279 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
280 * and "enchanted" items of the "good" variety.
282 * It can probably be argued that this function is now too powerful.
285 bool detect_objects_magic(POSITION range)
287 OBJECT_TYPE_VALUE tv;
293 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
295 /* Scan all objects */
296 for (i = 1; i < o_max; i++)
298 object_type *o_ptr = &o_list[i];
300 /* Skip dead objects */
301 if (!o_ptr->k_idx) continue;
303 /* Skip held objects */
304 if (o_ptr->held_m_idx) continue;
309 /* Only detect nearby objects */
310 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
312 /* Examine the tval */
315 /* Artifacts, misc magic items, or enchanted wearables */
316 if (object_is_artifact(o_ptr) ||
317 object_is_ego(o_ptr) ||
318 (tv == TV_WHISTLE) ||
326 (tv == TV_LIFE_BOOK) ||
327 (tv == TV_SORCERY_BOOK) ||
328 (tv == TV_NATURE_BOOK) ||
329 (tv == TV_CHAOS_BOOK) ||
330 (tv == TV_DEATH_BOOK) ||
331 (tv == TV_TRUMP_BOOK) ||
332 (tv == TV_ARCANE_BOOK) ||
333 (tv == TV_CRAFT_BOOK) ||
334 (tv == TV_DAEMON_BOOK) ||
335 (tv == TV_CRUSADE_BOOK) ||
336 (tv == TV_MUSIC_BOOK) ||
337 (tv == TV_HISSATSU_BOOK) ||
338 (tv == TV_HEX_BOOK) ||
339 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
341 /* Memorize the item */
342 o_ptr->marked |= OM_FOUND;
349 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
358 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
360 * @return 効力があった場合TRUEを返す
362 bool detect_monsters_normal(POSITION range)
368 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
370 for (i = 1; i < m_max; i++)
372 monster_type *m_ptr = &m_list[i];
373 monster_race *r_ptr = &r_info[m_ptr->r_idx];
375 /* Skip dead monsters */
376 if (!m_ptr->r_idx) continue;
381 /* Only detect nearby monsters */
382 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
384 /* Detect all non-invisible monsters */
385 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
387 /* Repair visibility later */
388 repair_monsters = TRUE;
390 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
391 update_monster(i, FALSE);
396 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
399 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
406 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
408 * @return 効力があった場合TRUEを返す
410 bool detect_monsters_invis(POSITION range)
416 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
418 for (i = 1; i < m_max; i++)
420 monster_type *m_ptr = &m_list[i];
421 monster_race *r_ptr = &r_info[m_ptr->r_idx];
423 /* Skip dead monsters */
424 if (!m_ptr->r_idx) continue;
429 /* Only detect nearby monsters */
430 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
432 /* Detect invisible monsters */
433 if (r_ptr->flags2 & RF2_INVISIBLE)
435 /* Update monster recall window */
436 if (p_ptr->monster_race_idx == m_ptr->r_idx)
438 p_ptr->window |= (PW_MONSTER);
441 /* Repair visibility later */
442 repair_monsters = TRUE;
444 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
445 update_monster(i, FALSE);
450 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
453 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
459 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
461 * @return 効力があった場合TRUEを返す
463 bool detect_monsters_evil(POSITION range)
469 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
471 for (i = 1; i < m_max; i++)
473 monster_type *m_ptr = &m_list[i];
474 monster_race *r_ptr = &r_info[m_ptr->r_idx];
476 /* Skip dead monsters */
477 if (!m_ptr->r_idx) continue;
482 /* Only detect nearby monsters */
483 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
485 /* Detect evil monsters */
486 if (r_ptr->flags3 & RF3_EVIL)
488 if (is_original_ap(m_ptr))
490 /* Take note that they are evil */
491 r_ptr->r_flags3 |= (RF3_EVIL);
493 /* Update monster recall window */
494 if (p_ptr->monster_race_idx == m_ptr->r_idx)
496 p_ptr->window |= (PW_MONSTER);
500 /* Repair visibility later */
501 repair_monsters = TRUE;
503 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
504 update_monster(i, FALSE);
510 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
516 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
518 * @return 効力があった場合TRUEを返す
520 bool detect_monsters_nonliving(POSITION range)
526 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
528 for (i = 1; i < m_max; i++)
530 monster_type *m_ptr = &m_list[i];
532 /* Skip dead monsters */
533 if (!m_ptr->r_idx) continue;
538 /* Only detect nearby monsters */
539 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
541 /* Detect non-living monsters */
542 if (!monster_living(m_ptr->r_idx))
544 /* Update monster recall window */
545 if (p_ptr->monster_race_idx == m_ptr->r_idx)
547 p_ptr->window |= (PW_MONSTER);
550 /* Repair visibility later */
551 repair_monsters = TRUE;
553 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
554 update_monster(i, FALSE);
560 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
566 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
568 * @return 効力があった場合TRUEを返す
570 bool detect_monsters_mind(POSITION range)
576 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
578 for (i = 1; i < m_max; i++)
580 monster_type *m_ptr = &m_list[i];
581 monster_race *r_ptr = &r_info[m_ptr->r_idx];
583 /* Skip dead monsters */
584 if (!m_ptr->r_idx) continue;
589 /* Only detect nearby monsters */
590 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
592 /* Detect non-living monsters */
593 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
595 /* Update monster recall window */
596 if (p_ptr->monster_race_idx == m_ptr->r_idx)
598 p_ptr->window |= (PW_MONSTER);
601 /* Repair visibility later */
602 repair_monsters = TRUE;
604 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
605 update_monster(i, FALSE);
611 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
618 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
620 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
621 * @return 効力があった場合TRUEを返す
623 bool detect_monsters_string(POSITION range, concptr Match)
629 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
631 for (i = 1; i < m_max; i++)
633 monster_type *m_ptr = &m_list[i];
634 monster_race *r_ptr = &r_info[m_ptr->r_idx];
636 /* Skip dead monsters */
637 if (!m_ptr->r_idx) continue;
642 /* Only detect nearby monsters */
643 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
645 /* Detect monsters with the same symbol */
646 if (my_strchr(Match, r_ptr->d_char))
648 /* Update monster recall window */
649 if (p_ptr->monster_race_idx == m_ptr->r_idx)
651 p_ptr->window |= (PW_MONSTER);
654 /* Repair visibility later */
655 repair_monsters = TRUE;
657 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
658 update_monster(i, FALSE);
663 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
666 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
672 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
674 * @param match_flag 感知フラグ
675 * @return 効力があった場合TRUEを返す
677 bool detect_monsters_xxx(POSITION range, u32b match_flag)
682 concptr desc_monsters = _("変なモンスター", "weird monsters");
684 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
686 for (i = 1; i < m_max; i++)
688 monster_type *m_ptr = &m_list[i];
689 monster_race *r_ptr = &r_info[m_ptr->r_idx];
691 /* Skip dead monsters */
692 if (!m_ptr->r_idx) continue;
697 /* Only detect nearby monsters */
698 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
700 /* Detect evil monsters */
701 if (r_ptr->flags3 & (match_flag))
703 if (is_original_ap(m_ptr))
705 /* Take note that they are something */
706 r_ptr->r_flags3 |= (match_flag);
708 /* Update monster recall window */
709 if (p_ptr->monster_race_idx == m_ptr->r_idx)
711 p_ptr->window |= (PW_MONSTER);
715 /* Repair visibility later */
716 repair_monsters = TRUE;
718 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
719 update_monster(i, FALSE);
728 desc_monsters = _("デーモン", "demons");
731 desc_monsters = _("アンデッド", "the undead");
735 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
743 * @brief 全感知処理 / Detect everything
745 * @return 効力があった場合TRUEを返す
747 bool detect_all(POSITION range)
751 /* Detect everything */
752 if (detect_traps(range, TRUE)) detect = TRUE;
753 if (detect_doors(range)) detect = TRUE;
754 if (detect_stairs(range)) detect = TRUE;
756 /* There are too many hidden treasure. So... */
757 /* if (detect_treasure(range)) detect = TRUE; */
759 if (detect_objects_gold(range)) detect = TRUE;
760 if (detect_objects_normal(range)) detect = TRUE;
761 if (detect_monsters_invis(range)) detect = TRUE;
762 if (detect_monsters_normal(range)) detect = TRUE;
768 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
771 * @return 効力があった場合TRUEを返す
774 * Note that affected monsters are NOT auto-tracked by this usage.
776 * To avoid misbehavior when monster deaths have side-effects,
777 * this is done in two passes. -- JDL
780 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
784 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
785 bool obvious = FALSE;
788 /* Mark all (nearby) monsters */
789 for (i = 1; i < m_max; i++)
791 monster_type *m_ptr = &m_list[i];
793 /* Paranoia -- Skip dead monsters */
794 if (!m_ptr->r_idx) continue;
799 /* Require line of sight */
800 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
802 /* Mark the monster */
803 m_ptr->mflag |= (MFLAG_TEMP);
806 /* Affect all marked monsters */
807 for (i = 1; i < m_max; i++)
809 monster_type *m_ptr = &m_list[i];
811 /* Skip unmarked monsters */
812 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
815 m_ptr->mflag &= ~(MFLAG_TEMP);
820 /* Jump directly to the target monster */
821 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
828 * @brief 視界内モンスターを加速する処理 / Speed monsters
829 * @return 効力があった場合TRUEを返す
831 bool speed_monsters(void)
833 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
837 * @brief 視界内モンスターを加速する処理 / Slow monsters
838 * @return 効力があった場合TRUEを返す
840 bool slow_monsters(int power)
842 return (project_all_los(GF_OLD_SLOW, power));
846 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
847 * @return 効力があった場合TRUEを返す
849 bool sleep_monsters(int power)
851 return (project_all_los(GF_OLD_SLEEP, power));
855 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
856 * @return 効力があった場合TRUEを返す
858 bool banish_evil(int dist)
860 return (project_all_los(GF_AWAY_EVIL, dist));
864 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
865 * @return 効力があった場合TRUEを返す
867 bool turn_undead(void)
869 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
871 chg_virtue(V_UNLIFE, -1);
876 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
877 * @return 効力があった場合TRUEを返す
879 bool dispel_undead(HIT_POINT dam)
881 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
883 chg_virtue(V_UNLIFE, -2);
888 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
889 * @return 効力があった場合TRUEを返す
891 bool dispel_evil(HIT_POINT dam)
893 return (project_all_los(GF_DISP_EVIL, dam));
897 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
898 * @return 効力があった場合TRUEを返す
900 bool dispel_good(HIT_POINT dam)
902 return (project_all_los(GF_DISP_GOOD, dam));
906 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
907 * @return 効力があった場合TRUEを返す
909 bool dispel_monsters(HIT_POINT dam)
911 return (project_all_los(GF_DISP_ALL, dam));
914 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
917 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
918 int k = 3 * creature_ptr->lev;
919 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
920 if (set_poisoned(0)) ident = TRUE;
921 if (set_afraid(0)) ident = TRUE;
922 if (hp_player(50)) ident = TRUE;
923 if (set_stun(0)) ident = TRUE;
924 if (set_cut(0)) ident = TRUE;
928 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
930 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
931 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
932 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
933 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))
935 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
941 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
942 * @return 効力があった場合TRUEを返す
944 bool dispel_living(HIT_POINT dam)
946 return (project_all_los(GF_DISP_LIVING, dam));
950 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
951 * @return 効力があった場合TRUEを返す
953 bool dispel_demons(HIT_POINT dam)
955 return (project_all_los(GF_DISP_DEMON, dam));
959 * @brief 視界内のモンスターに「聖戦」効果を与える処理
960 * @return 効力があった場合TRUEを返す
964 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
968 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
969 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
972 void aggravate_monsters(MONSTER_IDX who)
978 /* Aggravate everyone nearby */
979 for (i = 1; i < m_max; i++)
981 monster_type *m_ptr = &m_list[i];
983 /* Paranoia -- Skip dead monsters */
984 if (!m_ptr->r_idx) continue;
986 /* Skip aggravating monster (or player) */
987 if (i == who) continue;
989 /* Wake up nearby sleeping monsters */
990 if (m_ptr->cdis < MAX_SIGHT * 2)
993 if (MON_CSLEEP(m_ptr))
995 (void)set_monster_csleep(i, 0);
998 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1001 /* Speed up monsters in line of sight */
1002 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1006 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1012 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1013 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1014 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1019 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1020 * @param m_idx 抹殺するモンスターID
1021 * @param power 抹殺の威力
1022 * @param player_cast プレイヤーの魔法によるものならば TRUE
1023 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1024 * @param spell_name 抹殺効果を起こした魔法の名前
1025 * @return 効力があった場合TRUEを返す
1027 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1029 int msec = delay_factor * delay_factor * delay_factor;
1030 monster_type *m_ptr = &m_list[m_idx];
1031 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1032 bool resist = FALSE;
1034 if (is_pet(m_ptr) && !player_cast) return FALSE;
1036 /* Hack -- Skip Unique Monsters or Quest Monsters */
1037 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1038 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1039 else if (m_idx == p_ptr->riding) resist = TRUE;
1040 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1041 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1042 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1046 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1048 GAME_TEXT m_name[MAX_NLEN];
1050 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1051 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1054 delete_monster_idx(m_idx);
1057 if (resist && player_cast)
1059 bool see_m = is_seen(m_ptr);
1060 GAME_TEXT m_name[MAX_NLEN];
1062 monster_desc(m_name, m_ptr, 0);
1065 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1067 if (MON_CSLEEP(m_ptr))
1069 (void)set_monster_csleep(m_idx, 0);
1072 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1075 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1079 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1083 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1088 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1091 /* Visual feedback */
1092 move_cursor_relative(p_ptr->y, p_ptr->x);
1094 p_ptr->redraw |= (PR_HP);
1095 p_ptr->window |= (PW_PLAYER);
1100 Term_xtra(TERM_XTRA_DELAY, msec);
1107 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1108 * @param power 抹殺の威力
1109 * @param player_cast プレイヤーの魔法によるものならば TRUE
1110 * @return 効力があった場合TRUEを返す
1112 bool symbol_genocide(int power, bool player_cast)
1116 bool result = FALSE;
1118 /* Prevent genocide in quest levels */
1119 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1121 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1125 /* Mega-Hack -- Get a monster symbol */
1126 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1128 /* Delete the monsters of that "type" */
1129 for (i = 1; i < m_max; i++)
1131 monster_type *m_ptr = &m_list[i];
1132 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1134 /* Paranoia -- Skip dead monsters */
1135 if (!m_ptr->r_idx) continue;
1137 /* Skip "wrong" monsters */
1138 if (r_ptr->d_char != typ) continue;
1140 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1145 chg_virtue(V_VITALITY, -2);
1146 chg_virtue(V_CHANCE, -1);
1154 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1155 * @param power 抹殺の威力
1156 * @param player_cast プレイヤーの魔法によるものならば TRUE
1157 * @return 効力があった場合TRUEを返す
1159 bool mass_genocide(int power, bool player_cast)
1162 bool result = FALSE;
1164 /* Prevent mass genocide in quest levels */
1165 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1170 /* Delete the (nearby) monsters */
1171 for (i = 1; i < m_max; i++)
1173 monster_type *m_ptr = &m_list[i];
1175 /* Paranoia -- Skip dead monsters */
1176 if (!m_ptr->r_idx) continue;
1178 /* Skip distant monsters */
1179 if (m_ptr->cdis > MAX_SIGHT) continue;
1182 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1187 chg_virtue(V_VITALITY, -2);
1188 chg_virtue(V_CHANCE, -1);
1196 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1197 * @param power 抹殺の威力
1198 * @param player_cast プレイヤーの魔法によるものならば TRUE
1199 * @return 効力があった場合TRUEを返す
1201 bool mass_genocide_undead(int power, bool player_cast)
1204 bool result = FALSE;
1206 /* Prevent mass genocide in quest levels */
1207 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1212 /* Delete the (nearby) monsters */
1213 for (i = 1; i < m_max; i++)
1215 monster_type *m_ptr = &m_list[i];
1216 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1218 /* Paranoia -- Skip dead monsters */
1219 if (!m_ptr->r_idx) continue;
1221 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1223 /* Skip distant monsters */
1224 if (m_ptr->cdis > MAX_SIGHT) continue;
1227 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1232 chg_virtue(V_UNLIFE, -2);
1233 chg_virtue(V_CHANCE, -1);
1241 * @brief 周辺モンスターを調査する / Probe nearby monsters
1242 * @return 効力があった場合TRUEを返す
1247 int speed; /* TODO */
1258 /* Probe all (nearby) monsters */
1259 for (i = 1; i < m_max; i++)
1261 monster_type *m_ptr = &m_list[i];
1262 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1264 /* Paranoia -- Skip dead monsters */
1265 if (!m_ptr->r_idx) continue;
1267 /* Require line of sight */
1268 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1270 /* Probe visible monsters */
1273 GAME_TEXT m_name[MAX_NLEN];
1275 /* Start the message */
1278 msg_print(_("調査中...", "Probing..."));
1283 if (!is_original_ap(m_ptr))
1285 if (m_ptr->mflag2 & MFLAG2_KAGE)
1286 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1288 m_ptr->ap_r_idx = m_ptr->r_idx;
1289 lite_spot(m_ptr->fy, m_ptr->fx);
1291 /* Get "the monster" or "something" */
1292 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1294 speed = m_ptr->mspeed - 110;
1295 if (MON_FAST(m_ptr)) speed += 10;
1296 if (MON_SLOW(m_ptr)) speed -= 10;
1297 if (ironman_nightmare) speed += 5;
1299 /* Get the monster's alignment */
1300 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1301 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1302 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1303 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1304 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1305 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1306 else align = _("中立", "neutral");
1308 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1309 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1311 if (r_ptr->next_r_idx)
1313 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1317 strcat(buf, "xxx ");
1320 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1321 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1322 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1323 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1324 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1325 buf[strlen(buf)-1] = '\0';
1328 /* HACK : Add the line to message buffer */
1331 p_ptr->window |= (PW_MESSAGE);
1334 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1337 Term_erase(0, 0, 255);
1339 /* Learn everything about this monster */
1340 if (lore_do_probe(m_ptr->r_idx))
1342 /* Get base name of monster */
1343 strcpy(buf, (r_name + r_ptr->name));
1346 /* Note that we learnt some new flags -Mogami- */
1347 msg_format("%sについてさらに詳しくなった気がする。", buf);
1352 /* Note that we learnt some new flags -Mogami- */
1353 msg_format("You now know more about %s.", buf);
1355 /* Clear -more- prompt */
1370 chg_virtue(V_KNOWLEDGE, 1);
1371 msg_print(_("これで全部です。", "That's all."));
1379 * @brief *破壊*処理を行う / The spell of destruction
1380 * @param y1 破壊の中心Y座標
1381 * @param x1 破壊の中心X座標
1383 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1384 * @return 効力があった場合TRUEを返す
1387 * This spell "deletes" monsters (instead of "killing" them).
1389 * Later we may use one function for both "destruction" and
1390 * "earthquake" by using the "full" to select "destruction".
1393 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1400 /* Prevent destruction of quest levels and town */
1401 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1406 /* Lose monster light */
1407 if (!in_generate) clear_mon_lite();
1409 /* Big area of affect */
1410 for (y = (y1 - r); y <= (y1 + r); y++)
1412 for (x = (x1 - r); x <= (x1 + r); x++)
1414 /* Skip illegal grids */
1415 if (!in_bounds(y, x)) continue;
1417 /* Extract the distance */
1418 k = distance(y1, x1, y, x);
1420 /* Stay in the circle of death */
1421 if (k > r) continue;
1422 c_ptr = &cave[y][x];
1424 /* Lose room and vault */
1425 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1427 /* Lose light and knowledge */
1428 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1430 if (!in_generate) /* Normal */
1433 c_ptr->info &= ~(CAVE_UNSAFE);
1435 /* Hack -- Notice player affect */
1436 if (player_bold(y, x))
1438 /* Hurt the player later */
1441 /* Do not hurt this grid */
1446 /* Hack -- Skip the epicenter */
1447 if ((y == y1) && (x == x1)) continue;
1451 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1452 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1454 if (in_generate) /* In generation */
1456 /* Delete the monster (if any) */
1457 delete_monster(y, x);
1459 else if (r_ptr->flags1 & RF1_QUESTOR)
1461 /* Heal the monster */
1462 m_ptr->hp = m_ptr->maxhp;
1464 /* Try to teleport away quest monsters */
1465 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1469 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1471 GAME_TEXT m_name[MAX_NLEN];
1473 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1474 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1477 /* Delete the monster (if any) */
1478 delete_monster(y, x);
1482 /* During generation, destroyed artifacts are "preserved" */
1483 if (preserve_mode || in_generate)
1485 OBJECT_IDX this_o_idx, next_o_idx = 0;
1487 /* Scan all objects in the grid */
1488 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1491 o_ptr = &o_list[this_o_idx];
1493 /* Acquire next object */
1494 next_o_idx = o_ptr->next_o_idx;
1496 /* Hack -- Preserve unknown artifacts */
1497 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1499 /* Mega-Hack -- Preserve the artifact */
1500 a_info[o_ptr->name1].cur_num = 0;
1502 if (in_generate && cheat_peek)
1504 GAME_TEXT o_name[MAX_NLEN];
1505 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1506 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1509 else if (in_generate && cheat_peek && o_ptr->art_name)
1511 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1512 "One of the random artifacts was *destroyed* during generation."));
1517 delete_object(y, x);
1519 /* Destroy "non-permanent" grids */
1520 if (!cave_perma_grid(c_ptr))
1522 /* Wall (or floor) type */
1525 if (!in_generate) /* Normal */
1529 /* Create granite wall */
1530 cave_set_feat(y, x, feat_granite);
1534 /* Create quartz vein */
1535 cave_set_feat(y, x, feat_quartz_vein);
1539 /* Create magma vein */
1540 cave_set_feat(y, x, feat_magma_vein);
1545 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1548 else /* In generation */
1552 /* Create granite wall */
1553 place_extra_grid(c_ptr);
1557 /* Create quartz vein */
1558 c_ptr->feat = feat_quartz_vein;
1562 /* Create magma vein */
1563 c_ptr->feat = feat_magma_vein;
1568 place_floor_grid(c_ptr);
1571 /* Clear garbage of hidden trap or door */
1580 /* Process "re-glowing" */
1581 for (y = (y1 - r); y <= (y1 + r); y++)
1583 for (x = (x1 - r); x <= (x1 + r); x++)
1585 /* Skip illegal grids */
1586 if (!in_bounds(y, x)) continue;
1588 /* Extract the distance */
1589 k = distance(y1, x1, y, x);
1591 /* Stay in the circle of death */
1592 if (k > r) continue;
1593 c_ptr = &cave[y][x];
1595 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1596 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1602 for (i = 0; i < 9; i++)
1604 yy = y + ddy_ddd[i];
1605 xx = x + ddx_ddd[i];
1606 if (!in_bounds2(yy, xx)) continue;
1607 cc_ptr = &cave[yy][xx];
1608 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1610 c_ptr->info |= CAVE_GLOW;
1618 /* Hack -- Affect player */
1621 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1623 /* Blind the player */
1624 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1627 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1633 /* Mega-Hack -- Forget the view and lite */
1634 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1635 p_ptr->redraw |= (PR_MAP);
1636 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1638 if (p_ptr->special_defense & NINJA_S_STEALTH)
1640 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1650 * @brief 地震処理(サブルーチン) /
1651 * Induce an "earthquake" of the given radius at the given location.
1652 * @return 効力があった場合TRUEを返す
1656 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1660 * This will turn some walls into floors and some floors into walls.
1662 * The player will take damage and "jump" into a safe grid if possible,
1663 * otherwise, he will "tunnel" through the rubble instantaneously.
1665 * Monsters will take damage, and "jump" into a safe grid if possible,
1666 * otherwise they will be "buried" in the rubble, disappearing from
1667 * the level in the same way that they do when genocided.
1669 * Note that thus the player and monsters (except eaters of walls and
1670 * passers through walls) will never occupy the same grid as a wall.
1671 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1672 * for a single turn, unless that monster can pass_walls or kill_walls.
1673 * This has allowed massive simplification of the "monster" code.
1676 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1680 POSITION y, x, yy, xx, dy, dx;
1683 POSITION sy = 0, sx = 0;
1688 /* Prevent destruction of quest levels and town */
1689 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1694 /* Paranoia -- Enforce maximum range */
1697 /* Clear the "maximal blast" area */
1698 for (y = 0; y < 32; y++)
1700 for (x = 0; x < 32; x++)
1706 /* Check around the epicenter */
1707 for (dy = -r; dy <= r; dy++)
1709 for (dx = -r; dx <= r; dx++)
1711 /* Extract the location */
1715 /* Skip illegal grids */
1716 if (!in_bounds(yy, xx)) continue;
1718 /* Skip distant grids */
1719 if (distance(cy, cx, yy, xx) > r) continue;
1720 c_ptr = &cave[yy][xx];
1722 /* Lose room and vault / Lose light and knowledge */
1723 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1724 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1726 /* Skip the epicenter */
1727 if (!dx && !dy) continue;
1729 /* Skip most grids */
1730 if (randint0(100) < 85) continue;
1732 /* Damage this grid */
1733 map[16+yy-cy][16+xx-cx] = TRUE;
1735 /* Hack -- Take note of player damage */
1736 if (player_bold(yy, xx)) hurt = TRUE;
1740 /* First, affect the player (if necessary) */
1741 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1743 /* Check around the player */
1744 for (i = 0; i < 8; i++)
1746 /* Access the location */
1747 y = p_ptr->y + ddy_ddd[i];
1748 x = p_ptr->x + ddx_ddd[i];
1750 /* Skip non-empty grids */
1751 if (!cave_empty_bold(y, x)) continue;
1753 /* Important -- Skip "quake" grids */
1754 if (map[16+y-cy][16+x-cx]) continue;
1756 if (cave[y][x].m_idx) continue;
1758 /* Count "safe" grids */
1761 /* Randomize choice */
1762 if (randint0(sn) > 0) continue;
1764 /* Save the safe location */
1768 /* Random message */
1769 switch (randint1(3))
1773 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1778 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1783 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1788 /* Hurt the player a lot */
1791 /* Message and damage */
1792 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1796 /* Destroy the grid, and push the player to safety */
1799 /* Calculate results */
1800 switch (randint1(3))
1804 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1810 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1811 damage = damroll(10, 4);
1812 (void)set_stun(p_ptr->stun + randint1(50));
1817 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1818 damage = damroll(10, 4);
1819 (void)set_stun(p_ptr->stun + randint1(50));
1824 /* Move the player to the safe location */
1825 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1828 /* Important -- no wall on player */
1829 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1837 GAME_TEXT m_name[MAX_NLEN];
1838 monster_type *m_ptr = &m_list[m_idx];
1840 /* Get the monster's real name */
1841 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1843 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1847 killer = _("地震", "an earthquake");
1850 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1854 /* Examine the quaked region */
1855 for (dy = -r; dy <= r; dy++)
1857 for (dx = -r; dx <= r; dx++)
1859 /* Extract the location */
1863 /* Skip unaffected grids */
1864 if (!map[16+yy-cy][16+xx-cx]) continue;
1865 c_ptr = &cave[yy][xx];
1867 if (c_ptr->m_idx == p_ptr->riding) continue;
1869 /* Process monsters */
1872 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1873 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1875 /* Quest monsters */
1876 if (r_ptr->flags1 & RF1_QUESTOR)
1878 /* No wall on quest monsters */
1879 map[16+yy-cy][16+xx-cx] = FALSE;
1884 /* Most monsters cannot co-exist with rock */
1885 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1886 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1888 GAME_TEXT m_name[MAX_NLEN];
1890 /* Assume not safe */
1893 /* Monster can move to escape the wall */
1894 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1896 /* Look for safety */
1897 for (i = 0; i < 8; i++)
1899 y = yy + ddy_ddd[i];
1900 x = xx + ddx_ddd[i];
1902 /* Skip non-empty grids */
1903 if (!cave_empty_bold(y, x)) continue;
1905 /* Hack -- no safety on glyph of warding */
1906 if (is_glyph_grid(&cave[y][x])) continue;
1907 if (is_explosive_rune_grid(&cave[y][x])) continue;
1909 /* ... nor on the Pattern */
1910 if (pattern_tile(y, x)) continue;
1912 /* Important -- Skip "quake" grids */
1913 if (map[16+y-cy][16+x-cx]) continue;
1915 if (cave[y][x].m_idx) continue;
1916 if (player_bold(y, x)) continue;
1918 /* Count "safe" grids */
1921 /* Randomize choice */
1922 if (randint0(sn) > 0) continue;
1924 /* Save the safe grid */
1929 monster_desc(m_name, m_ptr, 0);
1931 /* Scream in pain */
1932 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1934 /* Take damage from the quake */
1935 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1937 /* Monster is certainly awake */
1938 (void)set_monster_csleep(c_ptr->m_idx, 0);
1940 /* Apply damage directly */
1941 m_ptr->hp -= damage;
1943 /* Delete (not kill) "dead" monsters */
1946 if (!ignore_unview || is_seen(m_ptr))
1947 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1951 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1953 char m2_name[MAX_NLEN];
1955 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1956 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1960 delete_monster(yy, xx);
1962 /* No longer safe */
1966 /* Hack -- Escape from the rock */
1969 IDX m_idx_aux = cave[yy][xx].m_idx;
1971 /* Update the old location */
1972 cave[yy][xx].m_idx = 0;
1974 /* Update the new location */
1975 cave[sy][sx].m_idx = m_idx_aux;
1977 /* Move the monster */
1981 update_monster(m_idx, TRUE);
1990 /* Lose monster light */
1993 /* Examine the quaked region */
1994 for (dy = -r; dy <= r; dy++)
1996 for (dx = -r; dx <= r; dx++)
1998 /* Extract the location */
2002 /* Skip unaffected grids */
2003 if (!map[16+yy-cy][16+xx-cx]) continue;
2005 c_ptr = &cave[yy][xx];
2007 /* Paranoia -- never affect player */
2008 /* if (player_bold(yy, xx)) continue; */
2010 /* Destroy location (if valid) */
2011 if (cave_valid_bold(yy, xx))
2013 delete_object(yy, xx);
2015 /* Wall (or floor) type */
2016 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2021 /* Create granite wall */
2022 cave_set_feat(yy, xx, feat_granite);
2028 /* Create quartz vein */
2029 cave_set_feat(yy, xx, feat_quartz_vein);
2035 /* Create magma vein */
2036 cave_set_feat(yy, xx, feat_magma_vein);
2043 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2049 /* Process "re-glowing" */
2050 for (dy = -r; dy <= r; dy++)
2052 for (dx = -r; dx <= r; dx++)
2054 /* Extract the location */
2058 /* Skip illegal grids */
2059 if (!in_bounds(yy, xx)) continue;
2061 /* Skip distant grids */
2062 if (distance(cy, cx, yy, xx) > r) continue;
2063 c_ptr = &cave[yy][xx];
2065 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2066 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2072 for (ii = 0; ii < 9; ii++)
2074 yyy = yy + ddy_ddd[ii];
2075 xxx = xx + ddx_ddd[ii];
2076 if (!in_bounds2(yyy, xxx)) continue;
2077 cc_ptr = &cave[yyy][xxx];
2078 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2080 c_ptr->info |= CAVE_GLOW;
2088 /* Mega-Hack -- Forget the view and lite */
2089 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2090 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2091 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2093 if (p_ptr->special_defense & NINJA_S_STEALTH)
2095 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2103 * @brief 地震処理(プレイヤーの中心発動) /
2104 * Induce an "earthquake" of the given radius at the given location.
2105 * @return 効力があった場合TRUEを返す
2110 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2112 return earthquake_aux(cy, cx, r, 0);
2119 void discharge_minion(void)
2124 for (i = 1; i < m_max; i++)
2126 monster_type *m_ptr = &m_list[i];
2127 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2128 if (m_ptr->nickname) okay = FALSE;
2130 if (!okay || p_ptr->riding)
2132 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2135 for (i = 1; i < m_max; i++)
2138 monster_type *m_ptr = &m_list[i];
2139 monster_race *r_ptr;
2141 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2142 r_ptr = &r_info[m_ptr->r_idx];
2144 /* Uniques resist discharging */
2145 if (r_ptr->flags1 & RF1_UNIQUE)
2147 GAME_TEXT m_name[MAX_NLEN];
2148 monster_desc(m_name, m_ptr, 0x00);
2149 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2150 delete_monster_idx(i);
2153 dam = m_ptr->maxhp / 2;
2154 if (dam > 100) dam = (dam - 100) / 2 + 100;
2155 if (dam > 400) dam = (dam - 400) / 2 + 400;
2156 if (dam > 800) dam = 800;
2157 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2158 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2160 if (record_named_pet && m_ptr->nickname)
2162 GAME_TEXT m_name[MAX_NLEN];
2164 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2165 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2168 delete_monster_idx(i);
2174 * @brief 部屋全体を照らすサブルーチン
2178 * This routine clears the entire "temp" set.
2179 * This routine will Perma-Lite all "temp" grids.
2180 * This routine is used (only) by "lite_room()"
2181 * Dark grids are illuminated.
2182 * Also, process all affected monsters.
2184 * SMART monsters always wake up when illuminated
2185 * NORMAL monsters wake up 1/4 the time when illuminated
2186 * STUPID monsters wake up 1/10 the time when illuminated
2189 static void cave_temp_room_lite(void)
2193 /* Clear them all */
2194 for (i = 0; i < temp_n; i++)
2196 POSITION y = temp_y[i];
2197 POSITION x = temp_x[i];
2199 cave_type *c_ptr = &cave[y][x];
2201 /* No longer in the array */
2202 c_ptr->info &= ~(CAVE_TEMP);
2204 /* Update only non-CAVE_GLOW grids */
2205 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2208 c_ptr->info |= (CAVE_GLOW);
2210 /* Process affected monsters */
2214 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2215 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2216 update_monster(c_ptr->m_idx, FALSE);
2218 /* Stupid monsters rarely wake up */
2219 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2221 /* Smart monsters always wake up */
2222 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2224 /* Sometimes monsters wake up */
2225 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2228 (void)set_monster_csleep(c_ptr->m_idx, 0);
2230 /* Notice the "waking up" */
2233 GAME_TEXT m_name[MAX_NLEN];
2234 monster_desc(m_name, m_ptr, 0);
2235 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2242 update_local_illumination(y, x);
2252 * @brief 部屋全体を暗くするサブルーチン
2256 * This routine clears the entire "temp" set.
2257 * This routine will "darken" all "temp" grids.
2258 * In addition, some of these grids will be "unmarked".
2259 * This routine is used (only) by "unlite_room()"
2260 * Also, process all affected monsters
2263 static void cave_temp_room_unlite(void)
2267 /* Clear them all */
2268 for (i = 0; i < temp_n; i++)
2270 POSITION y = temp_y[i];
2271 POSITION x = temp_x[i];
2274 cave_type *c_ptr = &cave[y][x];
2275 bool do_dark = !is_mirror_grid(c_ptr);
2277 /* No longer in the array */
2278 c_ptr->info &= ~(CAVE_TEMP);
2280 /* Darken the grid */
2283 if (dun_level || !is_daytime())
2285 for (j = 0; j < 9; j++)
2287 POSITION by = y + ddy_ddd[j];
2288 POSITION bx = x + ddx_ddd[j];
2290 if (in_bounds2(by, bx))
2292 cave_type *cc_ptr = &cave[by][bx];
2294 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2302 if (!do_dark) continue;
2305 c_ptr->info &= ~(CAVE_GLOW);
2307 /* Hack -- Forget "boring" grids */
2308 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2310 /* Forget the grid */
2311 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2315 /* Process affected monsters */
2318 update_monster(c_ptr->m_idx, FALSE);
2322 update_local_illumination(y, x);
2332 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2335 * @param pass_bold 地形条件を返す関数ポインタ
2338 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2345 for (i = 0; i < 16; i++)
2347 y = cy + ddy_cdd[i % 8];
2348 x = cx + ddx_cdd[i % 8];
2350 /* Found a wall, break the length */
2351 if (!pass_bold(y, x))
2353 /* Track best length */
2367 return (MAX(len, blen));
2371 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2374 * @param pass_bold 地形条件を返す関数ポインタ
2377 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2383 for (i = 0; i < 8; i++)
2385 y = cy + ddy_ddd[i];
2386 x = cx + ddx_ddd[i];
2388 if (!pass_bold(y, x)) c++;
2396 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2397 * @param y 部屋内のy座標1点
2398 * @param x 部屋内のx座標1点
2399 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2400 * @param pass_bold 地形条件を返す関数ポインタ
2403 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2408 c_ptr = &cave[y][x];
2410 /* Avoid infinite recursion */
2411 if (c_ptr->info & (CAVE_TEMP)) return;
2413 /* Do not "leave" the current room */
2414 if (!(c_ptr->info & (CAVE_ROOM)))
2416 if (only_room) return;
2419 if (!in_bounds2(y, x)) return;
2421 /* Do not exceed the maximum spell range */
2422 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2424 /* Verify this grid */
2426 * The reason why it is ==6 instead of >5 is that 8 is impossible
2427 * due to the check for cave_bold above.
2428 * 7 lights dead-end corridors (you need to do this for the
2429 * checkboard interesting rooms, so that the boundary is lit
2431 * This leaves only a check for 6 bounding walls!
2433 if (in_bounds(y, x) && pass_bold(y, x) &&
2434 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2437 /* Paranoia -- verify space */
2438 if (temp_n == TEMP_MAX) return;
2440 /* Mark the grid as "seen" */
2441 c_ptr->info |= (CAVE_TEMP);
2443 /* Add it to the "seen" set */
2450 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2453 * @return 光を通すならばtrueを返す。
2455 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2457 return cave_los_bold(y, x);
2461 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2466 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2468 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2472 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2475 * @return 射線を通すならばtrueを返す。
2477 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2479 return cave_have_flag_bold(y, x, FF_PROJECT);
2484 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2489 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2491 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2496 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2501 void lite_room(POSITION y1, POSITION x1)
2506 /* Add the initial grid */
2507 cave_temp_lite_room_aux(y1, x1);
2509 /* While grids are in the queue, add their neighbors */
2510 for (i = 0; i < temp_n; i++)
2512 x = temp_x[i], y = temp_y[i];
2514 /* Walls get lit, but stop light */
2515 if (!cave_pass_lite_bold(y, x)) continue;
2517 /* Spread adjacent */
2518 cave_temp_lite_room_aux(y + 1, x);
2519 cave_temp_lite_room_aux(y - 1, x);
2520 cave_temp_lite_room_aux(y, x + 1);
2521 cave_temp_lite_room_aux(y, x - 1);
2523 /* Spread diagonal */
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);
2527 cave_temp_lite_room_aux(y + 1, x - 1);
2530 /* Now, lite them all up at once */
2531 cave_temp_room_lite();
2533 if (p_ptr->special_defense & NINJA_S_STEALTH)
2535 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2541 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2546 void unlite_room(POSITION y1, POSITION x1)
2551 /* Add the initial grid */
2552 cave_temp_unlite_room_aux(y1, x1);
2554 /* Spread, breadth first */
2555 for (i = 0; i < temp_n; i++)
2557 x = temp_x[i], y = temp_y[i];
2559 /* Walls get dark, but stop darkness */
2560 if (!cave_pass_dark_bold(y, x)) continue;
2562 /* Spread adjacent */
2563 cave_temp_unlite_room_aux(y + 1, x);
2564 cave_temp_unlite_room_aux(y - 1, x);
2565 cave_temp_unlite_room_aux(y, x + 1);
2566 cave_temp_unlite_room_aux(y, x - 1);
2568 /* Spread diagonal */
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);
2572 cave_temp_unlite_room_aux(y + 1, x - 1);
2575 /* Now, darken them all at once */
2576 cave_temp_room_unlite();
2579 bool starlight(bool magic)
2581 HIT_POINT num = damroll(5, 3);
2582 POSITION y = 0, x = 0;
2586 if (!p_ptr->blind && !magic)
2588 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2590 for (k = 0; k < num; k++)
2596 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2597 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2598 if (!player_bold(y, x)) break;
2601 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2602 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2610 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2613 * @return 作用が実際にあった場合TRUEを返す
2615 bool lite_area(HIT_POINT dam, POSITION rad)
2617 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2619 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2621 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2627 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2630 /* Hook into the "project()" function */
2631 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2633 lite_room(p_ptr->y, p_ptr->x);
2641 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2644 * @return 作用が実際にあった場合TRUEを返す
2646 bool unlite_area(HIT_POINT dam, POSITION rad)
2648 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2650 /* Hack -- Message */
2653 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2656 /* Hook into the "project()" function */
2657 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2659 unlite_room(p_ptr->y, p_ptr->x);
2668 * @brief ボール系スペルの発動 / Cast a ball spell
2670 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2673 * @return 作用が実際にあった場合TRUEを返す
2676 * Stop if we hit a monster, act as a "ball"
2677 * Allow "target" mode to pass over monsters
2678 * Affect grids, objects, and monsters
2681 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2685 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2687 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2688 /* Use the given direction */
2689 tx = p_ptr->x + 99 * ddx[dir];
2690 ty = p_ptr->y + 99 * ddy[dir];
2692 /* Hack -- Use an actual "target" */
2693 if ((dir == 5) && target_okay())
2695 flg &= ~(PROJECT_STOP);
2700 /* Analyze the "dir" and the "target". Hurt items on floor. */
2701 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2705 * @brief ブレス系スペルの発動 / Cast a breath spell
2707 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2710 * @return 作用が実際にあった場合TRUEを返す
2713 * Stop if we hit a monster, act as a "ball"
2714 * Allow "target" mode to pass over monsters
2715 * Affect grids, objects, and monsters
2718 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2720 return fire_ball(typ, dir, dam, -rad);
2725 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2727 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2730 * @return 作用が実際にあった場合TRUEを返す
2733 * Stop if we hit a monster, act as a "ball"
2734 * Allow "target" mode to pass over monsters
2735 * Affect grids, objects, and monsters
2738 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2741 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2743 /* Use the given direction */
2744 tx = p_ptr->x + 99 * ddx[dir];
2745 ty = p_ptr->y + 99 * ddy[dir];
2747 /* Hack -- Use an actual "target" */
2748 if ((dir == 5) && target_okay())
2754 /* Analyze the "dir" and the "target". Hurt items on floor. */
2755 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2760 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2762 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2765 * @return 作用が実際にあった場合TRUEを返す
2768 * Stop if we hit a monster, act as a "ball"
2769 * Allow "target" mode to pass over monsters
2770 * Affect grids, objects, and monsters
2773 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2776 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2778 /* Use the given direction */
2779 tx = p_ptr->x + 99 * ddx[dir];
2780 ty = p_ptr->y + 99 * ddy[dir];
2782 /* Hack -- Use an actual "target" */
2783 if ((dir == 5) && target_okay())
2785 flg &= ~(PROJECT_STOP);
2790 /* Analyze the "dir" and the "target". Hurt items on floor. */
2791 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2796 * @brief メテオ系スペルの発動 / Cast a meteor spell
2797 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2803 * @return 作用が実際にあった場合TRUEを返す
2806 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2807 * player, or outside source, that starts out at an arbitrary location, and
2808 * leaving no trail from the "caster" to the target. This function is
2809 * especially useful for bombardments and similar. -LM-
2810 * Option to hurt the player.
2813 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2815 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2817 /* Analyze the "target" and the caster. */
2818 return (project(who, rad, y, x, dam, typ, flg, -1));
2823 * @brief ブラスト系スペルの発動 / Cast a blast spell
2825 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2830 * @return 作用が実際にあった場合TRUEを返す
2832 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2836 POSITION ty, tx, y, x;
2839 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2844 /* Use the given direction */
2847 ly = ty = p_ptr->y + 20 * ddy[dir];
2848 lx = tx = p_ptr->x + 20 * ddx[dir];
2851 /* Use an actual "target" */
2852 else /* if (dir == 5) */
2857 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2858 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2861 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2864 for (i = 0; i < num; i++)
2868 /* Get targets for some bolts */
2869 y = rand_spread(ly, ld * dev / 20);
2870 x = rand_spread(lx, ld * dev / 20);
2872 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2875 /* Analyze the "dir" and the "target". */
2876 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2887 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2888 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2889 * @return 作用が実際にあった場合TRUEを返す
2891 bool teleport_swap(DIRECTION dir)
2895 monster_type* m_ptr;
2896 monster_race* r_ptr;
2898 if ((dir == 5) && target_okay())
2905 tx = p_ptr->x + ddx[dir];
2906 ty = p_ptr->y + ddy[dir];
2908 c_ptr = &cave[ty][tx];
2910 if (p_ptr->anti_tele)
2912 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2916 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2918 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2922 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2924 msg_print(_("失敗した。", "Failed to swap."));
2928 m_ptr = &m_list[c_ptr->m_idx];
2929 r_ptr = &r_info[m_ptr->r_idx];
2931 (void)set_monster_csleep(c_ptr->m_idx, 0);
2933 if (r_ptr->flagsr & RFR_RES_TELE)
2935 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2936 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2940 sound(SOUND_TELEPORT);
2942 /* Swap the player and monster */
2943 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2951 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2953 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2956 * @return 作用が実際にあった場合TRUEを返す
2958 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2962 /* Pass through the target if needed */
2963 flg |= (PROJECT_THRU);
2965 /* Use the given direction */
2966 tx = p_ptr->x + ddx[dir];
2967 ty = p_ptr->y + ddy[dir];
2969 /* Hack -- Use an actual "target" */
2970 if ((dir == 5) && target_okay())
2976 /* Analyze the "dir" and the "target", do NOT explode */
2977 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2982 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2984 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2986 * @return 作用が実際にあった場合TRUEを返す
2989 * Stop if we hit a monster, as a "bolt".
2990 * Affect monsters and grids (not objects).
2993 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2995 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2996 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2997 return (project_hook(typ, dir, dam, flg));
3002 * @brief ビーム系スペルの発動 / Cast a beam spell.
3004 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3006 * @return 作用が実際にあった場合TRUEを返す
3009 * Pass through monsters, as a "beam".
3010 * Affect monsters, grids and objects.
3013 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3015 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3016 return (project_hook(typ, dir, dam, flg));
3021 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3022 * @param prob ビーム化する確率(%)
3024 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3026 * @return 作用が実際にあった場合TRUEを返す
3029 * Pass through monsters, as a "beam".
3030 * Affect monsters, grids and objects.
3033 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3035 if (randint0(100) < prob)
3037 return (fire_beam(typ, dir, dam));
3041 return (fire_bolt(typ, dir, dam));
3046 * @brief LITE_WEAK属性による光源ビーム処理
3047 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3049 * @return 作用が実際にあった場合TRUEを返す
3051 bool lite_line(DIRECTION dir, HIT_POINT dam)
3053 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3054 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3059 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3061 * @return 作用が実際にあった場合TRUEを返す
3063 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3065 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3066 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3071 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3073 * @return 作用が実際にあった場合TRUEを返す
3075 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3077 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3078 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3083 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3084 * @return 作用が実際にあった場合TRUEを返す
3086 bool wizard_lock(DIRECTION dir)
3088 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3089 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3094 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3095 * @return 作用が実際にあった場合TRUEを返す
3097 bool destroy_door(DIRECTION dir)
3099 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3100 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3105 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3106 * @return 作用が実際にあった場合TRUEを返す
3108 bool disarm_trap(DIRECTION dir)
3110 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3111 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3117 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3118 * @param plev プレイヤーレベル(効力はplev*200)
3119 * @return 作用が実際にあった場合TRUEを返す
3121 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3123 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3124 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3128 * @brief モンスター用テレポート処理
3129 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3130 * @param distance 移動距離
3131 * @return 作用が実際にあった場合TRUEを返す
3133 bool teleport_monster(DIRECTION dir, int distance)
3135 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3136 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3140 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3141 * @return 作用が実際にあった場合TRUEを返す
3143 bool door_creation(void)
3145 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3146 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3150 * @brief トラップ生成処理(起点から周囲1マス)
3153 * @return 作用が実際にあった場合TRUEを返す
3155 bool trap_creation(POSITION y, POSITION x)
3157 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3158 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3162 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3163 * @return 作用が実際にあった場合TRUEを返す
3165 bool tree_creation(void)
3167 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3168 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3172 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3173 * @return 作用が実際にあった場合TRUEを返す
3175 bool glyph_creation(void)
3177 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3178 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3182 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3183 * @return 作用が実際にあった場合TRUEを返す
3185 bool wall_stone(void)
3187 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3188 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3189 p_ptr->update |= (PU_FLOW);
3190 p_ptr->redraw |= (PR_MAP);
3195 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3196 * @return 作用が実際にあった場合TRUEを返す
3198 bool destroy_doors_touch(void)
3200 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3201 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3205 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3206 * @return 作用が実際にあった場合TRUEを返す
3208 bool disarm_traps_touch(void)
3210 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3211 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3215 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3216 * @return 作用が実際にあった場合TRUEを返す
3218 bool sleep_monsters_touch(void)
3220 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3221 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3226 * @brief 死者復活処理(起点より周囲5マス)
3227 * @param who 術者モンスターID(0ならばプレイヤー)
3230 * @return 作用が実際にあった場合TRUEを返す
3232 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3234 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3235 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3240 * @return 作用が実際にあった場合TRUEを返す
3242 void call_chaos(void)
3244 int Chaos_type, dummy, dir;
3245 PLAYER_LEVEL plev = p_ptr->lev;
3246 bool line_chaos = FALSE;
3248 int hurt_types[31] =
3250 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3251 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3252 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3253 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3254 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3255 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3256 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3257 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3260 Chaos_type = hurt_types[randint0(31)];
3261 if (one_in_(4)) line_chaos = TRUE;
3265 for (dummy = 1; dummy < 10; dummy++)
3270 fire_beam(Chaos_type, dummy, 150);
3272 fire_ball(Chaos_type, dummy, 150, 2);
3276 else if (one_in_(3))
3278 fire_ball(Chaos_type, 0, 500, 8);
3282 if (!get_aim_dir(&dir)) return;
3284 fire_beam(Chaos_type, dir, 250);
3286 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3291 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3292 * @param stop_ty 再帰処理停止フラグ
3294 * @return 作用が実際にあった場合TRUEを返す
3297 * rr9: Stop the nasty things when a Cyberdemon is summoned
3298 * or the player gets paralyzed.
3301 bool activate_ty_curse(bool stop_ty, int *count)
3304 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3308 switch (randint1(34))
3313 msg_print(_("地面が揺れた...", "The ground trembles..."));
3314 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3315 if (!one_in_(6)) break;
3320 HIT_POINT dam = damroll(10, 10);
3321 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3322 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3323 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3324 if (!one_in_(6)) break;
3329 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3330 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3331 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3332 if (!one_in_(6)) break;
3335 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3339 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3340 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3342 if (!one_in_(6)) break;
3343 case 1: case 2: case 3: case 16: case 17:
3344 aggravate_monsters(0);
3345 if (!one_in_(6)) break;
3346 case 4: case 5: case 6:
3347 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3348 if (!one_in_(6)) break;
3349 case 7: case 8: case 9: case 18:
3350 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
3351 if (!one_in_(6)) break;
3352 case 10: case 11: case 12:
3353 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3354 lose_exp(p_ptr->exp / 16);
3355 if (!one_in_(6)) break;
3356 case 13: case 14: case 15: case 19: case 20:
3357 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3363 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3364 if (p_ptr->free_act)
3365 set_paralyzed(p_ptr->paralyzed + randint1(3));
3367 set_paralyzed(p_ptr->paralyzed + randint1(13));
3370 if (!one_in_(6)) break;
3371 case 21: case 22: case 23:
3372 (void)do_dec_stat(randint0(6));
3373 if (!one_in_(6)) break;
3375 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3377 if (!one_in_(6)) break;
3380 * Only summon Cyberdemons deep in the dungeon.
3382 if ((dun_level > 65) && !stop_ty)
3384 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3388 if (!one_in_(6)) break;
3394 (void)do_dec_stat(i);
3402 while (one_in_(3) && !stop_ty);
3408 * @brief HI_SUMMON(上級召喚)処理発動
3411 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3412 * @return 作用が実際にあった場合TRUEを返す
3414 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3419 BIT_FLAGS mode = PM_ALLOW_GROUP;
3426 mode |= PM_FORCE_FRIENDLY;
3430 mode |= PM_FORCE_PET;
3435 if (!pet) mode |= PM_NO_PET;
3437 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3439 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3441 switch (randint1(25) + (dun_level / 20))
3444 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
3447 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
3450 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
3453 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
3456 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
3459 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
3462 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
3465 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
3469 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
3473 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
3476 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3477 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
3480 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3481 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
3484 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
3487 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3488 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
3496 * @brief 周辺破壊効果(プレイヤー中心)
3497 * @return 作用が実際にあった場合TRUEを返す
3499 void wall_breaker(void)
3502 POSITION y = 0, x = 0;
3503 int attempts = 1000;
3505 if (randint1(80 + p_ptr->lev) < 70)
3509 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3511 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3513 if (!player_bold(y, x)) break;
3516 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3517 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3519 else if (randint1(100) > 30)
3521 earthquake(p_ptr->y, p_ptr->x, 1);
3525 int num = damroll(5, 3);
3527 for (i = 0; i < num; i++)
3531 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3533 if (!player_bold(y, x)) break;
3536 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3537 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3544 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3546 * @return 作用が実際にあった場合TRUEを返す
3548 bool confuse_monsters(HIT_POINT dam)
3550 return (project_all_los(GF_OLD_CONF, dam));
3555 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3557 * @return 作用が実際にあった場合TRUEを返す
3559 bool charm_monsters(HIT_POINT dam)
3561 return (project_all_los(GF_CHARM, dam));
3566 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3568 * @return 作用が実際にあった場合TRUEを返す
3570 bool charm_animals(HIT_POINT dam)
3572 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3577 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3579 * @return 作用が実際にあった場合TRUEを返す
3581 bool stun_monsters(HIT_POINT dam)
3583 return (project_all_los(GF_STUN, dam));
3588 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3590 * @return 作用が実際にあった場合TRUEを返す
3592 bool stasis_monsters(HIT_POINT dam)
3594 return (project_all_los(GF_STASIS, dam));
3599 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3601 * @return 作用が実際にあった場合TRUEを返す
3603 bool mindblast_monsters(HIT_POINT dam)
3605 return (project_all_los(GF_PSI, dam));
3610 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3611 * @param dist 効力(距離)
3612 * @return 作用が実際にあった場合TRUEを返す
3614 bool banish_monsters(int dist)
3616 return (project_all_los(GF_AWAY_ALL, dist));
3621 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3623 * @return 作用が実際にあった場合TRUEを返す
3625 bool turn_evil(HIT_POINT dam)
3627 return (project_all_los(GF_TURN_EVIL, dam));
3632 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3634 * @return 作用が実際にあった場合TRUEを返す
3636 bool turn_monsters(HIT_POINT dam)
3638 return (project_all_los(GF_TURN_ALL, dam));
3643 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3644 * @return 作用が実際にあった場合TRUEを返す
3646 bool deathray_monsters(void)
3648 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3652 * @brief チャーム・モンスター(1体)
3653 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3655 * @return 作用が実際にあった場合TRUEを返す
3657 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3659 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3660 return (project_hook(GF_CHARM, dir, plev, flg));
3664 * @brief アンデッド支配(1体)
3665 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3667 * @return 作用が実際にあった場合TRUEを返す
3669 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3671 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3672 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3677 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3679 * @return 作用が実際にあった場合TRUEを返す
3681 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3683 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3684 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3689 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3691 * @return 作用が実際にあった場合TRUEを返す
3693 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3695 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3696 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3702 * @param success 判定成功上の処理ならばTRUE
3703 * @return 作用が実際にあった場合TRUEを返す
3705 bool kawarimi(bool success)
3708 object_type *q_ptr = &forge;
3711 if (p_ptr->is_dead) return FALSE;
3712 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3713 if (randint0(200) < p_ptr->stun) return FALSE;
3715 if (!success && one_in_(3))
3717 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3718 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3719 p_ptr->redraw |= (PR_STATUS);
3726 teleport_player(10 + randint1(90), 0L);
3728 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3730 q_ptr->pval = MON_NINJA;
3731 (void)drop_near(q_ptr, -1, y, x);
3733 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3734 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3736 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3737 p_ptr->redraw |= (PR_STATUS);
3745 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3746 * @param mdeath 目標モンスターが死亡したかを返す
3747 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3749 bool rush_attack(bool *mdeath)
3756 bool tmp_mdeath = FALSE;
3759 if (mdeath) *mdeath = FALSE;
3762 if (!get_aim_dir(&dir)) return FALSE;
3764 /* Use the given direction */
3765 tx = p_ptr->x + project_length * ddx[dir];
3766 ty = p_ptr->y + project_length * ddy[dir];
3768 /* Hack -- Use an actual "target" */
3769 if ((dir == 5) && target_okay())
3775 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3777 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3780 /* No need to move */
3781 if (!path_n) return TRUE;
3783 /* Use ty and tx as to-move point */
3787 /* Project along the path */
3788 for (i = 0; i < path_n; i++)
3790 monster_type *m_ptr;
3792 int ny = GRID_Y(path_g[i]);
3793 int nx = GRID_X(path_g[i]);
3795 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3800 /* Go to next grid */
3804 if (!cave[ny][nx].m_idx)
3808 msg_print(_("失敗!", "Failed!"));
3812 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3819 /* Move player before updating the monster */
3820 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3821 update_monster(cave[ny][nx].m_idx, TRUE);
3823 /* Found a monster */
3824 m_ptr = &m_list[cave[ny][nx].m_idx];
3826 if (tm_idx != cave[ny][nx].m_idx)
3829 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3831 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3834 else if (!player_bold(ty, tx))
3836 /* Hold the monster name */
3837 GAME_TEXT m_name[MAX_NLEN];
3839 /* Get the monster name (BEFORE polymorphing) */
3840 monster_desc(m_name, m_ptr, 0);
3841 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3844 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3846 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3851 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3853 if (mdeath) *mdeath = tmp_mdeath;
3859 * @brief 全鏡の消去 / Remove all mirrors in this floor
3860 * @param explode 爆発処理を伴うならばTRUE
3863 void remove_all_mirrors(bool explode)
3867 for (x = 0; x < cur_wid; x++)
3869 for (y = 0; y < cur_hgt; y++)
3871 if (is_mirror_grid(&cave[y][x]))
3873 remove_mirror(y, x);
3875 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3876 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3883 * @brief 『一つの指輪』の効果処理 /
3884 * Hack -- activate the ring of power
3885 * @param dir 発動の方向ID
3888 void ring_of_power(DIRECTION dir)
3890 /* Pick a random effect */
3891 switch (randint1(10))
3896 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3899 /* Decrease all stats (permanently) */
3900 (void)dec_stat(A_STR, 50, TRUE);
3901 (void)dec_stat(A_INT, 50, TRUE);
3902 (void)dec_stat(A_WIS, 50, TRUE);
3903 (void)dec_stat(A_DEX, 50, TRUE);
3904 (void)dec_stat(A_CON, 50, TRUE);
3905 (void)dec_stat(A_CHR, 50, TRUE);
3907 /* Lose some experience (permanently) */
3908 p_ptr->exp -= (p_ptr->exp / 4);
3909 p_ptr->max_exp -= (p_ptr->exp / 4);
3917 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3918 dispel_monsters(1000);
3926 fire_ball(GF_MANA, dir, 600, 3);
3935 fire_bolt(GF_MANA, dir, 500);
3942 * @brief 運命の輪、並びにカオス的な効果の発動
3943 * @param spell ランダムな効果を選択するための基準ID
3946 void wild_magic(int spell)
3949 int type = SUMMON_MOLD + randint0(6);
3951 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3952 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3954 switch (randint1(spell) + randint1(8) + 1)
3959 teleport_player(10, TELEPORT_PASSIVE);
3964 teleport_player(100, TELEPORT_PASSIVE);
3968 teleport_player(200, TELEPORT_PASSIVE);
3978 lite_area(damroll(2, 3), 2);
3981 destroy_doors_touch();
3986 sleep_monsters_touch();
3990 trap_creation(p_ptr->y, p_ptr->x);
3999 aggravate_monsters(0);
4002 earthquake(p_ptr->y, p_ptr->x, 5);
4006 (void)gain_random_mutation(0);
4010 apply_disenchant(1);
4016 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4023 while (counter++ < 8)
4025 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
4030 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4033 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4038 (void)activate_ty_curse(FALSE, &count);
4047 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4048 * / Drop 10+1d10 meteor ball at random places near the player
4053 void cast_meteor(HIT_POINT dam, POSITION rad)
4056 int b = 10 + randint1(10);
4058 for (i = 0; i < b; i++)
4060 POSITION y = 0, x = 0;
4063 for (count = 0; count <= 20; count++)
4067 x = p_ptr->x - 8 + randint0(17);
4068 y = p_ptr->y - 8 + randint0(17);
4070 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4071 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4073 /* Approximate distance */
4074 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4076 if (d >= 9) continue;
4078 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4079 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4081 /* Valid position */
4085 if (count > 20) continue;
4087 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4093 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4096 * @return ターゲットを指定し、実行したならばTRUEを返す。
4098 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4100 POSITION x, y, tx, ty;
4104 int b = 10 + randint1(10);
4106 if (!get_aim_dir(&dir)) return FALSE;
4108 /* Use the given direction */
4109 tx = p_ptr->x + 99 * ddx[dir];
4110 ty = p_ptr->y + 99 * ddy[dir];
4112 /* Hack -- Use an actual "target" */
4113 if ((dir == 5) && target_okay())
4124 /* Hack -- Stop at the target */
4125 if ((y == ty) && (x == tx)) break;
4129 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4131 /* Stop at maximum range */
4132 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4134 /* Stopped by walls/doors */
4135 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4137 /* Stopped by monsters */
4138 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4140 /* Save the new location */
4147 for (i = 0; i < b; i++)
4149 int count = 20, d = 0;
4155 x = tx - 5 + randint0(11);
4156 y = ty - 5 + randint0(11);
4158 dx = (tx > x) ? (tx - x) : (x - tx);
4159 dy = (ty > y) ? (ty - y) : (y - ty);
4161 /* Approximate distance */
4162 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4163 /* Within the radius */
4167 if (count < 0) continue;
4169 /* Cannot penetrate perm walls */
4170 if (!in_bounds(y, x) ||
4171 cave_stop_disintegration(y, x) ||
4172 !in_disintegration_range(ty, tx, y, x))
4175 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4182 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4186 * This spell should become more useful (more controlled) as the\n
4187 * player gains experience levels. Thus, add 1/5 of the player's\n
4188 * level to the die roll. This eliminates the worst effects later on,\n
4189 * while keeping the results quite random. It also allows some potent\n
4190 * effects only at high level.
4192 void cast_wonder(DIRECTION dir)
4194 PLAYER_LEVEL plev = p_ptr->lev;
4195 int die = randint1(100) + plev / 5;
4196 int vir = virtue_number(V_CHANCE);
4200 if (p_ptr->virtues[vir - 1] > 0)
4202 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4206 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4211 chg_virtue(V_CHANCE, 1);
4215 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4218 if (die < 8) clone_monster(dir);
4219 else if (die < 14) speed_monster(dir, plev);
4220 else if (die < 26) heal_monster(dir, damroll(4, 6));
4221 else if (die < 31) poly_monster(dir, plev);
4223 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4224 damroll(3 + ((plev - 1) / 5), 4));
4225 else if (die < 41) confuse_monster(dir, plev);
4226 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4227 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4229 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4230 damroll(3 + ((plev - 5) / 4), 8));
4232 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4233 damroll(5 + ((plev - 5) / 4), 8));
4235 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4236 damroll(6 + ((plev - 5) / 4), 8));
4238 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4239 damroll(8 + ((plev - 5) / 4), 8));
4240 else if (die < 76) hypodynamic_bolt(dir, 75);
4241 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4242 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4243 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4244 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4245 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4248 earthquake(p_ptr->y, p_ptr->x, 12);
4252 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4256 symbol_genocide(plev + 50, TRUE);
4258 else if (die < 110) dispel_monsters(120);
4261 dispel_monsters(150);
4262 slow_monsters(plev);
4263 sleep_monsters(plev);
4270 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4274 void cast_invoke_spirits(DIRECTION dir)
4276 PLAYER_LEVEL plev = p_ptr->lev;
4277 int die = randint1(100) + plev / 5;
4278 int vir = virtue_number(V_CHANCE);
4282 if (p_ptr->virtues[vir - 1] > 0)
4284 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4288 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4292 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4294 chg_virtue(V_CHANCE, 1);
4298 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4303 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4304 "Oh no! Mouldering forms rise from the earth around you!"));
4306 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
4307 chg_virtue(V_UNLIFE, 1);
4311 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4313 set_afraid(p_ptr->afraid + randint1(4) + 4);
4317 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4318 "Your head is invaded by a horde of gibbering spectral voices..."));
4320 set_confused(p_ptr->confused + randint1(4) + 4);
4324 poly_monster(dir, plev);
4328 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4329 damroll(3 + ((plev - 1) / 5), 4));
4333 confuse_monster(dir, plev);
4337 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4341 (void)lite_line(dir, damroll(6, 8));
4345 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4346 damroll(3 + ((plev - 5) / 4), 8));
4350 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4351 damroll(5 + ((plev - 5) / 4), 8));
4355 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4356 damroll(6 + ((plev - 5) / 4), 8));
4360 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4361 damroll(8 + ((plev - 5) / 4), 8));
4365 hypodynamic_bolt(dir, 75);
4369 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4373 fire_ball(GF_ACID, dir, 40 + plev, 2);
4377 fire_ball(GF_ICE, dir, 70 + plev, 3);
4381 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4385 hypodynamic_bolt(dir, 100 + plev);
4389 earthquake(p_ptr->y, p_ptr->x, 12);
4393 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4397 symbol_genocide(plev + 50, TRUE);
4401 dispel_monsters(120);
4405 dispel_monsters(150);
4406 slow_monsters(plev);
4407 sleep_monsters(plev);
4413 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4414 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4419 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4422 void cast_shuffle(void)
4424 PLAYER_LEVEL plev = p_ptr->lev;
4427 int vir = virtue_number(V_CHANCE);
4430 /* Card sharks and high mages get a level bonus */
4431 if ((p_ptr->pclass == CLASS_ROGUE) ||
4432 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4433 (p_ptr->pclass == CLASS_SORCERER))
4434 die = (randint1(110)) + plev / 5;
4436 die = randint1(120);
4441 if (p_ptr->virtues[vir - 1] > 0)
4443 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4447 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4451 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4454 chg_virtue(V_CHANCE, 1);
4458 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4460 for (i = 0; i < randint1(3); i++)
4461 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4465 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4466 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
4471 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4472 activate_ty_curse(FALSE, &count);
4476 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4477 aggravate_monsters(0);
4481 msg_print(_("《愚者》だ。", "It's the Fool."));
4487 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4488 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4492 msg_print(_("《月》だ。", "It's the Moon."));
4497 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4498 wild_magic(randint0(32));
4502 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4503 teleport_player(10, TELEPORT_PASSIVE);
4507 msg_print(_("《正義》だ。", "It's Justice."));
4508 set_blessed(p_ptr->lev, FALSE);
4512 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4513 teleport_player(100, TELEPORT_PASSIVE);
4517 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4518 teleport_player(200, TELEPORT_PASSIVE);
4522 msg_print(_("《塔》だ。", "It's the Tower."));
4527 msg_print(_("《節制》だ。", "It's Temperance."));
4528 sleep_monsters_touch();
4532 msg_print(_("《塔》だ。", "It's the Tower."));
4534 earthquake(p_ptr->y, p_ptr->x, 5);
4538 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4539 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4543 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4544 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4548 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4549 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4553 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4554 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4558 msg_print(_("《恋人》だ。", "It's the Lovers."));
4560 if (get_aim_dir(&dir))
4561 charm_monster(dir, MIN(p_ptr->lev, 20));
4565 msg_print(_("《隠者》だ。", "It's the Hermit."));
4570 msg_print(_("《審判》だ。", "It's the Judgement."));
4572 lose_all_mutations();
4576 msg_print(_("《太陽》だ。", "It's the Sun."));
4577 chg_virtue(V_KNOWLEDGE, 1);
4578 chg_virtue(V_ENLIGHTEN, 1);
4583 msg_print(_("《世界》だ。", "It's the World."));
4584 if (p_ptr->exp < PY_MAX_EXP)
4586 s32b ee = (p_ptr->exp / 25) + 1;
4587 if (ee > 5000) ee = 5000;
4588 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4595 * @brief 口を使う継続的な処理を中断する
4598 void stop_mouth(void)
4600 if (music_singing_any()) stop_singing();
4601 if (hex_spelling_any()) stop_hex_spell_all();
4605 bool_hack vampirism(void)
4612 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4614 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4618 /* Only works on adjacent monsters */
4619 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4620 y = p_ptr->y + ddy[dir];
4621 x = p_ptr->x + ddx[dir];
4622 c_ptr = &cave[y][x];
4626 if (!(c_ptr->m_idx))
4628 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4632 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4634 dummy = p_ptr->lev * 2;
4636 if (hypodynamic_bolt(dir, dummy))
4638 if (p_ptr->food < PY_FOOD_FULL)
4639 /* No heal if we are "full" */
4640 (void)hp_player(dummy);
4642 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4644 /* Gain nutritional sustenance: 150/hp drained */
4645 /* A Food ration gives 5000 food points (by contrast) */
4646 /* Don't ever get more than "Full" this way */
4647 /* But if we ARE Gorged, it won't cure us */
4648 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4649 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4650 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4653 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4657 bool panic_hit(void)
4662 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4663 y = p_ptr->y + ddy[dir];
4664 x = p_ptr->x + ddx[dir];
4665 if (cave[y][x].m_idx)
4668 if (randint0(p_ptr->skill_dis) < 7)
4669 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4671 teleport_player(30, 0L);
4676 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4684 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4687 * currently this function allows pseudo-id of any object,
4688 * including silly ones like potions & scrolls, which always
4689 * get '{average}'. This should be changed, either to stop such
4690 * items from being pseudo-id'd, or to allow psychometry to
4691 * detect whether the unidentified potion/scroll/etc is
4692 * good (Cure Light Wounds, Restore Strength, etc) or
4693 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4695 bool psychometry(void)
4699 GAME_TEXT o_name[MAX_NLEN];
4704 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4705 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4707 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4708 if (!o_ptr) return (FALSE);
4710 /* It is fully known, no information needed */
4711 if (object_is_known(o_ptr))
4713 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4717 /* Check for a feeling */
4718 feel = value_check_aux1(o_ptr);
4720 /* Get an object description */
4721 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4723 /* Skip non-feelings */
4726 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4731 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4733 msg_format("You feel that the %s %s %s...",
4734 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4738 o_ptr->ident |= (IDENT_SENSE);
4739 o_ptr->feeling = feel;
4740 o_ptr->marked |= OM_TOUCHED;
4742 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4743 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4745 /* Valid "tval" codes */
4746 switch (o_ptr->tval)
4774 /* Auto-inscription/destroy */
4775 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4777 /* Something happened */
4782 bool draconian_breath(player_type *creature_ptr)
4785 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4786 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4788 if (!get_aim_dir(&dir)) return FALSE;
4790 if (randint1(100) < creature_ptr->lev)
4792 switch (creature_ptr->pclass)
4795 case CLASS_BERSERKER:
4798 case CLASS_IMITATOR:
4804 Type_desc = _("エレメント", "the elements");
4809 Type_desc = _("破片", "shards");
4813 case CLASS_WARRIOR_MAGE:
4814 case CLASS_HIGH_MAGE:
4815 case CLASS_SORCERER:
4816 case CLASS_MAGIC_EATER:
4817 case CLASS_RED_MAGE:
4818 case CLASS_BLUE_MAGE:
4819 case CLASS_MIRROR_MASTER:
4823 Type_desc = _("魔力", "mana");
4827 Type = GF_DISENCHANT;
4828 Type_desc = _("劣化", "disenchantment");
4831 case CLASS_CHAOS_WARRIOR:
4834 Type = GF_CONFUSION;
4835 Type_desc = _("混乱", "confusion");
4840 Type_desc = _("カオス", "chaos");
4845 case CLASS_FORCETRAINER:
4848 Type = GF_CONFUSION;
4849 Type_desc = _("混乱", "confusion");
4854 Type_desc = _("轟音", "sound");
4857 case CLASS_MINDCRAFTER:
4860 Type = GF_CONFUSION;
4861 Type_desc = _("混乱", "confusion");
4866 Type_desc = _("精神エネルギー", "mental energy");
4873 Type = GF_HELL_FIRE;
4874 Type_desc = _("地獄の劫火", "hellfire");
4878 Type = GF_HOLY_FIRE;
4879 Type_desc = _("聖なる炎", "holy fire");
4887 Type_desc = _("暗黒", "darkness");
4892 Type_desc = _("毒", "poison");
4899 Type_desc = _("轟音", "sound");
4903 Type = GF_CONFUSION;
4904 Type_desc = _("混乱", "confusion");
4911 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4913 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4917 bool android_inside_weapon(player_type *creature_ptr)
4920 if (!get_aim_dir(&dir)) return FALSE;
4921 if (creature_ptr->lev < 10)
4923 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4924 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4926 else if (creature_ptr->lev < 25)
4928 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4929 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4931 else if (creature_ptr->lev < 35)
4933 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4934 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4936 else if (creature_ptr->lev < 45)
4938 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4939 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4943 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4944 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4949 bool create_ration(player_type *crature_ptr)
4955 /* Create the food ration */
4956 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4958 /* Drop the object from heaven */
4959 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4960 msg_print(_("食事を料理して作った。", "You cook some food."));
4964 void hayagake(player_type *creature_ptr)
4966 if (creature_ptr->action == ACTION_HAYAGAKE)
4968 set_action(ACTION_NONE);
4972 cave_type *c_ptr = &cave[creature_ptr->y][creature_ptr->x];
4973 feature_type *f_ptr = &f_info[c_ptr->feat];
4975 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4976 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4978 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4982 set_action(ACTION_HAYAGAKE);
4985 creature_ptr->energy_use = 0;
4988 bool double_attack(player_type *creature_ptr)
4993 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4994 y = creature_ptr->y + ddy[dir];
4995 x = creature_ptr->x + ddx[dir];
4996 if (cave[y][x].m_idx)
4999 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
5000 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
5002 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
5003 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
5005 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
5006 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
5009 if (cave[y][x].m_idx)
5014 creature_ptr->energy_need += ENERGY_NEED();
5018 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5024 bool comvert_hp_to_mp(player_type *creature_ptr)
5026 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5029 creature_ptr->csp += gain_sp;
5030 if (creature_ptr->csp > creature_ptr->msp)
5032 creature_ptr->csp = creature_ptr->msp;
5033 creature_ptr->csp_frac = 0;
5038 msg_print(_("変換に失敗した。", "You failed to convert."));
5040 creature_ptr->redraw |= (PR_HP | PR_MANA);
5044 bool comvert_mp_to_hp(player_type *creature_ptr)
5046 if (creature_ptr->csp >= creature_ptr->lev / 5)
5048 creature_ptr->csp -= creature_ptr->lev / 5;
5049 hp_player(creature_ptr->lev);
5053 msg_print(_("変換に失敗した。", "You failed to convert."));
5055 creature_ptr->redraw |= (PR_HP | PR_MANA);
5059 bool demonic_breath(player_type *creature_ptr)
5062 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5063 if (!get_aim_dir(&dir)) return FALSE;
5065 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5066 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5070 bool mirror_concentration(player_type *creature_ptr)
5074 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5077 if (is_mirror_grid(&cave[creature_ptr->y][creature_ptr->x]))
5079 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5081 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5082 if (creature_ptr->csp >= creature_ptr->msp)
5084 creature_ptr->csp = creature_ptr->msp;
5085 creature_ptr->csp_frac = 0;
5087 creature_ptr->redraw |= (PR_MANA);
5091 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5096 bool sword_dancing(player_type *creature_ptr)
5099 POSITION y = 0, x = 0;
5103 for (i = 0; i < 6; i++)
5106 y = creature_ptr->y + ddy_ddd[dir];
5107 x = creature_ptr->x + ddx_ddd[dir];
5108 c_ptr = &cave[y][x];
5110 /* Hack -- attack monsters */
5115 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5121 bool confusing_light(player_type *creature_ptr)
5123 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5124 slow_monsters(creature_ptr->lev);
5125 stun_monsters(creature_ptr->lev * 4);
5126 confuse_monsters(creature_ptr->lev * 4);
5127 turn_monsters(creature_ptr->lev * 4);
5128 stasis_monsters(creature_ptr->lev * 4);
5132 bool rodeo(player_type *creature_ptr)
5134 GAME_TEXT m_name[MAX_NLEN];
5135 monster_type *m_ptr;
5136 monster_race *r_ptr;
5139 if (creature_ptr->riding)
5141 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5144 if (!do_riding(TRUE)) return TRUE;
5146 m_ptr = &m_list[creature_ptr->riding];
5147 r_ptr = &r_info[m_ptr->r_idx];
5148 monster_desc(m_name, m_ptr, 0);
5149 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5151 if (is_pet(m_ptr)) return TRUE;
5153 rlev = r_ptr->level;
5155 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5156 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5157 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5158 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5159 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5160 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5162 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5167 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5171 /* 落馬処理に失敗してもとにかく乗馬解除 */
5172 creature_ptr->riding = 0;
5177 bool clear_mind(player_type *creature_ptr)
5181 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5184 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5186 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5187 if (creature_ptr->csp >= creature_ptr->msp)
5189 creature_ptr->csp = creature_ptr->msp;
5190 creature_ptr->csp_frac = 0;
5192 creature_ptr->redraw |= (PR_MANA);
5196 bool concentration(player_type *creature_ptr)
5198 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5202 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5205 if (creature_ptr->special_defense & KATA_MASK)
5207 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5210 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5212 creature_ptr->csp += creature_ptr->msp / 2;
5213 if (creature_ptr->csp >= max_csp)
5215 creature_ptr->csp = max_csp;
5216 creature_ptr->csp_frac = 0;
5218 creature_ptr->redraw |= (PR_MANA);