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.
23 #include "monsterrace-hook.h"
27 #include "spells-summon.h"
32 #include "spells-status.h"
33 #include "spells-floor.h"
34 #include "realm-hex.h"
36 #include "object-flavor.h"
37 #include "object-hook.h"
38 #include "monster-status.h"
39 #include "player-move.h"
40 #include "player-status.h"
41 #include "player-effects.h"
42 #include "player-skill.h"
45 #include "floor-events.h"
47 #include "view-mainwindow.h"
48 #include "objectkind.h"
49 #include "monsterrace.h"
50 #include "targeting.h"
53 * @brief プレイヤー周辺の地形を感知する
56 * @param known 地形から危険フラグを外すならTRUE
57 * @return 効力があった場合TRUEを返す
59 static bool detect_feat_flag(POSITION range, int flag, bool known)
65 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
67 /* Scan the current panel */
68 for (y = 1; y < current_floor_ptr->height - 1; y++)
70 for (x = 1; x <= current_floor_ptr->width - 1; x++)
72 int dist = distance(p_ptr->y, p_ptr->x, y, x);
73 if (dist > range) continue;
74 g_ptr = ¤t_floor_ptr->grid_array[y][x];
79 /* Mark as detected */
80 if (dist <= range && known)
82 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
84 g_ptr->info &= ~(CAVE_UNSAFE);
91 if (cave_have_flag_grid(g_ptr, flag))
96 /* Hack -- Memorize */
97 g_ptr->info |= (CAVE_MARK);
110 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
112 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
113 * @return 効力があった場合TRUEを返す
115 bool detect_traps(POSITION range, bool known)
117 bool detect = detect_feat_flag(range, FF_TRAP, known);
119 if (known) p_ptr->dtrap = TRUE;
121 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
124 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
131 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
133 * @return 効力があった場合TRUEを返す
135 bool detect_doors(POSITION range)
137 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
139 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
142 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
149 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
151 * @return 効力があった場合TRUEを返す
153 bool detect_stairs(POSITION range)
155 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
157 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
160 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
167 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
169 * @return 効力があった場合TRUEを返す
171 bool detect_treasure(POSITION range)
173 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
175 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
178 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
185 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
187 * @return 効力があった場合TRUEを返す
189 bool detect_objects_gold(POSITION range)
193 POSITION range2 = range;
197 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
200 for (i = 1; i < current_floor_ptr->o_max; i++)
202 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
204 /* Skip dead objects */
205 if (!o_ptr->k_idx) continue;
207 /* Skip held objects */
208 if (o_ptr->held_m_idx) continue;
213 /* Only detect nearby objects */
214 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
216 /* Detect "gold" objects */
217 if (o_ptr->tval == TV_GOLD)
219 o_ptr->marked |= OM_FOUND;
225 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
228 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
231 if (detect_monsters_string(range, "$"))
240 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
242 * @return 効力があった場合TRUEを返す
244 bool detect_objects_normal(POSITION range)
248 POSITION range2 = range;
252 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
255 for (i = 1; i < current_floor_ptr->o_max; i++)
257 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
259 /* Skip dead objects */
260 if (!o_ptr->k_idx) continue;
262 /* Skip held objects */
263 if (o_ptr->held_m_idx) continue;
268 /* Only detect nearby objects */
269 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
271 /* Detect "real" objects */
272 if (o_ptr->tval != TV_GOLD)
274 o_ptr->marked |= OM_FOUND;
280 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
283 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
286 if (detect_monsters_string(range, "!=?|/`"))
295 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
297 * @return 効力があった場合TRUEを返す
300 * This will light up all spaces with "magic" items, including artifacts,
301 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
302 * and "enchanted" items of the "good" variety.
304 * It can probably be argued that this function is now too powerful.
307 bool detect_objects_magic(POSITION range)
309 OBJECT_TYPE_VALUE tv;
315 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
317 /* Scan all objects */
318 for (i = 1; i < current_floor_ptr->o_max; i++)
320 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
322 /* Skip dead objects */
323 if (!o_ptr->k_idx) continue;
325 /* Skip held objects */
326 if (o_ptr->held_m_idx) continue;
331 /* Only detect nearby objects */
332 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
334 /* Examine the tval */
337 /* Artifacts, misc magic items, or enchanted wearables */
338 if (object_is_artifact(o_ptr) ||
339 object_is_ego(o_ptr) ||
340 (tv == TV_WHISTLE) ||
348 (tv == TV_LIFE_BOOK) ||
349 (tv == TV_SORCERY_BOOK) ||
350 (tv == TV_NATURE_BOOK) ||
351 (tv == TV_CHAOS_BOOK) ||
352 (tv == TV_DEATH_BOOK) ||
353 (tv == TV_TRUMP_BOOK) ||
354 (tv == TV_ARCANE_BOOK) ||
355 (tv == TV_CRAFT_BOOK) ||
356 (tv == TV_DAEMON_BOOK) ||
357 (tv == TV_CRUSADE_BOOK) ||
358 (tv == TV_MUSIC_BOOK) ||
359 (tv == TV_HISSATSU_BOOK) ||
360 (tv == TV_HEX_BOOK) ||
361 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
363 /* Memorize the item */
364 o_ptr->marked |= OM_FOUND;
371 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
380 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
382 * @return 効力があった場合TRUEを返す
384 bool detect_monsters_normal(POSITION range)
390 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
392 for (i = 1; i < current_floor_ptr->m_max; i++)
394 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
395 monster_race *r_ptr = &r_info[m_ptr->r_idx];
396 if (!monster_is_valid(m_ptr)) continue;
401 /* Only detect nearby monsters */
402 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
404 /* Detect all non-invisible monsters */
405 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
407 /* Repair visibility later */
408 repair_monsters = TRUE;
410 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
411 update_monster(i, FALSE);
416 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
419 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
426 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
428 * @return 効力があった場合TRUEを返す
430 bool detect_monsters_invis(POSITION range)
436 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
438 for (i = 1; i < current_floor_ptr->m_max; i++)
440 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
441 monster_race *r_ptr = &r_info[m_ptr->r_idx];
443 if (!monster_is_valid(m_ptr)) continue;
448 /* Only detect nearby monsters */
449 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
451 /* Detect invisible monsters */
452 if (r_ptr->flags2 & RF2_INVISIBLE)
454 /* Update monster recall window */
455 if (p_ptr->monster_race_idx == m_ptr->r_idx)
457 p_ptr->window |= (PW_MONSTER);
460 /* Repair visibility later */
461 repair_monsters = TRUE;
463 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
464 update_monster(i, FALSE);
469 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
472 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
478 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
480 * @return 効力があった場合TRUEを返す
482 bool detect_monsters_evil(POSITION range)
488 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
490 for (i = 1; i < current_floor_ptr->m_max; i++)
492 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
493 monster_race *r_ptr = &r_info[m_ptr->r_idx];
494 if (!monster_is_valid(m_ptr)) continue;
499 /* Only detect nearby monsters */
500 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
502 /* Detect evil monsters */
503 if (r_ptr->flags3 & RF3_EVIL)
505 if (is_original_ap(m_ptr))
507 /* Take note that they are evil */
508 r_ptr->r_flags3 |= (RF3_EVIL);
510 /* Update monster recall window */
511 if (p_ptr->monster_race_idx == m_ptr->r_idx)
513 p_ptr->window |= (PW_MONSTER);
517 /* Repair visibility later */
518 repair_monsters = TRUE;
520 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
521 update_monster(i, FALSE);
527 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
533 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
535 * @return 効力があった場合TRUEを返す
537 bool detect_monsters_nonliving(POSITION range)
543 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
545 for (i = 1; i < current_floor_ptr->m_max; i++)
547 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
548 if (!monster_is_valid(m_ptr)) continue;
553 /* Only detect nearby monsters */
554 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
556 /* Detect non-living monsters */
557 if (!monster_living(m_ptr->r_idx))
559 /* Update monster recall window */
560 if (p_ptr->monster_race_idx == m_ptr->r_idx)
562 p_ptr->window |= (PW_MONSTER);
565 /* Repair visibility later */
566 repair_monsters = TRUE;
568 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
569 update_monster(i, FALSE);
575 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
581 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
583 * @return 効力があった場合TRUEを返す
585 bool detect_monsters_mind(POSITION range)
591 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
593 for (i = 1; i < current_floor_ptr->m_max; i++)
595 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
596 monster_race *r_ptr = &r_info[m_ptr->r_idx];
597 if (!monster_is_valid(m_ptr)) continue;
602 /* Only detect nearby monsters */
603 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
605 /* Detect non-living monsters */
606 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
608 /* Update monster recall window */
609 if (p_ptr->monster_race_idx == m_ptr->r_idx)
611 p_ptr->window |= (PW_MONSTER);
614 /* Repair visibility later */
615 repair_monsters = TRUE;
617 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
618 update_monster(i, FALSE);
624 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
631 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
633 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
634 * @return 効力があった場合TRUEを返す
636 bool detect_monsters_string(POSITION range, concptr Match)
642 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
644 for (i = 1; i < current_floor_ptr->m_max; i++)
646 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
647 monster_race *r_ptr = &r_info[m_ptr->r_idx];
648 if (!monster_is_valid(m_ptr)) continue;
653 /* Only detect nearby monsters */
654 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
656 /* Detect monsters with the same symbol */
657 if (my_strchr(Match, r_ptr->d_char))
659 /* Update monster recall window */
660 if (p_ptr->monster_race_idx == m_ptr->r_idx)
662 p_ptr->window |= (PW_MONSTER);
665 /* Repair visibility later */
666 repair_monsters = TRUE;
668 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
669 update_monster(i, FALSE);
674 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
677 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
683 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
685 * @param match_flag 感知フラグ
686 * @return 効力があった場合TRUEを返す
688 bool detect_monsters_xxx(POSITION range, u32b match_flag)
693 concptr desc_monsters = _("変なモンスター", "weird monsters");
695 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
697 for (i = 1; i < current_floor_ptr->m_max; i++)
699 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
700 monster_race *r_ptr = &r_info[m_ptr->r_idx];
701 if (!monster_is_valid(m_ptr)) continue;
706 /* Only detect nearby monsters */
707 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
709 /* Detect evil monsters */
710 if (r_ptr->flags3 & (match_flag))
712 if (is_original_ap(m_ptr))
714 /* Take note that they are something */
715 r_ptr->r_flags3 |= (match_flag);
717 /* Update monster recall window */
718 if (p_ptr->monster_race_idx == m_ptr->r_idx)
720 p_ptr->window |= (PW_MONSTER);
724 /* Repair visibility later */
725 repair_monsters = TRUE;
727 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
728 update_monster(i, FALSE);
737 desc_monsters = _("デーモン", "demons");
740 desc_monsters = _("アンデッド", "the undead");
744 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
752 * @brief 全感知処理 / Detect everything
754 * @return 効力があった場合TRUEを返す
756 bool detect_all(POSITION range)
760 /* Detect everything */
761 if (detect_traps(range, TRUE)) detect = TRUE;
762 if (detect_doors(range)) detect = TRUE;
763 if (detect_stairs(range)) detect = TRUE;
765 /* There are too many hidden treasure. So... */
766 /* if (detect_treasure(range)) detect = TRUE; */
768 if (detect_objects_gold(range)) detect = TRUE;
769 if (detect_objects_normal(range)) detect = TRUE;
770 if (detect_monsters_invis(range)) detect = TRUE;
771 if (detect_monsters_normal(range)) detect = TRUE;
777 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
780 * @return 効力があった場合TRUEを返す
783 * Note that affected monsters are NOT auto-tracked by this usage.
785 * To avoid misbehavior when monster deaths have side-effects,
786 * this is done in two passes. -- JDL
789 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
793 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
794 bool obvious = FALSE;
796 /* Mark all (nearby) monsters */
797 for (i = 1; i < current_floor_ptr->m_max; i++)
799 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
800 if (!monster_is_valid(m_ptr)) continue;
805 /* Require line of sight */
806 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
808 /* Mark the monster */
809 m_ptr->mflag |= (MFLAG_LOS);
812 /* Affect all marked monsters */
813 for (i = 1; i < current_floor_ptr->m_max; i++)
815 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
817 /* Skip unmarked monsters */
818 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
821 m_ptr->mflag &= ~(MFLAG_LOS);
826 /* Jump directly to the target monster */
827 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
834 * @brief 視界内モンスターを加速する処理 / Speed monsters
835 * @return 効力があった場合TRUEを返す
837 bool speed_monsters(void)
839 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
843 * @brief 視界内モンスターを加速する処理 / Slow monsters
844 * @return 効力があった場合TRUEを返す
846 bool slow_monsters(int power)
848 return (project_all_los(GF_OLD_SLOW, power));
852 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
853 * @return 効力があった場合TRUEを返す
855 bool sleep_monsters(int power)
857 return (project_all_los(GF_OLD_SLEEP, power));
861 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
862 * @return 効力があった場合TRUEを返す
864 bool banish_evil(int dist)
866 return (project_all_los(GF_AWAY_EVIL, dist));
870 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
871 * @return 効力があった場合TRUEを返す
873 bool turn_undead(void)
875 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
877 chg_virtue(V_UNLIFE, -1);
882 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
883 * @return 効力があった場合TRUEを返す
885 bool dispel_undead(HIT_POINT dam)
887 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
889 chg_virtue(V_UNLIFE, -2);
894 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
895 * @return 効力があった場合TRUEを返す
897 bool dispel_evil(HIT_POINT dam)
899 return (project_all_los(GF_DISP_EVIL, dam));
903 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
904 * @return 効力があった場合TRUEを返す
906 bool dispel_good(HIT_POINT dam)
908 return (project_all_los(GF_DISP_GOOD, dam));
912 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
913 * @return 効力があった場合TRUEを返す
915 bool dispel_monsters(HIT_POINT dam)
917 return (project_all_los(GF_DISP_ALL, dam));
920 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
923 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
924 int k = 3 * creature_ptr->lev;
925 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
926 if (set_poisoned(0)) ident = TRUE;
927 if (set_afraid(0)) ident = TRUE;
928 if (hp_player(50)) ident = TRUE;
929 if (set_stun(0)) ident = TRUE;
930 if (set_cut(0)) ident = TRUE;
934 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
936 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
937 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
938 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
939 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))
941 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
947 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
948 * @return 効力があった場合TRUEを返す
950 bool dispel_living(HIT_POINT dam)
952 return (project_all_los(GF_DISP_LIVING, dam));
956 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
957 * @return 効力があった場合TRUEを返す
959 bool dispel_demons(HIT_POINT dam)
961 return (project_all_los(GF_DISP_DEMON, dam));
965 * @brief 視界内のモンスターに「聖戦」効果を与える処理
966 * @return 効力があった場合TRUEを返す
970 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
974 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
975 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
978 void aggravate_monsters(MONSTER_IDX who)
984 /* Aggravate everyone nearby */
985 for (i = 1; i < current_floor_ptr->m_max; i++)
987 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
988 if (!monster_is_valid(m_ptr)) continue;
990 /* Skip aggravating monster (or player) */
991 if (i == who) continue;
993 /* Wake up nearby sleeping monsters */
994 if (m_ptr->cdis < MAX_SIGHT * 2)
997 if (MON_CSLEEP(m_ptr))
999 (void)set_monster_csleep(i, 0);
1002 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1005 /* Speed up monsters in line of sight */
1006 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1010 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1016 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1017 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1018 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1023 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1024 * @param m_idx 抹殺するモンスターID
1025 * @param power 抹殺の威力
1026 * @param player_cast プレイヤーの魔法によるものならば TRUE
1027 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1028 * @param spell_name 抹殺効果を起こした魔法の名前
1029 * @return 効力があった場合TRUEを返す
1031 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1033 int msec = delay_factor * delay_factor * delay_factor;
1034 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1035 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1036 bool resist = FALSE;
1038 if (is_pet(m_ptr) && !player_cast) return FALSE;
1040 /* Hack -- Skip Unique Monsters or Quest Monsters */
1041 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1042 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1043 else if (m_idx == p_ptr->riding) resist = TRUE;
1044 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1045 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1046 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1050 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1052 GAME_TEXT m_name[MAX_NLEN];
1054 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1055 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1058 delete_monster_idx(m_idx);
1061 if (resist && player_cast)
1063 bool see_m = is_seen(m_ptr);
1064 GAME_TEXT m_name[MAX_NLEN];
1066 monster_desc(m_name, m_ptr, 0);
1069 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1071 if (MON_CSLEEP(m_ptr))
1073 (void)set_monster_csleep(m_idx, 0);
1076 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1079 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1083 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1087 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1092 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1095 /* Visual feedback */
1096 move_cursor_relative(p_ptr->y, p_ptr->x);
1098 p_ptr->redraw |= (PR_HP);
1099 p_ptr->window |= (PW_PLAYER);
1104 Term_xtra(TERM_XTRA_DELAY, msec);
1111 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1112 * @param power 抹殺の威力
1113 * @param player_cast プレイヤーの魔法によるものならば TRUE
1114 * @return 効力があった場合TRUEを返す
1116 bool symbol_genocide(int power, bool player_cast)
1120 bool result = FALSE;
1122 /* Prevent genocide in quest levels */
1123 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1125 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1129 /* Mega-Hack -- Get a monster symbol */
1130 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1132 /* Delete the monsters of that "type" */
1133 for (i = 1; i < current_floor_ptr->m_max; i++)
1135 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1136 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1137 if (!monster_is_valid(m_ptr)) continue;
1139 /* Skip "wrong" monsters */
1140 if (r_ptr->d_char != typ) continue;
1142 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1147 chg_virtue(V_VITALITY, -2);
1148 chg_virtue(V_CHANCE, -1);
1156 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1157 * @param power 抹殺の威力
1158 * @param player_cast プレイヤーの魔法によるものならば TRUE
1159 * @return 効力があった場合TRUEを返す
1161 bool mass_genocide(int power, bool player_cast)
1164 bool result = FALSE;
1166 /* Prevent mass genocide in quest levels */
1167 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1172 /* Delete the (nearby) monsters */
1173 for (i = 1; i < current_floor_ptr->m_max; i++)
1175 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1176 if (!monster_is_valid(m_ptr)) 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(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1212 /* Delete the (nearby) monsters */
1213 for (i = 1; i < current_floor_ptr->m_max; i++)
1215 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1216 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1217 if (!monster_is_valid(m_ptr)) continue;
1219 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1221 /* Skip distant monsters */
1222 if (m_ptr->cdis > MAX_SIGHT) continue;
1225 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1230 chg_virtue(V_UNLIFE, -2);
1231 chg_virtue(V_CHANCE, -1);
1239 * @brief 周辺モンスターを調査する / Probe nearby monsters
1240 * @return 効力があった場合TRUEを返す
1245 int speed; /* TODO */
1256 /* Probe all (nearby) monsters */
1257 for (i = 1; i < current_floor_ptr->m_max; i++)
1259 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1260 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1261 if (!monster_is_valid(m_ptr)) continue;
1263 /* Require line of sight */
1264 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1266 /* Probe visible monsters */
1269 GAME_TEXT m_name[MAX_NLEN];
1271 /* Start the message */
1274 msg_print(_("調査中...", "Probing..."));
1279 if (!is_original_ap(m_ptr))
1281 if (m_ptr->mflag2 & MFLAG2_KAGE)
1282 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1284 m_ptr->ap_r_idx = m_ptr->r_idx;
1285 lite_spot(m_ptr->fy, m_ptr->fx);
1287 /* Get "the monster" or "something" */
1288 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1290 speed = m_ptr->mspeed - 110;
1291 if (MON_FAST(m_ptr)) speed += 10;
1292 if (MON_SLOW(m_ptr)) speed -= 10;
1293 if (ironman_nightmare) speed += 5;
1295 /* Get the monster's alignment */
1296 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1297 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1298 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1299 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1300 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1301 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1302 else align = _("中立", "neutral");
1304 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1305 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1307 if (r_ptr->next_r_idx)
1309 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1313 strcat(buf, "xxx ");
1316 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1317 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1318 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1319 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1320 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1321 buf[strlen(buf)-1] = '\0';
1324 /* HACK : Add the line to message buffer */
1327 p_ptr->window |= (PW_MESSAGE);
1330 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1333 Term_erase(0, 0, 255);
1335 /* Learn everything about this monster */
1336 if (lore_do_probe(m_ptr->r_idx))
1338 /* Get base name of monster */
1339 strcpy(buf, (r_name + r_ptr->name));
1342 /* Note that we learnt some new flags -Mogami- */
1343 msg_format("%sについてさらに詳しくなった気がする。", buf);
1348 /* Note that we learnt some new flags -Mogami- */
1349 msg_format("You now know more about %s.", buf);
1351 /* Clear -more- prompt */
1366 chg_virtue(V_KNOWLEDGE, 1);
1367 msg_print(_("これで全部です。", "That's all."));
1375 * @brief *破壊*処理を行う / The spell of destruction
1376 * @param y1 破壊の中心Y座標
1377 * @param x1 破壊の中心X座標
1379 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1380 * @return 効力があった場合TRUEを返す
1383 * This spell "deletes" monsters (instead of "killing" them).
1385 * Later we may use one function for both "destruction" and
1386 * "earthquake" by using the "full" to select "destruction".
1389 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1396 /* Prevent destruction of quest levels and town */
1397 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1402 /* Lose monster light */
1403 if (!in_generate) clear_mon_lite();
1405 /* Big area of affect */
1406 for (y = (y1 - r); y <= (y1 + r); y++)
1408 for (x = (x1 - r); x <= (x1 + r); x++)
1410 /* Skip illegal grids */
1411 if (!in_bounds(y, x)) continue;
1413 /* Extract the distance */
1414 k = distance(y1, x1, y, x);
1416 /* Stay in the circle of death */
1417 if (k > r) continue;
1418 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1420 /* Lose room and vault */
1421 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1423 /* Lose light and knowledge */
1424 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1426 if (!in_generate) /* Normal */
1429 g_ptr->info &= ~(CAVE_UNSAFE);
1431 /* Hack -- Notice player affect */
1432 if (player_bold(y, x))
1434 /* Hurt the player later */
1437 /* Do not hurt this grid */
1442 /* Hack -- Skip the epicenter */
1443 if ((y == y1) && (x == x1)) continue;
1447 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1448 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1450 if (in_generate) /* In generation */
1452 /* Delete the monster (if any) */
1453 delete_monster(y, x);
1455 else if (r_ptr->flags1 & RF1_QUESTOR)
1457 /* Heal the monster */
1458 m_ptr->hp = m_ptr->maxhp;
1460 /* Try to teleport away quest monsters */
1461 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1465 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1467 GAME_TEXT m_name[MAX_NLEN];
1469 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1470 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1473 /* Delete the monster (if any) */
1474 delete_monster(y, x);
1478 /* During generation, destroyed artifacts are "preserved" */
1479 if (preserve_mode || in_generate)
1481 OBJECT_IDX this_o_idx, next_o_idx = 0;
1483 /* Scan all objects in the grid */
1484 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1487 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1488 next_o_idx = o_ptr->next_o_idx;
1490 /* Hack -- Preserve unknown artifacts */
1491 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1493 /* Mega-Hack -- Preserve the artifact */
1494 a_info[o_ptr->name1].cur_num = 0;
1496 if (in_generate && cheat_peek)
1498 GAME_TEXT o_name[MAX_NLEN];
1499 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1500 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1503 else if (in_generate && cheat_peek && o_ptr->art_name)
1505 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1506 "One of the random artifacts was *destroyed* during generation."));
1511 delete_object(y, x);
1513 /* Destroy "non-permanent" grids */
1514 if (!cave_perma_grid(g_ptr))
1516 /* Wall (or floor) type */
1519 if (!in_generate) /* Normal */
1523 /* Create granite wall */
1524 cave_set_feat(y, x, feat_granite);
1528 /* Create quartz vein */
1529 cave_set_feat(y, x, feat_quartz_vein);
1533 /* Create magma vein */
1534 cave_set_feat(y, x, feat_magma_vein);
1539 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1542 else /* In generation */
1546 /* Create granite wall */
1547 place_extra_grid(g_ptr);
1551 /* Create quartz vein */
1552 g_ptr->feat = feat_quartz_vein;
1556 /* Create magma vein */
1557 g_ptr->feat = feat_magma_vein;
1562 place_floor_grid(g_ptr);
1565 /* Clear garbage of hidden trap or door */
1574 /* Process "re-glowing" */
1575 for (y = (y1 - r); y <= (y1 + r); y++)
1577 for (x = (x1 - r); x <= (x1 + r); x++)
1579 /* Skip illegal grids */
1580 if (!in_bounds(y, x)) continue;
1582 /* Extract the distance */
1583 k = distance(y1, x1, y, x);
1585 /* Stay in the circle of death */
1586 if (k > r) continue;
1587 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1589 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1590 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1596 for (i = 0; i < 9; i++)
1598 yy = y + ddy_ddd[i];
1599 xx = x + ddx_ddd[i];
1600 if (!in_bounds2(yy, xx)) continue;
1601 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1602 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1604 g_ptr->info |= CAVE_GLOW;
1612 /* Hack -- Affect player */
1615 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1617 /* Blind the player */
1618 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1621 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1627 /* Mega-Hack -- Forget the view and lite */
1628 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1629 p_ptr->redraw |= (PR_MAP);
1630 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1632 if (p_ptr->special_defense & NINJA_S_STEALTH)
1634 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1644 * @brief 地震処理(サブルーチン) /
1645 * Induce an "earthquake" of the given radius at the given location.
1646 * @return 効力があった場合TRUEを返す
1650 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1654 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1656 * The player will take damage and "jump" into a safe grid if possible,
1657 * otherwise, he will "tunnel" through the rubble instantaneously.
1659 * Monsters will take damage, and "jump" into a safe grid if possible,
1660 * otherwise they will be "buried" in the rubble, disappearing from
1661 * the level in the same way that they do when genocided.
1663 * Note that thus the player and monsters (except eaters of walls and
1664 * passers through walls) will never occupy the same grid as a wall.
1665 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1666 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1667 * This has allowed massive simplification of the "monster" code.
1670 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1674 POSITION y, x, yy, xx, dy, dx;
1677 POSITION sy = 0, sx = 0;
1682 /* Prevent destruction of quest levels and town */
1683 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1688 /* Paranoia -- Enforce maximum range */
1691 /* Clear the "maximal blast" area */
1692 for (y = 0; y < 32; y++)
1694 for (x = 0; x < 32; x++)
1700 /* Check around the epicenter */
1701 for (dy = -r; dy <= r; dy++)
1703 for (dx = -r; dx <= r; dx++)
1705 /* Extract the location */
1709 /* Skip illegal grids */
1710 if (!in_bounds(yy, xx)) continue;
1712 /* Skip distant grids */
1713 if (distance(cy, cx, yy, xx) > r) continue;
1714 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1716 /* Lose room and vault / Lose light and knowledge */
1717 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1718 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1720 /* Skip the epicenter */
1721 if (!dx && !dy) continue;
1723 /* Skip most grids */
1724 if (randint0(100) < 85) continue;
1726 /* Damage this grid */
1727 map[16+yy-cy][16+xx-cx] = TRUE;
1729 /* Hack -- Take note of player damage */
1730 if (player_bold(yy, xx)) hurt = TRUE;
1734 /* First, affect the player (if necessary) */
1735 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1737 /* Check around the player */
1738 for (i = 0; i < 8; i++)
1740 y = p_ptr->y + ddy_ddd[i];
1741 x = p_ptr->x + ddx_ddd[i];
1743 /* Skip non-empty grids */
1744 if (!cave_empty_bold(y, x)) continue;
1746 /* Important -- Skip "quake" grids */
1747 if (map[16+y-cy][16+x-cx]) continue;
1749 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1751 /* Count "safe" grids */
1754 /* Randomize choice */
1755 if (randint0(sn) > 0) continue;
1757 /* Save the safe location */
1761 /* Random message */
1762 switch (randint1(3))
1766 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1771 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1776 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1781 /* Hurt the player a lot */
1784 /* Message and damage */
1785 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1789 /* Destroy the grid, and push the player to safety */
1792 /* Calculate results */
1793 switch (randint1(3))
1797 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1803 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1804 damage = damroll(10, 4);
1805 (void)set_stun(p_ptr->stun + randint1(50));
1810 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1811 damage = damroll(10, 4);
1812 (void)set_stun(p_ptr->stun + randint1(50));
1817 /* Move the player to the safe location */
1818 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1821 /* Important -- no wall on player */
1822 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1830 GAME_TEXT m_name[MAX_NLEN];
1831 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1832 monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
1833 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1837 killer = _("地震", "an earthquake");
1840 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1844 /* Examine the quaked region */
1845 for (dy = -r; dy <= r; dy++)
1847 for (dx = -r; dx <= r; dx++)
1849 /* Extract the location */
1853 /* Skip unaffected grids */
1854 if (!map[16+yy-cy][16+xx-cx]) continue;
1855 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1857 if (g_ptr->m_idx == p_ptr->riding) continue;
1859 /* Process monsters */
1862 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1863 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1865 /* Quest monsters */
1866 if (r_ptr->flags1 & RF1_QUESTOR)
1868 /* No wall on quest monsters */
1869 map[16+yy-cy][16+xx-cx] = FALSE;
1874 /* Most monsters cannot co-exist with rock */
1875 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1876 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1878 GAME_TEXT m_name[MAX_NLEN];
1880 /* Assume not safe */
1883 /* Monster can move to escape the wall */
1884 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1886 /* Look for safety */
1887 for (i = 0; i < 8; i++)
1889 y = yy + ddy_ddd[i];
1890 x = xx + ddx_ddd[i];
1892 /* Skip non-empty grids */
1893 if (!cave_empty_bold(y, x)) continue;
1895 /* Hack -- no safety on glyph of warding */
1896 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1897 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1899 /* ... nor on the Pattern */
1900 if (pattern_tile(y, x)) continue;
1902 /* Important -- Skip "quake" grids */
1903 if (map[16+y-cy][16+x-cx]) continue;
1905 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1906 if (player_bold(y, x)) continue;
1908 /* Count "safe" grids */
1911 /* Randomize choice */
1912 if (randint0(sn) > 0) continue;
1914 /* Save the safe grid */
1919 monster_desc(m_name, m_ptr, 0);
1921 /* Scream in pain */
1922 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1924 /* Take damage from the quake */
1925 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1927 /* Monster is certainly awake */
1928 (void)set_monster_csleep(g_ptr->m_idx, 0);
1930 /* Apply damage directly */
1931 m_ptr->hp -= damage;
1933 /* Delete (not kill) "dead" monsters */
1936 if (!ignore_unview || is_seen(m_ptr))
1937 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1941 if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1943 char m2_name[MAX_NLEN];
1945 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1946 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1950 delete_monster(yy, xx);
1952 /* No longer safe */
1956 /* Hack -- Escape from the rock */
1959 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1961 /* Update the old location */
1962 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1964 /* Update the new location */
1965 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1967 /* Move the monster */
1971 update_monster(m_idx, TRUE);
1980 /* Lose monster light */
1983 /* Examine the quaked region */
1984 for (dy = -r; dy <= r; dy++)
1986 for (dx = -r; dx <= r; dx++)
1988 /* Extract the location */
1992 /* Skip unaffected grids */
1993 if (!map[16+yy-cy][16+xx-cx]) continue;
1995 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1997 /* Paranoia -- never affect player */
1998 /* if (player_bold(yy, xx)) continue; */
2000 /* Destroy location (if valid) */
2001 if (cave_valid_bold(yy, xx))
2003 delete_object(yy, xx);
2005 /* Wall (or floor) type */
2006 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2011 /* Create granite wall */
2012 cave_set_feat(yy, xx, feat_granite);
2018 /* Create quartz vein */
2019 cave_set_feat(yy, xx, feat_quartz_vein);
2025 /* Create magma vein */
2026 cave_set_feat(yy, xx, feat_magma_vein);
2033 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2039 /* Process "re-glowing" */
2040 for (dy = -r; dy <= r; dy++)
2042 for (dx = -r; dx <= r; dx++)
2044 /* Extract the location */
2048 /* Skip illegal grids */
2049 if (!in_bounds(yy, xx)) continue;
2051 /* Skip distant grids */
2052 if (distance(cy, cx, yy, xx) > r) continue;
2053 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2055 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2056 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2062 for (ii = 0; ii < 9; ii++)
2064 yyy = yy + ddy_ddd[ii];
2065 xxx = xx + ddx_ddd[ii];
2066 if (!in_bounds2(yyy, xxx)) continue;
2067 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2068 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2070 g_ptr->info |= CAVE_GLOW;
2078 /* Mega-Hack -- Forget the view and lite */
2079 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2080 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2081 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2083 if (p_ptr->special_defense & NINJA_S_STEALTH)
2085 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2093 * @brief 地震処理(プレイヤーの中心発動) /
2094 * Induce an "earthquake" of the given radius at the given location.
2095 * @return 効力があった場合TRUEを返す
2100 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2102 return earthquake_aux(cy, cx, r, 0);
2109 void discharge_minion(void)
2114 for (i = 1; i < current_floor_ptr->m_max; i++)
2116 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2117 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2118 if (m_ptr->nickname) okay = FALSE;
2120 if (!okay || p_ptr->riding)
2122 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2125 for (i = 1; i < current_floor_ptr->m_max; i++)
2128 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2129 monster_race *r_ptr;
2131 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2132 r_ptr = &r_info[m_ptr->r_idx];
2134 /* Uniques resist discharging */
2135 if (r_ptr->flags1 & RF1_UNIQUE)
2137 GAME_TEXT m_name[MAX_NLEN];
2138 monster_desc(m_name, m_ptr, 0x00);
2139 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2140 delete_monster_idx(i);
2143 dam = m_ptr->maxhp / 2;
2144 if (dam > 100) dam = (dam - 100) / 2 + 100;
2145 if (dam > 400) dam = (dam - 400) / 2 + 400;
2146 if (dam > 800) dam = 800;
2147 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2148 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2150 if (record_named_pet && m_ptr->nickname)
2152 GAME_TEXT m_name[MAX_NLEN];
2154 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2155 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2158 delete_monster_idx(i);
2164 * @brief 部屋全体を照らすサブルーチン
2168 * This routine clears the entire "temp" set.
2169 * This routine will Perma-Lite all "temp" grids.
2170 * This routine is used (only) by "lite_room()"
2171 * Dark grids are illuminated.
2172 * Also, process all affected monsters.
2174 * SMART monsters always wake up when illuminated
2175 * NORMAL monsters wake up 1/4 the time when illuminated
2176 * STUPID monsters wake up 1/10 the time when illuminated
2179 static void cave_temp_room_lite(void)
2183 /* Clear them all */
2184 for (i = 0; i < tmp_pos.n; i++)
2186 POSITION y = tmp_pos.y[i];
2187 POSITION x = tmp_pos.x[i];
2189 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2191 /* No longer in the array */
2192 g_ptr->info &= ~(CAVE_TEMP);
2194 /* Update only non-CAVE_GLOW grids */
2195 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2198 g_ptr->info |= (CAVE_GLOW);
2200 /* Process affected monsters */
2203 PERCENTAGE chance = 25;
2204 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2205 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2206 update_monster(g_ptr->m_idx, FALSE);
2208 /* Stupid monsters rarely wake up */
2209 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2211 /* Smart monsters always wake up */
2212 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2214 /* Sometimes monsters wake up */
2215 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2218 (void)set_monster_csleep(g_ptr->m_idx, 0);
2220 /* Notice the "waking up" */
2223 GAME_TEXT m_name[MAX_NLEN];
2224 monster_desc(m_name, m_ptr, 0);
2225 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2232 update_local_illumination(y, x);
2242 * @brief 部屋全体を暗くするサブルーチン
2246 * This routine clears the entire "temp" set.
2247 * This routine will "darken" all "temp" grids.
2248 * In addition, some of these grids will be "unmarked".
2249 * This routine is used (only) by "unlite_room()"
2250 * Also, process all affected monsters
2253 static void cave_temp_room_unlite(void)
2257 /* Clear them all */
2258 for (i = 0; i < tmp_pos.n; i++)
2260 POSITION y = tmp_pos.y[i];
2261 POSITION x = tmp_pos.x[i];
2264 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2265 bool do_dark = !is_mirror_grid(g_ptr);
2267 /* No longer in the array */
2268 g_ptr->info &= ~(CAVE_TEMP);
2270 /* Darken the grid */
2273 if (current_floor_ptr->dun_level || !is_daytime())
2275 for (j = 0; j < 9; j++)
2277 POSITION by = y + ddy_ddd[j];
2278 POSITION bx = x + ddx_ddd[j];
2280 if (in_bounds2(by, bx))
2282 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2284 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2292 if (!do_dark) continue;
2295 g_ptr->info &= ~(CAVE_GLOW);
2297 /* Hack -- Forget "boring" grids */
2298 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2300 /* Forget the grid */
2301 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2305 /* Process affected monsters */
2308 update_monster(g_ptr->m_idx, FALSE);
2312 update_local_illumination(y, x);
2322 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2325 * @param pass_bold 地形条件を返す関数ポインタ
2328 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2335 for (i = 0; i < 16; i++)
2337 y = cy + ddy_cdd[i % 8];
2338 x = cx + ddx_cdd[i % 8];
2340 /* Found a wall, break the length */
2341 if (!pass_bold(y, x))
2343 /* Track best length */
2357 return (MAX(len, blen));
2361 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2364 * @param pass_bold 地形条件を返す関数ポインタ
2367 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2373 for (i = 0; i < 8; i++)
2375 y = cy + ddy_ddd[i];
2376 x = cx + ddx_ddd[i];
2378 if (!pass_bold(y, x)) c++;
2386 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2387 * @param y 部屋内のy座標1点
2388 * @param x 部屋内のx座標1点
2389 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2390 * @param pass_bold 地形条件を返す関数ポインタ
2393 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2396 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2398 /* Avoid infinite recursion */
2399 if (g_ptr->info & (CAVE_TEMP)) return;
2401 /* Do not "leave" the current room */
2402 if (!(g_ptr->info & (CAVE_ROOM)))
2404 if (only_room) return;
2407 if (!in_bounds2(y, x)) return;
2409 /* Do not exceed the maximum spell range */
2410 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2412 /* Verify this grid */
2414 * The reason why it is ==6 instead of >5 is that 8 is impossible
2415 * due to the check for cave_bold above.
2416 * 7 lights dead-end corridors (you need to do this for the
2417 * checkboard interesting rooms, so that the boundary is lit
2419 * This leaves only a check for 6 bounding walls!
2421 if (in_bounds(y, x) && pass_bold(y, x) &&
2422 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2425 /* Paranoia -- verify space */
2426 if (tmp_pos.n == TEMP_MAX) return;
2428 /* Mark the grid as "seen" */
2429 g_ptr->info |= (CAVE_TEMP);
2431 /* Add it to the "seen" set */
2432 tmp_pos.y[tmp_pos.n] = y;
2433 tmp_pos.x[tmp_pos.n] = x;
2438 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2441 * @return 光を通すならばtrueを返す。
2443 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2445 return cave_los_bold(y, x);
2449 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2454 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2456 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2460 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2463 * @return 射線を通すならばtrueを返す。
2465 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2467 return cave_have_flag_bold(y, x, FF_PROJECT);
2472 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2477 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2479 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2484 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2489 void lite_room(POSITION y1, POSITION x1)
2494 /* Add the initial grid */
2495 cave_temp_lite_room_aux(y1, x1);
2497 /* While grids are in the queue, add their neighbors */
2498 for (i = 0; i < tmp_pos.n; i++)
2500 x = tmp_pos.x[i], y = tmp_pos.y[i];
2502 /* Walls get lit, but stop light */
2503 if (!cave_pass_lite_bold(y, x)) continue;
2505 /* Spread adjacent */
2506 cave_temp_lite_room_aux(y + 1, x);
2507 cave_temp_lite_room_aux(y - 1, x);
2508 cave_temp_lite_room_aux(y, x + 1);
2509 cave_temp_lite_room_aux(y, x - 1);
2511 /* Spread diagonal */
2512 cave_temp_lite_room_aux(y + 1, x + 1);
2513 cave_temp_lite_room_aux(y - 1, x - 1);
2514 cave_temp_lite_room_aux(y - 1, x + 1);
2515 cave_temp_lite_room_aux(y + 1, x - 1);
2518 /* Now, lite them all up at once */
2519 cave_temp_room_lite();
2521 if (p_ptr->special_defense & NINJA_S_STEALTH)
2523 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2529 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2534 void unlite_room(POSITION y1, POSITION x1)
2539 /* Add the initial grid */
2540 cave_temp_unlite_room_aux(y1, x1);
2542 /* Spread, breadth first */
2543 for (i = 0; i < tmp_pos.n; i++)
2545 x = tmp_pos.x[i], y = tmp_pos.y[i];
2547 /* Walls get dark, but stop darkness */
2548 if (!cave_pass_dark_bold(y, x)) continue;
2550 /* Spread adjacent */
2551 cave_temp_unlite_room_aux(y + 1, x);
2552 cave_temp_unlite_room_aux(y - 1, x);
2553 cave_temp_unlite_room_aux(y, x + 1);
2554 cave_temp_unlite_room_aux(y, x - 1);
2556 /* Spread diagonal */
2557 cave_temp_unlite_room_aux(y + 1, x + 1);
2558 cave_temp_unlite_room_aux(y - 1, x - 1);
2559 cave_temp_unlite_room_aux(y - 1, x + 1);
2560 cave_temp_unlite_room_aux(y + 1, x - 1);
2563 /* Now, darken them all at once */
2564 cave_temp_room_unlite();
2567 bool starlight(bool magic)
2569 HIT_POINT num = damroll(5, 3);
2570 POSITION y = 0, x = 0;
2574 if (!p_ptr->blind && !magic)
2576 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2578 for (k = 0; k < num; k++)
2584 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2585 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2586 if (!player_bold(y, x)) break;
2589 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2590 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2598 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2601 * @return 作用が実際にあった場合TRUEを返す
2603 bool lite_area(HIT_POINT dam, POSITION rad)
2605 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2607 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2609 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2615 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2618 /* Hook into the "project()" function */
2619 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2621 lite_room(p_ptr->y, p_ptr->x);
2629 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2632 * @return 作用が実際にあった場合TRUEを返す
2634 bool unlite_area(HIT_POINT dam, POSITION rad)
2636 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2640 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2643 /* Hook into the "project()" function */
2644 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2646 unlite_room(p_ptr->y, p_ptr->x);
2655 * @brief ボール系スペルの発動 / Cast a ball spell
2657 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2660 * @return 作用が実際にあった場合TRUEを返す
2663 * Stop if we hit a monster, act as a "ball"
2664 * Allow "target" mode to pass over monsters
2665 * Affect grids, objects, and monsters
2668 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2672 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2674 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2675 /* Use the given direction */
2676 tx = p_ptr->x + 99 * ddx[dir];
2677 ty = p_ptr->y + 99 * ddy[dir];
2679 /* Hack -- Use an actual "target" */
2680 if ((dir == 5) && target_okay())
2682 flg &= ~(PROJECT_STOP);
2687 /* Analyze the "dir" and the "target". Hurt items on floor. */
2688 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2692 * @brief ブレス系スペルの発動 / Cast a breath spell
2694 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2697 * @return 作用が実際にあった場合TRUEを返す
2700 * Stop if we hit a monster, act as a "ball"
2701 * Allow "target" mode to pass over monsters
2702 * Affect grids, objects, and monsters
2705 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2707 return fire_ball(typ, dir, dam, -rad);
2712 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2714 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2717 * @return 作用が実際にあった場合TRUEを返す
2720 * Stop if we hit a monster, act as a "ball"
2721 * Allow "target" mode to pass over monsters
2722 * Affect grids, objects, and monsters
2725 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2728 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2730 /* Use the given direction */
2731 tx = p_ptr->x + 99 * ddx[dir];
2732 ty = p_ptr->y + 99 * ddy[dir];
2734 /* Hack -- Use an actual "target" */
2735 if ((dir == 5) && target_okay())
2741 /* Analyze the "dir" and the "target". Hurt items on floor. */
2742 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2747 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2749 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2752 * @return 作用が実際にあった場合TRUEを返す
2755 * Stop if we hit a monster, act as a "ball"
2756 * Allow "target" mode to pass over monsters
2757 * Affect grids, objects, and monsters
2760 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2763 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2765 /* Use the given direction */
2766 tx = p_ptr->x + 99 * ddx[dir];
2767 ty = p_ptr->y + 99 * ddy[dir];
2769 /* Hack -- Use an actual "target" */
2770 if ((dir == 5) && target_okay())
2772 flg &= ~(PROJECT_STOP);
2777 /* Analyze the "dir" and the "target". Hurt items on floor. */
2778 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2783 * @brief メテオ系スペルの発動 / Cast a meteor spell
2784 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2790 * @return 作用が実際にあった場合TRUEを返す
2793 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2794 * player, or outside source, that starts out at an arbitrary location, and
2795 * leaving no trail from the "caster" to the target. This function is
2796 * especially useful for bombardments and similar. -LM-
2797 * Option to hurt the player.
2800 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2802 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2804 /* Analyze the "target" and the caster. */
2805 return (project(who, rad, y, x, dam, typ, flg, -1));
2810 * @brief ブラスト系スペルの発動 / Cast a blast spell
2812 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2817 * @return 作用が実際にあった場合TRUEを返す
2819 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2823 POSITION ty, tx, y, x;
2826 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2831 /* Use the given direction */
2834 ly = ty = p_ptr->y + 20 * ddy[dir];
2835 lx = tx = p_ptr->x + 20 * ddx[dir];
2838 /* Use an actual "target" */
2839 else /* if (dir == 5) */
2844 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2845 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2848 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2851 for (i = 0; i < num; i++)
2855 /* Get targets for some bolts */
2856 y = rand_spread(ly, ld * dev / 20);
2857 x = rand_spread(lx, ld * dev / 20);
2859 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2862 /* Analyze the "dir" and the "target". */
2863 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2874 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2875 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2876 * @return 作用が実際にあった場合TRUEを返す
2878 bool teleport_swap(DIRECTION dir)
2882 monster_type* m_ptr;
2883 monster_race* r_ptr;
2885 if ((dir == 5) && target_okay())
2892 tx = p_ptr->x + ddx[dir];
2893 ty = p_ptr->y + ddy[dir];
2895 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2897 if (p_ptr->anti_tele)
2899 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2903 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2905 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2909 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2911 msg_print(_("失敗した。", "Failed to swap."));
2915 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2916 r_ptr = &r_info[m_ptr->r_idx];
2918 (void)set_monster_csleep(g_ptr->m_idx, 0);
2920 if (r_ptr->flagsr & RFR_RES_TELE)
2922 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2923 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2927 sound(SOUND_TELEPORT);
2929 /* Swap the player and monster */
2930 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2938 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2940 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2943 * @return 作用が実際にあった場合TRUEを返す
2945 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2949 /* Pass through the target if needed */
2950 flg |= (PROJECT_THRU);
2952 /* Use the given direction */
2953 tx = p_ptr->x + ddx[dir];
2954 ty = p_ptr->y + ddy[dir];
2956 /* Hack -- Use an actual "target" */
2957 if ((dir == 5) && target_okay())
2963 /* Analyze the "dir" and the "target", do NOT explode */
2964 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2969 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2971 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2973 * @return 作用が実際にあった場合TRUEを返す
2976 * Stop if we hit a monster, as a "bolt".
2977 * Affect monsters and grids (not objects).
2980 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2982 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2983 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2984 return (project_hook(typ, dir, dam, flg));
2989 * @brief ビーム系スペルの発動 / Cast a beam spell.
2991 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2993 * @return 作用が実際にあった場合TRUEを返す
2996 * Pass through monsters, as a "beam".
2997 * Affect monsters, grids and objects.
3000 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3002 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3003 return (project_hook(typ, dir, dam, flg));
3008 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3009 * @param prob ビーム化する確率(%)
3011 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3013 * @return 作用が実際にあった場合TRUEを返す
3016 * Pass through monsters, as a "beam".
3017 * Affect monsters, grids and objects.
3020 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3022 if (randint0(100) < prob)
3024 return (fire_beam(typ, dir, dam));
3028 return (fire_bolt(typ, dir, dam));
3033 * @brief LITE_WEAK属性による光源ビーム処理
3034 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3036 * @return 作用が実際にあった場合TRUEを返す
3038 bool lite_line(DIRECTION dir, HIT_POINT dam)
3040 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3041 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3046 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3048 * @return 作用が実際にあった場合TRUEを返す
3050 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3052 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3053 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3058 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3060 * @return 作用が実際にあった場合TRUEを返す
3062 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3064 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3065 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3070 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3071 * @return 作用が実際にあった場合TRUEを返す
3073 bool wizard_lock(DIRECTION dir)
3075 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3076 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3081 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3082 * @return 作用が実際にあった場合TRUEを返す
3084 bool destroy_door(DIRECTION dir)
3086 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3087 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3092 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3093 * @return 作用が実際にあった場合TRUEを返す
3095 bool disarm_trap(DIRECTION dir)
3097 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3098 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3104 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3105 * @param plev プレイヤーレベル(効力はplev*200)
3106 * @return 作用が実際にあった場合TRUEを返す
3108 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3110 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3111 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3115 * @brief モンスター用テレポート処理
3116 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3117 * @param distance 移動距離
3118 * @return 作用が実際にあった場合TRUEを返す
3120 bool teleport_monster(DIRECTION dir, int distance)
3122 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3123 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3127 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3128 * @return 作用が実際にあった場合TRUEを返す
3130 bool door_creation(void)
3132 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3133 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3137 * @brief トラップ生成処理(起点から周囲1マス)
3140 * @return 作用が実際にあった場合TRUEを返す
3142 bool trap_creation(POSITION y, POSITION x)
3144 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3145 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3149 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3150 * @return 作用が実際にあった場合TRUEを返す
3152 bool tree_creation(void)
3154 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3155 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3159 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3160 * @return 作用が実際にあった場合TRUEを返す
3162 bool glyph_creation(void)
3164 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3165 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3169 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3170 * @return 作用が実際にあった場合TRUEを返す
3172 bool wall_stone(void)
3174 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3175 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3176 p_ptr->update |= (PU_FLOW);
3177 p_ptr->redraw |= (PR_MAP);
3182 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3183 * @return 作用が実際にあった場合TRUEを返す
3185 bool destroy_doors_touch(void)
3187 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3188 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3192 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3193 * @return 作用が実際にあった場合TRUEを返す
3195 bool disarm_traps_touch(void)
3197 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3198 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3202 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3203 * @return 作用が実際にあった場合TRUEを返す
3205 bool sleep_monsters_touch(void)
3207 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3208 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3213 * @brief 死者復活処理(起点より周囲5マス)
3214 * @param who 術者モンスターID(0ならばプレイヤー)
3217 * @return 作用が実際にあった場合TRUEを返す
3219 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3221 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3222 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3227 * @return 作用が実際にあった場合TRUEを返す
3229 void call_chaos(void)
3231 int Chaos_type, dummy, dir;
3232 PLAYER_LEVEL plev = p_ptr->lev;
3233 bool line_chaos = FALSE;
3235 int hurt_types[31] =
3237 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3238 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3239 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3240 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3241 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3242 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3243 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3244 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3247 Chaos_type = hurt_types[randint0(31)];
3248 if (one_in_(4)) line_chaos = TRUE;
3252 for (dummy = 1; dummy < 10; dummy++)
3257 fire_beam(Chaos_type, dummy, 150);
3259 fire_ball(Chaos_type, dummy, 150, 2);
3263 else if (one_in_(3))
3265 fire_ball(Chaos_type, 0, 500, 8);
3269 if (!get_aim_dir(&dir)) return;
3271 fire_beam(Chaos_type, dir, 250);
3273 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3278 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3279 * @param stop_ty 再帰処理停止フラグ
3281 * @return 作用が実際にあった場合TRUEを返す
3284 * rr9: Stop the nasty things when a Cyberdemon is summoned
3285 * or the player gets paralyzed.
3288 bool activate_ty_curse(bool stop_ty, int *count)
3291 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3295 switch (randint1(34))
3300 msg_print(_("地面が揺れた...", "The ground trembles..."));
3301 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3302 if (!one_in_(6)) break;
3307 HIT_POINT dam = damroll(10, 10);
3308 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3309 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3310 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3311 if (!one_in_(6)) break;
3316 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3317 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3318 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3319 if (!one_in_(6)) break;
3322 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3326 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3327 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3329 if (!one_in_(6)) break;
3330 case 1: case 2: case 3: case 16: case 17:
3331 aggravate_monsters(0);
3332 if (!one_in_(6)) break;
3333 case 4: case 5: case 6:
3334 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3335 if (!one_in_(6)) break;
3336 case 7: case 8: case 9: case 18:
3337 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3338 if (!one_in_(6)) break;
3339 case 10: case 11: case 12:
3340 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3341 lose_exp(p_ptr->exp / 16);
3342 if (!one_in_(6)) break;
3343 case 13: case 14: case 15: case 19: case 20:
3344 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3350 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3351 if (p_ptr->free_act)
3352 set_paralyzed(p_ptr->paralyzed + randint1(3));
3354 set_paralyzed(p_ptr->paralyzed + randint1(13));
3357 if (!one_in_(6)) break;
3358 case 21: case 22: case 23:
3359 (void)do_dec_stat(randint0(6));
3360 if (!one_in_(6)) break;
3362 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3364 if (!one_in_(6)) break;
3367 * Only summon Cyberdemons deep in the dungeon.
3369 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3371 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3375 if (!one_in_(6)) break;
3381 (void)do_dec_stat(i);
3389 while (one_in_(3) && !stop_ty);
3395 * @brief HI_SUMMON(上級召喚)処理発動
3398 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3399 * @return 作用が実際にあった場合TRUEを返す
3401 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3406 BIT_FLAGS mode = PM_ALLOW_GROUP;
3413 mode |= PM_FORCE_FRIENDLY;
3417 mode |= PM_FORCE_PET;
3422 if (!pet) mode |= PM_NO_PET;
3424 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3426 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3428 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3431 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3434 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3437 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3440 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3443 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3446 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3449 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3452 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3456 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3460 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3463 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3464 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3467 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3468 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3471 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3474 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3475 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3483 * @brief 周辺破壊効果(プレイヤー中心)
3484 * @return 作用が実際にあった場合TRUEを返す
3486 void wall_breaker(void)
3489 POSITION y = 0, x = 0;
3490 int attempts = 1000;
3492 if (randint1(80 + p_ptr->lev) < 70)
3496 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3498 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3500 if (!player_bold(y, x)) break;
3503 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3504 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3506 else if (randint1(100) > 30)
3508 earthquake(p_ptr->y, p_ptr->x, 1);
3512 int num = damroll(5, 3);
3514 for (i = 0; i < num; i++)
3518 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3520 if (!player_bold(y, x)) break;
3523 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3524 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3531 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3533 * @return 作用が実際にあった場合TRUEを返す
3535 bool confuse_monsters(HIT_POINT dam)
3537 return (project_all_los(GF_OLD_CONF, dam));
3542 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3544 * @return 作用が実際にあった場合TRUEを返す
3546 bool charm_monsters(HIT_POINT dam)
3548 return (project_all_los(GF_CHARM, dam));
3553 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3555 * @return 作用が実際にあった場合TRUEを返す
3557 bool charm_animals(HIT_POINT dam)
3559 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3564 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3566 * @return 作用が実際にあった場合TRUEを返す
3568 bool stun_monsters(HIT_POINT dam)
3570 return (project_all_los(GF_STUN, dam));
3575 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3577 * @return 作用が実際にあった場合TRUEを返す
3579 bool stasis_monsters(HIT_POINT dam)
3581 return (project_all_los(GF_STASIS, dam));
3586 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3588 * @return 作用が実際にあった場合TRUEを返す
3590 bool mindblast_monsters(HIT_POINT dam)
3592 return (project_all_los(GF_PSI, dam));
3597 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3598 * @param dist 効力(距離)
3599 * @return 作用が実際にあった場合TRUEを返す
3601 bool banish_monsters(int dist)
3603 return (project_all_los(GF_AWAY_ALL, dist));
3608 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3610 * @return 作用が実際にあった場合TRUEを返す
3612 bool turn_evil(HIT_POINT dam)
3614 return (project_all_los(GF_TURN_EVIL, dam));
3619 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3621 * @return 作用が実際にあった場合TRUEを返す
3623 bool turn_monsters(HIT_POINT dam)
3625 return (project_all_los(GF_TURN_ALL, dam));
3630 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3631 * @return 作用が実際にあった場合TRUEを返す
3633 bool deathray_monsters(void)
3635 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3639 * @brief チャーム・モンスター(1体)
3640 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3642 * @return 作用が実際にあった場合TRUEを返す
3644 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3646 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3647 return (project_hook(GF_CHARM, dir, plev, flg));
3651 * @brief アンデッド支配(1体)
3652 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3654 * @return 作用が実際にあった場合TRUEを返す
3656 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3658 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3659 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3664 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3666 * @return 作用が実際にあった場合TRUEを返す
3668 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3670 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3671 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3676 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3678 * @return 作用が実際にあった場合TRUEを返す
3680 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3682 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3683 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3689 * @param success 判定成功上の処理ならばTRUE
3690 * @return 作用が実際にあった場合TRUEを返す
3692 bool kawarimi(bool success)
3695 object_type *q_ptr = &forge;
3698 if (p_ptr->is_dead) return FALSE;
3699 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3700 if (randint0(200) < p_ptr->stun) return FALSE;
3702 if (!success && one_in_(3))
3704 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3705 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3706 p_ptr->redraw |= (PR_STATUS);
3713 teleport_player(10 + randint1(90), 0L);
3715 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3717 q_ptr->pval = MON_NINJA;
3718 (void)drop_near(q_ptr, -1, y, x);
3720 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3721 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3723 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3724 p_ptr->redraw |= (PR_STATUS);
3732 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3733 * @param mdeath 目標モンスターが死亡したかを返す
3734 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3736 bool rush_attack(bool *mdeath)
3743 bool tmp_mdeath = FALSE;
3746 if (mdeath) *mdeath = FALSE;
3749 if (!get_aim_dir(&dir)) return FALSE;
3751 /* Use the given direction */
3752 tx = p_ptr->x + project_length * ddx[dir];
3753 ty = p_ptr->y + project_length * ddy[dir];
3755 /* Hack -- Use an actual "target" */
3756 if ((dir == 5) && target_okay())
3762 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3764 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3767 /* No need to move */
3768 if (!path_n) return TRUE;
3770 /* Use ty and tx as to-move point */
3774 /* Project along the path */
3775 for (i = 0; i < path_n; i++)
3777 monster_type *m_ptr;
3779 int ny = GRID_Y(path_g[i]);
3780 int nx = GRID_X(path_g[i]);
3782 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3787 /* Go to next grid */
3791 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3795 msg_print(_("失敗!", "Failed!"));
3799 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3806 /* Move player before updating the monster */
3807 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3808 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3810 /* Found a monster */
3811 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3813 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3816 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3818 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3821 else if (!player_bold(ty, tx))
3823 /* Hold the monster name */
3824 GAME_TEXT m_name[MAX_NLEN];
3826 /* Get the monster name (BEFORE polymorphing) */
3827 monster_desc(m_name, m_ptr, 0);
3828 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3831 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3833 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3838 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3840 if (mdeath) *mdeath = tmp_mdeath;
3846 * @brief 全鏡の消去 / Remove all mirrors in this floor
3847 * @param explode 爆発処理を伴うならばTRUE
3850 void remove_all_mirrors(bool explode)
3854 for (x = 0; x < current_floor_ptr->width; x++)
3856 for (y = 0; y < current_floor_ptr->height; y++)
3858 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3860 remove_mirror(y, x);
3862 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3863 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3870 * @brief 『一つの指輪』の効果処理 /
3871 * Hack -- activate the ring of power
3872 * @param dir 発動の方向ID
3875 void ring_of_power(DIRECTION dir)
3877 /* Pick a random effect */
3878 switch (randint1(10))
3883 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3886 /* Decrease all stats (permanently) */
3887 (void)dec_stat(A_STR, 50, TRUE);
3888 (void)dec_stat(A_INT, 50, TRUE);
3889 (void)dec_stat(A_WIS, 50, TRUE);
3890 (void)dec_stat(A_DEX, 50, TRUE);
3891 (void)dec_stat(A_CON, 50, TRUE);
3892 (void)dec_stat(A_CHR, 50, TRUE);
3894 /* Lose some experience (permanently) */
3895 p_ptr->exp -= (p_ptr->exp / 4);
3896 p_ptr->max_exp -= (p_ptr->exp / 4);
3904 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3905 dispel_monsters(1000);
3913 fire_ball(GF_MANA, dir, 600, 3);
3922 fire_bolt(GF_MANA, dir, 500);
3929 * @brief 運命の輪、並びにカオス的な効果の発動
3930 * @param spell ランダムな効果を選択するための基準ID
3933 void wild_magic(int spell)
3936 int type = SUMMON_MOLD + randint0(6);
3938 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3939 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3941 switch (randint1(spell) + randint1(8) + 1)
3946 teleport_player(10, TELEPORT_PASSIVE);
3951 teleport_player(100, TELEPORT_PASSIVE);
3955 teleport_player(200, TELEPORT_PASSIVE);
3965 lite_area(damroll(2, 3), 2);
3968 destroy_doors_touch();
3973 sleep_monsters_touch();
3977 trap_creation(p_ptr->y, p_ptr->x);
3986 aggravate_monsters(0);
3989 earthquake(p_ptr->y, p_ptr->x, 5);
3993 (void)gain_mutation(p_ptr, 0);
3997 apply_disenchant(1);
4003 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4010 while (counter++ < 8)
4012 (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4017 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4020 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4025 (void)activate_ty_curse(FALSE, &count);
4034 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4035 * / Drop 10+1d10 meteor ball at random places near the player
4040 void cast_meteor(HIT_POINT dam, POSITION rad)
4043 int b = 10 + randint1(10);
4045 for (i = 0; i < b; i++)
4047 POSITION y = 0, x = 0;
4050 for (count = 0; count <= 20; count++)
4054 x = p_ptr->x - 8 + randint0(17);
4055 y = p_ptr->y - 8 + randint0(17);
4057 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4058 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4060 /* Approximate distance */
4061 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4063 if (d >= 9) continue;
4065 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4066 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4068 /* Valid position */
4072 if (count > 20) continue;
4074 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4080 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4083 * @return ターゲットを指定し、実行したならばTRUEを返す。
4085 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4087 POSITION x, y, tx, ty;
4091 int b = 10 + randint1(10);
4093 if (!get_aim_dir(&dir)) return FALSE;
4095 /* Use the given direction */
4096 tx = p_ptr->x + 99 * ddx[dir];
4097 ty = p_ptr->y + 99 * ddy[dir];
4099 /* Hack -- Use an actual "target" */
4100 if ((dir == 5) && target_okay())
4111 /* Hack -- Stop at the target */
4112 if ((y == ty) && (x == tx)) break;
4116 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4118 /* Stop at maximum range */
4119 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4121 /* Stopped by walls/doors */
4122 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4124 /* Stopped by monsters */
4125 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4127 /* Save the new location */
4134 for (i = 0; i < b; i++)
4136 int count = 20, d = 0;
4142 x = tx - 5 + randint0(11);
4143 y = ty - 5 + randint0(11);
4145 dx = (tx > x) ? (tx - x) : (x - tx);
4146 dy = (ty > y) ? (ty - y) : (y - ty);
4148 /* Approximate distance */
4149 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4150 /* Within the radius */
4154 if (count < 0) continue;
4156 /* Cannot penetrate perm walls */
4157 if (!in_bounds(y, x) ||
4158 cave_stop_disintegration(y, x) ||
4159 !in_disintegration_range(ty, tx, y, x))
4162 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4169 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4173 * This spell should become more useful (more controlled) as the\n
4174 * player gains experience levels. Thus, add 1/5 of the player's\n
4175 * level to the die roll. This eliminates the worst effects later on,\n
4176 * while keeping the results quite random. It also allows some potent\n
4177 * effects only at high level.
4179 void cast_wonder(DIRECTION dir)
4181 PLAYER_LEVEL plev = p_ptr->lev;
4182 int die = randint1(100) + plev / 5;
4183 int vir = virtue_number(V_CHANCE);
4187 if (p_ptr->virtues[vir - 1] > 0)
4189 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4193 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4198 chg_virtue(V_CHANCE, 1);
4202 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4205 if (die < 8) clone_monster(dir);
4206 else if (die < 14) speed_monster(dir, plev);
4207 else if (die < 26) heal_monster(dir, damroll(4, 6));
4208 else if (die < 31) poly_monster(dir, plev);
4210 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4211 damroll(3 + ((plev - 1) / 5), 4));
4212 else if (die < 41) confuse_monster(dir, plev);
4213 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4214 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4216 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4217 damroll(3 + ((plev - 5) / 4), 8));
4219 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4220 damroll(5 + ((plev - 5) / 4), 8));
4222 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4223 damroll(6 + ((plev - 5) / 4), 8));
4225 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4226 damroll(8 + ((plev - 5) / 4), 8));
4227 else if (die < 76) hypodynamic_bolt(dir, 75);
4228 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4229 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4230 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4231 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4232 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4235 earthquake(p_ptr->y, p_ptr->x, 12);
4239 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4243 symbol_genocide(plev + 50, TRUE);
4245 else if (die < 110) dispel_monsters(120);
4248 dispel_monsters(150);
4249 slow_monsters(plev);
4250 sleep_monsters(plev);
4257 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4261 void cast_invoke_spirits(DIRECTION dir)
4263 PLAYER_LEVEL plev = p_ptr->lev;
4264 int die = randint1(100) + plev / 5;
4265 int vir = virtue_number(V_CHANCE);
4269 if (p_ptr->virtues[vir - 1] > 0)
4271 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4275 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4279 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4281 chg_virtue(V_CHANCE, 1);
4285 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4290 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4291 "Oh no! Mouldering forms rise from the earth around you!"));
4293 (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4294 chg_virtue(V_UNLIFE, 1);
4298 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4300 set_afraid(p_ptr->afraid + randint1(4) + 4);
4304 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4305 "Your head is invaded by a horde of gibbering spectral voices..."));
4307 set_confused(p_ptr->confused + randint1(4) + 4);
4311 poly_monster(dir, plev);
4315 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4316 damroll(3 + ((plev - 1) / 5), 4));
4320 confuse_monster(dir, plev);
4324 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4328 (void)lite_line(dir, damroll(6, 8));
4332 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4333 damroll(3 + ((plev - 5) / 4), 8));
4337 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4338 damroll(5 + ((plev - 5) / 4), 8));
4342 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4343 damroll(6 + ((plev - 5) / 4), 8));
4347 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4348 damroll(8 + ((plev - 5) / 4), 8));
4352 hypodynamic_bolt(dir, 75);
4356 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4360 fire_ball(GF_ACID, dir, 40 + plev, 2);
4364 fire_ball(GF_ICE, dir, 70 + plev, 3);
4368 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4372 hypodynamic_bolt(dir, 100 + plev);
4376 earthquake(p_ptr->y, p_ptr->x, 12);
4380 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4384 symbol_genocide(plev + 50, TRUE);
4388 dispel_monsters(120);
4392 dispel_monsters(150);
4393 slow_monsters(plev);
4394 sleep_monsters(plev);
4400 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4401 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4406 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4409 void cast_shuffle(void)
4411 PLAYER_LEVEL plev = p_ptr->lev;
4414 int vir = virtue_number(V_CHANCE);
4417 /* Card sharks and high mages get a level bonus */
4418 if ((p_ptr->pclass == CLASS_ROGUE) ||
4419 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4420 (p_ptr->pclass == CLASS_SORCERER))
4421 die = (randint1(110)) + plev / 5;
4423 die = randint1(120);
4428 if (p_ptr->virtues[vir - 1] > 0)
4430 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4434 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4438 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4441 chg_virtue(V_CHANCE, 1);
4445 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4447 for (i = 0; i < randint1(3); i++)
4448 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4452 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4453 summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4458 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4459 activate_ty_curse(FALSE, &count);
4463 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4464 aggravate_monsters(0);
4468 msg_print(_("《愚者》だ。", "It's the Fool."));
4474 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4475 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4479 msg_print(_("《月》だ。", "It's the Moon."));
4484 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4485 wild_magic(randint0(32));
4489 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4490 teleport_player(10, TELEPORT_PASSIVE);
4494 msg_print(_("《正義》だ。", "It's Justice."));
4495 set_blessed(p_ptr->lev, FALSE);
4499 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4500 teleport_player(100, TELEPORT_PASSIVE);
4504 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4505 teleport_player(200, TELEPORT_PASSIVE);
4509 msg_print(_("《塔》だ。", "It's the Tower."));
4514 msg_print(_("《節制》だ。", "It's Temperance."));
4515 sleep_monsters_touch();
4519 msg_print(_("《塔》だ。", "It's the Tower."));
4521 earthquake(p_ptr->y, p_ptr->x, 5);
4525 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4526 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4530 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4531 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4535 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4536 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4540 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4541 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4545 msg_print(_("《恋人》だ。", "It's the Lovers."));
4547 if (get_aim_dir(&dir))
4548 charm_monster(dir, MIN(p_ptr->lev, 20));
4552 msg_print(_("《隠者》だ。", "It's the Hermit."));
4557 msg_print(_("《審判》だ。", "It's the Judgement."));
4558 roll_hitdice(p_ptr, 0L);
4559 lose_all_mutations();
4563 msg_print(_("《太陽》だ。", "It's the Sun."));
4564 chg_virtue(V_KNOWLEDGE, 1);
4565 chg_virtue(V_ENLIGHTEN, 1);
4570 msg_print(_("《世界》だ。", "It's the World."));
4571 if (p_ptr->exp < PY_MAX_EXP)
4573 s32b ee = (p_ptr->exp / 25) + 1;
4574 if (ee > 5000) ee = 5000;
4575 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4582 * @brief 口を使う継続的な処理を中断する
4585 void stop_mouth(void)
4587 if (music_singing_any()) stop_singing(p_ptr);
4588 if (hex_spelling_any()) stop_hex_spell_all();
4592 bool_hack vampirism(void)
4599 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4601 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4605 /* Only works on adjacent monsters */
4606 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4607 y = p_ptr->y + ddy[dir];
4608 x = p_ptr->x + ddx[dir];
4609 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4613 if (!(g_ptr->m_idx))
4615 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4619 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4621 dummy = p_ptr->lev * 2;
4623 if (hypodynamic_bolt(dir, dummy))
4625 if (p_ptr->food < PY_FOOD_FULL)
4626 /* No heal if we are "full" */
4627 (void)hp_player(dummy);
4629 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4631 /* Gain nutritional sustenance: 150/hp drained */
4632 /* A Food ration gives 5000 food points (by contrast) */
4633 /* Don't ever get more than "Full" this way */
4634 /* But if we ARE Gorged, it won't cure us */
4635 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4636 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4637 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4640 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4644 bool panic_hit(void)
4649 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4650 y = p_ptr->y + ddy[dir];
4651 x = p_ptr->x + ddx[dir];
4652 if (current_floor_ptr->grid_array[y][x].m_idx)
4655 if (randint0(p_ptr->skill_dis) < 7)
4656 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4658 teleport_player(30, 0L);
4663 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4671 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
4674 * currently this function allows pseudo-id of any object,
4675 * including silly ones like potions & scrolls, which always
4676 * get '{average}'. This should be changed, either to stop such
4677 * items from being pseudo-id'd, or to allow psychometry to
4678 * detect whether the unidentified potion/scroll/etc is
4679 * good (Cure Light Wounds, Restore Strength, etc) or
4680 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4682 bool psychometry(void)
4686 GAME_TEXT o_name[MAX_NLEN];
4691 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4692 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4694 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4695 if (!o_ptr) return (FALSE);
4697 /* It is fully known, no information needed */
4698 if (object_is_known(o_ptr))
4700 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4704 /* Check for a feeling */
4705 feel = value_check_aux1(o_ptr);
4707 /* Get an object description */
4708 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4710 /* Skip non-feelings */
4713 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4718 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4720 msg_format("You feel that the %s %s %s...",
4721 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4725 o_ptr->ident |= (IDENT_SENSE);
4726 o_ptr->feeling = feel;
4727 o_ptr->marked |= OM_TOUCHED;
4729 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4730 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4732 /* Valid "tval" codes */
4733 switch (o_ptr->tval)
4761 /* Auto-inscription/destroy */
4762 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4764 /* Something happened */
4769 bool draconian_breath(player_type *creature_ptr)
4772 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4773 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4775 if (!get_aim_dir(&dir)) return FALSE;
4777 if (randint1(100) < creature_ptr->lev)
4779 switch (creature_ptr->pclass)
4782 case CLASS_BERSERKER:
4785 case CLASS_IMITATOR:
4791 Type_desc = _("エレメント", "the elements");
4796 Type_desc = _("破片", "shards");
4800 case CLASS_WARRIOR_MAGE:
4801 case CLASS_HIGH_MAGE:
4802 case CLASS_SORCERER:
4803 case CLASS_MAGIC_EATER:
4804 case CLASS_RED_MAGE:
4805 case CLASS_BLUE_MAGE:
4806 case CLASS_MIRROR_MASTER:
4810 Type_desc = _("魔力", "mana");
4814 Type = GF_DISENCHANT;
4815 Type_desc = _("劣化", "disenchantment");
4818 case CLASS_CHAOS_WARRIOR:
4821 Type = GF_CONFUSION;
4822 Type_desc = _("混乱", "confusion");
4827 Type_desc = _("カオス", "chaos");
4832 case CLASS_FORCETRAINER:
4835 Type = GF_CONFUSION;
4836 Type_desc = _("混乱", "confusion");
4841 Type_desc = _("轟音", "sound");
4844 case CLASS_MINDCRAFTER:
4847 Type = GF_CONFUSION;
4848 Type_desc = _("混乱", "confusion");
4853 Type_desc = _("精神エネルギー", "mental energy");
4860 Type = GF_HELL_FIRE;
4861 Type_desc = _("地獄の劫火", "hellfire");
4865 Type = GF_HOLY_FIRE;
4866 Type_desc = _("聖なる炎", "holy fire");
4874 Type_desc = _("暗黒", "darkness");
4879 Type_desc = _("毒", "poison");
4886 Type_desc = _("轟音", "sound");
4890 Type = GF_CONFUSION;
4891 Type_desc = _("混乱", "confusion");
4898 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4900 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4904 bool android_inside_weapon(player_type *creature_ptr)
4907 if (!get_aim_dir(&dir)) return FALSE;
4908 if (creature_ptr->lev < 10)
4910 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4911 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4913 else if (creature_ptr->lev < 25)
4915 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4916 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4918 else if (creature_ptr->lev < 35)
4920 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4921 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4923 else if (creature_ptr->lev < 45)
4925 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4926 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4930 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4931 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4936 bool create_ration(player_type *crature_ptr)
4942 /* Create the food ration */
4943 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4945 /* Drop the object from heaven */
4946 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4947 msg_print(_("食事を料理して作った。", "You cook some food."));
4951 void hayagake(player_type *creature_ptr)
4953 if (creature_ptr->action == ACTION_HAYAGAKE)
4955 set_action(ACTION_NONE);
4959 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4960 feature_type *f_ptr = &f_info[g_ptr->feat];
4962 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4963 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4965 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4969 set_action(ACTION_HAYAGAKE);
4972 creature_ptr->energy_use = 0;
4975 bool double_attack(player_type *creature_ptr)
4980 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4981 y = creature_ptr->y + ddy[dir];
4982 x = creature_ptr->x + ddx[dir];
4983 if (current_floor_ptr->grid_array[y][x].m_idx)
4986 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4987 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4989 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4990 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4992 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4993 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4996 if (current_floor_ptr->grid_array[y][x].m_idx)
5001 creature_ptr->energy_need += ENERGY_NEED();
5005 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5011 bool comvert_hp_to_mp(player_type *creature_ptr)
5013 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5016 creature_ptr->csp += gain_sp;
5017 if (creature_ptr->csp > creature_ptr->msp)
5019 creature_ptr->csp = creature_ptr->msp;
5020 creature_ptr->csp_frac = 0;
5025 msg_print(_("変換に失敗した。", "You failed to convert."));
5027 creature_ptr->redraw |= (PR_HP | PR_MANA);
5031 bool comvert_mp_to_hp(player_type *creature_ptr)
5033 if (creature_ptr->csp >= creature_ptr->lev / 5)
5035 creature_ptr->csp -= creature_ptr->lev / 5;
5036 hp_player(creature_ptr->lev);
5040 msg_print(_("変換に失敗した。", "You failed to convert."));
5042 creature_ptr->redraw |= (PR_HP | PR_MANA);
5046 bool demonic_breath(player_type *creature_ptr)
5049 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5050 if (!get_aim_dir(&dir)) return FALSE;
5052 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5053 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5057 bool mirror_concentration(player_type *creature_ptr)
5061 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5064 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5066 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5068 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5069 if (creature_ptr->csp >= creature_ptr->msp)
5071 creature_ptr->csp = creature_ptr->msp;
5072 creature_ptr->csp_frac = 0;
5074 creature_ptr->redraw |= (PR_MANA);
5078 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5083 bool sword_dancing(player_type *creature_ptr)
5086 POSITION y = 0, x = 0;
5090 for (i = 0; i < 6; i++)
5093 y = creature_ptr->y + ddy_ddd[dir];
5094 x = creature_ptr->x + ddx_ddd[dir];
5095 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5097 /* Hack -- attack monsters */
5102 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5108 bool confusing_light(player_type *creature_ptr)
5110 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5111 slow_monsters(creature_ptr->lev);
5112 stun_monsters(creature_ptr->lev * 4);
5113 confuse_monsters(creature_ptr->lev * 4);
5114 turn_monsters(creature_ptr->lev * 4);
5115 stasis_monsters(creature_ptr->lev * 4);
5119 bool rodeo(player_type *creature_ptr)
5121 GAME_TEXT m_name[MAX_NLEN];
5122 monster_type *m_ptr;
5123 monster_race *r_ptr;
5126 if (creature_ptr->riding)
5128 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5131 if (!do_riding(TRUE)) return TRUE;
5133 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5134 r_ptr = &r_info[m_ptr->r_idx];
5135 monster_desc(m_name, m_ptr, 0);
5136 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5138 if (is_pet(m_ptr)) return TRUE;
5140 rlev = r_ptr->level;
5142 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5143 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5144 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5145 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5146 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5147 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5149 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5154 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5156 /* 落馬処理に失敗してもとにかく乗馬解除 */
5157 creature_ptr->riding = 0;
5162 bool clear_mind(player_type *creature_ptr)
5166 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5169 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5171 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5172 if (creature_ptr->csp >= creature_ptr->msp)
5174 creature_ptr->csp = creature_ptr->msp;
5175 creature_ptr->csp_frac = 0;
5177 creature_ptr->redraw |= (PR_MANA);
5181 bool concentration(player_type *creature_ptr)
5183 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5187 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5190 if (creature_ptr->special_defense & KATA_MASK)
5192 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5195 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5197 creature_ptr->csp += creature_ptr->msp / 2;
5198 if (creature_ptr->csp >= max_csp)
5200 creature_ptr->csp = max_csp;
5201 creature_ptr->csp_frac = 0;
5203 creature_ptr->redraw |= (PR_MANA);