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.
22 #include "monsterrace-hook.h"
26 #include "spells-summon.h"
31 #include "spells-status.h"
32 #include "spells-floor.h"
33 #include "realm-hex.h"
34 #include "object-flavor.h"
35 #include "object-hook.h"
36 #include "monster-status.h"
37 #include "player-move.h"
38 #include "player-status.h"
39 #include "player-effects.h"
40 #include "player-skill.h"
43 #include "floor-events.h"
45 #include "view-mainwindow.h"
46 #include "objectkind.h"
47 #include "monsterrace.h"
50 * @brief プレイヤー周辺の地形を感知する
53 * @param known 地形から危険フラグを外すならTRUE
54 * @return 効力があった場合TRUEを返す
56 static bool detect_feat_flag(POSITION range, int flag, bool known)
62 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
64 /* Scan the current panel */
65 for (y = 1; y < current_floor_ptr->height - 1; y++)
67 for (x = 1; x <= current_floor_ptr->width - 1; x++)
69 int dist = distance(p_ptr->y, p_ptr->x, y, x);
70 if (dist > range) continue;
71 g_ptr = ¤t_floor_ptr->grid_array[y][x];
76 /* Mark as detected */
77 if (dist <= range && known)
79 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
81 g_ptr->info &= ~(CAVE_UNSAFE);
88 if (cave_have_flag_grid(g_ptr, flag))
93 /* Hack -- Memorize */
94 g_ptr->info |= (CAVE_MARK);
107 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
109 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
110 * @return 効力があった場合TRUEを返す
112 bool detect_traps(POSITION range, bool known)
114 bool detect = detect_feat_flag(range, FF_TRAP, known);
116 if (known) p_ptr->dtrap = TRUE;
118 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
121 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
128 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
130 * @return 効力があった場合TRUEを返す
132 bool detect_doors(POSITION range)
134 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
136 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
139 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
146 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
148 * @return 効力があった場合TRUEを返す
150 bool detect_stairs(POSITION range)
152 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
154 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
157 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
164 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
166 * @return 効力があった場合TRUEを返す
168 bool detect_treasure(POSITION range)
170 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
172 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
175 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
182 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
184 * @return 効力があった場合TRUEを返す
186 bool detect_objects_gold(POSITION range)
190 POSITION range2 = range;
194 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
197 for (i = 1; i < current_floor_ptr->o_max; i++)
199 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
201 /* Skip dead objects */
202 if (!o_ptr->k_idx) continue;
204 /* Skip held objects */
205 if (o_ptr->held_m_idx) continue;
210 /* Only detect nearby objects */
211 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
213 /* Detect "gold" objects */
214 if (o_ptr->tval == TV_GOLD)
216 o_ptr->marked |= OM_FOUND;
222 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
225 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
228 if (detect_monsters_string(range, "$"))
237 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
239 * @return 効力があった場合TRUEを返す
241 bool detect_objects_normal(POSITION range)
245 POSITION range2 = range;
249 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
252 for (i = 1; i < current_floor_ptr->o_max; i++)
254 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
256 /* Skip dead objects */
257 if (!o_ptr->k_idx) continue;
259 /* Skip held objects */
260 if (o_ptr->held_m_idx) continue;
265 /* Only detect nearby objects */
266 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
268 /* Detect "real" objects */
269 if (o_ptr->tval != TV_GOLD)
271 o_ptr->marked |= OM_FOUND;
277 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
280 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
283 if (detect_monsters_string(range, "!=?|/`"))
292 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
294 * @return 効力があった場合TRUEを返す
297 * This will light up all spaces with "magic" items, including artifacts,
298 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
299 * and "enchanted" items of the "good" variety.
301 * It can probably be argued that this function is now too powerful.
304 bool detect_objects_magic(POSITION range)
306 OBJECT_TYPE_VALUE tv;
312 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
314 /* Scan all objects */
315 for (i = 1; i < current_floor_ptr->o_max; i++)
317 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
319 /* Skip dead objects */
320 if (!o_ptr->k_idx) continue;
322 /* Skip held objects */
323 if (o_ptr->held_m_idx) continue;
328 /* Only detect nearby objects */
329 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
331 /* Examine the tval */
334 /* Artifacts, misc magic items, or enchanted wearables */
335 if (object_is_artifact(o_ptr) ||
336 object_is_ego(o_ptr) ||
337 (tv == TV_WHISTLE) ||
345 (tv == TV_LIFE_BOOK) ||
346 (tv == TV_SORCERY_BOOK) ||
347 (tv == TV_NATURE_BOOK) ||
348 (tv == TV_CHAOS_BOOK) ||
349 (tv == TV_DEATH_BOOK) ||
350 (tv == TV_TRUMP_BOOK) ||
351 (tv == TV_ARCANE_BOOK) ||
352 (tv == TV_CRAFT_BOOK) ||
353 (tv == TV_DAEMON_BOOK) ||
354 (tv == TV_CRUSADE_BOOK) ||
355 (tv == TV_MUSIC_BOOK) ||
356 (tv == TV_HISSATSU_BOOK) ||
357 (tv == TV_HEX_BOOK) ||
358 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
360 /* Memorize the item */
361 o_ptr->marked |= OM_FOUND;
368 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
377 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
379 * @return 効力があった場合TRUEを返す
381 bool detect_monsters_normal(POSITION range)
387 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
389 for (i = 1; i < current_floor_ptr->m_max; i++)
391 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
392 monster_race *r_ptr = &r_info[m_ptr->r_idx];
393 if (!monster_is_valid(m_ptr)) continue;
398 /* Only detect nearby monsters */
399 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
401 /* Detect all non-invisible monsters */
402 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
404 /* Repair visibility later */
405 repair_monsters = TRUE;
407 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
408 update_monster(i, FALSE);
413 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
416 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
423 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
425 * @return 効力があった場合TRUEを返す
427 bool detect_monsters_invis(POSITION range)
433 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
435 for (i = 1; i < current_floor_ptr->m_max; i++)
437 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
438 monster_race *r_ptr = &r_info[m_ptr->r_idx];
440 if (!monster_is_valid(m_ptr)) continue;
445 /* Only detect nearby monsters */
446 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
448 /* Detect invisible monsters */
449 if (r_ptr->flags2 & RF2_INVISIBLE)
451 /* Update monster recall window */
452 if (p_ptr->monster_race_idx == m_ptr->r_idx)
454 p_ptr->window |= (PW_MONSTER);
457 /* Repair visibility later */
458 repair_monsters = TRUE;
460 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
461 update_monster(i, FALSE);
466 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
469 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
475 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
477 * @return 効力があった場合TRUEを返す
479 bool detect_monsters_evil(POSITION range)
485 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
487 for (i = 1; i < current_floor_ptr->m_max; i++)
489 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
490 monster_race *r_ptr = &r_info[m_ptr->r_idx];
491 if (!monster_is_valid(m_ptr)) continue;
496 /* Only detect nearby monsters */
497 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
499 /* Detect evil monsters */
500 if (r_ptr->flags3 & RF3_EVIL)
502 if (is_original_ap(m_ptr))
504 /* Take note that they are evil */
505 r_ptr->r_flags3 |= (RF3_EVIL);
507 /* Update monster recall window */
508 if (p_ptr->monster_race_idx == m_ptr->r_idx)
510 p_ptr->window |= (PW_MONSTER);
514 /* Repair visibility later */
515 repair_monsters = TRUE;
517 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
518 update_monster(i, FALSE);
524 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
530 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
532 * @return 効力があった場合TRUEを返す
534 bool detect_monsters_nonliving(POSITION range)
540 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
542 for (i = 1; i < current_floor_ptr->m_max; i++)
544 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
545 if (!monster_is_valid(m_ptr)) continue;
550 /* Only detect nearby monsters */
551 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
553 /* Detect non-living monsters */
554 if (!monster_living(m_ptr->r_idx))
556 /* Update monster recall window */
557 if (p_ptr->monster_race_idx == m_ptr->r_idx)
559 p_ptr->window |= (PW_MONSTER);
562 /* Repair visibility later */
563 repair_monsters = TRUE;
565 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
566 update_monster(i, FALSE);
572 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
578 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
580 * @return 効力があった場合TRUEを返す
582 bool detect_monsters_mind(POSITION range)
588 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
590 for (i = 1; i < current_floor_ptr->m_max; i++)
592 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
593 monster_race *r_ptr = &r_info[m_ptr->r_idx];
594 if (!monster_is_valid(m_ptr)) continue;
599 /* Only detect nearby monsters */
600 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
602 /* Detect non-living monsters */
603 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
605 /* Update monster recall window */
606 if (p_ptr->monster_race_idx == m_ptr->r_idx)
608 p_ptr->window |= (PW_MONSTER);
611 /* Repair visibility later */
612 repair_monsters = TRUE;
614 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
615 update_monster(i, FALSE);
621 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
628 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
630 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
631 * @return 効力があった場合TRUEを返す
633 bool detect_monsters_string(POSITION range, concptr Match)
639 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
641 for (i = 1; i < current_floor_ptr->m_max; i++)
643 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
644 monster_race *r_ptr = &r_info[m_ptr->r_idx];
645 if (!monster_is_valid(m_ptr)) continue;
650 /* Only detect nearby monsters */
651 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
653 /* Detect monsters with the same symbol */
654 if (my_strchr(Match, r_ptr->d_char))
656 /* Update monster recall window */
657 if (p_ptr->monster_race_idx == m_ptr->r_idx)
659 p_ptr->window |= (PW_MONSTER);
662 /* Repair visibility later */
663 repair_monsters = TRUE;
665 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
666 update_monster(i, FALSE);
671 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
674 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
680 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
682 * @param match_flag 感知フラグ
683 * @return 効力があった場合TRUEを返す
685 bool detect_monsters_xxx(POSITION range, u32b match_flag)
690 concptr desc_monsters = _("変なモンスター", "weird monsters");
692 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
694 for (i = 1; i < current_floor_ptr->m_max; i++)
696 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
697 monster_race *r_ptr = &r_info[m_ptr->r_idx];
698 if (!monster_is_valid(m_ptr)) continue;
703 /* Only detect nearby monsters */
704 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
706 /* Detect evil monsters */
707 if (r_ptr->flags3 & (match_flag))
709 if (is_original_ap(m_ptr))
711 /* Take note that they are something */
712 r_ptr->r_flags3 |= (match_flag);
714 /* Update monster recall window */
715 if (p_ptr->monster_race_idx == m_ptr->r_idx)
717 p_ptr->window |= (PW_MONSTER);
721 /* Repair visibility later */
722 repair_monsters = TRUE;
724 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
725 update_monster(i, FALSE);
734 desc_monsters = _("デーモン", "demons");
737 desc_monsters = _("アンデッド", "the undead");
741 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
749 * @brief 全感知処理 / Detect everything
751 * @return 効力があった場合TRUEを返す
753 bool detect_all(POSITION range)
757 /* Detect everything */
758 if (detect_traps(range, TRUE)) detect = TRUE;
759 if (detect_doors(range)) detect = TRUE;
760 if (detect_stairs(range)) detect = TRUE;
762 /* There are too many hidden treasure. So... */
763 /* if (detect_treasure(range)) detect = TRUE; */
765 if (detect_objects_gold(range)) detect = TRUE;
766 if (detect_objects_normal(range)) detect = TRUE;
767 if (detect_monsters_invis(range)) detect = TRUE;
768 if (detect_monsters_normal(range)) detect = TRUE;
774 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
777 * @return 効力があった場合TRUEを返す
780 * Note that affected monsters are NOT auto-tracked by this usage.
782 * To avoid misbehavior when monster deaths have side-effects,
783 * this is done in two passes. -- JDL
786 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
790 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
791 bool obvious = FALSE;
793 /* Mark all (nearby) monsters */
794 for (i = 1; i < current_floor_ptr->m_max; i++)
796 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
797 if (!monster_is_valid(m_ptr)) continue;
802 /* Require line of sight */
803 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
805 /* Mark the monster */
806 m_ptr->mflag |= (MFLAG_LOS);
809 /* Affect all marked monsters */
810 for (i = 1; i < current_floor_ptr->m_max; i++)
812 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
814 /* Skip unmarked monsters */
815 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
818 m_ptr->mflag &= ~(MFLAG_LOS);
823 /* Jump directly to the target monster */
824 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
831 * @brief 視界内モンスターを加速する処理 / Speed monsters
832 * @return 効力があった場合TRUEを返す
834 bool speed_monsters(void)
836 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
840 * @brief 視界内モンスターを加速する処理 / Slow monsters
841 * @return 効力があった場合TRUEを返す
843 bool slow_monsters(int power)
845 return (project_all_los(GF_OLD_SLOW, power));
849 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
850 * @return 効力があった場合TRUEを返す
852 bool sleep_monsters(int power)
854 return (project_all_los(GF_OLD_SLEEP, power));
858 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
859 * @return 効力があった場合TRUEを返す
861 bool banish_evil(int dist)
863 return (project_all_los(GF_AWAY_EVIL, dist));
867 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
868 * @return 効力があった場合TRUEを返す
870 bool turn_undead(void)
872 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
874 chg_virtue(V_UNLIFE, -1);
879 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
880 * @return 効力があった場合TRUEを返す
882 bool dispel_undead(HIT_POINT dam)
884 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
886 chg_virtue(V_UNLIFE, -2);
891 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
892 * @return 効力があった場合TRUEを返す
894 bool dispel_evil(HIT_POINT dam)
896 return (project_all_los(GF_DISP_EVIL, dam));
900 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
901 * @return 効力があった場合TRUEを返す
903 bool dispel_good(HIT_POINT dam)
905 return (project_all_los(GF_DISP_GOOD, dam));
909 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
910 * @return 効力があった場合TRUEを返す
912 bool dispel_monsters(HIT_POINT dam)
914 return (project_all_los(GF_DISP_ALL, dam));
917 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
920 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
921 int k = 3 * creature_ptr->lev;
922 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
923 if (set_poisoned(0)) ident = TRUE;
924 if (set_afraid(0)) ident = TRUE;
925 if (hp_player(50)) ident = TRUE;
926 if (set_stun(0)) ident = TRUE;
927 if (set_cut(0)) ident = TRUE;
931 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
933 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
934 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
935 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
936 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))
938 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
944 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
945 * @return 効力があった場合TRUEを返す
947 bool dispel_living(HIT_POINT dam)
949 return (project_all_los(GF_DISP_LIVING, dam));
953 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
954 * @return 効力があった場合TRUEを返す
956 bool dispel_demons(HIT_POINT dam)
958 return (project_all_los(GF_DISP_DEMON, dam));
962 * @brief 視界内のモンスターに「聖戦」効果を与える処理
963 * @return 効力があった場合TRUEを返す
967 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
971 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
972 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
975 void aggravate_monsters(MONSTER_IDX who)
981 /* Aggravate everyone nearby */
982 for (i = 1; i < current_floor_ptr->m_max; i++)
984 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
985 if (!monster_is_valid(m_ptr)) continue;
987 /* Skip aggravating monster (or player) */
988 if (i == who) continue;
990 /* Wake up nearby sleeping monsters */
991 if (m_ptr->cdis < MAX_SIGHT * 2)
994 if (MON_CSLEEP(m_ptr))
996 (void)set_monster_csleep(i, 0);
999 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1002 /* Speed up monsters in line of sight */
1003 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1007 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1013 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1014 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1015 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1020 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1021 * @param m_idx 抹殺するモンスターID
1022 * @param power 抹殺の威力
1023 * @param player_cast プレイヤーの魔法によるものならば TRUE
1024 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1025 * @param spell_name 抹殺効果を起こした魔法の名前
1026 * @return 効力があった場合TRUEを返す
1028 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1030 int msec = delay_factor * delay_factor * delay_factor;
1031 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1032 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1033 bool resist = FALSE;
1035 if (is_pet(m_ptr) && !player_cast) return FALSE;
1037 /* Hack -- Skip Unique Monsters or Quest Monsters */
1038 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1039 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1040 else if (m_idx == p_ptr->riding) resist = TRUE;
1041 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1042 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1043 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1047 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1049 GAME_TEXT m_name[MAX_NLEN];
1051 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1052 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1055 delete_monster_idx(m_idx);
1058 if (resist && player_cast)
1060 bool see_m = is_seen(m_ptr);
1061 GAME_TEXT m_name[MAX_NLEN];
1063 monster_desc(m_name, m_ptr, 0);
1066 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1068 if (MON_CSLEEP(m_ptr))
1070 (void)set_monster_csleep(m_idx, 0);
1073 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1076 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1080 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1084 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1089 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1092 /* Visual feedback */
1093 move_cursor_relative(p_ptr->y, p_ptr->x);
1095 p_ptr->redraw |= (PR_HP);
1096 p_ptr->window |= (PW_PLAYER);
1101 Term_xtra(TERM_XTRA_DELAY, msec);
1108 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1109 * @param power 抹殺の威力
1110 * @param player_cast プレイヤーの魔法によるものならば TRUE
1111 * @return 効力があった場合TRUEを返す
1113 bool symbol_genocide(int power, bool player_cast)
1117 bool result = FALSE;
1119 /* Prevent genocide in quest levels */
1120 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1122 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1126 /* Mega-Hack -- Get a monster symbol */
1127 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1129 /* Delete the monsters of that "type" */
1130 for (i = 1; i < current_floor_ptr->m_max; i++)
1132 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1133 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1134 if (!monster_is_valid(m_ptr)) continue;
1136 /* Skip "wrong" monsters */
1137 if (r_ptr->d_char != typ) continue;
1139 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1144 chg_virtue(V_VITALITY, -2);
1145 chg_virtue(V_CHANCE, -1);
1153 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1154 * @param power 抹殺の威力
1155 * @param player_cast プレイヤーの魔法によるものならば TRUE
1156 * @return 効力があった場合TRUEを返す
1158 bool mass_genocide(int power, bool player_cast)
1161 bool result = FALSE;
1163 /* Prevent mass genocide in quest levels */
1164 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1169 /* Delete the (nearby) monsters */
1170 for (i = 1; i < current_floor_ptr->m_max; i++)
1172 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1173 if (!monster_is_valid(m_ptr)) continue;
1175 /* Skip distant monsters */
1176 if (m_ptr->cdis > MAX_SIGHT) continue;
1179 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1184 chg_virtue(V_VITALITY, -2);
1185 chg_virtue(V_CHANCE, -1);
1193 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1194 * @param power 抹殺の威力
1195 * @param player_cast プレイヤーの魔法によるものならば TRUE
1196 * @return 効力があった場合TRUEを返す
1198 bool mass_genocide_undead(int power, bool player_cast)
1201 bool result = FALSE;
1203 /* Prevent mass genocide in quest levels */
1204 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1209 /* Delete the (nearby) monsters */
1210 for (i = 1; i < current_floor_ptr->m_max; i++)
1212 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1213 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1214 if (!monster_is_valid(m_ptr)) continue;
1216 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1218 /* Skip distant monsters */
1219 if (m_ptr->cdis > MAX_SIGHT) continue;
1222 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1227 chg_virtue(V_UNLIFE, -2);
1228 chg_virtue(V_CHANCE, -1);
1236 * @brief 周辺モンスターを調査する / Probe nearby monsters
1237 * @return 効力があった場合TRUEを返す
1242 int speed; /* TODO */
1253 /* Probe all (nearby) monsters */
1254 for (i = 1; i < current_floor_ptr->m_max; i++)
1256 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1257 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1258 if (!monster_is_valid(m_ptr)) continue;
1260 /* Require line of sight */
1261 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1263 /* Probe visible monsters */
1266 GAME_TEXT m_name[MAX_NLEN];
1268 /* Start the message */
1271 msg_print(_("調査中...", "Probing..."));
1276 if (!is_original_ap(m_ptr))
1278 if (m_ptr->mflag2 & MFLAG2_KAGE)
1279 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1281 m_ptr->ap_r_idx = m_ptr->r_idx;
1282 lite_spot(m_ptr->fy, m_ptr->fx);
1284 /* Get "the monster" or "something" */
1285 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1287 speed = m_ptr->mspeed - 110;
1288 if (MON_FAST(m_ptr)) speed += 10;
1289 if (MON_SLOW(m_ptr)) speed -= 10;
1290 if (ironman_nightmare) speed += 5;
1292 /* Get the monster's alignment */
1293 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1294 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1295 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1296 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1297 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1298 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1299 else align = _("中立", "neutral");
1301 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1302 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1304 if (r_ptr->next_r_idx)
1306 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1310 strcat(buf, "xxx ");
1313 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1314 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1315 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1316 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1317 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1318 buf[strlen(buf)-1] = '\0';
1321 /* HACK : Add the line to message buffer */
1324 p_ptr->window |= (PW_MESSAGE);
1327 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1330 Term_erase(0, 0, 255);
1332 /* Learn everything about this monster */
1333 if (lore_do_probe(m_ptr->r_idx))
1335 /* Get base name of monster */
1336 strcpy(buf, (r_name + r_ptr->name));
1339 /* Note that we learnt some new flags -Mogami- */
1340 msg_format("%sについてさらに詳しくなった気がする。", buf);
1345 /* Note that we learnt some new flags -Mogami- */
1346 msg_format("You now know more about %s.", buf);
1348 /* Clear -more- prompt */
1363 chg_virtue(V_KNOWLEDGE, 1);
1364 msg_print(_("これで全部です。", "That's all."));
1372 * @brief *破壊*処理を行う / The spell of destruction
1373 * @param y1 破壊の中心Y座標
1374 * @param x1 破壊の中心X座標
1376 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1377 * @return 効力があった場合TRUEを返す
1380 * This spell "deletes" monsters (instead of "killing" them).
1382 * Later we may use one function for both "destruction" and
1383 * "earthquake" by using the "full" to select "destruction".
1386 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1393 /* Prevent destruction of quest levels and town */
1394 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1399 /* Lose monster light */
1400 if (!in_generate) clear_mon_lite();
1402 /* Big area of affect */
1403 for (y = (y1 - r); y <= (y1 + r); y++)
1405 for (x = (x1 - r); x <= (x1 + r); x++)
1407 /* Skip illegal grids */
1408 if (!in_bounds(y, x)) continue;
1410 /* Extract the distance */
1411 k = distance(y1, x1, y, x);
1413 /* Stay in the circle of death */
1414 if (k > r) continue;
1415 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1417 /* Lose room and vault */
1418 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1420 /* Lose light and knowledge */
1421 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1423 if (!in_generate) /* Normal */
1426 g_ptr->info &= ~(CAVE_UNSAFE);
1428 /* Hack -- Notice player affect */
1429 if (player_bold(y, x))
1431 /* Hurt the player later */
1434 /* Do not hurt this grid */
1439 /* Hack -- Skip the epicenter */
1440 if ((y == y1) && (x == x1)) continue;
1444 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1445 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1447 if (in_generate) /* In generation */
1449 /* Delete the monster (if any) */
1450 delete_monster(y, x);
1452 else if (r_ptr->flags1 & RF1_QUESTOR)
1454 /* Heal the monster */
1455 m_ptr->hp = m_ptr->maxhp;
1457 /* Try to teleport away quest monsters */
1458 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1462 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1464 GAME_TEXT m_name[MAX_NLEN];
1466 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1467 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1470 /* Delete the monster (if any) */
1471 delete_monster(y, x);
1475 /* During generation, destroyed artifacts are "preserved" */
1476 if (preserve_mode || in_generate)
1478 OBJECT_IDX this_o_idx, next_o_idx = 0;
1480 /* Scan all objects in the grid */
1481 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1484 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1485 next_o_idx = o_ptr->next_o_idx;
1487 /* Hack -- Preserve unknown artifacts */
1488 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1490 /* Mega-Hack -- Preserve the artifact */
1491 a_info[o_ptr->name1].cur_num = 0;
1493 if (in_generate && cheat_peek)
1495 GAME_TEXT o_name[MAX_NLEN];
1496 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1497 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1500 else if (in_generate && cheat_peek && o_ptr->art_name)
1502 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1503 "One of the random artifacts was *destroyed* during generation."));
1508 delete_object(y, x);
1510 /* Destroy "non-permanent" grids */
1511 if (!cave_perma_grid(g_ptr))
1513 /* Wall (or floor) type */
1516 if (!in_generate) /* Normal */
1520 /* Create granite wall */
1521 cave_set_feat(y, x, feat_granite);
1525 /* Create quartz vein */
1526 cave_set_feat(y, x, feat_quartz_vein);
1530 /* Create magma vein */
1531 cave_set_feat(y, x, feat_magma_vein);
1536 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1539 else /* In generation */
1543 /* Create granite wall */
1544 place_extra_grid(g_ptr);
1548 /* Create quartz vein */
1549 g_ptr->feat = feat_quartz_vein;
1553 /* Create magma vein */
1554 g_ptr->feat = feat_magma_vein;
1559 place_floor_grid(g_ptr);
1562 /* Clear garbage of hidden trap or door */
1571 /* Process "re-glowing" */
1572 for (y = (y1 - r); y <= (y1 + r); y++)
1574 for (x = (x1 - r); x <= (x1 + r); x++)
1576 /* Skip illegal grids */
1577 if (!in_bounds(y, x)) continue;
1579 /* Extract the distance */
1580 k = distance(y1, x1, y, x);
1582 /* Stay in the circle of death */
1583 if (k > r) continue;
1584 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1586 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1587 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1593 for (i = 0; i < 9; i++)
1595 yy = y + ddy_ddd[i];
1596 xx = x + ddx_ddd[i];
1597 if (!in_bounds2(yy, xx)) continue;
1598 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1599 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1601 g_ptr->info |= CAVE_GLOW;
1609 /* Hack -- Affect player */
1612 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1614 /* Blind the player */
1615 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1618 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1624 /* Mega-Hack -- Forget the view and lite */
1625 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1626 p_ptr->redraw |= (PR_MAP);
1627 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1629 if (p_ptr->special_defense & NINJA_S_STEALTH)
1631 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1641 * @brief 地震処理(サブルーチン) /
1642 * Induce an "earthquake" of the given radius at the given location.
1643 * @return 効力があった場合TRUEを返す
1647 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1651 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1653 * The player will take damage and "jump" into a safe grid if possible,
1654 * otherwise, he will "tunnel" through the rubble instantaneously.
1656 * Monsters will take damage, and "jump" into a safe grid if possible,
1657 * otherwise they will be "buried" in the rubble, disappearing from
1658 * the level in the same way that they do when genocided.
1660 * Note that thus the player and monsters (except eaters of walls and
1661 * passers through walls) will never occupy the same grid as a wall.
1662 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1663 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1664 * This has allowed massive simplification of the "monster" code.
1667 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1671 POSITION y, x, yy, xx, dy, dx;
1674 POSITION sy = 0, sx = 0;
1679 /* Prevent destruction of quest levels and town */
1680 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1685 /* Paranoia -- Enforce maximum range */
1688 /* Clear the "maximal blast" area */
1689 for (y = 0; y < 32; y++)
1691 for (x = 0; x < 32; x++)
1697 /* Check around the epicenter */
1698 for (dy = -r; dy <= r; dy++)
1700 for (dx = -r; dx <= r; dx++)
1702 /* Extract the location */
1706 /* Skip illegal grids */
1707 if (!in_bounds(yy, xx)) continue;
1709 /* Skip distant grids */
1710 if (distance(cy, cx, yy, xx) > r) continue;
1711 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1713 /* Lose room and vault / Lose light and knowledge */
1714 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1715 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1717 /* Skip the epicenter */
1718 if (!dx && !dy) continue;
1720 /* Skip most grids */
1721 if (randint0(100) < 85) continue;
1723 /* Damage this grid */
1724 map[16+yy-cy][16+xx-cx] = TRUE;
1726 /* Hack -- Take note of player damage */
1727 if (player_bold(yy, xx)) hurt = TRUE;
1731 /* First, affect the player (if necessary) */
1732 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1734 /* Check around the player */
1735 for (i = 0; i < 8; i++)
1737 y = p_ptr->y + ddy_ddd[i];
1738 x = p_ptr->x + ddx_ddd[i];
1740 /* Skip non-empty grids */
1741 if (!cave_empty_bold(y, x)) continue;
1743 /* Important -- Skip "quake" grids */
1744 if (map[16+y-cy][16+x-cx]) continue;
1746 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1748 /* Count "safe" grids */
1751 /* Randomize choice */
1752 if (randint0(sn) > 0) continue;
1754 /* Save the safe location */
1758 /* Random message */
1759 switch (randint1(3))
1763 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1768 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1773 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1778 /* Hurt the player a lot */
1781 /* Message and damage */
1782 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1786 /* Destroy the grid, and push the player to safety */
1789 /* Calculate results */
1790 switch (randint1(3))
1794 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1800 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1801 damage = damroll(10, 4);
1802 (void)set_stun(p_ptr->stun + randint1(50));
1807 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1808 damage = damroll(10, 4);
1809 (void)set_stun(p_ptr->stun + randint1(50));
1814 /* Move the player to the safe location */
1815 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1818 /* Important -- no wall on player */
1819 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1827 GAME_TEXT m_name[MAX_NLEN];
1828 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1829 monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
1830 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1834 killer = _("地震", "an earthquake");
1837 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1841 /* Examine the quaked region */
1842 for (dy = -r; dy <= r; dy++)
1844 for (dx = -r; dx <= r; dx++)
1846 /* Extract the location */
1850 /* Skip unaffected grids */
1851 if (!map[16+yy-cy][16+xx-cx]) continue;
1852 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1854 if (g_ptr->m_idx == p_ptr->riding) continue;
1856 /* Process monsters */
1859 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1860 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1862 /* Quest monsters */
1863 if (r_ptr->flags1 & RF1_QUESTOR)
1865 /* No wall on quest monsters */
1866 map[16+yy-cy][16+xx-cx] = FALSE;
1871 /* Most monsters cannot co-exist with rock */
1872 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1873 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1875 GAME_TEXT m_name[MAX_NLEN];
1877 /* Assume not safe */
1880 /* Monster can move to escape the wall */
1881 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1883 /* Look for safety */
1884 for (i = 0; i < 8; i++)
1886 y = yy + ddy_ddd[i];
1887 x = xx + ddx_ddd[i];
1889 /* Skip non-empty grids */
1890 if (!cave_empty_bold(y, x)) continue;
1892 /* Hack -- no safety on glyph of warding */
1893 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1894 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1896 /* ... nor on the Pattern */
1897 if (pattern_tile(y, x)) continue;
1899 /* Important -- Skip "quake" grids */
1900 if (map[16+y-cy][16+x-cx]) continue;
1902 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1903 if (player_bold(y, x)) continue;
1905 /* Count "safe" grids */
1908 /* Randomize choice */
1909 if (randint0(sn) > 0) continue;
1911 /* Save the safe grid */
1916 monster_desc(m_name, m_ptr, 0);
1918 /* Scream in pain */
1919 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1921 /* Take damage from the quake */
1922 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1924 /* Monster is certainly awake */
1925 (void)set_monster_csleep(g_ptr->m_idx, 0);
1927 /* Apply damage directly */
1928 m_ptr->hp -= damage;
1930 /* Delete (not kill) "dead" monsters */
1933 if (!ignore_unview || is_seen(m_ptr))
1934 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1938 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)
1940 char m2_name[MAX_NLEN];
1942 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1943 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1947 delete_monster(yy, xx);
1949 /* No longer safe */
1953 /* Hack -- Escape from the rock */
1956 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1958 /* Update the old location */
1959 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1961 /* Update the new location */
1962 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1964 /* Move the monster */
1968 update_monster(m_idx, TRUE);
1977 /* Lose monster light */
1980 /* Examine the quaked region */
1981 for (dy = -r; dy <= r; dy++)
1983 for (dx = -r; dx <= r; dx++)
1985 /* Extract the location */
1989 /* Skip unaffected grids */
1990 if (!map[16+yy-cy][16+xx-cx]) continue;
1992 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1994 /* Paranoia -- never affect player */
1995 /* if (player_bold(yy, xx)) continue; */
1997 /* Destroy location (if valid) */
1998 if (cave_valid_bold(yy, xx))
2000 delete_object(yy, xx);
2002 /* Wall (or floor) type */
2003 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2008 /* Create granite wall */
2009 cave_set_feat(yy, xx, feat_granite);
2015 /* Create quartz vein */
2016 cave_set_feat(yy, xx, feat_quartz_vein);
2022 /* Create magma vein */
2023 cave_set_feat(yy, xx, feat_magma_vein);
2030 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2036 /* Process "re-glowing" */
2037 for (dy = -r; dy <= r; dy++)
2039 for (dx = -r; dx <= r; dx++)
2041 /* Extract the location */
2045 /* Skip illegal grids */
2046 if (!in_bounds(yy, xx)) continue;
2048 /* Skip distant grids */
2049 if (distance(cy, cx, yy, xx) > r) continue;
2050 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2052 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2053 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2059 for (ii = 0; ii < 9; ii++)
2061 yyy = yy + ddy_ddd[ii];
2062 xxx = xx + ddx_ddd[ii];
2063 if (!in_bounds2(yyy, xxx)) continue;
2064 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2065 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2067 g_ptr->info |= CAVE_GLOW;
2075 /* Mega-Hack -- Forget the view and lite */
2076 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2077 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2078 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2080 if (p_ptr->special_defense & NINJA_S_STEALTH)
2082 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2090 * @brief 地震処理(プレイヤーの中心発動) /
2091 * Induce an "earthquake" of the given radius at the given location.
2092 * @return 効力があった場合TRUEを返す
2097 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2099 return earthquake_aux(cy, cx, r, 0);
2106 void discharge_minion(void)
2111 for (i = 1; i < current_floor_ptr->m_max; i++)
2113 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2114 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2115 if (m_ptr->nickname) okay = FALSE;
2117 if (!okay || p_ptr->riding)
2119 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2122 for (i = 1; i < current_floor_ptr->m_max; i++)
2125 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2126 monster_race *r_ptr;
2128 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2129 r_ptr = &r_info[m_ptr->r_idx];
2131 /* Uniques resist discharging */
2132 if (r_ptr->flags1 & RF1_UNIQUE)
2134 GAME_TEXT m_name[MAX_NLEN];
2135 monster_desc(m_name, m_ptr, 0x00);
2136 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2137 delete_monster_idx(i);
2140 dam = m_ptr->maxhp / 2;
2141 if (dam > 100) dam = (dam - 100) / 2 + 100;
2142 if (dam > 400) dam = (dam - 400) / 2 + 400;
2143 if (dam > 800) dam = 800;
2144 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2145 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2147 if (record_named_pet && m_ptr->nickname)
2149 GAME_TEXT m_name[MAX_NLEN];
2151 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2152 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2155 delete_monster_idx(i);
2161 * @brief 部屋全体を照らすサブルーチン
2165 * This routine clears the entire "temp" set.
2166 * This routine will Perma-Lite all "temp" grids.
2167 * This routine is used (only) by "lite_room()"
2168 * Dark grids are illuminated.
2169 * Also, process all affected monsters.
2171 * SMART monsters always wake up when illuminated
2172 * NORMAL monsters wake up 1/4 the time when illuminated
2173 * STUPID monsters wake up 1/10 the time when illuminated
2176 static void cave_temp_room_lite(void)
2180 /* Clear them all */
2181 for (i = 0; i < tmp_pos.n; i++)
2183 POSITION y = tmp_pos.y[i];
2184 POSITION x = tmp_pos.x[i];
2186 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2188 /* No longer in the array */
2189 g_ptr->info &= ~(CAVE_TEMP);
2191 /* Update only non-CAVE_GLOW grids */
2192 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2195 g_ptr->info |= (CAVE_GLOW);
2197 /* Process affected monsters */
2200 PERCENTAGE chance = 25;
2201 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2202 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2203 update_monster(g_ptr->m_idx, FALSE);
2205 /* Stupid monsters rarely wake up */
2206 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2208 /* Smart monsters always wake up */
2209 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2211 /* Sometimes monsters wake up */
2212 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2215 (void)set_monster_csleep(g_ptr->m_idx, 0);
2217 /* Notice the "waking up" */
2220 GAME_TEXT m_name[MAX_NLEN];
2221 monster_desc(m_name, m_ptr, 0);
2222 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2229 update_local_illumination(y, x);
2239 * @brief 部屋全体を暗くするサブルーチン
2243 * This routine clears the entire "temp" set.
2244 * This routine will "darken" all "temp" grids.
2245 * In addition, some of these grids will be "unmarked".
2246 * This routine is used (only) by "unlite_room()"
2247 * Also, process all affected monsters
2250 static void cave_temp_room_unlite(void)
2254 /* Clear them all */
2255 for (i = 0; i < tmp_pos.n; i++)
2257 POSITION y = tmp_pos.y[i];
2258 POSITION x = tmp_pos.x[i];
2261 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2262 bool do_dark = !is_mirror_grid(g_ptr);
2264 /* No longer in the array */
2265 g_ptr->info &= ~(CAVE_TEMP);
2267 /* Darken the grid */
2270 if (current_floor_ptr->dun_level || !is_daytime())
2272 for (j = 0; j < 9; j++)
2274 POSITION by = y + ddy_ddd[j];
2275 POSITION bx = x + ddx_ddd[j];
2277 if (in_bounds2(by, bx))
2279 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2281 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2289 if (!do_dark) continue;
2292 g_ptr->info &= ~(CAVE_GLOW);
2294 /* Hack -- Forget "boring" grids */
2295 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2297 /* Forget the grid */
2298 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2302 /* Process affected monsters */
2305 update_monster(g_ptr->m_idx, FALSE);
2309 update_local_illumination(y, x);
2319 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2322 * @param pass_bold 地形条件を返す関数ポインタ
2325 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2332 for (i = 0; i < 16; i++)
2334 y = cy + ddy_cdd[i % 8];
2335 x = cx + ddx_cdd[i % 8];
2337 /* Found a wall, break the length */
2338 if (!pass_bold(y, x))
2340 /* Track best length */
2354 return (MAX(len, blen));
2358 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2361 * @param pass_bold 地形条件を返す関数ポインタ
2364 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2370 for (i = 0; i < 8; i++)
2372 y = cy + ddy_ddd[i];
2373 x = cx + ddx_ddd[i];
2375 if (!pass_bold(y, x)) c++;
2383 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2384 * @param y 部屋内のy座標1点
2385 * @param x 部屋内のx座標1点
2386 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2387 * @param pass_bold 地形条件を返す関数ポインタ
2390 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2393 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2395 /* Avoid infinite recursion */
2396 if (g_ptr->info & (CAVE_TEMP)) return;
2398 /* Do not "leave" the current room */
2399 if (!(g_ptr->info & (CAVE_ROOM)))
2401 if (only_room) return;
2404 if (!in_bounds2(y, x)) return;
2406 /* Do not exceed the maximum spell range */
2407 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2409 /* Verify this grid */
2411 * The reason why it is ==6 instead of >5 is that 8 is impossible
2412 * due to the check for cave_bold above.
2413 * 7 lights dead-end corridors (you need to do this for the
2414 * checkboard interesting rooms, so that the boundary is lit
2416 * This leaves only a check for 6 bounding walls!
2418 if (in_bounds(y, x) && pass_bold(y, x) &&
2419 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2422 /* Paranoia -- verify space */
2423 if (tmp_pos.n == TEMP_MAX) return;
2425 /* Mark the grid as "seen" */
2426 g_ptr->info |= (CAVE_TEMP);
2428 /* Add it to the "seen" set */
2429 tmp_pos.y[tmp_pos.n] = y;
2430 tmp_pos.x[tmp_pos.n] = x;
2435 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2438 * @return 光を通すならばtrueを返す。
2440 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2442 return cave_los_bold(y, x);
2446 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2451 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2453 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2457 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2460 * @return 射線を通すならばtrueを返す。
2462 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2464 return cave_have_flag_bold(y, x, FF_PROJECT);
2469 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2474 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2476 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2481 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2486 void lite_room(POSITION y1, POSITION x1)
2491 /* Add the initial grid */
2492 cave_temp_lite_room_aux(y1, x1);
2494 /* While grids are in the queue, add their neighbors */
2495 for (i = 0; i < tmp_pos.n; i++)
2497 x = tmp_pos.x[i], y = tmp_pos.y[i];
2499 /* Walls get lit, but stop light */
2500 if (!cave_pass_lite_bold(y, x)) continue;
2502 /* Spread adjacent */
2503 cave_temp_lite_room_aux(y + 1, x);
2504 cave_temp_lite_room_aux(y - 1, x);
2505 cave_temp_lite_room_aux(y, x + 1);
2506 cave_temp_lite_room_aux(y, x - 1);
2508 /* Spread diagonal */
2509 cave_temp_lite_room_aux(y + 1, x + 1);
2510 cave_temp_lite_room_aux(y - 1, x - 1);
2511 cave_temp_lite_room_aux(y - 1, x + 1);
2512 cave_temp_lite_room_aux(y + 1, x - 1);
2515 /* Now, lite them all up at once */
2516 cave_temp_room_lite();
2518 if (p_ptr->special_defense & NINJA_S_STEALTH)
2520 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2526 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2531 void unlite_room(POSITION y1, POSITION x1)
2536 /* Add the initial grid */
2537 cave_temp_unlite_room_aux(y1, x1);
2539 /* Spread, breadth first */
2540 for (i = 0; i < tmp_pos.n; i++)
2542 x = tmp_pos.x[i], y = tmp_pos.y[i];
2544 /* Walls get dark, but stop darkness */
2545 if (!cave_pass_dark_bold(y, x)) continue;
2547 /* Spread adjacent */
2548 cave_temp_unlite_room_aux(y + 1, x);
2549 cave_temp_unlite_room_aux(y - 1, x);
2550 cave_temp_unlite_room_aux(y, x + 1);
2551 cave_temp_unlite_room_aux(y, x - 1);
2553 /* Spread diagonal */
2554 cave_temp_unlite_room_aux(y + 1, x + 1);
2555 cave_temp_unlite_room_aux(y - 1, x - 1);
2556 cave_temp_unlite_room_aux(y - 1, x + 1);
2557 cave_temp_unlite_room_aux(y + 1, x - 1);
2560 /* Now, darken them all at once */
2561 cave_temp_room_unlite();
2564 bool starlight(bool magic)
2566 HIT_POINT num = damroll(5, 3);
2567 POSITION y = 0, x = 0;
2571 if (!p_ptr->blind && !magic)
2573 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2575 for (k = 0; k < num; k++)
2581 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2582 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2583 if (!player_bold(y, x)) break;
2586 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2587 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2595 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2598 * @return 作用が実際にあった場合TRUEを返す
2600 bool lite_area(HIT_POINT dam, POSITION rad)
2602 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2604 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2606 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2612 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2615 /* Hook into the "project()" function */
2616 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2618 lite_room(p_ptr->y, p_ptr->x);
2626 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2629 * @return 作用が実際にあった場合TRUEを返す
2631 bool unlite_area(HIT_POINT dam, POSITION rad)
2633 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2637 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2640 /* Hook into the "project()" function */
2641 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2643 unlite_room(p_ptr->y, p_ptr->x);
2652 * @brief ボール系スペルの発動 / Cast a ball spell
2654 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2657 * @return 作用が実際にあった場合TRUEを返す
2660 * Stop if we hit a monster, act as a "ball"
2661 * Allow "target" mode to pass over monsters
2662 * Affect grids, objects, and monsters
2665 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2669 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2671 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2672 /* Use the given direction */
2673 tx = p_ptr->x + 99 * ddx[dir];
2674 ty = p_ptr->y + 99 * ddy[dir];
2676 /* Hack -- Use an actual "target" */
2677 if ((dir == 5) && target_okay())
2679 flg &= ~(PROJECT_STOP);
2684 /* Analyze the "dir" and the "target". Hurt items on floor. */
2685 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2689 * @brief ブレス系スペルの発動 / Cast a breath spell
2691 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2694 * @return 作用が実際にあった場合TRUEを返す
2697 * Stop if we hit a monster, act as a "ball"
2698 * Allow "target" mode to pass over monsters
2699 * Affect grids, objects, and monsters
2702 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2704 return fire_ball(typ, dir, dam, -rad);
2709 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2711 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2714 * @return 作用が実際にあった場合TRUEを返す
2717 * Stop if we hit a monster, act as a "ball"
2718 * Allow "target" mode to pass over monsters
2719 * Affect grids, objects, and monsters
2722 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2725 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2727 /* Use the given direction */
2728 tx = p_ptr->x + 99 * ddx[dir];
2729 ty = p_ptr->y + 99 * ddy[dir];
2731 /* Hack -- Use an actual "target" */
2732 if ((dir == 5) && target_okay())
2738 /* Analyze the "dir" and the "target". Hurt items on floor. */
2739 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2744 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2746 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2749 * @return 作用が実際にあった場合TRUEを返す
2752 * Stop if we hit a monster, act as a "ball"
2753 * Allow "target" mode to pass over monsters
2754 * Affect grids, objects, and monsters
2757 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2760 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2762 /* Use the given direction */
2763 tx = p_ptr->x + 99 * ddx[dir];
2764 ty = p_ptr->y + 99 * ddy[dir];
2766 /* Hack -- Use an actual "target" */
2767 if ((dir == 5) && target_okay())
2769 flg &= ~(PROJECT_STOP);
2774 /* Analyze the "dir" and the "target". Hurt items on floor. */
2775 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2780 * @brief メテオ系スペルの発動 / Cast a meteor spell
2781 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2787 * @return 作用が実際にあった場合TRUEを返す
2790 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2791 * player, or outside source, that starts out at an arbitrary location, and
2792 * leaving no trail from the "caster" to the target. This function is
2793 * especially useful for bombardments and similar. -LM-
2794 * Option to hurt the player.
2797 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2799 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2801 /* Analyze the "target" and the caster. */
2802 return (project(who, rad, y, x, dam, typ, flg, -1));
2807 * @brief ブラスト系スペルの発動 / Cast a blast spell
2809 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2814 * @return 作用が実際にあった場合TRUEを返す
2816 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2820 POSITION ty, tx, y, x;
2823 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2828 /* Use the given direction */
2831 ly = ty = p_ptr->y + 20 * ddy[dir];
2832 lx = tx = p_ptr->x + 20 * ddx[dir];
2835 /* Use an actual "target" */
2836 else /* if (dir == 5) */
2841 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2842 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2845 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2848 for (i = 0; i < num; i++)
2852 /* Get targets for some bolts */
2853 y = rand_spread(ly, ld * dev / 20);
2854 x = rand_spread(lx, ld * dev / 20);
2856 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2859 /* Analyze the "dir" and the "target". */
2860 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2871 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2872 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2873 * @return 作用が実際にあった場合TRUEを返す
2875 bool teleport_swap(DIRECTION dir)
2879 monster_type* m_ptr;
2880 monster_race* r_ptr;
2882 if ((dir == 5) && target_okay())
2889 tx = p_ptr->x + ddx[dir];
2890 ty = p_ptr->y + ddy[dir];
2892 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2894 if (p_ptr->anti_tele)
2896 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2900 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2902 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2906 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2908 msg_print(_("失敗した。", "Failed to swap."));
2912 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2913 r_ptr = &r_info[m_ptr->r_idx];
2915 (void)set_monster_csleep(g_ptr->m_idx, 0);
2917 if (r_ptr->flagsr & RFR_RES_TELE)
2919 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2920 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2924 sound(SOUND_TELEPORT);
2926 /* Swap the player and monster */
2927 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2935 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2937 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2940 * @return 作用が実際にあった場合TRUEを返す
2942 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2946 /* Pass through the target if needed */
2947 flg |= (PROJECT_THRU);
2949 /* Use the given direction */
2950 tx = p_ptr->x + ddx[dir];
2951 ty = p_ptr->y + ddy[dir];
2953 /* Hack -- Use an actual "target" */
2954 if ((dir == 5) && target_okay())
2960 /* Analyze the "dir" and the "target", do NOT explode */
2961 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2966 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2968 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2970 * @return 作用が実際にあった場合TRUEを返す
2973 * Stop if we hit a monster, as a "bolt".
2974 * Affect monsters and grids (not objects).
2977 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2979 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2980 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2981 return (project_hook(typ, dir, dam, flg));
2986 * @brief ビーム系スペルの発動 / Cast a beam spell.
2988 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2990 * @return 作用が実際にあった場合TRUEを返す
2993 * Pass through monsters, as a "beam".
2994 * Affect monsters, grids and objects.
2997 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2999 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3000 return (project_hook(typ, dir, dam, flg));
3005 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3006 * @param prob ビーム化する確率(%)
3008 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3010 * @return 作用が実際にあった場合TRUEを返す
3013 * Pass through monsters, as a "beam".
3014 * Affect monsters, grids and objects.
3017 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3019 if (randint0(100) < prob)
3021 return (fire_beam(typ, dir, dam));
3025 return (fire_bolt(typ, dir, dam));
3030 * @brief LITE_WEAK属性による光源ビーム処理
3031 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3033 * @return 作用が実際にあった場合TRUEを返す
3035 bool lite_line(DIRECTION dir, HIT_POINT dam)
3037 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3038 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3043 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3045 * @return 作用が実際にあった場合TRUEを返す
3047 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3049 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3050 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3055 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3057 * @return 作用が実際にあった場合TRUEを返す
3059 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3061 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3062 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3067 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3068 * @return 作用が実際にあった場合TRUEを返す
3070 bool wizard_lock(DIRECTION dir)
3072 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3073 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3078 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3079 * @return 作用が実際にあった場合TRUEを返す
3081 bool destroy_door(DIRECTION dir)
3083 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3084 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3089 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3090 * @return 作用が実際にあった場合TRUEを返す
3092 bool disarm_trap(DIRECTION dir)
3094 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3095 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3101 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3102 * @param plev プレイヤーレベル(効力はplev*200)
3103 * @return 作用が実際にあった場合TRUEを返す
3105 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3107 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3108 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3112 * @brief モンスター用テレポート処理
3113 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3114 * @param distance 移動距離
3115 * @return 作用が実際にあった場合TRUEを返す
3117 bool teleport_monster(DIRECTION dir, int distance)
3119 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3120 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3124 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3125 * @return 作用が実際にあった場合TRUEを返す
3127 bool door_creation(void)
3129 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3130 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3134 * @brief トラップ生成処理(起点から周囲1マス)
3137 * @return 作用が実際にあった場合TRUEを返す
3139 bool trap_creation(POSITION y, POSITION x)
3141 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3142 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3146 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3147 * @return 作用が実際にあった場合TRUEを返す
3149 bool tree_creation(void)
3151 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3152 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3156 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3157 * @return 作用が実際にあった場合TRUEを返す
3159 bool glyph_creation(void)
3161 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3162 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3166 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3167 * @return 作用が実際にあった場合TRUEを返す
3169 bool wall_stone(void)
3171 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3172 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3173 p_ptr->update |= (PU_FLOW);
3174 p_ptr->redraw |= (PR_MAP);
3179 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3180 * @return 作用が実際にあった場合TRUEを返す
3182 bool destroy_doors_touch(void)
3184 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3185 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3189 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3190 * @return 作用が実際にあった場合TRUEを返す
3192 bool disarm_traps_touch(void)
3194 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3195 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3199 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3200 * @return 作用が実際にあった場合TRUEを返す
3202 bool sleep_monsters_touch(void)
3204 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3205 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3210 * @brief 死者復活処理(起点より周囲5マス)
3211 * @param who 術者モンスターID(0ならばプレイヤー)
3214 * @return 作用が実際にあった場合TRUEを返す
3216 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3218 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3219 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3224 * @return 作用が実際にあった場合TRUEを返す
3226 void call_chaos(void)
3228 int Chaos_type, dummy, dir;
3229 PLAYER_LEVEL plev = p_ptr->lev;
3230 bool line_chaos = FALSE;
3232 int hurt_types[31] =
3234 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3235 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3236 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3237 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3238 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3239 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3240 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3241 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3244 Chaos_type = hurt_types[randint0(31)];
3245 if (one_in_(4)) line_chaos = TRUE;
3249 for (dummy = 1; dummy < 10; dummy++)
3254 fire_beam(Chaos_type, dummy, 150);
3256 fire_ball(Chaos_type, dummy, 150, 2);
3260 else if (one_in_(3))
3262 fire_ball(Chaos_type, 0, 500, 8);
3266 if (!get_aim_dir(&dir)) return;
3268 fire_beam(Chaos_type, dir, 250);
3270 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3275 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3276 * @param stop_ty 再帰処理停止フラグ
3278 * @return 作用が実際にあった場合TRUEを返す
3281 * rr9: Stop the nasty things when a Cyberdemon is summoned
3282 * or the player gets paralyzed.
3285 bool activate_ty_curse(bool stop_ty, int *count)
3288 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3292 switch (randint1(34))
3297 msg_print(_("地面が揺れた...", "The ground trembles..."));
3298 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3299 if (!one_in_(6)) break;
3304 HIT_POINT dam = damroll(10, 10);
3305 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3306 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3307 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3308 if (!one_in_(6)) break;
3313 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3314 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3315 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3316 if (!one_in_(6)) break;
3319 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3323 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3324 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3326 if (!one_in_(6)) break;
3327 case 1: case 2: case 3: case 16: case 17:
3328 aggravate_monsters(0);
3329 if (!one_in_(6)) break;
3330 case 4: case 5: case 6:
3331 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3332 if (!one_in_(6)) break;
3333 case 7: case 8: case 9: case 18:
3334 (*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), '\0');
3335 if (!one_in_(6)) break;
3336 case 10: case 11: case 12:
3337 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3338 lose_exp(p_ptr->exp / 16);
3339 if (!one_in_(6)) break;
3340 case 13: case 14: case 15: case 19: case 20:
3341 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3347 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3348 if (p_ptr->free_act)
3349 set_paralyzed(p_ptr->paralyzed + randint1(3));
3351 set_paralyzed(p_ptr->paralyzed + randint1(13));
3354 if (!one_in_(6)) break;
3355 case 21: case 22: case 23:
3356 (void)do_dec_stat(randint0(6));
3357 if (!one_in_(6)) break;
3359 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3361 if (!one_in_(6)) break;
3364 * Only summon Cyberdemons deep in the dungeon.
3366 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3368 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3372 if (!one_in_(6)) break;
3378 (void)do_dec_stat(i);
3386 while (one_in_(3) && !stop_ty);
3392 * @brief HI_SUMMON(上級召喚)処理発動
3395 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3396 * @return 作用が実際にあった場合TRUEを返す
3398 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3403 BIT_FLAGS mode = PM_ALLOW_GROUP;
3410 mode |= PM_FORCE_FRIENDLY;
3414 mode |= PM_FORCE_PET;
3419 if (!pet) mode |= PM_NO_PET;
3421 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3423 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3425 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3428 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
3431 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
3434 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
3437 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
3440 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
3443 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
3446 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
3449 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
3453 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
3457 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
3460 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3461 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
3464 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3465 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
3468 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
3471 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3472 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
3480 * @brief 周辺破壊効果(プレイヤー中心)
3481 * @return 作用が実際にあった場合TRUEを返す
3483 void wall_breaker(void)
3486 POSITION y = 0, x = 0;
3487 int attempts = 1000;
3489 if (randint1(80 + p_ptr->lev) < 70)
3493 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3495 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3497 if (!player_bold(y, x)) break;
3500 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3501 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3503 else if (randint1(100) > 30)
3505 earthquake(p_ptr->y, p_ptr->x, 1);
3509 int num = damroll(5, 3);
3511 for (i = 0; i < num; i++)
3515 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3517 if (!player_bold(y, x)) break;
3520 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3521 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3528 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3530 * @return 作用が実際にあった場合TRUEを返す
3532 bool confuse_monsters(HIT_POINT dam)
3534 return (project_all_los(GF_OLD_CONF, dam));
3539 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3541 * @return 作用が実際にあった場合TRUEを返す
3543 bool charm_monsters(HIT_POINT dam)
3545 return (project_all_los(GF_CHARM, dam));
3550 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3552 * @return 作用が実際にあった場合TRUEを返す
3554 bool charm_animals(HIT_POINT dam)
3556 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3561 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3563 * @return 作用が実際にあった場合TRUEを返す
3565 bool stun_monsters(HIT_POINT dam)
3567 return (project_all_los(GF_STUN, dam));
3572 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3574 * @return 作用が実際にあった場合TRUEを返す
3576 bool stasis_monsters(HIT_POINT dam)
3578 return (project_all_los(GF_STASIS, dam));
3583 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3585 * @return 作用が実際にあった場合TRUEを返す
3587 bool mindblast_monsters(HIT_POINT dam)
3589 return (project_all_los(GF_PSI, dam));
3594 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3595 * @param dist 効力(距離)
3596 * @return 作用が実際にあった場合TRUEを返す
3598 bool banish_monsters(int dist)
3600 return (project_all_los(GF_AWAY_ALL, dist));
3605 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3607 * @return 作用が実際にあった場合TRUEを返す
3609 bool turn_evil(HIT_POINT dam)
3611 return (project_all_los(GF_TURN_EVIL, dam));
3616 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3618 * @return 作用が実際にあった場合TRUEを返す
3620 bool turn_monsters(HIT_POINT dam)
3622 return (project_all_los(GF_TURN_ALL, dam));
3627 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3628 * @return 作用が実際にあった場合TRUEを返す
3630 bool deathray_monsters(void)
3632 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3636 * @brief チャーム・モンスター(1体)
3637 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3639 * @return 作用が実際にあった場合TRUEを返す
3641 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3643 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3644 return (project_hook(GF_CHARM, dir, plev, flg));
3648 * @brief アンデッド支配(1体)
3649 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3651 * @return 作用が実際にあった場合TRUEを返す
3653 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3655 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3656 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3661 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3663 * @return 作用が実際にあった場合TRUEを返す
3665 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3667 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3668 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3673 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3675 * @return 作用が実際にあった場合TRUEを返す
3677 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3679 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3680 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3686 * @param success 判定成功上の処理ならばTRUE
3687 * @return 作用が実際にあった場合TRUEを返す
3689 bool kawarimi(bool success)
3692 object_type *q_ptr = &forge;
3695 if (p_ptr->is_dead) return FALSE;
3696 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3697 if (randint0(200) < p_ptr->stun) return FALSE;
3699 if (!success && one_in_(3))
3701 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3702 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3703 p_ptr->redraw |= (PR_STATUS);
3710 teleport_player(10 + randint1(90), 0L);
3712 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3714 q_ptr->pval = MON_NINJA;
3715 (void)drop_near(q_ptr, -1, y, x);
3717 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3718 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3720 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3721 p_ptr->redraw |= (PR_STATUS);
3729 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3730 * @param mdeath 目標モンスターが死亡したかを返す
3731 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3733 bool rush_attack(bool *mdeath)
3740 bool tmp_mdeath = FALSE;
3743 if (mdeath) *mdeath = FALSE;
3746 if (!get_aim_dir(&dir)) return FALSE;
3748 /* Use the given direction */
3749 tx = p_ptr->x + project_length * ddx[dir];
3750 ty = p_ptr->y + project_length * ddy[dir];
3752 /* Hack -- Use an actual "target" */
3753 if ((dir == 5) && target_okay())
3759 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3761 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3764 /* No need to move */
3765 if (!path_n) return TRUE;
3767 /* Use ty and tx as to-move point */
3771 /* Project along the path */
3772 for (i = 0; i < path_n; i++)
3774 monster_type *m_ptr;
3776 int ny = GRID_Y(path_g[i]);
3777 int nx = GRID_X(path_g[i]);
3779 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3784 /* Go to next grid */
3788 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3792 msg_print(_("失敗!", "Failed!"));
3796 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3803 /* Move player before updating the monster */
3804 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3805 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3807 /* Found a monster */
3808 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3810 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3813 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3815 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3818 else if (!player_bold(ty, tx))
3820 /* Hold the monster name */
3821 GAME_TEXT m_name[MAX_NLEN];
3823 /* Get the monster name (BEFORE polymorphing) */
3824 monster_desc(m_name, m_ptr, 0);
3825 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3828 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3830 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3835 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3837 if (mdeath) *mdeath = tmp_mdeath;
3843 * @brief 全鏡の消去 / Remove all mirrors in this floor
3844 * @param explode 爆発処理を伴うならばTRUE
3847 void remove_all_mirrors(bool explode)
3851 for (x = 0; x < current_floor_ptr->width; x++)
3853 for (y = 0; y < current_floor_ptr->height; y++)
3855 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3857 remove_mirror(y, x);
3859 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3860 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3867 * @brief 『一つの指輪』の効果処理 /
3868 * Hack -- activate the ring of power
3869 * @param dir 発動の方向ID
3872 void ring_of_power(DIRECTION dir)
3874 /* Pick a random effect */
3875 switch (randint1(10))
3880 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3883 /* Decrease all stats (permanently) */
3884 (void)dec_stat(A_STR, 50, TRUE);
3885 (void)dec_stat(A_INT, 50, TRUE);
3886 (void)dec_stat(A_WIS, 50, TRUE);
3887 (void)dec_stat(A_DEX, 50, TRUE);
3888 (void)dec_stat(A_CON, 50, TRUE);
3889 (void)dec_stat(A_CHR, 50, TRUE);
3891 /* Lose some experience (permanently) */
3892 p_ptr->exp -= (p_ptr->exp / 4);
3893 p_ptr->max_exp -= (p_ptr->exp / 4);
3901 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3902 dispel_monsters(1000);
3910 fire_ball(GF_MANA, dir, 600, 3);
3919 fire_bolt(GF_MANA, dir, 500);
3926 * @brief 運命の輪、並びにカオス的な効果の発動
3927 * @param spell ランダムな効果を選択するための基準ID
3930 void wild_magic(int spell)
3933 int type = SUMMON_MOLD + randint0(6);
3935 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3936 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3938 switch (randint1(spell) + randint1(8) + 1)
3943 teleport_player(10, TELEPORT_PASSIVE);
3948 teleport_player(100, TELEPORT_PASSIVE);
3952 teleport_player(200, TELEPORT_PASSIVE);
3962 lite_area(damroll(2, 3), 2);
3965 destroy_doors_touch();
3970 sleep_monsters_touch();
3974 trap_creation(p_ptr->y, p_ptr->x);
3983 aggravate_monsters(0);
3986 earthquake(p_ptr->y, p_ptr->x, 5);
3990 (void)gain_mutation(p_ptr, 0);
3994 apply_disenchant(1);
4000 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4007 while (counter++ < 8)
4009 (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
4014 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4017 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4022 (void)activate_ty_curse(FALSE, &count);
4031 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4032 * / Drop 10+1d10 meteor ball at random places near the player
4037 void cast_meteor(HIT_POINT dam, POSITION rad)
4040 int b = 10 + randint1(10);
4042 for (i = 0; i < b; i++)
4044 POSITION y = 0, x = 0;
4047 for (count = 0; count <= 20; count++)
4051 x = p_ptr->x - 8 + randint0(17);
4052 y = p_ptr->y - 8 + randint0(17);
4054 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4055 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4057 /* Approximate distance */
4058 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4060 if (d >= 9) continue;
4062 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4063 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4065 /* Valid position */
4069 if (count > 20) continue;
4071 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4077 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4080 * @return ターゲットを指定し、実行したならばTRUEを返す。
4082 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4084 POSITION x, y, tx, ty;
4088 int b = 10 + randint1(10);
4090 if (!get_aim_dir(&dir)) return FALSE;
4092 /* Use the given direction */
4093 tx = p_ptr->x + 99 * ddx[dir];
4094 ty = p_ptr->y + 99 * ddy[dir];
4096 /* Hack -- Use an actual "target" */
4097 if ((dir == 5) && target_okay())
4108 /* Hack -- Stop at the target */
4109 if ((y == ty) && (x == tx)) break;
4113 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4115 /* Stop at maximum range */
4116 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4118 /* Stopped by walls/doors */
4119 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4121 /* Stopped by monsters */
4122 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4124 /* Save the new location */
4131 for (i = 0; i < b; i++)
4133 int count = 20, d = 0;
4139 x = tx - 5 + randint0(11);
4140 y = ty - 5 + randint0(11);
4142 dx = (tx > x) ? (tx - x) : (x - tx);
4143 dy = (ty > y) ? (ty - y) : (y - ty);
4145 /* Approximate distance */
4146 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4147 /* Within the radius */
4151 if (count < 0) continue;
4153 /* Cannot penetrate perm walls */
4154 if (!in_bounds(y, x) ||
4155 cave_stop_disintegration(y, x) ||
4156 !in_disintegration_range(ty, tx, y, x))
4159 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4166 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4170 * This spell should become more useful (more controlled) as the\n
4171 * player gains experience levels. Thus, add 1/5 of the player's\n
4172 * level to the die roll. This eliminates the worst effects later on,\n
4173 * while keeping the results quite random. It also allows some potent\n
4174 * effects only at high level.
4176 void cast_wonder(DIRECTION dir)
4178 PLAYER_LEVEL plev = p_ptr->lev;
4179 int die = randint1(100) + plev / 5;
4180 int vir = virtue_number(V_CHANCE);
4184 if (p_ptr->virtues[vir - 1] > 0)
4186 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4190 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4195 chg_virtue(V_CHANCE, 1);
4199 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4202 if (die < 8) clone_monster(dir);
4203 else if (die < 14) speed_monster(dir, plev);
4204 else if (die < 26) heal_monster(dir, damroll(4, 6));
4205 else if (die < 31) poly_monster(dir, plev);
4207 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4208 damroll(3 + ((plev - 1) / 5), 4));
4209 else if (die < 41) confuse_monster(dir, plev);
4210 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4211 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4213 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4214 damroll(3 + ((plev - 5) / 4), 8));
4216 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4217 damroll(5 + ((plev - 5) / 4), 8));
4219 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4220 damroll(6 + ((plev - 5) / 4), 8));
4222 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4223 damroll(8 + ((plev - 5) / 4), 8));
4224 else if (die < 76) hypodynamic_bolt(dir, 75);
4225 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4226 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4227 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4228 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4229 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4232 earthquake(p_ptr->y, p_ptr->x, 12);
4236 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4240 symbol_genocide(plev + 50, TRUE);
4242 else if (die < 110) dispel_monsters(120);
4245 dispel_monsters(150);
4246 slow_monsters(plev);
4247 sleep_monsters(plev);
4254 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4258 void cast_invoke_spirits(DIRECTION dir)
4260 PLAYER_LEVEL plev = p_ptr->lev;
4261 int die = randint1(100) + plev / 5;
4262 int vir = virtue_number(V_CHANCE);
4266 if (p_ptr->virtues[vir - 1] > 0)
4268 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4272 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4276 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4278 chg_virtue(V_CHANCE, 1);
4282 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4287 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4288 "Oh no! Mouldering forms rise from the earth around you!"));
4290 (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), '\0');
4291 chg_virtue(V_UNLIFE, 1);
4295 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4297 set_afraid(p_ptr->afraid + randint1(4) + 4);
4301 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4302 "Your head is invaded by a horde of gibbering spectral voices..."));
4304 set_confused(p_ptr->confused + randint1(4) + 4);
4308 poly_monster(dir, plev);
4312 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4313 damroll(3 + ((plev - 1) / 5), 4));
4317 confuse_monster(dir, plev);
4321 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4325 (void)lite_line(dir, damroll(6, 8));
4329 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4330 damroll(3 + ((plev - 5) / 4), 8));
4334 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4335 damroll(5 + ((plev - 5) / 4), 8));
4339 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4340 damroll(6 + ((plev - 5) / 4), 8));
4344 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4345 damroll(8 + ((plev - 5) / 4), 8));
4349 hypodynamic_bolt(dir, 75);
4353 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4357 fire_ball(GF_ACID, dir, 40 + plev, 2);
4361 fire_ball(GF_ICE, dir, 70 + plev, 3);
4365 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4369 hypodynamic_bolt(dir, 100 + plev);
4373 earthquake(p_ptr->y, p_ptr->x, 12);
4377 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4381 symbol_genocide(plev + 50, TRUE);
4385 dispel_monsters(120);
4389 dispel_monsters(150);
4390 slow_monsters(plev);
4391 sleep_monsters(plev);
4397 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4398 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4403 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4406 void cast_shuffle(void)
4408 PLAYER_LEVEL plev = p_ptr->lev;
4411 int vir = virtue_number(V_CHANCE);
4414 /* Card sharks and high mages get a level bonus */
4415 if ((p_ptr->pclass == CLASS_ROGUE) ||
4416 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4417 (p_ptr->pclass == CLASS_SORCERER))
4418 die = (randint1(110)) + plev / 5;
4420 die = randint1(120);
4425 if (p_ptr->virtues[vir - 1] > 0)
4427 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4431 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4435 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4438 chg_virtue(V_CHANCE, 1);
4442 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4444 for (i = 0; i < randint1(3); i++)
4445 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4449 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4450 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), '\0');
4455 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4456 activate_ty_curse(FALSE, &count);
4460 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4461 aggravate_monsters(0);
4465 msg_print(_("《愚者》だ。", "It's the Fool."));
4471 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4472 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);
4476 msg_print(_("《月》だ。", "It's the Moon."));
4481 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4482 wild_magic(randint0(32));
4486 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4487 teleport_player(10, TELEPORT_PASSIVE);
4491 msg_print(_("《正義》だ。", "It's Justice."));
4492 set_blessed(p_ptr->lev, FALSE);
4496 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4497 teleport_player(100, TELEPORT_PASSIVE);
4501 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4502 teleport_player(200, TELEPORT_PASSIVE);
4506 msg_print(_("《塔》だ。", "It's the Tower."));
4511 msg_print(_("《節制》だ。", "It's Temperance."));
4512 sleep_monsters_touch();
4516 msg_print(_("《塔》だ。", "It's the Tower."));
4518 earthquake(p_ptr->y, p_ptr->x, 5);
4522 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4523 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4527 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4528 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4532 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4533 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4537 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4538 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4542 msg_print(_("《恋人》だ。", "It's the Lovers."));
4544 if (get_aim_dir(&dir))
4545 charm_monster(dir, MIN(p_ptr->lev, 20));
4549 msg_print(_("《隠者》だ。", "It's the Hermit."));
4554 msg_print(_("《審判》だ。", "It's the Judgement."));
4555 roll_hitdice(p_ptr, 0L);
4556 lose_all_mutations();
4560 msg_print(_("《太陽》だ。", "It's the Sun."));
4561 chg_virtue(V_KNOWLEDGE, 1);
4562 chg_virtue(V_ENLIGHTEN, 1);
4567 msg_print(_("《世界》だ。", "It's the World."));
4568 if (p_ptr->exp < PY_MAX_EXP)
4570 s32b ee = (p_ptr->exp / 25) + 1;
4571 if (ee > 5000) ee = 5000;
4572 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4579 * @brief 口を使う継続的な処理を中断する
4582 void stop_mouth(void)
4584 if (music_singing_any()) stop_singing(p_ptr);
4585 if (hex_spelling_any()) stop_hex_spell_all();
4589 bool_hack vampirism(void)
4596 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4598 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4602 /* Only works on adjacent monsters */
4603 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4604 y = p_ptr->y + ddy[dir];
4605 x = p_ptr->x + ddx[dir];
4606 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4610 if (!(g_ptr->m_idx))
4612 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4616 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4618 dummy = p_ptr->lev * 2;
4620 if (hypodynamic_bolt(dir, dummy))
4622 if (p_ptr->food < PY_FOOD_FULL)
4623 /* No heal if we are "full" */
4624 (void)hp_player(dummy);
4626 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4628 /* Gain nutritional sustenance: 150/hp drained */
4629 /* A Food ration gives 5000 food points (by contrast) */
4630 /* Don't ever get more than "Full" this way */
4631 /* But if we ARE Gorged, it won't cure us */
4632 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4633 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4634 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4637 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4641 bool panic_hit(void)
4646 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4647 y = p_ptr->y + ddy[dir];
4648 x = p_ptr->x + ddx[dir];
4649 if (current_floor_ptr->grid_array[y][x].m_idx)
4652 if (randint0(p_ptr->skill_dis) < 7)
4653 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4655 teleport_player(30, 0L);
4660 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4668 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
4671 * currently this function allows pseudo-id of any object,
4672 * including silly ones like potions & scrolls, which always
4673 * get '{average}'. This should be changed, either to stop such
4674 * items from being pseudo-id'd, or to allow psychometry to
4675 * detect whether the unidentified potion/scroll/etc is
4676 * good (Cure Light Wounds, Restore Strength, etc) or
4677 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4679 bool psychometry(void)
4683 GAME_TEXT o_name[MAX_NLEN];
4688 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4689 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4691 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4692 if (!o_ptr) return (FALSE);
4694 /* It is fully known, no information needed */
4695 if (object_is_known(o_ptr))
4697 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4701 /* Check for a feeling */
4702 feel = value_check_aux1(o_ptr);
4704 /* Get an object description */
4705 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4707 /* Skip non-feelings */
4710 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4715 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4717 msg_format("You feel that the %s %s %s...",
4718 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4722 o_ptr->ident |= (IDENT_SENSE);
4723 o_ptr->feeling = feel;
4724 o_ptr->marked |= OM_TOUCHED;
4726 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4727 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4729 /* Valid "tval" codes */
4730 switch (o_ptr->tval)
4758 /* Auto-inscription/destroy */
4759 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4761 /* Something happened */
4766 bool draconian_breath(player_type *creature_ptr)
4769 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4770 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4772 if (!get_aim_dir(&dir)) return FALSE;
4774 if (randint1(100) < creature_ptr->lev)
4776 switch (creature_ptr->pclass)
4779 case CLASS_BERSERKER:
4782 case CLASS_IMITATOR:
4788 Type_desc = _("エレメント", "the elements");
4793 Type_desc = _("破片", "shards");
4797 case CLASS_WARRIOR_MAGE:
4798 case CLASS_HIGH_MAGE:
4799 case CLASS_SORCERER:
4800 case CLASS_MAGIC_EATER:
4801 case CLASS_RED_MAGE:
4802 case CLASS_BLUE_MAGE:
4803 case CLASS_MIRROR_MASTER:
4807 Type_desc = _("魔力", "mana");
4811 Type = GF_DISENCHANT;
4812 Type_desc = _("劣化", "disenchantment");
4815 case CLASS_CHAOS_WARRIOR:
4818 Type = GF_CONFUSION;
4819 Type_desc = _("混乱", "confusion");
4824 Type_desc = _("カオス", "chaos");
4829 case CLASS_FORCETRAINER:
4832 Type = GF_CONFUSION;
4833 Type_desc = _("混乱", "confusion");
4838 Type_desc = _("轟音", "sound");
4841 case CLASS_MINDCRAFTER:
4844 Type = GF_CONFUSION;
4845 Type_desc = _("混乱", "confusion");
4850 Type_desc = _("精神エネルギー", "mental energy");
4857 Type = GF_HELL_FIRE;
4858 Type_desc = _("地獄の劫火", "hellfire");
4862 Type = GF_HOLY_FIRE;
4863 Type_desc = _("聖なる炎", "holy fire");
4871 Type_desc = _("暗黒", "darkness");
4876 Type_desc = _("毒", "poison");
4883 Type_desc = _("轟音", "sound");
4887 Type = GF_CONFUSION;
4888 Type_desc = _("混乱", "confusion");
4895 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4897 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4901 bool android_inside_weapon(player_type *creature_ptr)
4904 if (!get_aim_dir(&dir)) return FALSE;
4905 if (creature_ptr->lev < 10)
4907 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4908 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4910 else if (creature_ptr->lev < 25)
4912 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4913 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4915 else if (creature_ptr->lev < 35)
4917 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4918 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4920 else if (creature_ptr->lev < 45)
4922 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4923 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4927 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4928 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4933 bool create_ration(player_type *crature_ptr)
4939 /* Create the food ration */
4940 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4942 /* Drop the object from heaven */
4943 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4944 msg_print(_("食事を料理して作った。", "You cook some food."));
4948 void hayagake(player_type *creature_ptr)
4950 if (creature_ptr->action == ACTION_HAYAGAKE)
4952 set_action(ACTION_NONE);
4956 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4957 feature_type *f_ptr = &f_info[g_ptr->feat];
4959 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4960 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4962 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4966 set_action(ACTION_HAYAGAKE);
4969 creature_ptr->energy_use = 0;
4972 bool double_attack(player_type *creature_ptr)
4977 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4978 y = creature_ptr->y + ddy[dir];
4979 x = creature_ptr->x + ddx[dir];
4980 if (current_floor_ptr->grid_array[y][x].m_idx)
4983 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4984 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4986 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4987 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4989 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4990 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4993 if (current_floor_ptr->grid_array[y][x].m_idx)
4998 creature_ptr->energy_need += ENERGY_NEED();
5002 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5008 bool comvert_hp_to_mp(player_type *creature_ptr)
5010 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5013 creature_ptr->csp += gain_sp;
5014 if (creature_ptr->csp > creature_ptr->msp)
5016 creature_ptr->csp = creature_ptr->msp;
5017 creature_ptr->csp_frac = 0;
5022 msg_print(_("変換に失敗した。", "You failed to convert."));
5024 creature_ptr->redraw |= (PR_HP | PR_MANA);
5028 bool comvert_mp_to_hp(player_type *creature_ptr)
5030 if (creature_ptr->csp >= creature_ptr->lev / 5)
5032 creature_ptr->csp -= creature_ptr->lev / 5;
5033 hp_player(creature_ptr->lev);
5037 msg_print(_("変換に失敗した。", "You failed to convert."));
5039 creature_ptr->redraw |= (PR_HP | PR_MANA);
5043 bool demonic_breath(player_type *creature_ptr)
5046 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5047 if (!get_aim_dir(&dir)) return FALSE;
5049 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5050 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5054 bool mirror_concentration(player_type *creature_ptr)
5058 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5061 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5063 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5065 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5066 if (creature_ptr->csp >= creature_ptr->msp)
5068 creature_ptr->csp = creature_ptr->msp;
5069 creature_ptr->csp_frac = 0;
5071 creature_ptr->redraw |= (PR_MANA);
5075 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5080 bool sword_dancing(player_type *creature_ptr)
5083 POSITION y = 0, x = 0;
5087 for (i = 0; i < 6; i++)
5090 y = creature_ptr->y + ddy_ddd[dir];
5091 x = creature_ptr->x + ddx_ddd[dir];
5092 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5094 /* Hack -- attack monsters */
5099 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5105 bool confusing_light(player_type *creature_ptr)
5107 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5108 slow_monsters(creature_ptr->lev);
5109 stun_monsters(creature_ptr->lev * 4);
5110 confuse_monsters(creature_ptr->lev * 4);
5111 turn_monsters(creature_ptr->lev * 4);
5112 stasis_monsters(creature_ptr->lev * 4);
5116 bool rodeo(player_type *creature_ptr)
5118 GAME_TEXT m_name[MAX_NLEN];
5119 monster_type *m_ptr;
5120 monster_race *r_ptr;
5123 if (creature_ptr->riding)
5125 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5128 if (!do_riding(TRUE)) return TRUE;
5130 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5131 r_ptr = &r_info[m_ptr->r_idx];
5132 monster_desc(m_name, m_ptr, 0);
5133 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5135 if (is_pet(m_ptr)) return TRUE;
5137 rlev = r_ptr->level;
5139 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5140 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5141 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5142 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5143 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5144 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5146 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5151 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5153 /* 落馬処理に失敗してもとにかく乗馬解除 */
5154 creature_ptr->riding = 0;
5159 bool clear_mind(player_type *creature_ptr)
5163 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5166 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5168 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5169 if (creature_ptr->csp >= creature_ptr->msp)
5171 creature_ptr->csp = creature_ptr->msp;
5172 creature_ptr->csp_frac = 0;
5174 creature_ptr->redraw |= (PR_MANA);
5178 bool concentration(player_type *creature_ptr)
5180 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5184 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5187 if (creature_ptr->special_defense & KATA_MASK)
5189 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5192 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5194 creature_ptr->csp += creature_ptr->msp / 2;
5195 if (creature_ptr->csp >= max_csp)
5197 creature_ptr->csp = max_csp;
5198 creature_ptr->csp_frac = 0;
5200 creature_ptr->redraw |= (PR_MANA);