3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
26 #include "monsterrace-hook.h"
30 #include "spells-summon.h"
35 #include "spells-status.h"
36 #include "spells-floor.h"
37 #include "realm-hex.h"
39 #include "object-flavor.h"
40 #include "object-hook.h"
41 #include "monster-status.h"
42 #include "player-move.h"
43 #include "player-status.h"
44 #include "player-effects.h"
45 #include "player-skill.h"
46 #include "player-class.h"
47 #include "player-damage.h"
50 #include "floor-events.h"
52 #include "view-mainwindow.h"
53 #include "objectkind.h"
54 #include "monsterrace.h"
55 #include "targeting.h"
56 #include "realm-song.h"
59 * @brief プレイヤー周辺の地形を感知する
62 * @param known 地形から危険フラグを外すならTRUE
63 * @return 効力があった場合TRUEを返す
65 static bool detect_feat_flag(POSITION range, int flag, bool known)
71 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
73 /* Scan the current panel */
74 for (y = 1; y < current_floor_ptr->height - 1; y++)
76 for (x = 1; x <= current_floor_ptr->width - 1; x++)
78 int dist = distance(p_ptr->y, p_ptr->x, y, x);
79 if (dist > range) continue;
80 g_ptr = ¤t_floor_ptr->grid_array[y][x];
85 /* Mark as detected */
86 if (dist <= range && known)
88 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
90 g_ptr->info &= ~(CAVE_UNSAFE);
97 if (cave_have_flag_grid(g_ptr, flag))
102 /* Hack -- Memorize */
103 g_ptr->info |= (CAVE_MARK);
116 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
118 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
119 * @return 効力があった場合TRUEを返す
121 bool detect_traps(POSITION range, bool known)
123 bool detect = detect_feat_flag(range, FF_TRAP, known);
125 if (known) p_ptr->dtrap = TRUE;
127 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
130 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
137 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
139 * @return 効力があった場合TRUEを返す
141 bool detect_doors(POSITION range)
143 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
145 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
148 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
155 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
157 * @return 効力があった場合TRUEを返す
159 bool detect_stairs(POSITION range)
161 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
163 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
166 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
173 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
175 * @return 効力があった場合TRUEを返す
177 bool detect_treasure(POSITION range)
179 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
181 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
184 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
191 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
193 * @return 効力があった場合TRUEを返す
195 bool detect_objects_gold(POSITION range)
199 POSITION range2 = range;
203 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
206 for (i = 1; i < current_floor_ptr->o_max; i++)
208 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
210 /* Skip dead objects */
211 if (!o_ptr->k_idx) continue;
213 /* Skip held objects */
214 if (o_ptr->held_m_idx) continue;
219 /* Only detect nearby objects */
220 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
222 /* Detect "gold" objects */
223 if (o_ptr->tval == TV_GOLD)
225 o_ptr->marked |= OM_FOUND;
231 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
234 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
237 if (detect_monsters_string(range, "$"))
246 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
248 * @return 効力があった場合TRUEを返す
250 bool detect_objects_normal(POSITION range)
254 POSITION range2 = range;
258 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
261 for (i = 1; i < current_floor_ptr->o_max; i++)
263 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
265 /* Skip dead objects */
266 if (!o_ptr->k_idx) continue;
268 /* Skip held objects */
269 if (o_ptr->held_m_idx) continue;
274 /* Only detect nearby objects */
275 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
277 /* Detect "real" objects */
278 if (o_ptr->tval != TV_GOLD)
280 o_ptr->marked |= OM_FOUND;
286 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
289 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
292 if (detect_monsters_string(range, "!=?|/`"))
301 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
303 * @return 効力があった場合TRUEを返す
306 * This will light up all spaces with "magic" items, including artifacts,
307 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
308 * and "enchanted" items of the "good" variety.
310 * It can probably be argued that this function is now too powerful.
313 bool detect_objects_magic(POSITION range)
315 OBJECT_TYPE_VALUE tv;
321 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
323 /* Scan all objects */
324 for (i = 1; i < current_floor_ptr->o_max; i++)
326 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
328 /* Skip dead objects */
329 if (!o_ptr->k_idx) continue;
331 /* Skip held objects */
332 if (o_ptr->held_m_idx) continue;
337 /* Only detect nearby objects */
338 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
340 /* Examine the tval */
343 /* Artifacts, misc magic items, or enchanted wearables */
344 if (object_is_artifact(o_ptr) ||
345 object_is_ego(o_ptr) ||
346 (tv == TV_WHISTLE) ||
354 (tv == TV_LIFE_BOOK) ||
355 (tv == TV_SORCERY_BOOK) ||
356 (tv == TV_NATURE_BOOK) ||
357 (tv == TV_CHAOS_BOOK) ||
358 (tv == TV_DEATH_BOOK) ||
359 (tv == TV_TRUMP_BOOK) ||
360 (tv == TV_ARCANE_BOOK) ||
361 (tv == TV_CRAFT_BOOK) ||
362 (tv == TV_DAEMON_BOOK) ||
363 (tv == TV_CRUSADE_BOOK) ||
364 (tv == TV_MUSIC_BOOK) ||
365 (tv == TV_HISSATSU_BOOK) ||
366 (tv == TV_HEX_BOOK) ||
367 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
369 /* Memorize the item */
370 o_ptr->marked |= OM_FOUND;
377 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
386 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
388 * @return 効力があった場合TRUEを返す
390 bool detect_monsters_normal(POSITION range)
396 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
398 for (i = 1; i < current_floor_ptr->m_max; i++)
400 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
401 monster_race *r_ptr = &r_info[m_ptr->r_idx];
402 if (!monster_is_valid(m_ptr)) continue;
407 /* Only detect nearby monsters */
408 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
410 /* Detect all non-invisible monsters */
411 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
413 /* Repair visibility later */
414 repair_monsters = TRUE;
416 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
417 update_monster(i, FALSE);
422 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
425 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
432 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
434 * @return 効力があった場合TRUEを返す
436 bool detect_monsters_invis(POSITION range)
442 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
444 for (i = 1; i < current_floor_ptr->m_max; i++)
446 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
447 monster_race *r_ptr = &r_info[m_ptr->r_idx];
449 if (!monster_is_valid(m_ptr)) continue;
454 /* Only detect nearby monsters */
455 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
457 /* Detect invisible monsters */
458 if (r_ptr->flags2 & RF2_INVISIBLE)
460 /* Update monster recall window */
461 if (p_ptr->monster_race_idx == m_ptr->r_idx)
463 p_ptr->window |= (PW_MONSTER);
466 /* Repair visibility later */
467 repair_monsters = TRUE;
469 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
470 update_monster(i, FALSE);
475 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
478 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
484 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
486 * @return 効力があった場合TRUEを返す
488 bool detect_monsters_evil(POSITION range)
494 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
496 for (i = 1; i < current_floor_ptr->m_max; i++)
498 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
499 monster_race *r_ptr = &r_info[m_ptr->r_idx];
500 if (!monster_is_valid(m_ptr)) continue;
505 /* Only detect nearby monsters */
506 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
508 /* Detect evil monsters */
509 if (r_ptr->flags3 & RF3_EVIL)
511 if (is_original_ap(m_ptr))
513 /* Take note that they are evil */
514 r_ptr->r_flags3 |= (RF3_EVIL);
516 /* Update monster recall window */
517 if (p_ptr->monster_race_idx == m_ptr->r_idx)
519 p_ptr->window |= (PW_MONSTER);
523 /* Repair visibility later */
524 repair_monsters = TRUE;
526 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
527 update_monster(i, FALSE);
533 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
539 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
541 * @return 効力があった場合TRUEを返す
543 bool detect_monsters_nonliving(POSITION range)
549 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
551 for (i = 1; i < current_floor_ptr->m_max; i++)
553 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
554 if (!monster_is_valid(m_ptr)) continue;
559 /* Only detect nearby monsters */
560 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
562 /* Detect non-living monsters */
563 if (!monster_living(m_ptr->r_idx))
565 /* Update monster recall window */
566 if (p_ptr->monster_race_idx == m_ptr->r_idx)
568 p_ptr->window |= (PW_MONSTER);
571 /* Repair visibility later */
572 repair_monsters = TRUE;
574 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
575 update_monster(i, FALSE);
581 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
587 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
589 * @return 効力があった場合TRUEを返す
591 bool detect_monsters_mind(POSITION range)
597 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
599 for (i = 1; i < current_floor_ptr->m_max; i++)
601 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
602 monster_race *r_ptr = &r_info[m_ptr->r_idx];
603 if (!monster_is_valid(m_ptr)) continue;
608 /* Only detect nearby monsters */
609 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
611 /* Detect non-living monsters */
612 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
614 /* Update monster recall window */
615 if (p_ptr->monster_race_idx == m_ptr->r_idx)
617 p_ptr->window |= (PW_MONSTER);
620 /* Repair visibility later */
621 repair_monsters = TRUE;
623 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
624 update_monster(i, FALSE);
630 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
637 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
639 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
640 * @return 効力があった場合TRUEを返す
642 bool detect_monsters_string(POSITION range, concptr Match)
648 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
650 for (i = 1; i < current_floor_ptr->m_max; i++)
652 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
653 monster_race *r_ptr = &r_info[m_ptr->r_idx];
654 if (!monster_is_valid(m_ptr)) continue;
659 /* Only detect nearby monsters */
660 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
662 /* Detect monsters with the same symbol */
663 if (my_strchr(Match, r_ptr->d_char))
665 /* Update monster recall window */
666 if (p_ptr->monster_race_idx == m_ptr->r_idx)
668 p_ptr->window |= (PW_MONSTER);
671 /* Repair visibility later */
672 repair_monsters = TRUE;
674 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
675 update_monster(i, FALSE);
680 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
683 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
689 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
691 * @param match_flag 感知フラグ
692 * @return 効力があった場合TRUEを返す
694 bool detect_monsters_xxx(POSITION range, u32b match_flag)
699 concptr desc_monsters = _("変なモンスター", "weird monsters");
701 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
703 for (i = 1; i < current_floor_ptr->m_max; i++)
705 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
706 monster_race *r_ptr = &r_info[m_ptr->r_idx];
707 if (!monster_is_valid(m_ptr)) continue;
712 /* Only detect nearby monsters */
713 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
715 /* Detect evil monsters */
716 if (r_ptr->flags3 & (match_flag))
718 if (is_original_ap(m_ptr))
720 /* Take note that they are something */
721 r_ptr->r_flags3 |= (match_flag);
723 /* Update monster recall window */
724 if (p_ptr->monster_race_idx == m_ptr->r_idx)
726 p_ptr->window |= (PW_MONSTER);
730 /* Repair visibility later */
731 repair_monsters = TRUE;
733 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
734 update_monster(i, FALSE);
743 desc_monsters = _("デーモン", "demons");
746 desc_monsters = _("アンデッド", "the undead");
750 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
758 * @brief 全感知処理 / Detect everything
760 * @return 効力があった場合TRUEを返す
762 bool detect_all(POSITION range)
766 /* Detect everything */
767 if (detect_traps(range, TRUE)) detect = TRUE;
768 if (detect_doors(range)) detect = TRUE;
769 if (detect_stairs(range)) detect = TRUE;
771 /* There are too many hidden treasure. So... */
772 /* if (detect_treasure(range)) detect = TRUE; */
774 if (detect_objects_gold(range)) detect = TRUE;
775 if (detect_objects_normal(range)) detect = TRUE;
776 if (detect_monsters_invis(range)) detect = TRUE;
777 if (detect_monsters_normal(range)) detect = TRUE;
783 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
786 * @return 効力があった場合TRUEを返す
789 * Note that affected monsters are NOT auto-tracked by this usage.
791 * To avoid misbehavior when monster deaths have side-effects,
792 * this is done in two passes. -- JDL
795 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
799 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
800 bool obvious = FALSE;
802 /* Mark all (nearby) monsters */
803 for (i = 1; i < current_floor_ptr->m_max; i++)
805 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
806 if (!monster_is_valid(m_ptr)) continue;
811 /* Require line of sight */
812 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
814 /* Mark the monster */
815 m_ptr->mflag |= (MFLAG_LOS);
818 /* Affect all marked monsters */
819 for (i = 1; i < current_floor_ptr->m_max; i++)
821 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
823 /* Skip unmarked monsters */
824 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
827 m_ptr->mflag &= ~(MFLAG_LOS);
832 /* Jump directly to the target monster */
833 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
840 * @brief 視界内モンスターを加速する処理 / Speed monsters
841 * @return 効力があった場合TRUEを返す
843 bool speed_monsters(void)
845 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
849 * @brief 視界内モンスターを加速する処理 / Slow monsters
850 * @return 効力があった場合TRUEを返す
852 bool slow_monsters(int power)
854 return (project_all_los(GF_OLD_SLOW, power));
858 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
859 * @return 効力があった場合TRUEを返す
861 bool sleep_monsters(int power)
863 return (project_all_los(GF_OLD_SLEEP, power));
867 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
868 * @return 効力があった場合TRUEを返す
870 bool banish_evil(int dist)
872 return (project_all_los(GF_AWAY_EVIL, dist));
876 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
877 * @return 効力があった場合TRUEを返す
879 bool turn_undead(void)
881 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
883 chg_virtue(V_UNLIFE, -1);
888 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
889 * @return 効力があった場合TRUEを返す
891 bool dispel_undead(HIT_POINT dam)
893 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
895 chg_virtue(V_UNLIFE, -2);
900 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
901 * @return 効力があった場合TRUEを返す
903 bool dispel_evil(HIT_POINT dam)
905 return (project_all_los(GF_DISP_EVIL, dam));
909 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
910 * @return 効力があった場合TRUEを返す
912 bool dispel_good(HIT_POINT dam)
914 return (project_all_los(GF_DISP_GOOD, dam));
918 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
919 * @return 効力があった場合TRUEを返す
921 bool dispel_monsters(HIT_POINT dam)
923 return (project_all_los(GF_DISP_ALL, dam));
926 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
929 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
930 int k = 3 * creature_ptr->lev;
931 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
932 if (set_poisoned(0)) ident = TRUE;
933 if (set_afraid(0)) ident = TRUE;
934 if (hp_player(50)) ident = TRUE;
935 if (set_stun(0)) ident = TRUE;
936 if (set_cut(0)) ident = TRUE;
940 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
942 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
943 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
944 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
945 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))
947 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
953 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
954 * @return 効力があった場合TRUEを返す
956 bool dispel_living(HIT_POINT dam)
958 return (project_all_los(GF_DISP_LIVING, dam));
962 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
963 * @return 効力があった場合TRUEを返す
965 bool dispel_demons(HIT_POINT dam)
967 return (project_all_los(GF_DISP_DEMON, dam));
971 * @brief 視界内のモンスターに「聖戦」効果を与える処理
972 * @return 効力があった場合TRUEを返す
976 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
980 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
981 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
984 void aggravate_monsters(MONSTER_IDX who)
990 /* Aggravate everyone nearby */
991 for (i = 1; i < current_floor_ptr->m_max; i++)
993 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
994 if (!monster_is_valid(m_ptr)) continue;
996 /* Skip aggravating monster (or player) */
997 if (i == who) continue;
999 /* Wake up nearby sleeping monsters */
1000 if (m_ptr->cdis < MAX_SIGHT * 2)
1003 if (MON_CSLEEP(m_ptr))
1005 (void)set_monster_csleep(i, 0);
1008 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1011 /* Speed up monsters in line of sight */
1012 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1016 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1022 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1023 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1024 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1029 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1030 * @param m_idx 抹殺するモンスターID
1031 * @param power 抹殺の威力
1032 * @param player_cast プレイヤーの魔法によるものならば TRUE
1033 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1034 * @param spell_name 抹殺効果を起こした魔法の名前
1035 * @return 効力があった場合TRUEを返す
1037 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1039 int msec = delay_factor * delay_factor * delay_factor;
1040 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1041 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1042 bool resist = FALSE;
1044 if (is_pet(m_ptr) && !player_cast) return FALSE;
1046 /* Hack -- Skip Unique Monsters or Quest Monsters */
1047 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1048 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1049 else if (m_idx == p_ptr->riding) resist = TRUE;
1050 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1051 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1052 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1056 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1058 GAME_TEXT m_name[MAX_NLEN];
1060 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1061 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1064 delete_monster_idx(m_idx);
1067 if (resist && player_cast)
1069 bool see_m = is_seen(m_ptr);
1070 GAME_TEXT m_name[MAX_NLEN];
1072 monster_desc(m_name, m_ptr, 0);
1075 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1077 if (MON_CSLEEP(m_ptr))
1079 (void)set_monster_csleep(m_idx, 0);
1082 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1085 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1089 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1093 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1098 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1101 /* Visual feedback */
1102 move_cursor_relative(p_ptr->y, p_ptr->x);
1104 p_ptr->redraw |= (PR_HP);
1105 p_ptr->window |= (PW_PLAYER);
1110 Term_xtra(TERM_XTRA_DELAY, msec);
1117 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1118 * @param power 抹殺の威力
1119 * @param player_cast プレイヤーの魔法によるものならば TRUE
1120 * @return 効力があった場合TRUEを返す
1122 bool symbol_genocide(int power, bool player_cast)
1126 bool result = FALSE;
1128 /* Prevent genocide in quest levels */
1129 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1131 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1135 /* Mega-Hack -- Get a monster symbol */
1136 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1138 /* Delete the monsters of that "type" */
1139 for (i = 1; i < current_floor_ptr->m_max; i++)
1141 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1142 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1143 if (!monster_is_valid(m_ptr)) continue;
1145 /* Skip "wrong" monsters */
1146 if (r_ptr->d_char != typ) continue;
1148 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1153 chg_virtue(V_VITALITY, -2);
1154 chg_virtue(V_CHANCE, -1);
1162 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1163 * @param power 抹殺の威力
1164 * @param player_cast プレイヤーの魔法によるものならば TRUE
1165 * @return 効力があった場合TRUEを返す
1167 bool mass_genocide(int power, bool player_cast)
1170 bool result = FALSE;
1172 /* Prevent mass genocide in quest levels */
1173 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1178 /* Delete the (nearby) monsters */
1179 for (i = 1; i < current_floor_ptr->m_max; i++)
1181 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1182 if (!monster_is_valid(m_ptr)) continue;
1184 /* Skip distant monsters */
1185 if (m_ptr->cdis > MAX_SIGHT) continue;
1188 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1193 chg_virtue(V_VITALITY, -2);
1194 chg_virtue(V_CHANCE, -1);
1202 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1203 * @param power 抹殺の威力
1204 * @param player_cast プレイヤーの魔法によるものならば TRUE
1205 * @return 効力があった場合TRUEを返す
1207 bool mass_genocide_undead(int power, bool player_cast)
1210 bool result = FALSE;
1212 /* Prevent mass genocide in quest levels */
1213 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1218 /* Delete the (nearby) monsters */
1219 for (i = 1; i < current_floor_ptr->m_max; i++)
1221 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1222 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1223 if (!monster_is_valid(m_ptr)) continue;
1225 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1227 /* Skip distant monsters */
1228 if (m_ptr->cdis > MAX_SIGHT) continue;
1231 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1236 chg_virtue(V_UNLIFE, -2);
1237 chg_virtue(V_CHANCE, -1);
1245 * @brief 周辺モンスターを調査する / Probe nearby monsters
1246 * @return 効力があった場合TRUEを返す
1251 int speed; /* TODO */
1262 /* Probe all (nearby) monsters */
1263 for (i = 1; i < current_floor_ptr->m_max; i++)
1265 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1266 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1267 if (!monster_is_valid(m_ptr)) continue;
1269 /* Require line of sight */
1270 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1272 /* Probe visible monsters */
1275 GAME_TEXT m_name[MAX_NLEN];
1277 /* Start the message */
1280 msg_print(_("調査中...", "Probing..."));
1285 if (!is_original_ap(m_ptr))
1287 if (m_ptr->mflag2 & MFLAG2_KAGE)
1288 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1290 m_ptr->ap_r_idx = m_ptr->r_idx;
1291 lite_spot(m_ptr->fy, m_ptr->fx);
1293 /* Get "the monster" or "something" */
1294 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1296 speed = m_ptr->mspeed - 110;
1297 if (MON_FAST(m_ptr)) speed += 10;
1298 if (MON_SLOW(m_ptr)) speed -= 10;
1299 if (ironman_nightmare) speed += 5;
1301 /* Get the monster's alignment */
1302 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1303 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1304 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1305 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1306 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1307 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1308 else align = _("中立", "neutral");
1310 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1311 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1313 if (r_ptr->next_r_idx)
1315 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1319 strcat(buf, "xxx ");
1322 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1323 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1324 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1325 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1326 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1327 buf[strlen(buf)-1] = '\0';
1330 /* HACK : Add the line to message buffer */
1333 p_ptr->window |= (PW_MESSAGE);
1336 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1339 Term_erase(0, 0, 255);
1341 /* Learn everything about this monster */
1342 if (lore_do_probe(m_ptr->r_idx))
1344 /* Get base name of monster */
1345 strcpy(buf, (r_name + r_ptr->name));
1348 /* Note that we learnt some new flags -Mogami- */
1349 msg_format("%sについてさらに詳しくなった気がする。", buf);
1354 /* Note that we learnt some new flags -Mogami- */
1355 msg_format("You now know more about %s.", buf);
1357 /* Clear -more- prompt */
1372 chg_virtue(V_KNOWLEDGE, 1);
1373 msg_print(_("これで全部です。", "That's all."));
1381 * @brief *破壊*処理を行う / The spell of destruction
1382 * @param y1 破壊の中心Y座標
1383 * @param x1 破壊の中心X座標
1385 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1386 * @return 効力があった場合TRUEを返す
1389 * This spell "deletes" monsters (instead of "killing" them).
1391 * Later we may use one function for both "destruction" and
1392 * "earthquake" by using the "full" to select "destruction".
1395 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1402 /* Prevent destruction of quest levels and town */
1403 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1408 /* Lose monster light */
1409 if (!in_generate) clear_mon_lite();
1411 /* Big area of affect */
1412 for (y = (y1 - r); y <= (y1 + r); y++)
1414 for (x = (x1 - r); x <= (x1 + r); x++)
1416 /* Skip illegal grids */
1417 if (!in_bounds(y, x)) continue;
1419 /* Extract the distance */
1420 k = distance(y1, x1, y, x);
1422 /* Stay in the circle of death */
1423 if (k > r) continue;
1424 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1426 /* Lose room and vault */
1427 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1429 /* Lose light and knowledge */
1430 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1432 if (!in_generate) /* Normal */
1435 g_ptr->info &= ~(CAVE_UNSAFE);
1437 /* Hack -- Notice player affect */
1438 if (player_bold(y, x))
1440 /* Hurt the player later */
1443 /* Do not hurt this grid */
1448 /* Hack -- Skip the epicenter */
1449 if ((y == y1) && (x == x1)) continue;
1453 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1454 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1456 if (in_generate) /* In generation */
1458 /* Delete the monster (if any) */
1459 delete_monster(y, x);
1461 else if (r_ptr->flags1 & RF1_QUESTOR)
1463 /* Heal the monster */
1464 m_ptr->hp = m_ptr->maxhp;
1466 /* Try to teleport away quest monsters */
1467 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1471 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1473 GAME_TEXT m_name[MAX_NLEN];
1475 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1476 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1479 /* Delete the monster (if any) */
1480 delete_monster(y, x);
1484 /* During generation, destroyed artifacts are "preserved" */
1485 if (preserve_mode || in_generate)
1487 OBJECT_IDX this_o_idx, next_o_idx = 0;
1489 /* Scan all objects in the grid */
1490 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1493 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1494 next_o_idx = o_ptr->next_o_idx;
1496 /* Hack -- Preserve unknown artifacts */
1497 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1499 /* Mega-Hack -- Preserve the artifact */
1500 a_info[o_ptr->name1].cur_num = 0;
1502 if (in_generate && cheat_peek)
1504 GAME_TEXT o_name[MAX_NLEN];
1505 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1506 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1509 else if (in_generate && cheat_peek && o_ptr->art_name)
1511 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1512 "One of the random artifacts was *destroyed* during generation."));
1517 delete_object(y, x);
1519 /* Destroy "non-permanent" grids */
1520 if (!cave_perma_grid(g_ptr))
1522 /* Wall (or floor) type */
1525 if (!in_generate) /* Normal */
1529 /* Create granite wall */
1530 cave_set_feat(y, x, feat_granite);
1534 /* Create quartz vein */
1535 cave_set_feat(y, x, feat_quartz_vein);
1539 /* Create magma vein */
1540 cave_set_feat(y, x, feat_magma_vein);
1545 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1548 else /* In generation */
1552 /* Create granite wall */
1553 place_extra_grid(g_ptr);
1557 /* Create quartz vein */
1558 g_ptr->feat = feat_quartz_vein;
1562 /* Create magma vein */
1563 g_ptr->feat = feat_magma_vein;
1568 place_floor_grid(g_ptr);
1571 /* Clear garbage of hidden trap or door */
1580 /* Process "re-glowing" */
1581 for (y = (y1 - r); y <= (y1 + r); y++)
1583 for (x = (x1 - r); x <= (x1 + r); x++)
1585 /* Skip illegal grids */
1586 if (!in_bounds(y, x)) continue;
1588 /* Extract the distance */
1589 k = distance(y1, x1, y, x);
1591 /* Stay in the circle of death */
1592 if (k > r) continue;
1593 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1595 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1596 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1602 for (i = 0; i < 9; i++)
1604 yy = y + ddy_ddd[i];
1605 xx = x + ddx_ddd[i];
1606 if (!in_bounds2(yy, xx)) continue;
1607 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1608 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1610 g_ptr->info |= CAVE_GLOW;
1618 /* Hack -- Affect player */
1621 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1623 /* Blind the player */
1624 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1627 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1633 /* Mega-Hack -- Forget the view and lite */
1634 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1635 p_ptr->redraw |= (PR_MAP);
1636 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1638 if (p_ptr->special_defense & NINJA_S_STEALTH)
1640 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1650 * @brief 地震処理(サブルーチン) /
1651 * Induce an "earthquake" of the given radius at the given location.
1652 * @return 効力があった場合TRUEを返す
1656 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1660 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1662 * The player will take damage and "jump" into a safe grid if possible,
1663 * otherwise, he will "tunnel" through the rubble instantaneously.
1665 * Monsters will take damage, and "jump" into a safe grid if possible,
1666 * otherwise they will be "buried" in the rubble, disappearing from
1667 * the level in the same way that they do when genocided.
1669 * Note that thus the player and monsters (except eaters of walls and
1670 * passers through walls) will never occupy the same grid as a wall.
1671 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1672 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1673 * This has allowed massive simplification of the "monster" code.
1676 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1680 POSITION y, x, yy, xx, dy, dx;
1683 POSITION sy = 0, sx = 0;
1688 /* Prevent destruction of quest levels and town */
1689 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1694 /* Paranoia -- Enforce maximum range */
1697 /* Clear the "maximal blast" area */
1698 for (y = 0; y < 32; y++)
1700 for (x = 0; x < 32; x++)
1706 /* Check around the epicenter */
1707 for (dy = -r; dy <= r; dy++)
1709 for (dx = -r; dx <= r; dx++)
1711 /* Extract the location */
1715 /* Skip illegal grids */
1716 if (!in_bounds(yy, xx)) continue;
1718 /* Skip distant grids */
1719 if (distance(cy, cx, yy, xx) > r) continue;
1720 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1722 /* Lose room and vault / Lose light and knowledge */
1723 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1724 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1726 /* Skip the epicenter */
1727 if (!dx && !dy) continue;
1729 /* Skip most grids */
1730 if (randint0(100) < 85) continue;
1732 /* Damage this grid */
1733 map[16+yy-cy][16+xx-cx] = TRUE;
1735 /* Hack -- Take note of player damage */
1736 if (player_bold(yy, xx)) hurt = TRUE;
1740 /* First, affect the player (if necessary) */
1741 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1743 /* Check around the player */
1744 for (i = 0; i < 8; i++)
1746 y = p_ptr->y + ddy_ddd[i];
1747 x = p_ptr->x + ddx_ddd[i];
1749 /* Skip non-empty grids */
1750 if (!cave_empty_bold(y, x)) continue;
1752 /* Important -- Skip "quake" grids */
1753 if (map[16+y-cy][16+x-cx]) continue;
1755 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1757 /* Count "safe" grids */
1760 /* Randomize choice */
1761 if (randint0(sn) > 0) continue;
1763 /* Save the safe location */
1767 /* Random message */
1768 switch (randint1(3))
1772 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1777 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1782 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1787 /* Hurt the player a lot */
1790 /* Message and damage */
1791 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1795 /* Destroy the grid, and push the player to safety */
1798 /* Calculate results */
1799 switch (randint1(3))
1803 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1809 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1810 damage = damroll(10, 4);
1811 (void)set_stun(p_ptr->stun + randint1(50));
1816 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1817 damage = damroll(10, 4);
1818 (void)set_stun(p_ptr->stun + randint1(50));
1823 /* Move the player to the safe location */
1824 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1827 /* Important -- no wall on player */
1828 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1836 GAME_TEXT m_name[MAX_NLEN];
1837 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1838 monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
1839 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1843 killer = _("地震", "an earthquake");
1846 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1850 /* Examine the quaked region */
1851 for (dy = -r; dy <= r; dy++)
1853 for (dx = -r; dx <= r; dx++)
1855 /* Extract the location */
1859 /* Skip unaffected grids */
1860 if (!map[16+yy-cy][16+xx-cx]) continue;
1861 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1863 if (g_ptr->m_idx == p_ptr->riding) continue;
1865 /* Process monsters */
1868 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1869 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1871 /* Quest monsters */
1872 if (r_ptr->flags1 & RF1_QUESTOR)
1874 /* No wall on quest monsters */
1875 map[16+yy-cy][16+xx-cx] = FALSE;
1880 /* Most monsters cannot co-exist with rock */
1881 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1882 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1884 GAME_TEXT m_name[MAX_NLEN];
1886 /* Assume not safe */
1889 /* Monster can move to escape the wall */
1890 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1892 /* Look for safety */
1893 for (i = 0; i < 8; i++)
1895 y = yy + ddy_ddd[i];
1896 x = xx + ddx_ddd[i];
1898 /* Skip non-empty grids */
1899 if (!cave_empty_bold(y, x)) continue;
1901 /* Hack -- no safety on glyph of warding */
1902 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1903 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1905 /* ... nor on the Pattern */
1906 if (pattern_tile(y, x)) continue;
1908 /* Important -- Skip "quake" grids */
1909 if (map[16+y-cy][16+x-cx]) continue;
1911 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1912 if (player_bold(y, x)) continue;
1914 /* Count "safe" grids */
1917 /* Randomize choice */
1918 if (randint0(sn) > 0) continue;
1920 /* Save the safe grid */
1925 monster_desc(m_name, m_ptr, 0);
1927 /* Scream in pain */
1928 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1930 /* Take damage from the quake */
1931 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1933 /* Monster is certainly awake */
1934 (void)set_monster_csleep(g_ptr->m_idx, 0);
1936 /* Apply damage directly */
1937 m_ptr->hp -= damage;
1939 /* Delete (not kill) "dead" monsters */
1942 if (!ignore_unview || is_seen(m_ptr))
1943 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1947 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)
1949 char m2_name[MAX_NLEN];
1951 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1952 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1956 delete_monster(yy, xx);
1958 /* No longer safe */
1962 /* Hack -- Escape from the rock */
1965 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1967 /* Update the old location */
1968 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1970 /* Update the new location */
1971 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1973 /* Move the monster */
1977 update_monster(m_idx, TRUE);
1986 /* Lose monster light */
1989 /* Examine the quaked region */
1990 for (dy = -r; dy <= r; dy++)
1992 for (dx = -r; dx <= r; dx++)
1994 /* Extract the location */
1998 /* Skip unaffected grids */
1999 if (!map[16+yy-cy][16+xx-cx]) continue;
2001 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2003 /* Paranoia -- never affect player */
2004 /* if (player_bold(yy, xx)) continue; */
2006 /* Destroy location (if valid) */
2007 if (cave_valid_bold(yy, xx))
2009 delete_object(yy, xx);
2011 /* Wall (or floor) type */
2012 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2017 /* Create granite wall */
2018 cave_set_feat(yy, xx, feat_granite);
2024 /* Create quartz vein */
2025 cave_set_feat(yy, xx, feat_quartz_vein);
2031 /* Create magma vein */
2032 cave_set_feat(yy, xx, feat_magma_vein);
2039 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2045 /* Process "re-glowing" */
2046 for (dy = -r; dy <= r; dy++)
2048 for (dx = -r; dx <= r; dx++)
2050 /* Extract the location */
2054 /* Skip illegal grids */
2055 if (!in_bounds(yy, xx)) continue;
2057 /* Skip distant grids */
2058 if (distance(cy, cx, yy, xx) > r) continue;
2059 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2061 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2062 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2068 for (ii = 0; ii < 9; ii++)
2070 yyy = yy + ddy_ddd[ii];
2071 xxx = xx + ddx_ddd[ii];
2072 if (!in_bounds2(yyy, xxx)) continue;
2073 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2074 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2076 g_ptr->info |= CAVE_GLOW;
2084 /* Mega-Hack -- Forget the view and lite */
2085 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2086 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2087 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2089 if (p_ptr->special_defense & NINJA_S_STEALTH)
2091 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2099 * @brief 地震処理(プレイヤーの中心発動) /
2100 * Induce an "earthquake" of the given radius at the given location.
2101 * @return 効力があった場合TRUEを返す
2106 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2108 return earthquake_aux(cy, cx, r, 0);
2115 void discharge_minion(void)
2120 for (i = 1; i < current_floor_ptr->m_max; i++)
2122 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2123 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2124 if (m_ptr->nickname) okay = FALSE;
2126 if (!okay || p_ptr->riding)
2128 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2131 for (i = 1; i < current_floor_ptr->m_max; i++)
2134 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2135 monster_race *r_ptr;
2137 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2138 r_ptr = &r_info[m_ptr->r_idx];
2140 /* Uniques resist discharging */
2141 if (r_ptr->flags1 & RF1_UNIQUE)
2143 GAME_TEXT m_name[MAX_NLEN];
2144 monster_desc(m_name, m_ptr, 0x00);
2145 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2146 delete_monster_idx(i);
2149 dam = m_ptr->maxhp / 2;
2150 if (dam > 100) dam = (dam - 100) / 2 + 100;
2151 if (dam > 400) dam = (dam - 400) / 2 + 400;
2152 if (dam > 800) dam = 800;
2153 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2154 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2156 if (record_named_pet && m_ptr->nickname)
2158 GAME_TEXT m_name[MAX_NLEN];
2160 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2161 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2164 delete_monster_idx(i);
2170 * @brief 部屋全体を照らすサブルーチン
2174 * This routine clears the entire "temp" set.
2175 * This routine will Perma-Lite all "temp" grids.
2176 * This routine is used (only) by "lite_room()"
2177 * Dark grids are illuminated.
2178 * Also, process all affected monsters.
2180 * SMART monsters always wake up when illuminated
2181 * NORMAL monsters wake up 1/4 the time when illuminated
2182 * STUPID monsters wake up 1/10 the time when illuminated
2185 static void cave_temp_room_lite(void)
2189 /* Clear them all */
2190 for (i = 0; i < tmp_pos.n; i++)
2192 POSITION y = tmp_pos.y[i];
2193 POSITION x = tmp_pos.x[i];
2195 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2197 /* No longer in the array */
2198 g_ptr->info &= ~(CAVE_TEMP);
2200 /* Update only non-CAVE_GLOW grids */
2201 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2204 g_ptr->info |= (CAVE_GLOW);
2206 /* Process affected monsters */
2209 PERCENTAGE chance = 25;
2210 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2211 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2212 update_monster(g_ptr->m_idx, FALSE);
2214 /* Stupid monsters rarely wake up */
2215 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2217 /* Smart monsters always wake up */
2218 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2220 /* Sometimes monsters wake up */
2221 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2224 (void)set_monster_csleep(g_ptr->m_idx, 0);
2226 /* Notice the "waking up" */
2229 GAME_TEXT m_name[MAX_NLEN];
2230 monster_desc(m_name, m_ptr, 0);
2231 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2238 update_local_illumination(y, x);
2248 * @brief 部屋全体を暗くするサブルーチン
2252 * This routine clears the entire "temp" set.
2253 * This routine will "darken" all "temp" grids.
2254 * In addition, some of these grids will be "unmarked".
2255 * This routine is used (only) by "unlite_room()"
2256 * Also, process all affected monsters
2259 static void cave_temp_room_unlite(void)
2263 /* Clear them all */
2264 for (i = 0; i < tmp_pos.n; i++)
2266 POSITION y = tmp_pos.y[i];
2267 POSITION x = tmp_pos.x[i];
2270 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2271 bool do_dark = !is_mirror_grid(g_ptr);
2273 /* No longer in the array */
2274 g_ptr->info &= ~(CAVE_TEMP);
2276 /* Darken the grid */
2279 if (current_floor_ptr->dun_level || !is_daytime())
2281 for (j = 0; j < 9; j++)
2283 POSITION by = y + ddy_ddd[j];
2284 POSITION bx = x + ddx_ddd[j];
2286 if (in_bounds2(by, bx))
2288 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2290 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2298 if (!do_dark) continue;
2301 g_ptr->info &= ~(CAVE_GLOW);
2303 /* Hack -- Forget "boring" grids */
2304 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2306 /* Forget the grid */
2307 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2311 /* Process affected monsters */
2314 update_monster(g_ptr->m_idx, FALSE);
2318 update_local_illumination(y, x);
2328 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2331 * @param pass_bold 地形条件を返す関数ポインタ
2334 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2341 for (i = 0; i < 16; i++)
2343 y = cy + ddy_cdd[i % 8];
2344 x = cx + ddx_cdd[i % 8];
2346 /* Found a wall, break the length */
2347 if (!pass_bold(y, x))
2349 /* Track best length */
2363 return (MAX(len, blen));
2367 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2370 * @param pass_bold 地形条件を返す関数ポインタ
2373 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2379 for (i = 0; i < 8; i++)
2381 y = cy + ddy_ddd[i];
2382 x = cx + ddx_ddd[i];
2384 if (!pass_bold(y, x)) c++;
2392 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2393 * @param y 部屋内のy座標1点
2394 * @param x 部屋内のx座標1点
2395 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2396 * @param pass_bold 地形条件を返す関数ポインタ
2399 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2402 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2404 /* Avoid infinite recursion */
2405 if (g_ptr->info & (CAVE_TEMP)) return;
2407 /* Do not "leave" the current room */
2408 if (!(g_ptr->info & (CAVE_ROOM)))
2410 if (only_room) return;
2413 if (!in_bounds2(y, x)) return;
2415 /* Do not exceed the maximum spell range */
2416 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2418 /* Verify this grid */
2420 * The reason why it is ==6 instead of >5 is that 8 is impossible
2421 * due to the check for cave_bold above.
2422 * 7 lights dead-end corridors (you need to do this for the
2423 * checkboard interesting rooms, so that the boundary is lit
2425 * This leaves only a check for 6 bounding walls!
2427 if (in_bounds(y, x) && pass_bold(y, x) &&
2428 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2431 /* Paranoia -- verify space */
2432 if (tmp_pos.n == TEMP_MAX) return;
2434 /* Mark the grid as "seen" */
2435 g_ptr->info |= (CAVE_TEMP);
2437 /* Add it to the "seen" set */
2438 tmp_pos.y[tmp_pos.n] = y;
2439 tmp_pos.x[tmp_pos.n] = x;
2444 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2447 * @return 光を通すならばtrueを返す。
2449 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2451 return cave_los_bold(y, x);
2455 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2460 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2462 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2466 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2469 * @return 射線を通すならばtrueを返す。
2471 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2473 return cave_have_flag_bold(y, x, FF_PROJECT);
2478 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2483 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2485 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2490 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2495 void lite_room(POSITION y1, POSITION x1)
2500 /* Add the initial grid */
2501 cave_temp_lite_room_aux(y1, x1);
2503 /* While grids are in the queue, add their neighbors */
2504 for (i = 0; i < tmp_pos.n; i++)
2506 x = tmp_pos.x[i], y = tmp_pos.y[i];
2508 /* Walls get lit, but stop light */
2509 if (!cave_pass_lite_bold(y, x)) continue;
2511 /* Spread adjacent */
2512 cave_temp_lite_room_aux(y + 1, x);
2513 cave_temp_lite_room_aux(y - 1, x);
2514 cave_temp_lite_room_aux(y, x + 1);
2515 cave_temp_lite_room_aux(y, x - 1);
2517 /* Spread diagonal */
2518 cave_temp_lite_room_aux(y + 1, x + 1);
2519 cave_temp_lite_room_aux(y - 1, x - 1);
2520 cave_temp_lite_room_aux(y - 1, x + 1);
2521 cave_temp_lite_room_aux(y + 1, x - 1);
2524 /* Now, lite them all up at once */
2525 cave_temp_room_lite();
2527 if (p_ptr->special_defense & NINJA_S_STEALTH)
2529 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2535 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2540 void unlite_room(POSITION y1, POSITION x1)
2545 /* Add the initial grid */
2546 cave_temp_unlite_room_aux(y1, x1);
2548 /* Spread, breadth first */
2549 for (i = 0; i < tmp_pos.n; i++)
2551 x = tmp_pos.x[i], y = tmp_pos.y[i];
2553 /* Walls get dark, but stop darkness */
2554 if (!cave_pass_dark_bold(y, x)) continue;
2556 /* Spread adjacent */
2557 cave_temp_unlite_room_aux(y + 1, x);
2558 cave_temp_unlite_room_aux(y - 1, x);
2559 cave_temp_unlite_room_aux(y, x + 1);
2560 cave_temp_unlite_room_aux(y, x - 1);
2562 /* Spread diagonal */
2563 cave_temp_unlite_room_aux(y + 1, x + 1);
2564 cave_temp_unlite_room_aux(y - 1, x - 1);
2565 cave_temp_unlite_room_aux(y - 1, x + 1);
2566 cave_temp_unlite_room_aux(y + 1, x - 1);
2569 /* Now, darken them all at once */
2570 cave_temp_room_unlite();
2573 bool starlight(bool magic)
2575 HIT_POINT num = damroll(5, 3);
2576 POSITION y = 0, x = 0;
2580 if (!p_ptr->blind && !magic)
2582 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2584 for (k = 0; k < num; k++)
2590 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2591 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2592 if (!player_bold(y, x)) break;
2595 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2596 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2604 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2607 * @return 作用が実際にあった場合TRUEを返す
2609 bool lite_area(HIT_POINT dam, POSITION rad)
2611 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2613 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2615 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2621 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2624 /* Hook into the "project()" function */
2625 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2627 lite_room(p_ptr->y, p_ptr->x);
2635 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2638 * @return 作用が実際にあった場合TRUEを返す
2640 bool unlite_area(HIT_POINT dam, POSITION rad)
2642 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2646 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2649 /* Hook into the "project()" function */
2650 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2652 unlite_room(p_ptr->y, p_ptr->x);
2661 * @brief ボール系スペルの発動 / Cast a ball spell
2663 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2666 * @return 作用が実際にあった場合TRUEを返す
2669 * Stop if we hit a monster, act as a "ball"
2670 * Allow "target" mode to pass over monsters
2671 * Affect grids, objects, and monsters
2674 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2678 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2680 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2681 /* Use the given direction */
2682 tx = p_ptr->x + 99 * ddx[dir];
2683 ty = p_ptr->y + 99 * ddy[dir];
2685 /* Hack -- Use an actual "target" */
2686 if ((dir == 5) && target_okay())
2688 flg &= ~(PROJECT_STOP);
2693 /* Analyze the "dir" and the "target". Hurt items on floor. */
2694 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2698 * @brief ブレス系スペルの発動 / Cast a breath spell
2700 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2703 * @return 作用が実際にあった場合TRUEを返す
2706 * Stop if we hit a monster, act as a "ball"
2707 * Allow "target" mode to pass over monsters
2708 * Affect grids, objects, and monsters
2711 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2713 return fire_ball(typ, dir, dam, -rad);
2718 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2720 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2723 * @return 作用が実際にあった場合TRUEを返す
2726 * Stop if we hit a monster, act as a "ball"
2727 * Allow "target" mode to pass over monsters
2728 * Affect grids, objects, and monsters
2731 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2734 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2736 /* Use the given direction */
2737 tx = p_ptr->x + 99 * ddx[dir];
2738 ty = p_ptr->y + 99 * ddy[dir];
2740 /* Hack -- Use an actual "target" */
2741 if ((dir == 5) && target_okay())
2747 /* Analyze the "dir" and the "target". Hurt items on floor. */
2748 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2753 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2755 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2758 * @return 作用が実際にあった場合TRUEを返す
2761 * Stop if we hit a monster, act as a "ball"
2762 * Allow "target" mode to pass over monsters
2763 * Affect grids, objects, and monsters
2766 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2769 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2771 /* Use the given direction */
2772 tx = p_ptr->x + 99 * ddx[dir];
2773 ty = p_ptr->y + 99 * ddy[dir];
2775 /* Hack -- Use an actual "target" */
2776 if ((dir == 5) && target_okay())
2778 flg &= ~(PROJECT_STOP);
2783 /* Analyze the "dir" and the "target". Hurt items on floor. */
2784 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2789 * @brief メテオ系スペルの発動 / Cast a meteor spell
2790 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2796 * @return 作用が実際にあった場合TRUEを返す
2799 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2800 * player, or outside source, that starts out at an arbitrary location, and
2801 * leaving no trail from the "caster" to the target. This function is
2802 * especially useful for bombardments and similar. -LM-
2803 * Option to hurt the player.
2806 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2808 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2810 /* Analyze the "target" and the caster. */
2811 return (project(who, rad, y, x, dam, typ, flg, -1));
2816 * @brief ブラスト系スペルの発動 / Cast a blast spell
2818 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2823 * @return 作用が実際にあった場合TRUEを返す
2825 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2829 POSITION ty, tx, y, x;
2832 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2837 /* Use the given direction */
2840 ly = ty = p_ptr->y + 20 * ddy[dir];
2841 lx = tx = p_ptr->x + 20 * ddx[dir];
2844 /* Use an actual "target" */
2845 else /* if (dir == 5) */
2850 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2851 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2854 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2857 for (i = 0; i < num; i++)
2861 /* Get targets for some bolts */
2862 y = rand_spread(ly, ld * dev / 20);
2863 x = rand_spread(lx, ld * dev / 20);
2865 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2868 /* Analyze the "dir" and the "target". */
2869 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2880 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2881 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2882 * @return 作用が実際にあった場合TRUEを返す
2884 bool teleport_swap(DIRECTION dir)
2888 monster_type* m_ptr;
2889 monster_race* r_ptr;
2891 if ((dir == 5) && target_okay())
2898 tx = p_ptr->x + ddx[dir];
2899 ty = p_ptr->y + ddy[dir];
2901 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2903 if (p_ptr->anti_tele)
2905 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2909 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2911 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2915 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2917 msg_print(_("失敗した。", "Failed to swap."));
2921 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2922 r_ptr = &r_info[m_ptr->r_idx];
2924 (void)set_monster_csleep(g_ptr->m_idx, 0);
2926 if (r_ptr->flagsr & RFR_RES_TELE)
2928 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2929 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2933 sound(SOUND_TELEPORT);
2935 /* Swap the player and monster */
2936 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2944 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2946 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2949 * @return 作用が実際にあった場合TRUEを返す
2951 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2955 /* Pass through the target if needed */
2956 flg |= (PROJECT_THRU);
2958 /* Use the given direction */
2959 tx = p_ptr->x + ddx[dir];
2960 ty = p_ptr->y + ddy[dir];
2962 /* Hack -- Use an actual "target" */
2963 if ((dir == 5) && target_okay())
2969 /* Analyze the "dir" and the "target", do NOT explode */
2970 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2975 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2977 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2979 * @return 作用が実際にあった場合TRUEを返す
2982 * Stop if we hit a monster, as a "bolt".
2983 * Affect monsters and grids (not objects).
2986 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2988 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2989 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2990 return (project_hook(typ, dir, dam, flg));
2995 * @brief ビーム系スペルの発動 / Cast a beam spell.
2997 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2999 * @return 作用が実際にあった場合TRUEを返す
3002 * Pass through monsters, as a "beam".
3003 * Affect monsters, grids and objects.
3006 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3008 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3009 return (project_hook(typ, dir, dam, flg));
3014 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3015 * @param prob ビーム化する確率(%)
3017 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3019 * @return 作用が実際にあった場合TRUEを返す
3022 * Pass through monsters, as a "beam".
3023 * Affect monsters, grids and objects.
3026 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3028 if (randint0(100) < prob)
3030 return (fire_beam(typ, dir, dam));
3034 return (fire_bolt(typ, dir, dam));
3039 * @brief LITE_WEAK属性による光源ビーム処理
3040 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3042 * @return 作用が実際にあった場合TRUEを返す
3044 bool lite_line(DIRECTION dir, HIT_POINT dam)
3046 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3047 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3052 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3054 * @return 作用が実際にあった場合TRUEを返す
3056 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3058 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3059 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3064 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3066 * @return 作用が実際にあった場合TRUEを返す
3068 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3070 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3071 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3076 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3077 * @return 作用が実際にあった場合TRUEを返す
3079 bool wizard_lock(DIRECTION dir)
3081 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3082 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3087 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3088 * @return 作用が実際にあった場合TRUEを返す
3090 bool destroy_door(DIRECTION dir)
3092 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3093 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3098 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3099 * @return 作用が実際にあった場合TRUEを返す
3101 bool disarm_trap(DIRECTION dir)
3103 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3104 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3110 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3111 * @param plev プレイヤーレベル(効力はplev*200)
3112 * @return 作用が実際にあった場合TRUEを返す
3114 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3116 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3117 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3121 * @brief モンスター用テレポート処理
3122 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3123 * @param distance 移動距離
3124 * @return 作用が実際にあった場合TRUEを返す
3126 bool teleport_monster(DIRECTION dir, int distance)
3128 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3129 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3133 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3134 * @return 作用が実際にあった場合TRUEを返す
3136 bool door_creation(void)
3138 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3139 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3143 * @brief トラップ生成処理(起点から周囲1マス)
3146 * @return 作用が実際にあった場合TRUEを返す
3148 bool trap_creation(POSITION y, POSITION x)
3150 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3151 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3155 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3156 * @return 作用が実際にあった場合TRUEを返す
3158 bool tree_creation(void)
3160 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3161 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3165 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3166 * @return 作用が実際にあった場合TRUEを返す
3168 bool glyph_creation(void)
3170 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3171 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3175 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3176 * @return 作用が実際にあった場合TRUEを返す
3178 bool wall_stone(void)
3180 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3181 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3182 p_ptr->update |= (PU_FLOW);
3183 p_ptr->redraw |= (PR_MAP);
3188 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3189 * @return 作用が実際にあった場合TRUEを返す
3191 bool destroy_doors_touch(void)
3193 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3194 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3198 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3199 * @return 作用が実際にあった場合TRUEを返す
3201 bool disarm_traps_touch(void)
3203 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3204 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3208 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3209 * @return 作用が実際にあった場合TRUEを返す
3211 bool sleep_monsters_touch(void)
3213 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3214 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3219 * @brief 死者復活処理(起点より周囲5マス)
3220 * @param who 術者モンスターID(0ならばプレイヤー)
3223 * @return 作用が実際にあった場合TRUEを返す
3225 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3227 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3228 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3233 * @return 作用が実際にあった場合TRUEを返す
3235 void call_chaos(void)
3237 int Chaos_type, dummy, dir;
3238 PLAYER_LEVEL plev = p_ptr->lev;
3239 bool line_chaos = FALSE;
3241 int hurt_types[31] =
3243 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3244 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3245 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3246 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3247 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3248 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3249 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3250 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3253 Chaos_type = hurt_types[randint0(31)];
3254 if (one_in_(4)) line_chaos = TRUE;
3258 for (dummy = 1; dummy < 10; dummy++)
3263 fire_beam(Chaos_type, dummy, 150);
3265 fire_ball(Chaos_type, dummy, 150, 2);
3269 else if (one_in_(3))
3271 fire_ball(Chaos_type, 0, 500, 8);
3275 if (!get_aim_dir(&dir)) return;
3277 fire_beam(Chaos_type, dir, 250);
3279 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3284 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3285 * @param stop_ty 再帰処理停止フラグ
3287 * @return 作用が実際にあった場合TRUEを返す
3290 * rr9: Stop the nasty things when a Cyberdemon is summoned
3291 * or the player gets paralyzed.
3294 bool activate_ty_curse(bool stop_ty, int *count)
3297 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3301 switch (randint1(34))
3306 msg_print(_("地面が揺れた...", "The ground trembles..."));
3307 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3308 if (!one_in_(6)) break;
3313 HIT_POINT dam = damroll(10, 10);
3314 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3315 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3316 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3317 if (!one_in_(6)) break;
3322 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3323 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3324 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3325 if (!one_in_(6)) break;
3328 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3332 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3333 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3335 if (!one_in_(6)) break;
3336 case 1: case 2: case 3: case 16: case 17:
3337 aggravate_monsters(0);
3338 if (!one_in_(6)) break;
3339 case 4: case 5: case 6:
3340 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3341 if (!one_in_(6)) break;
3342 case 7: case 8: case 9: case 18:
3343 (*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));
3344 if (!one_in_(6)) break;
3345 case 10: case 11: case 12:
3346 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3347 lose_exp(p_ptr->exp / 16);
3348 if (!one_in_(6)) break;
3349 case 13: case 14: case 15: case 19: case 20:
3350 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3356 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3357 if (p_ptr->free_act)
3358 set_paralyzed(p_ptr->paralyzed + randint1(3));
3360 set_paralyzed(p_ptr->paralyzed + randint1(13));
3363 if (!one_in_(6)) break;
3364 case 21: case 22: case 23:
3365 (void)do_dec_stat(randint0(6));
3366 if (!one_in_(6)) break;
3368 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3370 if (!one_in_(6)) break;
3373 * Only summon Cyberdemons deep in the dungeon.
3375 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3377 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3381 if (!one_in_(6)) break;
3387 (void)do_dec_stat(i);
3395 while (one_in_(3) && !stop_ty);
3401 * @brief HI_SUMMON(上級召喚)処理発動
3404 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3405 * @return 作用が実際にあった場合TRUEを返す
3407 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3412 BIT_FLAGS mode = PM_ALLOW_GROUP;
3419 mode |= PM_FORCE_FRIENDLY;
3423 mode |= PM_FORCE_PET;
3428 if (!pet) mode |= PM_NO_PET;
3430 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3432 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3434 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3437 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3440 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3443 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3446 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3449 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3452 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3455 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3458 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3462 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3466 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3469 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3470 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3473 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3474 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3477 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3480 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3481 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3489 * @brief 周辺破壊効果(プレイヤー中心)
3490 * @return 作用が実際にあった場合TRUEを返す
3492 void wall_breaker(void)
3495 POSITION y = 0, x = 0;
3496 int attempts = 1000;
3498 if (randint1(80 + p_ptr->lev) < 70)
3502 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3504 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3506 if (!player_bold(y, x)) break;
3509 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3510 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3512 else if (randint1(100) > 30)
3514 earthquake(p_ptr->y, p_ptr->x, 1);
3518 int num = damroll(5, 3);
3520 for (i = 0; i < num; i++)
3524 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3526 if (!player_bold(y, x)) break;
3529 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3530 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3537 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3539 * @return 作用が実際にあった場合TRUEを返す
3541 bool confuse_monsters(HIT_POINT dam)
3543 return (project_all_los(GF_OLD_CONF, dam));
3548 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3550 * @return 作用が実際にあった場合TRUEを返す
3552 bool charm_monsters(HIT_POINT dam)
3554 return (project_all_los(GF_CHARM, dam));
3559 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3561 * @return 作用が実際にあった場合TRUEを返す
3563 bool charm_animals(HIT_POINT dam)
3565 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3570 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3572 * @return 作用が実際にあった場合TRUEを返す
3574 bool stun_monsters(HIT_POINT dam)
3576 return (project_all_los(GF_STUN, dam));
3581 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3583 * @return 作用が実際にあった場合TRUEを返す
3585 bool stasis_monsters(HIT_POINT dam)
3587 return (project_all_los(GF_STASIS, dam));
3592 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3594 * @return 作用が実際にあった場合TRUEを返す
3596 bool mindblast_monsters(HIT_POINT dam)
3598 return (project_all_los(GF_PSI, dam));
3603 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3604 * @param dist 効力(距離)
3605 * @return 作用が実際にあった場合TRUEを返す
3607 bool banish_monsters(int dist)
3609 return (project_all_los(GF_AWAY_ALL, dist));
3614 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3616 * @return 作用が実際にあった場合TRUEを返す
3618 bool turn_evil(HIT_POINT dam)
3620 return (project_all_los(GF_TURN_EVIL, dam));
3625 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3627 * @return 作用が実際にあった場合TRUEを返す
3629 bool turn_monsters(HIT_POINT dam)
3631 return (project_all_los(GF_TURN_ALL, dam));
3636 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3637 * @return 作用が実際にあった場合TRUEを返す
3639 bool deathray_monsters(void)
3641 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3645 * @brief チャーム・モンスター(1体)
3646 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3648 * @return 作用が実際にあった場合TRUEを返す
3650 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3652 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3653 return (project_hook(GF_CHARM, dir, plev, flg));
3657 * @brief アンデッド支配(1体)
3658 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3660 * @return 作用が実際にあった場合TRUEを返す
3662 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3664 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3665 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3670 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3672 * @return 作用が実際にあった場合TRUEを返す
3674 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3676 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3677 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3682 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3684 * @return 作用が実際にあった場合TRUEを返す
3686 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3688 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3689 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3695 * @param success 判定成功上の処理ならばTRUE
3696 * @return 作用が実際にあった場合TRUEを返す
3698 bool kawarimi(bool success)
3701 object_type *q_ptr = &forge;
3704 if (p_ptr->is_dead) return FALSE;
3705 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3706 if (randint0(200) < p_ptr->stun) return FALSE;
3708 if (!success && one_in_(3))
3710 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3711 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3712 p_ptr->redraw |= (PR_STATUS);
3719 teleport_player(10 + randint1(90), 0L);
3721 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3723 q_ptr->pval = MON_NINJA;
3724 (void)drop_near(q_ptr, -1, y, x);
3726 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3727 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3729 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3730 p_ptr->redraw |= (PR_STATUS);
3738 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3739 * @param mdeath 目標モンスターが死亡したかを返す
3740 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3742 bool rush_attack(bool *mdeath)
3749 bool tmp_mdeath = FALSE;
3752 if (mdeath) *mdeath = FALSE;
3755 if (!get_aim_dir(&dir)) return FALSE;
3757 /* Use the given direction */
3758 tx = p_ptr->x + project_length * ddx[dir];
3759 ty = p_ptr->y + project_length * ddy[dir];
3761 /* Hack -- Use an actual "target" */
3762 if ((dir == 5) && target_okay())
3768 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3770 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3773 /* No need to move */
3774 if (!path_n) return TRUE;
3776 /* Use ty and tx as to-move point */
3780 /* Project along the path */
3781 for (i = 0; i < path_n; i++)
3783 monster_type *m_ptr;
3785 int ny = GRID_Y(path_g[i]);
3786 int nx = GRID_X(path_g[i]);
3788 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3793 /* Go to next grid */
3797 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3801 msg_print(_("失敗!", "Failed!"));
3805 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3812 /* Move player before updating the monster */
3813 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3814 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3816 /* Found a monster */
3817 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3819 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3822 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3824 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3827 else if (!player_bold(ty, tx))
3829 /* Hold the monster name */
3830 GAME_TEXT m_name[MAX_NLEN];
3832 /* Get the monster name (BEFORE polymorphing) */
3833 monster_desc(m_name, m_ptr, 0);
3834 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3837 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3839 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3844 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3846 if (mdeath) *mdeath = tmp_mdeath;
3852 * @brief 全鏡の消去 / Remove all mirrors in this floor
3853 * @param explode 爆発処理を伴うならばTRUE
3856 void remove_all_mirrors(bool explode)
3860 for (x = 0; x < current_floor_ptr->width; x++)
3862 for (y = 0; y < current_floor_ptr->height; y++)
3864 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3866 remove_mirror(y, x);
3868 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3869 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3876 * @brief 『一つの指輪』の効果処理 /
3877 * Hack -- activate the ring of power
3878 * @param dir 発動の方向ID
3881 void ring_of_power(DIRECTION dir)
3883 /* Pick a random effect */
3884 switch (randint1(10))
3889 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3892 /* Decrease all stats (permanently) */
3893 (void)dec_stat(A_STR, 50, TRUE);
3894 (void)dec_stat(A_INT, 50, TRUE);
3895 (void)dec_stat(A_WIS, 50, TRUE);
3896 (void)dec_stat(A_DEX, 50, TRUE);
3897 (void)dec_stat(A_CON, 50, TRUE);
3898 (void)dec_stat(A_CHR, 50, TRUE);
3900 /* Lose some experience (permanently) */
3901 p_ptr->exp -= (p_ptr->exp / 4);
3902 p_ptr->max_exp -= (p_ptr->exp / 4);
3910 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3911 dispel_monsters(1000);
3919 fire_ball(GF_MANA, dir, 600, 3);
3928 fire_bolt(GF_MANA, dir, 500);
3935 * @brief 運命の輪、並びにカオス的な効果の発動
3936 * @param spell ランダムな効果を選択するための基準ID
3939 void wild_magic(int spell)
3942 int type = SUMMON_MOLD + randint0(6);
3944 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3945 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3947 switch (randint1(spell) + randint1(8) + 1)
3952 teleport_player(10, TELEPORT_PASSIVE);
3957 teleport_player(100, TELEPORT_PASSIVE);
3961 teleport_player(200, TELEPORT_PASSIVE);
3971 lite_area(damroll(2, 3), 2);
3974 destroy_doors_touch();
3979 sleep_monsters_touch();
3983 trap_creation(p_ptr->y, p_ptr->x);
3992 aggravate_monsters(0);
3995 earthquake(p_ptr->y, p_ptr->x, 5);
3999 (void)gain_mutation(p_ptr, 0);
4003 apply_disenchant(1);
4009 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4016 while (counter++ < 8)
4018 (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4023 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4026 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4031 (void)activate_ty_curse(FALSE, &count);
4040 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4041 * / Drop 10+1d10 meteor ball at random places near the player
4046 void cast_meteor(HIT_POINT dam, POSITION rad)
4049 int b = 10 + randint1(10);
4051 for (i = 0; i < b; i++)
4053 POSITION y = 0, x = 0;
4056 for (count = 0; count <= 20; count++)
4060 x = p_ptr->x - 8 + randint0(17);
4061 y = p_ptr->y - 8 + randint0(17);
4063 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4064 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4066 /* Approximate distance */
4067 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4069 if (d >= 9) continue;
4071 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4072 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4074 /* Valid position */
4078 if (count > 20) continue;
4080 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4086 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4089 * @return ターゲットを指定し、実行したならばTRUEを返す。
4091 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4093 POSITION x, y, tx, ty;
4097 int b = 10 + randint1(10);
4099 if (!get_aim_dir(&dir)) return FALSE;
4101 /* Use the given direction */
4102 tx = p_ptr->x + 99 * ddx[dir];
4103 ty = p_ptr->y + 99 * ddy[dir];
4105 /* Hack -- Use an actual "target" */
4106 if ((dir == 5) && target_okay())
4117 /* Hack -- Stop at the target */
4118 if ((y == ty) && (x == tx)) break;
4122 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4124 /* Stop at maximum range */
4125 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4127 /* Stopped by walls/doors */
4128 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4130 /* Stopped by monsters */
4131 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4133 /* Save the new location */
4140 for (i = 0; i < b; i++)
4142 int count = 20, d = 0;
4148 x = tx - 5 + randint0(11);
4149 y = ty - 5 + randint0(11);
4151 dx = (tx > x) ? (tx - x) : (x - tx);
4152 dy = (ty > y) ? (ty - y) : (y - ty);
4154 /* Approximate distance */
4155 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4156 /* Within the radius */
4160 if (count < 0) continue;
4162 /* Cannot penetrate perm walls */
4163 if (!in_bounds(y, x) ||
4164 cave_stop_disintegration(y, x) ||
4165 !in_disintegration_range(ty, tx, y, x))
4168 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4175 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4179 * This spell should become more useful (more controlled) as the\n
4180 * player gains experience levels. Thus, add 1/5 of the player's\n
4181 * level to the die roll. This eliminates the worst effects later on,\n
4182 * while keeping the results quite random. It also allows some potent\n
4183 * effects only at high level.
4185 void cast_wonder(DIRECTION dir)
4187 PLAYER_LEVEL plev = p_ptr->lev;
4188 int die = randint1(100) + plev / 5;
4189 int vir = virtue_number(V_CHANCE);
4193 if (p_ptr->virtues[vir - 1] > 0)
4195 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4199 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4204 chg_virtue(V_CHANCE, 1);
4208 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4211 if (die < 8) clone_monster(dir);
4212 else if (die < 14) speed_monster(dir, plev);
4213 else if (die < 26) heal_monster(dir, damroll(4, 6));
4214 else if (die < 31) poly_monster(dir, plev);
4216 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4217 damroll(3 + ((plev - 1) / 5), 4));
4218 else if (die < 41) confuse_monster(dir, plev);
4219 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4220 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4222 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4223 damroll(3 + ((plev - 5) / 4), 8));
4225 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4226 damroll(5 + ((plev - 5) / 4), 8));
4228 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4229 damroll(6 + ((plev - 5) / 4), 8));
4231 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4232 damroll(8 + ((plev - 5) / 4), 8));
4233 else if (die < 76) hypodynamic_bolt(dir, 75);
4234 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4235 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4236 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4237 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4238 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4241 earthquake(p_ptr->y, p_ptr->x, 12);
4245 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4249 symbol_genocide(plev + 50, TRUE);
4251 else if (die < 110) dispel_monsters(120);
4254 dispel_monsters(150);
4255 slow_monsters(plev);
4256 sleep_monsters(plev);
4263 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4267 void cast_invoke_spirits(DIRECTION dir)
4269 PLAYER_LEVEL plev = p_ptr->lev;
4270 int die = randint1(100) + plev / 5;
4271 int vir = virtue_number(V_CHANCE);
4275 if (p_ptr->virtues[vir - 1] > 0)
4277 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4281 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4285 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4287 chg_virtue(V_CHANCE, 1);
4291 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4296 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4297 "Oh no! Mouldering forms rise from the earth around you!"));
4299 (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));
4300 chg_virtue(V_UNLIFE, 1);
4304 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4306 set_afraid(p_ptr->afraid + randint1(4) + 4);
4310 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4311 "Your head is invaded by a horde of gibbering spectral voices..."));
4313 set_confused(p_ptr->confused + randint1(4) + 4);
4317 poly_monster(dir, plev);
4321 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4322 damroll(3 + ((plev - 1) / 5), 4));
4326 confuse_monster(dir, plev);
4330 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4334 (void)lite_line(dir, damroll(6, 8));
4338 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4339 damroll(3 + ((plev - 5) / 4), 8));
4343 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4344 damroll(5 + ((plev - 5) / 4), 8));
4348 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4349 damroll(6 + ((plev - 5) / 4), 8));
4353 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4354 damroll(8 + ((plev - 5) / 4), 8));
4358 hypodynamic_bolt(dir, 75);
4362 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4366 fire_ball(GF_ACID, dir, 40 + plev, 2);
4370 fire_ball(GF_ICE, dir, 70 + plev, 3);
4374 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4378 hypodynamic_bolt(dir, 100 + plev);
4382 earthquake(p_ptr->y, p_ptr->x, 12);
4386 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4390 symbol_genocide(plev + 50, TRUE);
4394 dispel_monsters(120);
4398 dispel_monsters(150);
4399 slow_monsters(plev);
4400 sleep_monsters(plev);
4406 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4407 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4412 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4415 void cast_shuffle(void)
4417 PLAYER_LEVEL plev = p_ptr->lev;
4420 int vir = virtue_number(V_CHANCE);
4423 /* Card sharks and high mages get a level bonus */
4424 if ((p_ptr->pclass == CLASS_ROGUE) ||
4425 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4426 (p_ptr->pclass == CLASS_SORCERER))
4427 die = (randint1(110)) + plev / 5;
4429 die = randint1(120);
4434 if (p_ptr->virtues[vir - 1] > 0)
4436 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4440 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4444 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4447 chg_virtue(V_CHANCE, 1);
4451 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4453 for (i = 0; i < randint1(3); i++)
4454 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4458 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4459 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));
4464 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4465 activate_ty_curse(FALSE, &count);
4469 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4470 aggravate_monsters(0);
4474 msg_print(_("《愚者》だ。", "It's the Fool."));
4480 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4481 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);
4485 msg_print(_("《月》だ。", "It's the Moon."));
4490 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4491 wild_magic(randint0(32));
4495 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4496 teleport_player(10, TELEPORT_PASSIVE);
4500 msg_print(_("《正義》だ。", "It's Justice."));
4501 set_blessed(p_ptr->lev, FALSE);
4505 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4506 teleport_player(100, TELEPORT_PASSIVE);
4510 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4511 teleport_player(200, TELEPORT_PASSIVE);
4515 msg_print(_("《塔》だ。", "It's the Tower."));
4520 msg_print(_("《節制》だ。", "It's Temperance."));
4521 sleep_monsters_touch();
4525 msg_print(_("《塔》だ。", "It's the Tower."));
4527 earthquake(p_ptr->y, p_ptr->x, 5);
4531 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4532 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4536 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4537 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4541 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4542 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4546 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4547 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4551 msg_print(_("《恋人》だ。", "It's the Lovers."));
4553 if (get_aim_dir(&dir))
4554 charm_monster(dir, MIN(p_ptr->lev, 20));
4558 msg_print(_("《隠者》だ。", "It's the Hermit."));
4563 msg_print(_("《審判》だ。", "It's the Judgement."));
4564 roll_hitdice(p_ptr, 0L);
4565 lose_all_mutations();
4569 msg_print(_("《太陽》だ。", "It's the Sun."));
4570 chg_virtue(V_KNOWLEDGE, 1);
4571 chg_virtue(V_ENLIGHTEN, 1);
4576 msg_print(_("《世界》だ。", "It's the World."));
4577 if (p_ptr->exp < PY_MAX_EXP)
4579 s32b ee = (p_ptr->exp / 25) + 1;
4580 if (ee > 5000) ee = 5000;
4581 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4588 * @brief 口を使う継続的な処理を中断する
4591 void stop_mouth(void)
4593 if (music_singing_any()) stop_singing(p_ptr);
4594 if (hex_spelling_any()) stop_hex_spell_all();
4598 bool_hack vampirism(void)
4605 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4607 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4611 /* Only works on adjacent monsters */
4612 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4613 y = p_ptr->y + ddy[dir];
4614 x = p_ptr->x + ddx[dir];
4615 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4619 if (!(g_ptr->m_idx))
4621 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4625 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4627 dummy = p_ptr->lev * 2;
4629 if (hypodynamic_bolt(dir, dummy))
4631 if (p_ptr->food < PY_FOOD_FULL)
4632 /* No heal if we are "full" */
4633 (void)hp_player(dummy);
4635 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4637 /* Gain nutritional sustenance: 150/hp drained */
4638 /* A Food ration gives 5000 food points (by contrast) */
4639 /* Don't ever get more than "Full" this way */
4640 /* But if we ARE Gorged, it won't cure us */
4641 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4642 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4643 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4646 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4650 bool panic_hit(void)
4655 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4656 y = p_ptr->y + ddy[dir];
4657 x = p_ptr->x + ddx[dir];
4658 if (current_floor_ptr->grid_array[y][x].m_idx)
4661 if (randint0(p_ptr->skill_dis) < 7)
4662 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4664 teleport_player(30, 0L);
4669 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4677 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
4680 * currently this function allows pseudo-id of any object,
4681 * including silly ones like potions & scrolls, which always
4682 * get '{average}'. This should be changed, either to stop such
4683 * items from being pseudo-id'd, or to allow psychometry to
4684 * detect whether the unidentified potion/scroll/etc is
4685 * good (Cure Light Wounds, Restore Strength, etc) or
4686 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4688 bool psychometry(void)
4692 GAME_TEXT o_name[MAX_NLEN];
4697 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4698 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4700 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4701 if (!o_ptr) return (FALSE);
4703 /* It is fully known, no information needed */
4704 if (object_is_known(o_ptr))
4706 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4710 /* Check for a feeling */
4711 feel = value_check_aux1(o_ptr);
4713 /* Get an object description */
4714 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4716 /* Skip non-feelings */
4719 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4724 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4726 msg_format("You feel that the %s %s %s...",
4727 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4731 o_ptr->ident |= (IDENT_SENSE);
4732 o_ptr->feeling = feel;
4733 o_ptr->marked |= OM_TOUCHED;
4735 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4736 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4738 /* Valid "tval" codes */
4739 switch (o_ptr->tval)
4767 /* Auto-inscription/destroy */
4768 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4770 /* Something happened */
4775 bool draconian_breath(player_type *creature_ptr)
4778 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4779 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4781 if (!get_aim_dir(&dir)) return FALSE;
4783 if (randint1(100) < creature_ptr->lev)
4785 switch (creature_ptr->pclass)
4788 case CLASS_BERSERKER:
4791 case CLASS_IMITATOR:
4797 Type_desc = _("エレメント", "the elements");
4802 Type_desc = _("破片", "shards");
4806 case CLASS_WARRIOR_MAGE:
4807 case CLASS_HIGH_MAGE:
4808 case CLASS_SORCERER:
4809 case CLASS_MAGIC_EATER:
4810 case CLASS_RED_MAGE:
4811 case CLASS_BLUE_MAGE:
4812 case CLASS_MIRROR_MASTER:
4816 Type_desc = _("魔力", "mana");
4820 Type = GF_DISENCHANT;
4821 Type_desc = _("劣化", "disenchantment");
4824 case CLASS_CHAOS_WARRIOR:
4827 Type = GF_CONFUSION;
4828 Type_desc = _("混乱", "confusion");
4833 Type_desc = _("カオス", "chaos");
4838 case CLASS_FORCETRAINER:
4841 Type = GF_CONFUSION;
4842 Type_desc = _("混乱", "confusion");
4847 Type_desc = _("轟音", "sound");
4850 case CLASS_MINDCRAFTER:
4853 Type = GF_CONFUSION;
4854 Type_desc = _("混乱", "confusion");
4859 Type_desc = _("精神エネルギー", "mental energy");
4866 Type = GF_HELL_FIRE;
4867 Type_desc = _("地獄の劫火", "hellfire");
4871 Type = GF_HOLY_FIRE;
4872 Type_desc = _("聖なる炎", "holy fire");
4880 Type_desc = _("暗黒", "darkness");
4885 Type_desc = _("毒", "poison");
4892 Type_desc = _("轟音", "sound");
4896 Type = GF_CONFUSION;
4897 Type_desc = _("混乱", "confusion");
4904 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4906 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4910 bool android_inside_weapon(player_type *creature_ptr)
4913 if (!get_aim_dir(&dir)) return FALSE;
4914 if (creature_ptr->lev < 10)
4916 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4917 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4919 else if (creature_ptr->lev < 25)
4921 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4922 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4924 else if (creature_ptr->lev < 35)
4926 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4927 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4929 else if (creature_ptr->lev < 45)
4931 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4932 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4936 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4937 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4942 bool create_ration(player_type *crature_ptr)
4948 /* Create the food ration */
4949 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4951 /* Drop the object from heaven */
4952 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4953 msg_print(_("食事を料理して作った。", "You cook some food."));
4957 void hayagake(player_type *creature_ptr)
4959 if (creature_ptr->action == ACTION_HAYAGAKE)
4961 set_action(ACTION_NONE);
4965 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4966 feature_type *f_ptr = &f_info[g_ptr->feat];
4968 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4969 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4971 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4975 set_action(ACTION_HAYAGAKE);
4978 creature_ptr->energy_use = 0;
4981 bool double_attack(player_type *creature_ptr)
4986 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4987 y = creature_ptr->y + ddy[dir];
4988 x = creature_ptr->x + ddx[dir];
4989 if (current_floor_ptr->grid_array[y][x].m_idx)
4992 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4993 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4995 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4996 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4998 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4999 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
5002 if (current_floor_ptr->grid_array[y][x].m_idx)
5007 creature_ptr->energy_need += ENERGY_NEED();
5011 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5017 bool comvert_hp_to_mp(player_type *creature_ptr)
5019 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5022 creature_ptr->csp += gain_sp;
5023 if (creature_ptr->csp > creature_ptr->msp)
5025 creature_ptr->csp = creature_ptr->msp;
5026 creature_ptr->csp_frac = 0;
5031 msg_print(_("変換に失敗した。", "You failed to convert."));
5033 creature_ptr->redraw |= (PR_HP | PR_MANA);
5037 bool comvert_mp_to_hp(player_type *creature_ptr)
5039 if (creature_ptr->csp >= creature_ptr->lev / 5)
5041 creature_ptr->csp -= creature_ptr->lev / 5;
5042 hp_player(creature_ptr->lev);
5046 msg_print(_("変換に失敗した。", "You failed to convert."));
5048 creature_ptr->redraw |= (PR_HP | PR_MANA);
5052 bool demonic_breath(player_type *creature_ptr)
5055 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5056 if (!get_aim_dir(&dir)) return FALSE;
5058 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5059 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5063 bool mirror_concentration(player_type *creature_ptr)
5067 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5070 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5072 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5074 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5075 if (creature_ptr->csp >= creature_ptr->msp)
5077 creature_ptr->csp = creature_ptr->msp;
5078 creature_ptr->csp_frac = 0;
5080 creature_ptr->redraw |= (PR_MANA);
5084 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5089 bool sword_dancing(player_type *creature_ptr)
5092 POSITION y = 0, x = 0;
5096 for (i = 0; i < 6; i++)
5099 y = creature_ptr->y + ddy_ddd[dir];
5100 x = creature_ptr->x + ddx_ddd[dir];
5101 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5103 /* Hack -- attack monsters */
5108 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5114 bool confusing_light(player_type *creature_ptr)
5116 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5117 slow_monsters(creature_ptr->lev);
5118 stun_monsters(creature_ptr->lev * 4);
5119 confuse_monsters(creature_ptr->lev * 4);
5120 turn_monsters(creature_ptr->lev * 4);
5121 stasis_monsters(creature_ptr->lev * 4);
5125 bool rodeo(player_type *creature_ptr)
5127 GAME_TEXT m_name[MAX_NLEN];
5128 monster_type *m_ptr;
5129 monster_race *r_ptr;
5132 if (creature_ptr->riding)
5134 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5137 if (!do_riding(TRUE)) return TRUE;
5139 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5140 r_ptr = &r_info[m_ptr->r_idx];
5141 monster_desc(m_name, m_ptr, 0);
5142 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5144 if (is_pet(m_ptr)) return TRUE;
5146 rlev = r_ptr->level;
5148 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5149 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5150 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5151 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5152 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5153 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5155 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5160 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5162 /* 落馬処理に失敗してもとにかく乗馬解除 */
5163 creature_ptr->riding = 0;
5168 bool clear_mind(player_type *creature_ptr)
5172 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5175 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5177 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5178 if (creature_ptr->csp >= creature_ptr->msp)
5180 creature_ptr->csp = creature_ptr->msp;
5181 creature_ptr->csp_frac = 0;
5183 creature_ptr->redraw |= (PR_MANA);
5187 bool concentration(player_type *creature_ptr)
5189 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5193 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5196 if (creature_ptr->special_defense & KATA_MASK)
5198 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5201 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5203 creature_ptr->csp += creature_ptr->msp / 2;
5204 if (creature_ptr->csp >= max_csp)
5206 creature_ptr->csp = max_csp;
5207 creature_ptr->csp_frac = 0;
5209 creature_ptr->redraw |= (PR_MANA);