3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
18 #include "monsterrace-hook.h"
21 #include "projection.h"
22 #include "spells-summon.h"
27 #include "spells-status.h"
28 #include "spells-floor.h"
29 #include "realm-hex.h"
30 #include "object-hook.h"
31 #include "monster-status.h"
34 * @brief プレイヤー周辺の地形を感知する
37 * @param known 地形から危険フラグを外すならTRUE
38 * @return 効力があった場合TRUEを返す
40 static bool detect_feat_flag(POSITION range, int flag, bool known)
46 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
48 /* Scan the current panel */
49 for (y = 1; y < current_floor_ptr->height - 1; y++)
51 for (x = 1; x <= current_floor_ptr->width - 1; x++)
53 int dist = distance(p_ptr->y, p_ptr->x, y, x);
54 if (dist > range) continue;
55 g_ptr = ¤t_floor_ptr->grid_array[y][x];
60 /* Mark as detected */
61 if (dist <= range && known)
63 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
65 g_ptr->info &= ~(CAVE_UNSAFE);
72 if (cave_have_flag_grid(g_ptr, flag))
77 /* Hack -- Memorize */
78 g_ptr->info |= (CAVE_MARK);
91 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
93 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
94 * @return 効力があった場合TRUEを返す
96 bool detect_traps(POSITION range, bool known)
98 bool detect = detect_feat_flag(range, FF_TRAP, known);
100 if (known) p_ptr->dtrap = TRUE;
102 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
105 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
112 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
114 * @return 効力があった場合TRUEを返す
116 bool detect_doors(POSITION range)
118 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
120 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
123 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
130 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
132 * @return 効力があった場合TRUEを返す
134 bool detect_stairs(POSITION range)
136 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
138 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
141 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
148 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
150 * @return 効力があった場合TRUEを返す
152 bool detect_treasure(POSITION range)
154 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
156 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
159 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
166 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
168 * @return 効力があった場合TRUEを返す
170 bool detect_objects_gold(POSITION range)
174 POSITION range2 = range;
178 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
181 for (i = 1; i < o_max; i++)
183 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
185 /* Skip dead objects */
186 if (!o_ptr->k_idx) continue;
188 /* Skip held objects */
189 if (o_ptr->held_m_idx) continue;
194 /* Only detect nearby objects */
195 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
197 /* Detect "gold" objects */
198 if (o_ptr->tval == TV_GOLD)
200 o_ptr->marked |= OM_FOUND;
206 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
209 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
212 if (detect_monsters_string(range, "$"))
221 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
223 * @return 効力があった場合TRUEを返す
225 bool detect_objects_normal(POSITION range)
229 POSITION range2 = range;
233 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
236 for (i = 1; i < o_max; i++)
238 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
240 /* Skip dead objects */
241 if (!o_ptr->k_idx) continue;
243 /* Skip held objects */
244 if (o_ptr->held_m_idx) continue;
249 /* Only detect nearby objects */
250 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
252 /* Detect "real" objects */
253 if (o_ptr->tval != TV_GOLD)
255 o_ptr->marked |= OM_FOUND;
261 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
264 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
267 if (detect_monsters_string(range, "!=?|/`"))
276 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
278 * @return 効力があった場合TRUEを返す
281 * This will light up all spaces with "magic" items, including artifacts,
282 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
283 * and "enchanted" items of the "good" variety.
285 * It can probably be argued that this function is now too powerful.
288 bool detect_objects_magic(POSITION range)
290 OBJECT_TYPE_VALUE tv;
296 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
298 /* Scan all objects */
299 for (i = 1; i < o_max; i++)
301 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
303 /* Skip dead objects */
304 if (!o_ptr->k_idx) continue;
306 /* Skip held objects */
307 if (o_ptr->held_m_idx) continue;
312 /* Only detect nearby objects */
313 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
315 /* Examine the tval */
318 /* Artifacts, misc magic items, or enchanted wearables */
319 if (object_is_artifact(o_ptr) ||
320 object_is_ego(o_ptr) ||
321 (tv == TV_WHISTLE) ||
329 (tv == TV_LIFE_BOOK) ||
330 (tv == TV_SORCERY_BOOK) ||
331 (tv == TV_NATURE_BOOK) ||
332 (tv == TV_CHAOS_BOOK) ||
333 (tv == TV_DEATH_BOOK) ||
334 (tv == TV_TRUMP_BOOK) ||
335 (tv == TV_ARCANE_BOOK) ||
336 (tv == TV_CRAFT_BOOK) ||
337 (tv == TV_DAEMON_BOOK) ||
338 (tv == TV_CRUSADE_BOOK) ||
339 (tv == TV_MUSIC_BOOK) ||
340 (tv == TV_HISSATSU_BOOK) ||
341 (tv == TV_HEX_BOOK) ||
342 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
344 /* Memorize the item */
345 o_ptr->marked |= OM_FOUND;
352 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
361 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
363 * @return 効力があった場合TRUEを返す
365 bool detect_monsters_normal(POSITION range)
371 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
373 for (i = 1; i < m_max; i++)
375 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
376 monster_race *r_ptr = &r_info[m_ptr->r_idx];
377 if (!monster_is_valid(m_ptr)) continue;
382 /* Only detect nearby monsters */
383 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
385 /* Detect all non-invisible monsters */
386 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
388 /* Repair visibility later */
389 repair_monsters = TRUE;
391 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
392 update_monster(i, FALSE);
397 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
400 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
407 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
409 * @return 効力があった場合TRUEを返す
411 bool detect_monsters_invis(POSITION range)
417 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
419 for (i = 1; i < m_max; i++)
421 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
422 monster_race *r_ptr = &r_info[m_ptr->r_idx];
424 if (!monster_is_valid(m_ptr)) continue;
429 /* Only detect nearby monsters */
430 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
432 /* Detect invisible monsters */
433 if (r_ptr->flags2 & RF2_INVISIBLE)
435 /* Update monster recall window */
436 if (p_ptr->monster_race_idx == m_ptr->r_idx)
438 p_ptr->window |= (PW_MONSTER);
441 /* Repair visibility later */
442 repair_monsters = TRUE;
444 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
445 update_monster(i, FALSE);
450 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
453 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
459 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
461 * @return 効力があった場合TRUEを返す
463 bool detect_monsters_evil(POSITION range)
469 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
471 for (i = 1; i < m_max; i++)
473 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
474 monster_race *r_ptr = &r_info[m_ptr->r_idx];
475 if (!monster_is_valid(m_ptr)) continue;
480 /* Only detect nearby monsters */
481 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
483 /* Detect evil monsters */
484 if (r_ptr->flags3 & RF3_EVIL)
486 if (is_original_ap(m_ptr))
488 /* Take note that they are evil */
489 r_ptr->r_flags3 |= (RF3_EVIL);
491 /* Update monster recall window */
492 if (p_ptr->monster_race_idx == m_ptr->r_idx)
494 p_ptr->window |= (PW_MONSTER);
498 /* Repair visibility later */
499 repair_monsters = TRUE;
501 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
502 update_monster(i, FALSE);
508 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
514 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
516 * @return 効力があった場合TRUEを返す
518 bool detect_monsters_nonliving(POSITION range)
524 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
526 for (i = 1; i < m_max; i++)
528 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
529 if (!monster_is_valid(m_ptr)) continue;
534 /* Only detect nearby monsters */
535 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
537 /* Detect non-living monsters */
538 if (!monster_living(m_ptr->r_idx))
540 /* Update monster recall window */
541 if (p_ptr->monster_race_idx == m_ptr->r_idx)
543 p_ptr->window |= (PW_MONSTER);
546 /* Repair visibility later */
547 repair_monsters = TRUE;
549 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
550 update_monster(i, FALSE);
556 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
562 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
564 * @return 効力があった場合TRUEを返す
566 bool detect_monsters_mind(POSITION range)
572 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
574 for (i = 1; i < m_max; i++)
576 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
577 monster_race *r_ptr = &r_info[m_ptr->r_idx];
578 if (!monster_is_valid(m_ptr)) continue;
583 /* Only detect nearby monsters */
584 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
586 /* Detect non-living monsters */
587 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
589 /* Update monster recall window */
590 if (p_ptr->monster_race_idx == m_ptr->r_idx)
592 p_ptr->window |= (PW_MONSTER);
595 /* Repair visibility later */
596 repair_monsters = TRUE;
598 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
599 update_monster(i, FALSE);
605 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
612 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
614 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
615 * @return 効力があった場合TRUEを返す
617 bool detect_monsters_string(POSITION range, concptr Match)
623 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
625 for (i = 1; i < m_max; i++)
627 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
628 monster_race *r_ptr = &r_info[m_ptr->r_idx];
629 if (!monster_is_valid(m_ptr)) continue;
634 /* Only detect nearby monsters */
635 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
637 /* Detect monsters with the same symbol */
638 if (my_strchr(Match, r_ptr->d_char))
640 /* Update monster recall window */
641 if (p_ptr->monster_race_idx == m_ptr->r_idx)
643 p_ptr->window |= (PW_MONSTER);
646 /* Repair visibility later */
647 repair_monsters = TRUE;
649 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
650 update_monster(i, FALSE);
655 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
658 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
664 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
666 * @param match_flag 感知フラグ
667 * @return 効力があった場合TRUEを返す
669 bool detect_monsters_xxx(POSITION range, u32b match_flag)
674 concptr desc_monsters = _("変なモンスター", "weird monsters");
676 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
678 for (i = 1; i < m_max; i++)
680 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
681 monster_race *r_ptr = &r_info[m_ptr->r_idx];
682 if (!monster_is_valid(m_ptr)) continue;
687 /* Only detect nearby monsters */
688 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
690 /* Detect evil monsters */
691 if (r_ptr->flags3 & (match_flag))
693 if (is_original_ap(m_ptr))
695 /* Take note that they are something */
696 r_ptr->r_flags3 |= (match_flag);
698 /* Update monster recall window */
699 if (p_ptr->monster_race_idx == m_ptr->r_idx)
701 p_ptr->window |= (PW_MONSTER);
705 /* Repair visibility later */
706 repair_monsters = TRUE;
708 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
709 update_monster(i, FALSE);
718 desc_monsters = _("デーモン", "demons");
721 desc_monsters = _("アンデッド", "the undead");
725 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
733 * @brief 全感知処理 / Detect everything
735 * @return 効力があった場合TRUEを返す
737 bool detect_all(POSITION range)
741 /* Detect everything */
742 if (detect_traps(range, TRUE)) detect = TRUE;
743 if (detect_doors(range)) detect = TRUE;
744 if (detect_stairs(range)) detect = TRUE;
746 /* There are too many hidden treasure. So... */
747 /* if (detect_treasure(range)) detect = TRUE; */
749 if (detect_objects_gold(range)) detect = TRUE;
750 if (detect_objects_normal(range)) detect = TRUE;
751 if (detect_monsters_invis(range)) detect = TRUE;
752 if (detect_monsters_normal(range)) detect = TRUE;
758 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
761 * @return 効力があった場合TRUEを返す
764 * Note that affected monsters are NOT auto-tracked by this usage.
766 * To avoid misbehavior when monster deaths have side-effects,
767 * this is done in two passes. -- JDL
770 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
774 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
775 bool obvious = FALSE;
777 /* Mark all (nearby) monsters */
778 for (i = 1; i < m_max; i++)
780 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
781 if (!monster_is_valid(m_ptr)) continue;
786 /* Require line of sight */
787 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
789 /* Mark the monster */
790 m_ptr->mflag |= (MFLAG_LOS);
793 /* Affect all marked monsters */
794 for (i = 1; i < m_max; i++)
796 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
798 /* Skip unmarked monsters */
799 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
802 m_ptr->mflag &= ~(MFLAG_LOS);
807 /* Jump directly to the target monster */
808 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
815 * @brief 視界内モンスターを加速する処理 / Speed monsters
816 * @return 効力があった場合TRUEを返す
818 bool speed_monsters(void)
820 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
824 * @brief 視界内モンスターを加速する処理 / Slow monsters
825 * @return 効力があった場合TRUEを返す
827 bool slow_monsters(int power)
829 return (project_all_los(GF_OLD_SLOW, power));
833 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
834 * @return 効力があった場合TRUEを返す
836 bool sleep_monsters(int power)
838 return (project_all_los(GF_OLD_SLEEP, power));
842 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
843 * @return 効力があった場合TRUEを返す
845 bool banish_evil(int dist)
847 return (project_all_los(GF_AWAY_EVIL, dist));
851 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
852 * @return 効力があった場合TRUEを返す
854 bool turn_undead(void)
856 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
858 chg_virtue(V_UNLIFE, -1);
863 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
864 * @return 効力があった場合TRUEを返す
866 bool dispel_undead(HIT_POINT dam)
868 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
870 chg_virtue(V_UNLIFE, -2);
875 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
876 * @return 効力があった場合TRUEを返す
878 bool dispel_evil(HIT_POINT dam)
880 return (project_all_los(GF_DISP_EVIL, dam));
884 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
885 * @return 効力があった場合TRUEを返す
887 bool dispel_good(HIT_POINT dam)
889 return (project_all_los(GF_DISP_GOOD, dam));
893 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
894 * @return 効力があった場合TRUEを返す
896 bool dispel_monsters(HIT_POINT dam)
898 return (project_all_los(GF_DISP_ALL, dam));
901 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
904 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
905 int k = 3 * creature_ptr->lev;
906 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
907 if (set_poisoned(0)) ident = TRUE;
908 if (set_afraid(0)) ident = TRUE;
909 if (hp_player(50)) ident = TRUE;
910 if (set_stun(0)) ident = TRUE;
911 if (set_cut(0)) ident = TRUE;
915 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
917 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
918 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
919 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
920 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))
922 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
928 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
929 * @return 効力があった場合TRUEを返す
931 bool dispel_living(HIT_POINT dam)
933 return (project_all_los(GF_DISP_LIVING, dam));
937 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
938 * @return 効力があった場合TRUEを返す
940 bool dispel_demons(HIT_POINT dam)
942 return (project_all_los(GF_DISP_DEMON, dam));
946 * @brief 視界内のモンスターに「聖戦」効果を与える処理
947 * @return 効力があった場合TRUEを返す
951 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
955 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
956 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
959 void aggravate_monsters(MONSTER_IDX who)
965 /* Aggravate everyone nearby */
966 for (i = 1; i < m_max; i++)
968 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
969 if (!monster_is_valid(m_ptr)) continue;
971 /* Skip aggravating monster (or player) */
972 if (i == who) continue;
974 /* Wake up nearby sleeping monsters */
975 if (m_ptr->cdis < MAX_SIGHT * 2)
978 if (MON_CSLEEP(m_ptr))
980 (void)set_monster_csleep(i, 0);
983 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
986 /* Speed up monsters in line of sight */
987 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
991 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
997 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
998 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
999 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1004 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1005 * @param m_idx 抹殺するモンスターID
1006 * @param power 抹殺の威力
1007 * @param player_cast プレイヤーの魔法によるものならば TRUE
1008 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1009 * @param spell_name 抹殺効果を起こした魔法の名前
1010 * @return 効力があった場合TRUEを返す
1012 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1014 int msec = delay_factor * delay_factor * delay_factor;
1015 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1016 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1017 bool resist = FALSE;
1019 if (is_pet(m_ptr) && !player_cast) return FALSE;
1021 /* Hack -- Skip Unique Monsters or Quest Monsters */
1022 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1023 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1024 else if (m_idx == p_ptr->riding) resist = TRUE;
1025 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1026 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1027 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1031 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1033 GAME_TEXT m_name[MAX_NLEN];
1035 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1036 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1039 delete_monster_idx(m_idx);
1042 if (resist && player_cast)
1044 bool see_m = is_seen(m_ptr);
1045 GAME_TEXT m_name[MAX_NLEN];
1047 monster_desc(m_name, m_ptr, 0);
1050 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1052 if (MON_CSLEEP(m_ptr))
1054 (void)set_monster_csleep(m_idx, 0);
1057 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1060 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1064 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1068 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1073 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1076 /* Visual feedback */
1077 move_cursor_relative(p_ptr->y, p_ptr->x);
1079 p_ptr->redraw |= (PR_HP);
1080 p_ptr->window |= (PW_PLAYER);
1085 Term_xtra(TERM_XTRA_DELAY, msec);
1092 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1093 * @param power 抹殺の威力
1094 * @param player_cast プレイヤーの魔法によるものならば TRUE
1095 * @return 効力があった場合TRUEを返す
1097 bool symbol_genocide(int power, bool player_cast)
1101 bool result = FALSE;
1103 /* Prevent genocide in quest levels */
1104 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1106 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1110 /* Mega-Hack -- Get a monster symbol */
1111 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1113 /* Delete the monsters of that "type" */
1114 for (i = 1; i < m_max; i++)
1116 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1117 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1118 if (!monster_is_valid(m_ptr)) continue;
1120 /* Skip "wrong" monsters */
1121 if (r_ptr->d_char != typ) continue;
1123 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1128 chg_virtue(V_VITALITY, -2);
1129 chg_virtue(V_CHANCE, -1);
1137 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1138 * @param power 抹殺の威力
1139 * @param player_cast プレイヤーの魔法によるものならば TRUE
1140 * @return 効力があった場合TRUEを返す
1142 bool mass_genocide(int power, bool player_cast)
1145 bool result = FALSE;
1147 /* Prevent mass genocide in quest levels */
1148 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1153 /* Delete the (nearby) monsters */
1154 for (i = 1; i < m_max; i++)
1156 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1157 if (!monster_is_valid(m_ptr)) continue;
1159 /* Skip distant monsters */
1160 if (m_ptr->cdis > MAX_SIGHT) continue;
1163 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1168 chg_virtue(V_VITALITY, -2);
1169 chg_virtue(V_CHANCE, -1);
1177 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1178 * @param power 抹殺の威力
1179 * @param player_cast プレイヤーの魔法によるものならば TRUE
1180 * @return 効力があった場合TRUEを返す
1182 bool mass_genocide_undead(int power, bool player_cast)
1185 bool result = FALSE;
1187 /* Prevent mass genocide in quest levels */
1188 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1193 /* Delete the (nearby) monsters */
1194 for (i = 1; i < m_max; i++)
1196 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1197 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1198 if (!monster_is_valid(m_ptr)) continue;
1200 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1202 /* Skip distant monsters */
1203 if (m_ptr->cdis > MAX_SIGHT) continue;
1206 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1211 chg_virtue(V_UNLIFE, -2);
1212 chg_virtue(V_CHANCE, -1);
1220 * @brief 周辺モンスターを調査する / Probe nearby monsters
1221 * @return 効力があった場合TRUEを返す
1226 int speed; /* TODO */
1237 /* Probe all (nearby) monsters */
1238 for (i = 1; i < m_max; i++)
1240 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1241 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1242 if (!monster_is_valid(m_ptr)) continue;
1244 /* Require line of sight */
1245 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1247 /* Probe visible monsters */
1250 GAME_TEXT m_name[MAX_NLEN];
1252 /* Start the message */
1255 msg_print(_("調査中...", "Probing..."));
1260 if (!is_original_ap(m_ptr))
1262 if (m_ptr->mflag2 & MFLAG2_KAGE)
1263 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1265 m_ptr->ap_r_idx = m_ptr->r_idx;
1266 lite_spot(m_ptr->fy, m_ptr->fx);
1268 /* Get "the monster" or "something" */
1269 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1271 speed = m_ptr->mspeed - 110;
1272 if (MON_FAST(m_ptr)) speed += 10;
1273 if (MON_SLOW(m_ptr)) speed -= 10;
1274 if (ironman_nightmare) speed += 5;
1276 /* Get the monster's alignment */
1277 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1278 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1279 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1280 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1281 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1282 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1283 else align = _("中立", "neutral");
1285 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1286 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1288 if (r_ptr->next_r_idx)
1290 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1294 strcat(buf, "xxx ");
1297 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1298 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1299 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1300 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1301 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1302 buf[strlen(buf)-1] = '\0';
1305 /* HACK : Add the line to message buffer */
1308 p_ptr->window |= (PW_MESSAGE);
1311 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1314 Term_erase(0, 0, 255);
1316 /* Learn everything about this monster */
1317 if (lore_do_probe(m_ptr->r_idx))
1319 /* Get base name of monster */
1320 strcpy(buf, (r_name + r_ptr->name));
1323 /* Note that we learnt some new flags -Mogami- */
1324 msg_format("%sについてさらに詳しくなった気がする。", buf);
1329 /* Note that we learnt some new flags -Mogami- */
1330 msg_format("You now know more about %s.", buf);
1332 /* Clear -more- prompt */
1347 chg_virtue(V_KNOWLEDGE, 1);
1348 msg_print(_("これで全部です。", "That's all."));
1356 * @brief *破壊*処理を行う / The spell of destruction
1357 * @param y1 破壊の中心Y座標
1358 * @param x1 破壊の中心X座標
1360 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1361 * @return 効力があった場合TRUEを返す
1364 * This spell "deletes" monsters (instead of "killing" them).
1366 * Later we may use one function for both "destruction" and
1367 * "earthquake" by using the "full" to select "destruction".
1370 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1377 /* Prevent destruction of quest levels and town */
1378 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1383 /* Lose monster light */
1384 if (!in_generate) clear_mon_lite();
1386 /* Big area of affect */
1387 for (y = (y1 - r); y <= (y1 + r); y++)
1389 for (x = (x1 - r); x <= (x1 + r); x++)
1391 /* Skip illegal grids */
1392 if (!in_bounds(y, x)) continue;
1394 /* Extract the distance */
1395 k = distance(y1, x1, y, x);
1397 /* Stay in the circle of death */
1398 if (k > r) continue;
1399 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1401 /* Lose room and vault */
1402 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1404 /* Lose light and knowledge */
1405 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1407 if (!in_generate) /* Normal */
1410 g_ptr->info &= ~(CAVE_UNSAFE);
1412 /* Hack -- Notice player affect */
1413 if (player_bold(y, x))
1415 /* Hurt the player later */
1418 /* Do not hurt this grid */
1423 /* Hack -- Skip the epicenter */
1424 if ((y == y1) && (x == x1)) continue;
1428 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1429 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1431 if (in_generate) /* In generation */
1433 /* Delete the monster (if any) */
1434 delete_monster(y, x);
1436 else if (r_ptr->flags1 & RF1_QUESTOR)
1438 /* Heal the monster */
1439 m_ptr->hp = m_ptr->maxhp;
1441 /* Try to teleport away quest monsters */
1442 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1446 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1448 GAME_TEXT m_name[MAX_NLEN];
1450 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1451 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1454 /* Delete the monster (if any) */
1455 delete_monster(y, x);
1459 /* During generation, destroyed artifacts are "preserved" */
1460 if (preserve_mode || in_generate)
1462 OBJECT_IDX this_o_idx, next_o_idx = 0;
1464 /* Scan all objects in the grid */
1465 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1468 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1469 next_o_idx = o_ptr->next_o_idx;
1471 /* Hack -- Preserve unknown artifacts */
1472 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1474 /* Mega-Hack -- Preserve the artifact */
1475 a_info[o_ptr->name1].cur_num = 0;
1477 if (in_generate && cheat_peek)
1479 GAME_TEXT o_name[MAX_NLEN];
1480 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1481 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1484 else if (in_generate && cheat_peek && o_ptr->art_name)
1486 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1487 "One of the random artifacts was *destroyed* during generation."));
1492 delete_object(y, x);
1494 /* Destroy "non-permanent" grids */
1495 if (!cave_perma_grid(g_ptr))
1497 /* Wall (or floor) type */
1500 if (!in_generate) /* Normal */
1504 /* Create granite wall */
1505 cave_set_feat(y, x, feat_granite);
1509 /* Create quartz vein */
1510 cave_set_feat(y, x, feat_quartz_vein);
1514 /* Create magma vein */
1515 cave_set_feat(y, x, feat_magma_vein);
1520 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1523 else /* In generation */
1527 /* Create granite wall */
1528 place_extra_grid(g_ptr);
1532 /* Create quartz vein */
1533 g_ptr->feat = feat_quartz_vein;
1537 /* Create magma vein */
1538 g_ptr->feat = feat_magma_vein;
1543 place_floor_grid(g_ptr);
1546 /* Clear garbage of hidden trap or door */
1555 /* Process "re-glowing" */
1556 for (y = (y1 - r); y <= (y1 + r); y++)
1558 for (x = (x1 - r); x <= (x1 + r); x++)
1560 /* Skip illegal grids */
1561 if (!in_bounds(y, x)) continue;
1563 /* Extract the distance */
1564 k = distance(y1, x1, y, x);
1566 /* Stay in the circle of death */
1567 if (k > r) continue;
1568 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1570 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1571 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1577 for (i = 0; i < 9; i++)
1579 yy = y + ddy_ddd[i];
1580 xx = x + ddx_ddd[i];
1581 if (!in_bounds2(yy, xx)) continue;
1582 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1583 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1585 g_ptr->info |= CAVE_GLOW;
1593 /* Hack -- Affect player */
1596 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1598 /* Blind the player */
1599 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1602 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1608 /* Mega-Hack -- Forget the view and lite */
1609 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1610 p_ptr->redraw |= (PR_MAP);
1611 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1613 if (p_ptr->special_defense & NINJA_S_STEALTH)
1615 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1625 * @brief 地震処理(サブルーチン) /
1626 * Induce an "earthquake" of the given radius at the given location.
1627 * @return 効力があった場合TRUEを返す
1631 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1635 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1637 * The player will take damage and "jump" into a safe grid if possible,
1638 * otherwise, he will "tunnel" through the rubble instantaneously.
1640 * Monsters will take damage, and "jump" into a safe grid if possible,
1641 * otherwise they will be "buried" in the rubble, disappearing from
1642 * the level in the same way that they do when genocided.
1644 * Note that thus the player and monsters (except eaters of walls and
1645 * passers through walls) will never occupy the same grid as a wall.
1646 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1647 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1648 * This has allowed massive simplification of the "monster" code.
1651 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1655 POSITION y, x, yy, xx, dy, dx;
1658 POSITION sy = 0, sx = 0;
1663 /* Prevent destruction of quest levels and town */
1664 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1669 /* Paranoia -- Enforce maximum range */
1672 /* Clear the "maximal blast" area */
1673 for (y = 0; y < 32; y++)
1675 for (x = 0; x < 32; x++)
1681 /* Check around the epicenter */
1682 for (dy = -r; dy <= r; dy++)
1684 for (dx = -r; dx <= r; dx++)
1686 /* Extract the location */
1690 /* Skip illegal grids */
1691 if (!in_bounds(yy, xx)) continue;
1693 /* Skip distant grids */
1694 if (distance(cy, cx, yy, xx) > r) continue;
1695 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1697 /* Lose room and vault / Lose light and knowledge */
1698 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1699 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1701 /* Skip the epicenter */
1702 if (!dx && !dy) continue;
1704 /* Skip most grids */
1705 if (randint0(100) < 85) continue;
1707 /* Damage this grid */
1708 map[16+yy-cy][16+xx-cx] = TRUE;
1710 /* Hack -- Take note of player damage */
1711 if (player_bold(yy, xx)) hurt = TRUE;
1715 /* First, affect the player (if necessary) */
1716 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1718 /* Check around the player */
1719 for (i = 0; i < 8; i++)
1721 /* Access the location */
1722 y = p_ptr->y + ddy_ddd[i];
1723 x = p_ptr->x + ddx_ddd[i];
1725 /* Skip non-empty grids */
1726 if (!cave_empty_bold(y, x)) continue;
1728 /* Important -- Skip "quake" grids */
1729 if (map[16+y-cy][16+x-cx]) continue;
1731 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1733 /* Count "safe" grids */
1736 /* Randomize choice */
1737 if (randint0(sn) > 0) continue;
1739 /* Save the safe location */
1743 /* Random message */
1744 switch (randint1(3))
1748 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1753 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1758 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1763 /* Hurt the player a lot */
1766 /* Message and damage */
1767 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1771 /* Destroy the grid, and push the player to safety */
1774 /* Calculate results */
1775 switch (randint1(3))
1779 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1785 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1786 damage = damroll(10, 4);
1787 (void)set_stun(p_ptr->stun + randint1(50));
1792 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1793 damage = damroll(10, 4);
1794 (void)set_stun(p_ptr->stun + randint1(50));
1799 /* Move the player to the safe location */
1800 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1803 /* Important -- no wall on player */
1804 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1812 GAME_TEXT m_name[MAX_NLEN];
1813 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1815 /* Get the monster's real name */
1816 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1818 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1822 killer = _("地震", "an earthquake");
1825 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1829 /* Examine the quaked region */
1830 for (dy = -r; dy <= r; dy++)
1832 for (dx = -r; dx <= r; dx++)
1834 /* Extract the location */
1838 /* Skip unaffected grids */
1839 if (!map[16+yy-cy][16+xx-cx]) continue;
1840 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1842 if (g_ptr->m_idx == p_ptr->riding) continue;
1844 /* Process monsters */
1847 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1848 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1850 /* Quest monsters */
1851 if (r_ptr->flags1 & RF1_QUESTOR)
1853 /* No wall on quest monsters */
1854 map[16+yy-cy][16+xx-cx] = FALSE;
1859 /* Most monsters cannot co-exist with rock */
1860 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1861 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1863 GAME_TEXT m_name[MAX_NLEN];
1865 /* Assume not safe */
1868 /* Monster can move to escape the wall */
1869 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1871 /* Look for safety */
1872 for (i = 0; i < 8; i++)
1874 y = yy + ddy_ddd[i];
1875 x = xx + ddx_ddd[i];
1877 /* Skip non-empty grids */
1878 if (!cave_empty_bold(y, x)) continue;
1880 /* Hack -- no safety on glyph of warding */
1881 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1882 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1884 /* ... nor on the Pattern */
1885 if (pattern_tile(y, x)) continue;
1887 /* Important -- Skip "quake" grids */
1888 if (map[16+y-cy][16+x-cx]) continue;
1890 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1891 if (player_bold(y, x)) continue;
1893 /* Count "safe" grids */
1896 /* Randomize choice */
1897 if (randint0(sn) > 0) continue;
1899 /* Save the safe grid */
1904 monster_desc(m_name, m_ptr, 0);
1906 /* Scream in pain */
1907 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1909 /* Take damage from the quake */
1910 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1912 /* Monster is certainly awake */
1913 (void)set_monster_csleep(g_ptr->m_idx, 0);
1915 /* Apply damage directly */
1916 m_ptr->hp -= damage;
1918 /* Delete (not kill) "dead" monsters */
1921 if (!ignore_unview || is_seen(m_ptr))
1922 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1926 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)
1928 char m2_name[MAX_NLEN];
1930 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1931 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1935 delete_monster(yy, xx);
1937 /* No longer safe */
1941 /* Hack -- Escape from the rock */
1944 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1946 /* Update the old location */
1947 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1949 /* Update the new location */
1950 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1952 /* Move the monster */
1956 update_monster(m_idx, TRUE);
1965 /* Lose monster light */
1968 /* Examine the quaked region */
1969 for (dy = -r; dy <= r; dy++)
1971 for (dx = -r; dx <= r; dx++)
1973 /* Extract the location */
1977 /* Skip unaffected grids */
1978 if (!map[16+yy-cy][16+xx-cx]) continue;
1980 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1982 /* Paranoia -- never affect player */
1983 /* if (player_bold(yy, xx)) continue; */
1985 /* Destroy location (if valid) */
1986 if (cave_valid_bold(yy, xx))
1988 delete_object(yy, xx);
1990 /* Wall (or floor) type */
1991 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
1996 /* Create granite wall */
1997 cave_set_feat(yy, xx, feat_granite);
2003 /* Create quartz vein */
2004 cave_set_feat(yy, xx, feat_quartz_vein);
2010 /* Create magma vein */
2011 cave_set_feat(yy, xx, feat_magma_vein);
2018 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2024 /* Process "re-glowing" */
2025 for (dy = -r; dy <= r; dy++)
2027 for (dx = -r; dx <= r; dx++)
2029 /* Extract the location */
2033 /* Skip illegal grids */
2034 if (!in_bounds(yy, xx)) continue;
2036 /* Skip distant grids */
2037 if (distance(cy, cx, yy, xx) > r) continue;
2038 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2040 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2041 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2047 for (ii = 0; ii < 9; ii++)
2049 yyy = yy + ddy_ddd[ii];
2050 xxx = xx + ddx_ddd[ii];
2051 if (!in_bounds2(yyy, xxx)) continue;
2052 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2053 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2055 g_ptr->info |= CAVE_GLOW;
2063 /* Mega-Hack -- Forget the view and lite */
2064 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2065 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2066 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2068 if (p_ptr->special_defense & NINJA_S_STEALTH)
2070 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2078 * @brief 地震処理(プレイヤーの中心発動) /
2079 * Induce an "earthquake" of the given radius at the given location.
2080 * @return 効力があった場合TRUEを返す
2085 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2087 return earthquake_aux(cy, cx, r, 0);
2094 void discharge_minion(void)
2099 for (i = 1; i < m_max; i++)
2101 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2102 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2103 if (m_ptr->nickname) okay = FALSE;
2105 if (!okay || p_ptr->riding)
2107 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2110 for (i = 1; i < m_max; i++)
2113 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2114 monster_race *r_ptr;
2116 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2117 r_ptr = &r_info[m_ptr->r_idx];
2119 /* Uniques resist discharging */
2120 if (r_ptr->flags1 & RF1_UNIQUE)
2122 GAME_TEXT m_name[MAX_NLEN];
2123 monster_desc(m_name, m_ptr, 0x00);
2124 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2125 delete_monster_idx(i);
2128 dam = m_ptr->maxhp / 2;
2129 if (dam > 100) dam = (dam - 100) / 2 + 100;
2130 if (dam > 400) dam = (dam - 400) / 2 + 400;
2131 if (dam > 800) dam = 800;
2132 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2133 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2135 if (record_named_pet && m_ptr->nickname)
2137 GAME_TEXT m_name[MAX_NLEN];
2139 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2140 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2143 delete_monster_idx(i);
2149 * @brief 部屋全体を照らすサブルーチン
2153 * This routine clears the entire "temp" set.
2154 * This routine will Perma-Lite all "temp" grids.
2155 * This routine is used (only) by "lite_room()"
2156 * Dark grids are illuminated.
2157 * Also, process all affected monsters.
2159 * SMART monsters always wake up when illuminated
2160 * NORMAL monsters wake up 1/4 the time when illuminated
2161 * STUPID monsters wake up 1/10 the time when illuminated
2164 static void cave_temp_room_lite(void)
2168 /* Clear them all */
2169 for (i = 0; i < tmp_pos.n; i++)
2171 POSITION y = tmp_pos.y[i];
2172 POSITION x = tmp_pos.x[i];
2174 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2176 /* No longer in the array */
2177 g_ptr->info &= ~(CAVE_TEMP);
2179 /* Update only non-CAVE_GLOW grids */
2180 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2183 g_ptr->info |= (CAVE_GLOW);
2185 /* Process affected monsters */
2188 PERCENTAGE chance = 25;
2189 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2190 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2191 update_monster(g_ptr->m_idx, FALSE);
2193 /* Stupid monsters rarely wake up */
2194 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2196 /* Smart monsters always wake up */
2197 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2199 /* Sometimes monsters wake up */
2200 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2203 (void)set_monster_csleep(g_ptr->m_idx, 0);
2205 /* Notice the "waking up" */
2208 GAME_TEXT m_name[MAX_NLEN];
2209 monster_desc(m_name, m_ptr, 0);
2210 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2217 update_local_illumination(y, x);
2227 * @brief 部屋全体を暗くするサブルーチン
2231 * This routine clears the entire "temp" set.
2232 * This routine will "darken" all "temp" grids.
2233 * In addition, some of these grids will be "unmarked".
2234 * This routine is used (only) by "unlite_room()"
2235 * Also, process all affected monsters
2238 static void cave_temp_room_unlite(void)
2242 /* Clear them all */
2243 for (i = 0; i < tmp_pos.n; i++)
2245 POSITION y = tmp_pos.y[i];
2246 POSITION x = tmp_pos.x[i];
2249 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2250 bool do_dark = !is_mirror_grid(g_ptr);
2252 /* No longer in the array */
2253 g_ptr->info &= ~(CAVE_TEMP);
2255 /* Darken the grid */
2258 if (current_floor_ptr->dun_level || !is_daytime())
2260 for (j = 0; j < 9; j++)
2262 POSITION by = y + ddy_ddd[j];
2263 POSITION bx = x + ddx_ddd[j];
2265 if (in_bounds2(by, bx))
2267 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2269 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2277 if (!do_dark) continue;
2280 g_ptr->info &= ~(CAVE_GLOW);
2282 /* Hack -- Forget "boring" grids */
2283 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2285 /* Forget the grid */
2286 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2290 /* Process affected monsters */
2293 update_monster(g_ptr->m_idx, FALSE);
2297 update_local_illumination(y, x);
2307 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2310 * @param pass_bold 地形条件を返す関数ポインタ
2313 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2320 for (i = 0; i < 16; i++)
2322 y = cy + ddy_cdd[i % 8];
2323 x = cx + ddx_cdd[i % 8];
2325 /* Found a wall, break the length */
2326 if (!pass_bold(y, x))
2328 /* Track best length */
2342 return (MAX(len, blen));
2346 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2349 * @param pass_bold 地形条件を返す関数ポインタ
2352 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2358 for (i = 0; i < 8; i++)
2360 y = cy + ddy_ddd[i];
2361 x = cx + ddx_ddd[i];
2363 if (!pass_bold(y, x)) c++;
2371 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2372 * @param y 部屋内のy座標1点
2373 * @param x 部屋内のx座標1点
2374 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2375 * @param pass_bold 地形条件を返す関数ポインタ
2378 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2381 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2383 /* Avoid infinite recursion */
2384 if (g_ptr->info & (CAVE_TEMP)) return;
2386 /* Do not "leave" the current room */
2387 if (!(g_ptr->info & (CAVE_ROOM)))
2389 if (only_room) return;
2392 if (!in_bounds2(y, x)) return;
2394 /* Do not exceed the maximum spell range */
2395 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2397 /* Verify this grid */
2399 * The reason why it is ==6 instead of >5 is that 8 is impossible
2400 * due to the check for cave_bold above.
2401 * 7 lights dead-end corridors (you need to do this for the
2402 * checkboard interesting rooms, so that the boundary is lit
2404 * This leaves only a check for 6 bounding walls!
2406 if (in_bounds(y, x) && pass_bold(y, x) &&
2407 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2410 /* Paranoia -- verify space */
2411 if (tmp_pos.n == TEMP_MAX) return;
2413 /* Mark the grid as "seen" */
2414 g_ptr->info |= (CAVE_TEMP);
2416 /* Add it to the "seen" set */
2417 tmp_pos.y[tmp_pos.n] = y;
2418 tmp_pos.x[tmp_pos.n] = x;
2423 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2426 * @return 光を通すならばtrueを返す。
2428 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2430 return cave_los_bold(y, x);
2434 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2439 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2441 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2445 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2448 * @return 射線を通すならばtrueを返す。
2450 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2452 return cave_have_flag_bold(y, x, FF_PROJECT);
2457 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2462 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2464 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2469 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2474 void lite_room(POSITION y1, POSITION x1)
2479 /* Add the initial grid */
2480 cave_temp_lite_room_aux(y1, x1);
2482 /* While grids are in the queue, add their neighbors */
2483 for (i = 0; i < tmp_pos.n; i++)
2485 x = tmp_pos.x[i], y = tmp_pos.y[i];
2487 /* Walls get lit, but stop light */
2488 if (!cave_pass_lite_bold(y, x)) continue;
2490 /* Spread adjacent */
2491 cave_temp_lite_room_aux(y + 1, x);
2492 cave_temp_lite_room_aux(y - 1, x);
2493 cave_temp_lite_room_aux(y, x + 1);
2494 cave_temp_lite_room_aux(y, x - 1);
2496 /* Spread diagonal */
2497 cave_temp_lite_room_aux(y + 1, x + 1);
2498 cave_temp_lite_room_aux(y - 1, x - 1);
2499 cave_temp_lite_room_aux(y - 1, x + 1);
2500 cave_temp_lite_room_aux(y + 1, x - 1);
2503 /* Now, lite them all up at once */
2504 cave_temp_room_lite();
2506 if (p_ptr->special_defense & NINJA_S_STEALTH)
2508 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2514 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2519 void unlite_room(POSITION y1, POSITION x1)
2524 /* Add the initial grid */
2525 cave_temp_unlite_room_aux(y1, x1);
2527 /* Spread, breadth first */
2528 for (i = 0; i < tmp_pos.n; i++)
2530 x = tmp_pos.x[i], y = tmp_pos.y[i];
2532 /* Walls get dark, but stop darkness */
2533 if (!cave_pass_dark_bold(y, x)) continue;
2535 /* Spread adjacent */
2536 cave_temp_unlite_room_aux(y + 1, x);
2537 cave_temp_unlite_room_aux(y - 1, x);
2538 cave_temp_unlite_room_aux(y, x + 1);
2539 cave_temp_unlite_room_aux(y, x - 1);
2541 /* Spread diagonal */
2542 cave_temp_unlite_room_aux(y + 1, x + 1);
2543 cave_temp_unlite_room_aux(y - 1, x - 1);
2544 cave_temp_unlite_room_aux(y - 1, x + 1);
2545 cave_temp_unlite_room_aux(y + 1, x - 1);
2548 /* Now, darken them all at once */
2549 cave_temp_room_unlite();
2552 bool starlight(bool magic)
2554 HIT_POINT num = damroll(5, 3);
2555 POSITION y = 0, x = 0;
2559 if (!p_ptr->blind && !magic)
2561 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2563 for (k = 0; k < num; k++)
2569 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2570 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2571 if (!player_bold(y, x)) break;
2574 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2575 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2583 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2586 * @return 作用が実際にあった場合TRUEを返す
2588 bool lite_area(HIT_POINT dam, POSITION rad)
2590 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2592 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2594 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2600 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2603 /* Hook into the "project()" function */
2604 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2606 lite_room(p_ptr->y, p_ptr->x);
2614 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2617 * @return 作用が実際にあった場合TRUEを返す
2619 bool unlite_area(HIT_POINT dam, POSITION rad)
2621 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2625 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2628 /* Hook into the "project()" function */
2629 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2631 unlite_room(p_ptr->y, p_ptr->x);
2640 * @brief ボール系スペルの発動 / Cast a ball spell
2642 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2645 * @return 作用が実際にあった場合TRUEを返す
2648 * Stop if we hit a monster, act as a "ball"
2649 * Allow "target" mode to pass over monsters
2650 * Affect grids, objects, and monsters
2653 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2657 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2659 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2660 /* Use the given direction */
2661 tx = p_ptr->x + 99 * ddx[dir];
2662 ty = p_ptr->y + 99 * ddy[dir];
2664 /* Hack -- Use an actual "target" */
2665 if ((dir == 5) && target_okay())
2667 flg &= ~(PROJECT_STOP);
2672 /* Analyze the "dir" and the "target". Hurt items on floor. */
2673 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2677 * @brief ブレス系スペルの発動 / Cast a breath spell
2679 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2682 * @return 作用が実際にあった場合TRUEを返す
2685 * Stop if we hit a monster, act as a "ball"
2686 * Allow "target" mode to pass over monsters
2687 * Affect grids, objects, and monsters
2690 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2692 return fire_ball(typ, dir, dam, -rad);
2697 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2699 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2702 * @return 作用が実際にあった場合TRUEを返す
2705 * Stop if we hit a monster, act as a "ball"
2706 * Allow "target" mode to pass over monsters
2707 * Affect grids, objects, and monsters
2710 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2713 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2715 /* Use the given direction */
2716 tx = p_ptr->x + 99 * ddx[dir];
2717 ty = p_ptr->y + 99 * ddy[dir];
2719 /* Hack -- Use an actual "target" */
2720 if ((dir == 5) && target_okay())
2726 /* Analyze the "dir" and the "target". Hurt items on floor. */
2727 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2732 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2734 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2737 * @return 作用が実際にあった場合TRUEを返す
2740 * Stop if we hit a monster, act as a "ball"
2741 * Allow "target" mode to pass over monsters
2742 * Affect grids, objects, and monsters
2745 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2748 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2750 /* Use the given direction */
2751 tx = p_ptr->x + 99 * ddx[dir];
2752 ty = p_ptr->y + 99 * ddy[dir];
2754 /* Hack -- Use an actual "target" */
2755 if ((dir == 5) && target_okay())
2757 flg &= ~(PROJECT_STOP);
2762 /* Analyze the "dir" and the "target". Hurt items on floor. */
2763 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2768 * @brief メテオ系スペルの発動 / Cast a meteor spell
2769 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2775 * @return 作用が実際にあった場合TRUEを返す
2778 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2779 * player, or outside source, that starts out at an arbitrary location, and
2780 * leaving no trail from the "caster" to the target. This function is
2781 * especially useful for bombardments and similar. -LM-
2782 * Option to hurt the player.
2785 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2787 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2789 /* Analyze the "target" and the caster. */
2790 return (project(who, rad, y, x, dam, typ, flg, -1));
2795 * @brief ブラスト系スペルの発動 / Cast a blast spell
2797 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2802 * @return 作用が実際にあった場合TRUEを返す
2804 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2808 POSITION ty, tx, y, x;
2811 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2816 /* Use the given direction */
2819 ly = ty = p_ptr->y + 20 * ddy[dir];
2820 lx = tx = p_ptr->x + 20 * ddx[dir];
2823 /* Use an actual "target" */
2824 else /* if (dir == 5) */
2829 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2830 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2833 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2836 for (i = 0; i < num; i++)
2840 /* Get targets for some bolts */
2841 y = rand_spread(ly, ld * dev / 20);
2842 x = rand_spread(lx, ld * dev / 20);
2844 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2847 /* Analyze the "dir" and the "target". */
2848 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2859 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2860 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2861 * @return 作用が実際にあった場合TRUEを返す
2863 bool teleport_swap(DIRECTION dir)
2867 monster_type* m_ptr;
2868 monster_race* r_ptr;
2870 if ((dir == 5) && target_okay())
2877 tx = p_ptr->x + ddx[dir];
2878 ty = p_ptr->y + ddy[dir];
2880 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2882 if (p_ptr->anti_tele)
2884 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2888 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2890 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2894 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2896 msg_print(_("失敗した。", "Failed to swap."));
2900 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2901 r_ptr = &r_info[m_ptr->r_idx];
2903 (void)set_monster_csleep(g_ptr->m_idx, 0);
2905 if (r_ptr->flagsr & RFR_RES_TELE)
2907 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2908 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2912 sound(SOUND_TELEPORT);
2914 /* Swap the player and monster */
2915 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2923 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2925 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2928 * @return 作用が実際にあった場合TRUEを返す
2930 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2934 /* Pass through the target if needed */
2935 flg |= (PROJECT_THRU);
2937 /* Use the given direction */
2938 tx = p_ptr->x + ddx[dir];
2939 ty = p_ptr->y + ddy[dir];
2941 /* Hack -- Use an actual "target" */
2942 if ((dir == 5) && target_okay())
2948 /* Analyze the "dir" and the "target", do NOT explode */
2949 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2954 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2956 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2958 * @return 作用が実際にあった場合TRUEを返す
2961 * Stop if we hit a monster, as a "bolt".
2962 * Affect monsters and grids (not objects).
2965 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2967 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2968 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2969 return (project_hook(typ, dir, dam, flg));
2974 * @brief ビーム系スペルの発動 / Cast a beam spell.
2976 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2978 * @return 作用が実際にあった場合TRUEを返す
2981 * Pass through monsters, as a "beam".
2982 * Affect monsters, grids and objects.
2985 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2987 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2988 return (project_hook(typ, dir, dam, flg));
2993 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2994 * @param prob ビーム化する確率(%)
2996 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2998 * @return 作用が実際にあった場合TRUEを返す
3001 * Pass through monsters, as a "beam".
3002 * Affect monsters, grids and objects.
3005 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3007 if (randint0(100) < prob)
3009 return (fire_beam(typ, dir, dam));
3013 return (fire_bolt(typ, dir, dam));
3018 * @brief LITE_WEAK属性による光源ビーム処理
3019 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3021 * @return 作用が実際にあった場合TRUEを返す
3023 bool lite_line(DIRECTION dir, HIT_POINT dam)
3025 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3026 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3031 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3033 * @return 作用が実際にあった場合TRUEを返す
3035 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3037 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3038 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3043 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3045 * @return 作用が実際にあった場合TRUEを返す
3047 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3049 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3050 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3055 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3056 * @return 作用が実際にあった場合TRUEを返す
3058 bool wizard_lock(DIRECTION dir)
3060 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3061 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3066 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3067 * @return 作用が実際にあった場合TRUEを返す
3069 bool destroy_door(DIRECTION dir)
3071 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3072 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3077 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3078 * @return 作用が実際にあった場合TRUEを返す
3080 bool disarm_trap(DIRECTION dir)
3082 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3083 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3089 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3090 * @param plev プレイヤーレベル(効力はplev*200)
3091 * @return 作用が実際にあった場合TRUEを返す
3093 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3095 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3096 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3100 * @brief モンスター用テレポート処理
3101 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3102 * @param distance 移動距離
3103 * @return 作用が実際にあった場合TRUEを返す
3105 bool teleport_monster(DIRECTION dir, int distance)
3107 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3108 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3112 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3113 * @return 作用が実際にあった場合TRUEを返す
3115 bool door_creation(void)
3117 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3118 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3122 * @brief トラップ生成処理(起点から周囲1マス)
3125 * @return 作用が実際にあった場合TRUEを返す
3127 bool trap_creation(POSITION y, POSITION x)
3129 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3130 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3134 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3135 * @return 作用が実際にあった場合TRUEを返す
3137 bool tree_creation(void)
3139 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3140 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3144 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3145 * @return 作用が実際にあった場合TRUEを返す
3147 bool glyph_creation(void)
3149 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3150 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3154 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3155 * @return 作用が実際にあった場合TRUEを返す
3157 bool wall_stone(void)
3159 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3160 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3161 p_ptr->update |= (PU_FLOW);
3162 p_ptr->redraw |= (PR_MAP);
3167 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3168 * @return 作用が実際にあった場合TRUEを返す
3170 bool destroy_doors_touch(void)
3172 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3173 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3177 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3178 * @return 作用が実際にあった場合TRUEを返す
3180 bool disarm_traps_touch(void)
3182 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3183 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3187 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3188 * @return 作用が実際にあった場合TRUEを返す
3190 bool sleep_monsters_touch(void)
3192 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3193 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3198 * @brief 死者復活処理(起点より周囲5マス)
3199 * @param who 術者モンスターID(0ならばプレイヤー)
3202 * @return 作用が実際にあった場合TRUEを返す
3204 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3206 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3207 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3212 * @return 作用が実際にあった場合TRUEを返す
3214 void call_chaos(void)
3216 int Chaos_type, dummy, dir;
3217 PLAYER_LEVEL plev = p_ptr->lev;
3218 bool line_chaos = FALSE;
3220 int hurt_types[31] =
3222 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3223 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3224 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3225 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3226 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3227 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3228 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3229 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3232 Chaos_type = hurt_types[randint0(31)];
3233 if (one_in_(4)) line_chaos = TRUE;
3237 for (dummy = 1; dummy < 10; dummy++)
3242 fire_beam(Chaos_type, dummy, 150);
3244 fire_ball(Chaos_type, dummy, 150, 2);
3248 else if (one_in_(3))
3250 fire_ball(Chaos_type, 0, 500, 8);
3254 if (!get_aim_dir(&dir)) return;
3256 fire_beam(Chaos_type, dir, 250);
3258 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3263 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3264 * @param stop_ty 再帰処理停止フラグ
3266 * @return 作用が実際にあった場合TRUEを返す
3269 * rr9: Stop the nasty things when a Cyberdemon is summoned
3270 * or the player gets paralyzed.
3273 bool activate_ty_curse(bool stop_ty, int *count)
3276 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3280 switch (randint1(34))
3285 msg_print(_("地面が揺れた...", "The ground trembles..."));
3286 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3287 if (!one_in_(6)) break;
3292 HIT_POINT dam = damroll(10, 10);
3293 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3294 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3295 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3296 if (!one_in_(6)) break;
3301 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3302 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3303 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3304 if (!one_in_(6)) break;
3307 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3311 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3312 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3314 if (!one_in_(6)) break;
3315 case 1: case 2: case 3: case 16: case 17:
3316 aggravate_monsters(0);
3317 if (!one_in_(6)) break;
3318 case 4: case 5: case 6:
3319 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3320 if (!one_in_(6)) break;
3321 case 7: case 8: case 9: case 18:
3322 (*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');
3323 if (!one_in_(6)) break;
3324 case 10: case 11: case 12:
3325 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3326 lose_exp(p_ptr->exp / 16);
3327 if (!one_in_(6)) break;
3328 case 13: case 14: case 15: case 19: case 20:
3329 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3335 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3336 if (p_ptr->free_act)
3337 set_paralyzed(p_ptr->paralyzed + randint1(3));
3339 set_paralyzed(p_ptr->paralyzed + randint1(13));
3342 if (!one_in_(6)) break;
3343 case 21: case 22: case 23:
3344 (void)do_dec_stat(randint0(6));
3345 if (!one_in_(6)) break;
3347 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3349 if (!one_in_(6)) break;
3352 * Only summon Cyberdemons deep in the dungeon.
3354 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3356 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3360 if (!one_in_(6)) break;
3366 (void)do_dec_stat(i);
3374 while (one_in_(3) && !stop_ty);
3380 * @brief HI_SUMMON(上級召喚)処理発動
3383 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3384 * @return 作用が実際にあった場合TRUEを返す
3386 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3391 BIT_FLAGS mode = PM_ALLOW_GROUP;
3398 mode |= PM_FORCE_FRIENDLY;
3402 mode |= PM_FORCE_PET;
3407 if (!pet) mode |= PM_NO_PET;
3409 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3411 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3413 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3416 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
3419 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
3422 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
3425 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
3428 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
3431 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
3434 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
3437 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
3441 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
3445 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
3448 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3449 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
3452 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3453 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
3456 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
3459 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3460 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
3468 * @brief 周辺破壊効果(プレイヤー中心)
3469 * @return 作用が実際にあった場合TRUEを返す
3471 void wall_breaker(void)
3474 POSITION y = 0, x = 0;
3475 int attempts = 1000;
3477 if (randint1(80 + p_ptr->lev) < 70)
3481 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3483 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3485 if (!player_bold(y, x)) break;
3488 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3489 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3491 else if (randint1(100) > 30)
3493 earthquake(p_ptr->y, p_ptr->x, 1);
3497 int num = damroll(5, 3);
3499 for (i = 0; i < num; i++)
3503 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3505 if (!player_bold(y, x)) break;
3508 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3509 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3516 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3518 * @return 作用が実際にあった場合TRUEを返す
3520 bool confuse_monsters(HIT_POINT dam)
3522 return (project_all_los(GF_OLD_CONF, dam));
3527 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3529 * @return 作用が実際にあった場合TRUEを返す
3531 bool charm_monsters(HIT_POINT dam)
3533 return (project_all_los(GF_CHARM, dam));
3538 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3540 * @return 作用が実際にあった場合TRUEを返す
3542 bool charm_animals(HIT_POINT dam)
3544 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3549 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3551 * @return 作用が実際にあった場合TRUEを返す
3553 bool stun_monsters(HIT_POINT dam)
3555 return (project_all_los(GF_STUN, dam));
3560 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3562 * @return 作用が実際にあった場合TRUEを返す
3564 bool stasis_monsters(HIT_POINT dam)
3566 return (project_all_los(GF_STASIS, dam));
3571 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3573 * @return 作用が実際にあった場合TRUEを返す
3575 bool mindblast_monsters(HIT_POINT dam)
3577 return (project_all_los(GF_PSI, dam));
3582 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3583 * @param dist 効力(距離)
3584 * @return 作用が実際にあった場合TRUEを返す
3586 bool banish_monsters(int dist)
3588 return (project_all_los(GF_AWAY_ALL, dist));
3593 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3595 * @return 作用が実際にあった場合TRUEを返す
3597 bool turn_evil(HIT_POINT dam)
3599 return (project_all_los(GF_TURN_EVIL, dam));
3604 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3606 * @return 作用が実際にあった場合TRUEを返す
3608 bool turn_monsters(HIT_POINT dam)
3610 return (project_all_los(GF_TURN_ALL, dam));
3615 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3616 * @return 作用が実際にあった場合TRUEを返す
3618 bool deathray_monsters(void)
3620 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3624 * @brief チャーム・モンスター(1体)
3625 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3627 * @return 作用が実際にあった場合TRUEを返す
3629 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3631 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3632 return (project_hook(GF_CHARM, dir, plev, flg));
3636 * @brief アンデッド支配(1体)
3637 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3639 * @return 作用が実際にあった場合TRUEを返す
3641 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3643 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3644 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3649 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3651 * @return 作用が実際にあった場合TRUEを返す
3653 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3655 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3656 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3661 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3663 * @return 作用が実際にあった場合TRUEを返す
3665 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3667 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3668 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3674 * @param success 判定成功上の処理ならばTRUE
3675 * @return 作用が実際にあった場合TRUEを返す
3677 bool kawarimi(bool success)
3680 object_type *q_ptr = &forge;
3683 if (p_ptr->is_dead) return FALSE;
3684 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3685 if (randint0(200) < p_ptr->stun) return FALSE;
3687 if (!success && one_in_(3))
3689 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3690 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3691 p_ptr->redraw |= (PR_STATUS);
3698 teleport_player(10 + randint1(90), 0L);
3700 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3702 q_ptr->pval = MON_NINJA;
3703 (void)drop_near(q_ptr, -1, y, x);
3705 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3706 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3708 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3709 p_ptr->redraw |= (PR_STATUS);
3717 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3718 * @param mdeath 目標モンスターが死亡したかを返す
3719 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3721 bool rush_attack(bool *mdeath)
3728 bool tmp_mdeath = FALSE;
3731 if (mdeath) *mdeath = FALSE;
3734 if (!get_aim_dir(&dir)) return FALSE;
3736 /* Use the given direction */
3737 tx = p_ptr->x + project_length * ddx[dir];
3738 ty = p_ptr->y + project_length * ddy[dir];
3740 /* Hack -- Use an actual "target" */
3741 if ((dir == 5) && target_okay())
3747 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3749 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3752 /* No need to move */
3753 if (!path_n) return TRUE;
3755 /* Use ty and tx as to-move point */
3759 /* Project along the path */
3760 for (i = 0; i < path_n; i++)
3762 monster_type *m_ptr;
3764 int ny = GRID_Y(path_g[i]);
3765 int nx = GRID_X(path_g[i]);
3767 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3772 /* Go to next grid */
3776 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3780 msg_print(_("失敗!", "Failed!"));
3784 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3791 /* Move player before updating the monster */
3792 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3793 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3795 /* Found a monster */
3796 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3798 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3801 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3803 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3806 else if (!player_bold(ty, tx))
3808 /* Hold the monster name */
3809 GAME_TEXT m_name[MAX_NLEN];
3811 /* Get the monster name (BEFORE polymorphing) */
3812 monster_desc(m_name, m_ptr, 0);
3813 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3816 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3818 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3823 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3825 if (mdeath) *mdeath = tmp_mdeath;
3831 * @brief 全鏡の消去 / Remove all mirrors in this floor
3832 * @param explode 爆発処理を伴うならばTRUE
3835 void remove_all_mirrors(bool explode)
3839 for (x = 0; x < current_floor_ptr->width; x++)
3841 for (y = 0; y < current_floor_ptr->height; y++)
3843 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3845 remove_mirror(y, x);
3847 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3848 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3855 * @brief 『一つの指輪』の効果処理 /
3856 * Hack -- activate the ring of power
3857 * @param dir 発動の方向ID
3860 void ring_of_power(DIRECTION dir)
3862 /* Pick a random effect */
3863 switch (randint1(10))
3868 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3871 /* Decrease all stats (permanently) */
3872 (void)dec_stat(A_STR, 50, TRUE);
3873 (void)dec_stat(A_INT, 50, TRUE);
3874 (void)dec_stat(A_WIS, 50, TRUE);
3875 (void)dec_stat(A_DEX, 50, TRUE);
3876 (void)dec_stat(A_CON, 50, TRUE);
3877 (void)dec_stat(A_CHR, 50, TRUE);
3879 /* Lose some experience (permanently) */
3880 p_ptr->exp -= (p_ptr->exp / 4);
3881 p_ptr->max_exp -= (p_ptr->exp / 4);
3889 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3890 dispel_monsters(1000);
3898 fire_ball(GF_MANA, dir, 600, 3);
3907 fire_bolt(GF_MANA, dir, 500);
3914 * @brief 運命の輪、並びにカオス的な効果の発動
3915 * @param spell ランダムな効果を選択するための基準ID
3918 void wild_magic(int spell)
3921 int type = SUMMON_MOLD + randint0(6);
3923 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3924 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3926 switch (randint1(spell) + randint1(8) + 1)
3931 teleport_player(10, TELEPORT_PASSIVE);
3936 teleport_player(100, TELEPORT_PASSIVE);
3940 teleport_player(200, TELEPORT_PASSIVE);
3950 lite_area(damroll(2, 3), 2);
3953 destroy_doors_touch();
3958 sleep_monsters_touch();
3962 trap_creation(p_ptr->y, p_ptr->x);
3971 aggravate_monsters(0);
3974 earthquake(p_ptr->y, p_ptr->x, 5);
3978 (void)gain_mutation(p_ptr, 0);
3982 apply_disenchant(1);
3988 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3995 while (counter++ < 8)
3997 (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');
4002 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4005 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4010 (void)activate_ty_curse(FALSE, &count);
4019 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4020 * / Drop 10+1d10 meteor ball at random places near the player
4025 void cast_meteor(HIT_POINT dam, POSITION rad)
4028 int b = 10 + randint1(10);
4030 for (i = 0; i < b; i++)
4032 POSITION y = 0, x = 0;
4035 for (count = 0; count <= 20; count++)
4039 x = p_ptr->x - 8 + randint0(17);
4040 y = p_ptr->y - 8 + randint0(17);
4042 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4043 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4045 /* Approximate distance */
4046 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4048 if (d >= 9) continue;
4050 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4051 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4053 /* Valid position */
4057 if (count > 20) continue;
4059 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4065 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4068 * @return ターゲットを指定し、実行したならばTRUEを返す。
4070 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4072 POSITION x, y, tx, ty;
4076 int b = 10 + randint1(10);
4078 if (!get_aim_dir(&dir)) return FALSE;
4080 /* Use the given direction */
4081 tx = p_ptr->x + 99 * ddx[dir];
4082 ty = p_ptr->y + 99 * ddy[dir];
4084 /* Hack -- Use an actual "target" */
4085 if ((dir == 5) && target_okay())
4096 /* Hack -- Stop at the target */
4097 if ((y == ty) && (x == tx)) break;
4101 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4103 /* Stop at maximum range */
4104 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4106 /* Stopped by walls/doors */
4107 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4109 /* Stopped by monsters */
4110 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4112 /* Save the new location */
4119 for (i = 0; i < b; i++)
4121 int count = 20, d = 0;
4127 x = tx - 5 + randint0(11);
4128 y = ty - 5 + randint0(11);
4130 dx = (tx > x) ? (tx - x) : (x - tx);
4131 dy = (ty > y) ? (ty - y) : (y - ty);
4133 /* Approximate distance */
4134 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4135 /* Within the radius */
4139 if (count < 0) continue;
4141 /* Cannot penetrate perm walls */
4142 if (!in_bounds(y, x) ||
4143 cave_stop_disintegration(y, x) ||
4144 !in_disintegration_range(ty, tx, y, x))
4147 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4154 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4158 * This spell should become more useful (more controlled) as the\n
4159 * player gains experience levels. Thus, add 1/5 of the player's\n
4160 * level to the die roll. This eliminates the worst effects later on,\n
4161 * while keeping the results quite random. It also allows some potent\n
4162 * effects only at high level.
4164 void cast_wonder(DIRECTION dir)
4166 PLAYER_LEVEL plev = p_ptr->lev;
4167 int die = randint1(100) + plev / 5;
4168 int vir = virtue_number(V_CHANCE);
4172 if (p_ptr->virtues[vir - 1] > 0)
4174 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4178 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4183 chg_virtue(V_CHANCE, 1);
4187 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4190 if (die < 8) clone_monster(dir);
4191 else if (die < 14) speed_monster(dir, plev);
4192 else if (die < 26) heal_monster(dir, damroll(4, 6));
4193 else if (die < 31) poly_monster(dir, plev);
4195 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4196 damroll(3 + ((plev - 1) / 5), 4));
4197 else if (die < 41) confuse_monster(dir, plev);
4198 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4199 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4201 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4202 damroll(3 + ((plev - 5) / 4), 8));
4204 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4205 damroll(5 + ((plev - 5) / 4), 8));
4207 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4208 damroll(6 + ((plev - 5) / 4), 8));
4210 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4211 damroll(8 + ((plev - 5) / 4), 8));
4212 else if (die < 76) hypodynamic_bolt(dir, 75);
4213 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4214 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4215 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4216 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4217 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4220 earthquake(p_ptr->y, p_ptr->x, 12);
4224 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4228 symbol_genocide(plev + 50, TRUE);
4230 else if (die < 110) dispel_monsters(120);
4233 dispel_monsters(150);
4234 slow_monsters(plev);
4235 sleep_monsters(plev);
4242 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4246 void cast_invoke_spirits(DIRECTION dir)
4248 PLAYER_LEVEL plev = p_ptr->lev;
4249 int die = randint1(100) + plev / 5;
4250 int vir = virtue_number(V_CHANCE);
4254 if (p_ptr->virtues[vir - 1] > 0)
4256 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4260 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4264 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4266 chg_virtue(V_CHANCE, 1);
4270 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4275 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4276 "Oh no! Mouldering forms rise from the earth around you!"));
4278 (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');
4279 chg_virtue(V_UNLIFE, 1);
4283 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4285 set_afraid(p_ptr->afraid + randint1(4) + 4);
4289 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4290 "Your head is invaded by a horde of gibbering spectral voices..."));
4292 set_confused(p_ptr->confused + randint1(4) + 4);
4296 poly_monster(dir, plev);
4300 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4301 damroll(3 + ((plev - 1) / 5), 4));
4305 confuse_monster(dir, plev);
4309 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4313 (void)lite_line(dir, damroll(6, 8));
4317 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4318 damroll(3 + ((plev - 5) / 4), 8));
4322 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4323 damroll(5 + ((plev - 5) / 4), 8));
4327 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4328 damroll(6 + ((plev - 5) / 4), 8));
4332 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4333 damroll(8 + ((plev - 5) / 4), 8));
4337 hypodynamic_bolt(dir, 75);
4341 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4345 fire_ball(GF_ACID, dir, 40 + plev, 2);
4349 fire_ball(GF_ICE, dir, 70 + plev, 3);
4353 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4357 hypodynamic_bolt(dir, 100 + plev);
4361 earthquake(p_ptr->y, p_ptr->x, 12);
4365 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4369 symbol_genocide(plev + 50, TRUE);
4373 dispel_monsters(120);
4377 dispel_monsters(150);
4378 slow_monsters(plev);
4379 sleep_monsters(plev);
4385 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4386 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4391 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4394 void cast_shuffle(void)
4396 PLAYER_LEVEL plev = p_ptr->lev;
4399 int vir = virtue_number(V_CHANCE);
4402 /* Card sharks and high mages get a level bonus */
4403 if ((p_ptr->pclass == CLASS_ROGUE) ||
4404 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4405 (p_ptr->pclass == CLASS_SORCERER))
4406 die = (randint1(110)) + plev / 5;
4408 die = randint1(120);
4413 if (p_ptr->virtues[vir - 1] > 0)
4415 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4419 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4423 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4426 chg_virtue(V_CHANCE, 1);
4430 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4432 for (i = 0; i < randint1(3); i++)
4433 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4437 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4438 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');
4443 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4444 activate_ty_curse(FALSE, &count);
4448 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4449 aggravate_monsters(0);
4453 msg_print(_("《愚者》だ。", "It's the Fool."));
4459 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4460 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);
4464 msg_print(_("《月》だ。", "It's the Moon."));
4469 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4470 wild_magic(randint0(32));
4474 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4475 teleport_player(10, TELEPORT_PASSIVE);
4479 msg_print(_("《正義》だ。", "It's Justice."));
4480 set_blessed(p_ptr->lev, FALSE);
4484 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4485 teleport_player(100, TELEPORT_PASSIVE);
4489 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4490 teleport_player(200, TELEPORT_PASSIVE);
4494 msg_print(_("《塔》だ。", "It's the Tower."));
4499 msg_print(_("《節制》だ。", "It's Temperance."));
4500 sleep_monsters_touch();
4504 msg_print(_("《塔》だ。", "It's the Tower."));
4506 earthquake(p_ptr->y, p_ptr->x, 5);
4510 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4511 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4515 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4516 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4520 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4521 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4525 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4526 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4530 msg_print(_("《恋人》だ。", "It's the Lovers."));
4532 if (get_aim_dir(&dir))
4533 charm_monster(dir, MIN(p_ptr->lev, 20));
4537 msg_print(_("《隠者》だ。", "It's the Hermit."));
4542 msg_print(_("《審判》だ。", "It's the Judgement."));
4543 roll_hitdice(p_ptr, 0L);
4544 lose_all_mutations();
4548 msg_print(_("《太陽》だ。", "It's the Sun."));
4549 chg_virtue(V_KNOWLEDGE, 1);
4550 chg_virtue(V_ENLIGHTEN, 1);
4555 msg_print(_("《世界》だ。", "It's the World."));
4556 if (p_ptr->exp < PY_MAX_EXP)
4558 s32b ee = (p_ptr->exp / 25) + 1;
4559 if (ee > 5000) ee = 5000;
4560 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4567 * @brief 口を使う継続的な処理を中断する
4570 void stop_mouth(void)
4572 if (music_singing_any()) stop_singing(p_ptr);
4573 if (hex_spelling_any()) stop_hex_spell_all();
4577 bool_hack vampirism(void)
4584 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4586 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4590 /* Only works on adjacent monsters */
4591 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4592 y = p_ptr->y + ddy[dir];
4593 x = p_ptr->x + ddx[dir];
4594 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4598 if (!(g_ptr->m_idx))
4600 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4604 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4606 dummy = p_ptr->lev * 2;
4608 if (hypodynamic_bolt(dir, dummy))
4610 if (p_ptr->food < PY_FOOD_FULL)
4611 /* No heal if we are "full" */
4612 (void)hp_player(dummy);
4614 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4616 /* Gain nutritional sustenance: 150/hp drained */
4617 /* A Food ration gives 5000 food points (by contrast) */
4618 /* Don't ever get more than "Full" this way */
4619 /* But if we ARE Gorged, it won't cure us */
4620 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4621 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4622 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4625 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4629 bool panic_hit(void)
4634 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4635 y = p_ptr->y + ddy[dir];
4636 x = p_ptr->x + ddx[dir];
4637 if (current_floor_ptr->grid_array[y][x].m_idx)
4640 if (randint0(p_ptr->skill_dis) < 7)
4641 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4643 teleport_player(30, 0L);
4648 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4656 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4659 * currently this function allows pseudo-id of any object,
4660 * including silly ones like potions & scrolls, which always
4661 * get '{average}'. This should be changed, either to stop such
4662 * items from being pseudo-id'd, or to allow psychometry to
4663 * detect whether the unidentified potion/scroll/etc is
4664 * good (Cure Light Wounds, Restore Strength, etc) or
4665 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4667 bool psychometry(void)
4671 GAME_TEXT o_name[MAX_NLEN];
4676 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4677 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4679 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4680 if (!o_ptr) return (FALSE);
4682 /* It is fully known, no information needed */
4683 if (object_is_known(o_ptr))
4685 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4689 /* Check for a feeling */
4690 feel = value_check_aux1(o_ptr);
4692 /* Get an object description */
4693 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4695 /* Skip non-feelings */
4698 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4703 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4705 msg_format("You feel that the %s %s %s...",
4706 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4710 o_ptr->ident |= (IDENT_SENSE);
4711 o_ptr->feeling = feel;
4712 o_ptr->marked |= OM_TOUCHED;
4714 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4715 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4717 /* Valid "tval" codes */
4718 switch (o_ptr->tval)
4746 /* Auto-inscription/destroy */
4747 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4749 /* Something happened */
4754 bool draconian_breath(player_type *creature_ptr)
4757 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4758 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4760 if (!get_aim_dir(&dir)) return FALSE;
4762 if (randint1(100) < creature_ptr->lev)
4764 switch (creature_ptr->pclass)
4767 case CLASS_BERSERKER:
4770 case CLASS_IMITATOR:
4776 Type_desc = _("エレメント", "the elements");
4781 Type_desc = _("破片", "shards");
4785 case CLASS_WARRIOR_MAGE:
4786 case CLASS_HIGH_MAGE:
4787 case CLASS_SORCERER:
4788 case CLASS_MAGIC_EATER:
4789 case CLASS_RED_MAGE:
4790 case CLASS_BLUE_MAGE:
4791 case CLASS_MIRROR_MASTER:
4795 Type_desc = _("魔力", "mana");
4799 Type = GF_DISENCHANT;
4800 Type_desc = _("劣化", "disenchantment");
4803 case CLASS_CHAOS_WARRIOR:
4806 Type = GF_CONFUSION;
4807 Type_desc = _("混乱", "confusion");
4812 Type_desc = _("カオス", "chaos");
4817 case CLASS_FORCETRAINER:
4820 Type = GF_CONFUSION;
4821 Type_desc = _("混乱", "confusion");
4826 Type_desc = _("轟音", "sound");
4829 case CLASS_MINDCRAFTER:
4832 Type = GF_CONFUSION;
4833 Type_desc = _("混乱", "confusion");
4838 Type_desc = _("精神エネルギー", "mental energy");
4845 Type = GF_HELL_FIRE;
4846 Type_desc = _("地獄の劫火", "hellfire");
4850 Type = GF_HOLY_FIRE;
4851 Type_desc = _("聖なる炎", "holy fire");
4859 Type_desc = _("暗黒", "darkness");
4864 Type_desc = _("毒", "poison");
4871 Type_desc = _("轟音", "sound");
4875 Type = GF_CONFUSION;
4876 Type_desc = _("混乱", "confusion");
4883 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4885 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4889 bool android_inside_weapon(player_type *creature_ptr)
4892 if (!get_aim_dir(&dir)) return FALSE;
4893 if (creature_ptr->lev < 10)
4895 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4896 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4898 else if (creature_ptr->lev < 25)
4900 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4901 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4903 else if (creature_ptr->lev < 35)
4905 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4906 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4908 else if (creature_ptr->lev < 45)
4910 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4911 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4915 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4916 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4921 bool create_ration(player_type *crature_ptr)
4927 /* Create the food ration */
4928 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4930 /* Drop the object from heaven */
4931 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4932 msg_print(_("食事を料理して作った。", "You cook some food."));
4936 void hayagake(player_type *creature_ptr)
4938 if (creature_ptr->action == ACTION_HAYAGAKE)
4940 set_action(ACTION_NONE);
4944 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4945 feature_type *f_ptr = &f_info[g_ptr->feat];
4947 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4948 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4950 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4954 set_action(ACTION_HAYAGAKE);
4957 creature_ptr->energy_use = 0;
4960 bool double_attack(player_type *creature_ptr)
4965 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4966 y = creature_ptr->y + ddy[dir];
4967 x = creature_ptr->x + ddx[dir];
4968 if (current_floor_ptr->grid_array[y][x].m_idx)
4971 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4972 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4974 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4975 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4977 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4978 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4981 if (current_floor_ptr->grid_array[y][x].m_idx)
4986 creature_ptr->energy_need += ENERGY_NEED();
4990 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4996 bool comvert_hp_to_mp(player_type *creature_ptr)
4998 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5001 creature_ptr->csp += gain_sp;
5002 if (creature_ptr->csp > creature_ptr->msp)
5004 creature_ptr->csp = creature_ptr->msp;
5005 creature_ptr->csp_frac = 0;
5010 msg_print(_("変換に失敗した。", "You failed to convert."));
5012 creature_ptr->redraw |= (PR_HP | PR_MANA);
5016 bool comvert_mp_to_hp(player_type *creature_ptr)
5018 if (creature_ptr->csp >= creature_ptr->lev / 5)
5020 creature_ptr->csp -= creature_ptr->lev / 5;
5021 hp_player(creature_ptr->lev);
5025 msg_print(_("変換に失敗した。", "You failed to convert."));
5027 creature_ptr->redraw |= (PR_HP | PR_MANA);
5031 bool demonic_breath(player_type *creature_ptr)
5034 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5035 if (!get_aim_dir(&dir)) return FALSE;
5037 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5038 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5042 bool mirror_concentration(player_type *creature_ptr)
5046 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5049 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5051 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5053 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5054 if (creature_ptr->csp >= creature_ptr->msp)
5056 creature_ptr->csp = creature_ptr->msp;
5057 creature_ptr->csp_frac = 0;
5059 creature_ptr->redraw |= (PR_MANA);
5063 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5068 bool sword_dancing(player_type *creature_ptr)
5071 POSITION y = 0, x = 0;
5075 for (i = 0; i < 6; i++)
5078 y = creature_ptr->y + ddy_ddd[dir];
5079 x = creature_ptr->x + ddx_ddd[dir];
5080 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5082 /* Hack -- attack monsters */
5087 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5093 bool confusing_light(player_type *creature_ptr)
5095 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5096 slow_monsters(creature_ptr->lev);
5097 stun_monsters(creature_ptr->lev * 4);
5098 confuse_monsters(creature_ptr->lev * 4);
5099 turn_monsters(creature_ptr->lev * 4);
5100 stasis_monsters(creature_ptr->lev * 4);
5104 bool rodeo(player_type *creature_ptr)
5106 GAME_TEXT m_name[MAX_NLEN];
5107 monster_type *m_ptr;
5108 monster_race *r_ptr;
5111 if (creature_ptr->riding)
5113 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5116 if (!do_riding(TRUE)) return TRUE;
5118 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5119 r_ptr = &r_info[m_ptr->r_idx];
5120 monster_desc(m_name, m_ptr, 0);
5121 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5123 if (is_pet(m_ptr)) return TRUE;
5125 rlev = r_ptr->level;
5127 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5128 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5129 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5130 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5131 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5132 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5134 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5139 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5143 /* 落馬処理に失敗してもとにかく乗馬解除 */
5144 creature_ptr->riding = 0;
5149 bool clear_mind(player_type *creature_ptr)
5153 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5156 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5158 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5159 if (creature_ptr->csp >= creature_ptr->msp)
5161 creature_ptr->csp = creature_ptr->msp;
5162 creature_ptr->csp_frac = 0;
5164 creature_ptr->redraw |= (PR_MANA);
5168 bool concentration(player_type *creature_ptr)
5170 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5174 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5177 if (creature_ptr->special_defense & KATA_MASK)
5179 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5182 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5184 creature_ptr->csp += creature_ptr->msp / 2;
5185 if (creature_ptr->csp >= max_csp)
5187 creature_ptr->csp = max_csp;
5188 creature_ptr->csp_frac = 0;
5190 creature_ptr->redraw |= (PR_MANA);