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"
33 * @brief プレイヤー周辺の地形を感知する
36 * @param known 地形から危険フラグを外すならTRUE
37 * @return 効力があった場合TRUEを返す
39 static bool detect_feat_flag(POSITION range, int flag, bool known)
45 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
47 /* Scan the current panel */
48 for (y = 1; y < current_floor_ptr->height - 1; y++)
50 for (x = 1; x <= current_floor_ptr->width - 1; x++)
52 int dist = distance(p_ptr->y, p_ptr->x, y, x);
53 if (dist > range) continue;
54 g_ptr = ¤t_floor_ptr->grid_array[y][x];
59 /* Mark as detected */
60 if (dist <= range && known)
62 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
64 g_ptr->info &= ~(CAVE_UNSAFE);
71 if (cave_have_flag_grid(g_ptr, flag))
76 /* Hack -- Memorize */
77 g_ptr->info |= (CAVE_MARK);
90 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
92 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
93 * @return 効力があった場合TRUEを返す
95 bool detect_traps(POSITION range, bool known)
97 bool detect = detect_feat_flag(range, FF_TRAP, known);
99 if (known) p_ptr->dtrap = TRUE;
101 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
104 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
111 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
113 * @return 効力があった場合TRUEを返す
115 bool detect_doors(POSITION range)
117 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
119 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
122 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
129 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
131 * @return 効力があった場合TRUEを返す
133 bool detect_stairs(POSITION range)
135 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
137 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
140 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
147 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
149 * @return 効力があった場合TRUEを返す
151 bool detect_treasure(POSITION range)
153 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
155 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
158 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
165 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
167 * @return 効力があった場合TRUEを返す
169 bool detect_objects_gold(POSITION range)
173 POSITION range2 = range;
177 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
180 for (i = 1; i < o_max; i++)
182 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
184 /* Skip dead objects */
185 if (!o_ptr->k_idx) continue;
187 /* Skip held objects */
188 if (o_ptr->held_m_idx) continue;
193 /* Only detect nearby objects */
194 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
196 /* Detect "gold" objects */
197 if (o_ptr->tval == TV_GOLD)
199 o_ptr->marked |= OM_FOUND;
205 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
208 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
211 if (detect_monsters_string(range, "$"))
220 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
222 * @return 効力があった場合TRUEを返す
224 bool detect_objects_normal(POSITION range)
228 POSITION range2 = range;
232 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
235 for (i = 1; i < o_max; i++)
237 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
239 /* Skip dead objects */
240 if (!o_ptr->k_idx) continue;
242 /* Skip held objects */
243 if (o_ptr->held_m_idx) continue;
248 /* Only detect nearby objects */
249 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
251 /* Detect "real" objects */
252 if (o_ptr->tval != TV_GOLD)
254 o_ptr->marked |= OM_FOUND;
260 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
263 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
266 if (detect_monsters_string(range, "!=?|/`"))
275 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
277 * @return 効力があった場合TRUEを返す
280 * This will light up all spaces with "magic" items, including artifacts,
281 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
282 * and "enchanted" items of the "good" variety.
284 * It can probably be argued that this function is now too powerful.
287 bool detect_objects_magic(POSITION range)
289 OBJECT_TYPE_VALUE tv;
295 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
297 /* Scan all objects */
298 for (i = 1; i < o_max; i++)
300 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
302 /* Skip dead objects */
303 if (!o_ptr->k_idx) continue;
305 /* Skip held objects */
306 if (o_ptr->held_m_idx) continue;
311 /* Only detect nearby objects */
312 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
314 /* Examine the tval */
317 /* Artifacts, misc magic items, or enchanted wearables */
318 if (object_is_artifact(o_ptr) ||
319 object_is_ego(o_ptr) ||
320 (tv == TV_WHISTLE) ||
328 (tv == TV_LIFE_BOOK) ||
329 (tv == TV_SORCERY_BOOK) ||
330 (tv == TV_NATURE_BOOK) ||
331 (tv == TV_CHAOS_BOOK) ||
332 (tv == TV_DEATH_BOOK) ||
333 (tv == TV_TRUMP_BOOK) ||
334 (tv == TV_ARCANE_BOOK) ||
335 (tv == TV_CRAFT_BOOK) ||
336 (tv == TV_DAEMON_BOOK) ||
337 (tv == TV_CRUSADE_BOOK) ||
338 (tv == TV_MUSIC_BOOK) ||
339 (tv == TV_HISSATSU_BOOK) ||
340 (tv == TV_HEX_BOOK) ||
341 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
343 /* Memorize the item */
344 o_ptr->marked |= OM_FOUND;
351 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
360 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
362 * @return 効力があった場合TRUEを返す
364 bool detect_monsters_normal(POSITION range)
370 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
372 for (i = 1; i < m_max; i++)
374 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
375 monster_race *r_ptr = &r_info[m_ptr->r_idx];
377 /* Skip dead monsters */
378 if (!m_ptr->r_idx) continue;
383 /* Only detect nearby monsters */
384 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
386 /* Detect all non-invisible monsters */
387 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
389 /* Repair visibility later */
390 repair_monsters = TRUE;
392 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
393 update_monster(i, FALSE);
398 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
401 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
408 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
410 * @return 効力があった場合TRUEを返す
412 bool detect_monsters_invis(POSITION range)
418 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
420 for (i = 1; i < m_max; i++)
422 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
423 monster_race *r_ptr = &r_info[m_ptr->r_idx];
425 /* Skip dead monsters */
426 if (!m_ptr->r_idx) continue;
431 /* Only detect nearby monsters */
432 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
434 /* Detect invisible monsters */
435 if (r_ptr->flags2 & RF2_INVISIBLE)
437 /* Update monster recall window */
438 if (p_ptr->monster_race_idx == m_ptr->r_idx)
440 p_ptr->window |= (PW_MONSTER);
443 /* Repair visibility later */
444 repair_monsters = TRUE;
446 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
447 update_monster(i, FALSE);
452 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
455 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
461 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
463 * @return 効力があった場合TRUEを返す
465 bool detect_monsters_evil(POSITION range)
471 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
473 for (i = 1; i < m_max; i++)
475 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
476 monster_race *r_ptr = &r_info[m_ptr->r_idx];
478 /* Skip dead monsters */
479 if (!m_ptr->r_idx) continue;
484 /* Only detect nearby monsters */
485 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
487 /* Detect evil monsters */
488 if (r_ptr->flags3 & RF3_EVIL)
490 if (is_original_ap(m_ptr))
492 /* Take note that they are evil */
493 r_ptr->r_flags3 |= (RF3_EVIL);
495 /* Update monster recall window */
496 if (p_ptr->monster_race_idx == m_ptr->r_idx)
498 p_ptr->window |= (PW_MONSTER);
502 /* Repair visibility later */
503 repair_monsters = TRUE;
505 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
506 update_monster(i, FALSE);
512 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
518 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
520 * @return 効力があった場合TRUEを返す
522 bool detect_monsters_nonliving(POSITION range)
528 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
530 for (i = 1; i < m_max; i++)
532 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
534 /* Skip dead monsters */
535 if (!m_ptr->r_idx) continue;
540 /* Only detect nearby monsters */
541 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
543 /* Detect non-living monsters */
544 if (!monster_living(m_ptr->r_idx))
546 /* Update monster recall window */
547 if (p_ptr->monster_race_idx == m_ptr->r_idx)
549 p_ptr->window |= (PW_MONSTER);
552 /* Repair visibility later */
553 repair_monsters = TRUE;
555 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
556 update_monster(i, FALSE);
562 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
568 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
570 * @return 効力があった場合TRUEを返す
572 bool detect_monsters_mind(POSITION range)
578 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
580 for (i = 1; i < m_max; i++)
582 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
583 monster_race *r_ptr = &r_info[m_ptr->r_idx];
585 /* Skip dead monsters */
586 if (!m_ptr->r_idx) continue;
591 /* Only detect nearby monsters */
592 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
594 /* Detect non-living monsters */
595 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
597 /* Update monster recall window */
598 if (p_ptr->monster_race_idx == m_ptr->r_idx)
600 p_ptr->window |= (PW_MONSTER);
603 /* Repair visibility later */
604 repair_monsters = TRUE;
606 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
607 update_monster(i, FALSE);
613 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
620 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
622 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
623 * @return 効力があった場合TRUEを返す
625 bool detect_monsters_string(POSITION range, concptr Match)
631 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
633 for (i = 1; i < m_max; i++)
635 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
636 monster_race *r_ptr = &r_info[m_ptr->r_idx];
638 /* Skip dead monsters */
639 if (!m_ptr->r_idx) continue;
644 /* Only detect nearby monsters */
645 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
647 /* Detect monsters with the same symbol */
648 if (my_strchr(Match, r_ptr->d_char))
650 /* Update monster recall window */
651 if (p_ptr->monster_race_idx == m_ptr->r_idx)
653 p_ptr->window |= (PW_MONSTER);
656 /* Repair visibility later */
657 repair_monsters = TRUE;
659 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
660 update_monster(i, FALSE);
665 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
668 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
674 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
676 * @param match_flag 感知フラグ
677 * @return 効力があった場合TRUEを返す
679 bool detect_monsters_xxx(POSITION range, u32b match_flag)
684 concptr desc_monsters = _("変なモンスター", "weird monsters");
686 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
688 for (i = 1; i < m_max; i++)
690 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
691 monster_race *r_ptr = &r_info[m_ptr->r_idx];
693 /* Skip dead monsters */
694 if (!m_ptr->r_idx) continue;
699 /* Only detect nearby monsters */
700 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
702 /* Detect evil monsters */
703 if (r_ptr->flags3 & (match_flag))
705 if (is_original_ap(m_ptr))
707 /* Take note that they are something */
708 r_ptr->r_flags3 |= (match_flag);
710 /* Update monster recall window */
711 if (p_ptr->monster_race_idx == m_ptr->r_idx)
713 p_ptr->window |= (PW_MONSTER);
717 /* Repair visibility later */
718 repair_monsters = TRUE;
720 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
721 update_monster(i, FALSE);
730 desc_monsters = _("デーモン", "demons");
733 desc_monsters = _("アンデッド", "the undead");
737 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
745 * @brief 全感知処理 / Detect everything
747 * @return 効力があった場合TRUEを返す
749 bool detect_all(POSITION range)
753 /* Detect everything */
754 if (detect_traps(range, TRUE)) detect = TRUE;
755 if (detect_doors(range)) detect = TRUE;
756 if (detect_stairs(range)) detect = TRUE;
758 /* There are too many hidden treasure. So... */
759 /* if (detect_treasure(range)) detect = TRUE; */
761 if (detect_objects_gold(range)) detect = TRUE;
762 if (detect_objects_normal(range)) detect = TRUE;
763 if (detect_monsters_invis(range)) detect = TRUE;
764 if (detect_monsters_normal(range)) detect = TRUE;
770 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
773 * @return 効力があった場合TRUEを返す
776 * Note that affected monsters are NOT auto-tracked by this usage.
778 * To avoid misbehavior when monster deaths have side-effects,
779 * this is done in two passes. -- JDL
782 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
786 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
787 bool obvious = FALSE;
790 /* Mark all (nearby) monsters */
791 for (i = 1; i < m_max; i++)
793 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
795 /* Paranoia -- Skip dead monsters */
796 if (!m_ptr->r_idx) continue;
801 /* Require line of sight */
802 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
804 /* Mark the monster */
805 m_ptr->mflag |= (MFLAG_TEMP);
808 /* Affect all marked monsters */
809 for (i = 1; i < m_max; i++)
811 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
813 /* Skip unmarked monsters */
814 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
817 m_ptr->mflag &= ~(MFLAG_TEMP);
822 /* Jump directly to the target monster */
823 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
830 * @brief 視界内モンスターを加速する処理 / Speed monsters
831 * @return 効力があった場合TRUEを返す
833 bool speed_monsters(void)
835 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
839 * @brief 視界内モンスターを加速する処理 / Slow monsters
840 * @return 効力があった場合TRUEを返す
842 bool slow_monsters(int power)
844 return (project_all_los(GF_OLD_SLOW, power));
848 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
849 * @return 効力があった場合TRUEを返す
851 bool sleep_monsters(int power)
853 return (project_all_los(GF_OLD_SLEEP, power));
857 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
858 * @return 効力があった場合TRUEを返す
860 bool banish_evil(int dist)
862 return (project_all_los(GF_AWAY_EVIL, dist));
866 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
867 * @return 効力があった場合TRUEを返す
869 bool turn_undead(void)
871 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
873 chg_virtue(V_UNLIFE, -1);
878 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
879 * @return 効力があった場合TRUEを返す
881 bool dispel_undead(HIT_POINT dam)
883 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
885 chg_virtue(V_UNLIFE, -2);
890 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
891 * @return 効力があった場合TRUEを返す
893 bool dispel_evil(HIT_POINT dam)
895 return (project_all_los(GF_DISP_EVIL, dam));
899 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
900 * @return 効力があった場合TRUEを返す
902 bool dispel_good(HIT_POINT dam)
904 return (project_all_los(GF_DISP_GOOD, dam));
908 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
909 * @return 効力があった場合TRUEを返す
911 bool dispel_monsters(HIT_POINT dam)
913 return (project_all_los(GF_DISP_ALL, dam));
916 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
919 if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
920 int k = 3 * creature_ptr->lev;
921 if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
922 if (set_poisoned(0)) ident = TRUE;
923 if (set_afraid(0)) ident = TRUE;
924 if (hp_player(50)) ident = TRUE;
925 if (set_stun(0)) ident = TRUE;
926 if (set_cut(0)) ident = TRUE;
930 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
932 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
933 project(0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
934 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
935 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))
937 (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
943 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
944 * @return 効力があった場合TRUEを返す
946 bool dispel_living(HIT_POINT dam)
948 return (project_all_los(GF_DISP_LIVING, dam));
952 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
953 * @return 効力があった場合TRUEを返す
955 bool dispel_demons(HIT_POINT dam)
957 return (project_all_los(GF_DISP_DEMON, dam));
961 * @brief 視界内のモンスターに「聖戦」効果を与える処理
962 * @return 効力があった場合TRUEを返す
966 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
970 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
971 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
974 void aggravate_monsters(MONSTER_IDX who)
980 /* Aggravate everyone nearby */
981 for (i = 1; i < m_max; i++)
983 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
985 /* Paranoia -- Skip dead monsters */
986 if (!m_ptr->r_idx) continue;
988 /* Skip aggravating monster (or player) */
989 if (i == who) continue;
991 /* Wake up nearby sleeping monsters */
992 if (m_ptr->cdis < MAX_SIGHT * 2)
995 if (MON_CSLEEP(m_ptr))
997 (void)set_monster_csleep(i, 0);
1000 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1003 /* Speed up monsters in line of sight */
1004 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
1008 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1014 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1015 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1016 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
1021 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1022 * @param m_idx 抹殺するモンスターID
1023 * @param power 抹殺の威力
1024 * @param player_cast プレイヤーの魔法によるものならば TRUE
1025 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1026 * @param spell_name 抹殺効果を起こした魔法の名前
1027 * @return 効力があった場合TRUEを返す
1029 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1031 int msec = delay_factor * delay_factor * delay_factor;
1032 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1033 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1034 bool resist = FALSE;
1036 if (is_pet(m_ptr) && !player_cast) return FALSE;
1038 /* Hack -- Skip Unique Monsters or Quest Monsters */
1039 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1040 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1041 else if (m_idx == p_ptr->riding) resist = TRUE;
1042 else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1043 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1044 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1048 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1050 GAME_TEXT m_name[MAX_NLEN];
1052 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1053 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1056 delete_monster_idx(m_idx);
1059 if (resist && player_cast)
1061 bool see_m = is_seen(m_ptr);
1062 GAME_TEXT m_name[MAX_NLEN];
1064 monster_desc(m_name, m_ptr, 0);
1067 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1069 if (MON_CSLEEP(m_ptr))
1071 (void)set_monster_csleep(m_idx, 0);
1074 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1077 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1081 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1085 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1090 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1093 /* Visual feedback */
1094 move_cursor_relative(p_ptr->y, p_ptr->x);
1096 p_ptr->redraw |= (PR_HP);
1097 p_ptr->window |= (PW_PLAYER);
1102 Term_xtra(TERM_XTRA_DELAY, msec);
1109 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1110 * @param power 抹殺の威力
1111 * @param player_cast プレイヤーの魔法によるものならば TRUE
1112 * @return 効力があった場合TRUEを返す
1114 bool symbol_genocide(int power, bool player_cast)
1118 bool result = FALSE;
1120 /* Prevent genocide in quest levels */
1121 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1123 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1127 /* Mega-Hack -- Get a monster symbol */
1128 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1130 /* Delete the monsters of that "type" */
1131 for (i = 1; i < m_max; i++)
1133 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1134 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1136 /* Paranoia -- Skip dead monsters */
1137 if (!m_ptr->r_idx) continue;
1139 /* Skip "wrong" monsters */
1140 if (r_ptr->d_char != typ) continue;
1142 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1147 chg_virtue(V_VITALITY, -2);
1148 chg_virtue(V_CHANCE, -1);
1156 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1157 * @param power 抹殺の威力
1158 * @param player_cast プレイヤーの魔法によるものならば TRUE
1159 * @return 効力があった場合TRUEを返す
1161 bool mass_genocide(int power, bool player_cast)
1164 bool result = FALSE;
1166 /* Prevent mass genocide in quest levels */
1167 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1172 /* Delete the (nearby) monsters */
1173 for (i = 1; i < m_max; i++)
1175 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1177 /* Paranoia -- Skip dead monsters */
1178 if (!m_ptr->r_idx) continue;
1180 /* Skip distant monsters */
1181 if (m_ptr->cdis > MAX_SIGHT) continue;
1184 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1189 chg_virtue(V_VITALITY, -2);
1190 chg_virtue(V_CHANCE, -1);
1198 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1199 * @param power 抹殺の威力
1200 * @param player_cast プレイヤーの魔法によるものならば TRUE
1201 * @return 効力があった場合TRUEを返す
1203 bool mass_genocide_undead(int power, bool player_cast)
1206 bool result = FALSE;
1208 /* Prevent mass genocide in quest levels */
1209 if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1214 /* Delete the (nearby) monsters */
1215 for (i = 1; i < m_max; i++)
1217 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1218 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1220 /* Paranoia -- Skip dead monsters */
1221 if (!m_ptr->r_idx) continue;
1223 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1225 /* Skip distant monsters */
1226 if (m_ptr->cdis > MAX_SIGHT) continue;
1229 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1234 chg_virtue(V_UNLIFE, -2);
1235 chg_virtue(V_CHANCE, -1);
1243 * @brief 周辺モンスターを調査する / Probe nearby monsters
1244 * @return 効力があった場合TRUEを返す
1249 int speed; /* TODO */
1260 /* Probe all (nearby) monsters */
1261 for (i = 1; i < m_max; i++)
1263 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
1264 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1266 /* Paranoia -- Skip dead monsters */
1267 if (!m_ptr->r_idx) continue;
1269 /* Require line of sight */
1270 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1272 /* Probe visible monsters */
1275 GAME_TEXT m_name[MAX_NLEN];
1277 /* Start the message */
1280 msg_print(_("調査中...", "Probing..."));
1285 if (!is_original_ap(m_ptr))
1287 if (m_ptr->mflag2 & MFLAG2_KAGE)
1288 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1290 m_ptr->ap_r_idx = m_ptr->r_idx;
1291 lite_spot(m_ptr->fy, m_ptr->fx);
1293 /* Get "the monster" or "something" */
1294 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1296 speed = m_ptr->mspeed - 110;
1297 if (MON_FAST(m_ptr)) speed += 10;
1298 if (MON_SLOW(m_ptr)) speed -= 10;
1299 if (ironman_nightmare) speed += 5;
1301 /* Get the monster's alignment */
1302 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1303 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1304 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1305 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1306 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1307 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1308 else align = _("中立", "neutral");
1310 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1311 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1313 if (r_ptr->next_r_idx)
1315 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1319 strcat(buf, "xxx ");
1322 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1323 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1324 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1325 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1326 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1327 buf[strlen(buf)-1] = '\0';
1330 /* HACK : Add the line to message buffer */
1333 p_ptr->window |= (PW_MESSAGE);
1336 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1339 Term_erase(0, 0, 255);
1341 /* Learn everything about this monster */
1342 if (lore_do_probe(m_ptr->r_idx))
1344 /* Get base name of monster */
1345 strcpy(buf, (r_name + r_ptr->name));
1348 /* Note that we learnt some new flags -Mogami- */
1349 msg_format("%sについてさらに詳しくなった気がする。", buf);
1354 /* Note that we learnt some new flags -Mogami- */
1355 msg_format("You now know more about %s.", buf);
1357 /* Clear -more- prompt */
1372 chg_virtue(V_KNOWLEDGE, 1);
1373 msg_print(_("これで全部です。", "That's all."));
1381 * @brief *破壊*処理を行う / The spell of destruction
1382 * @param y1 破壊の中心Y座標
1383 * @param x1 破壊の中心X座標
1385 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1386 * @return 効力があった場合TRUEを返す
1389 * This spell "deletes" monsters (instead of "killing" them).
1391 * Later we may use one function for both "destruction" and
1392 * "earthquake" by using the "full" to select "destruction".
1395 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1402 /* Prevent destruction of quest levels and town */
1403 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1408 /* Lose monster light */
1409 if (!in_generate) clear_mon_lite();
1411 /* Big area of affect */
1412 for (y = (y1 - r); y <= (y1 + r); y++)
1414 for (x = (x1 - r); x <= (x1 + r); x++)
1416 /* Skip illegal grids */
1417 if (!in_bounds(y, x)) continue;
1419 /* Extract the distance */
1420 k = distance(y1, x1, y, x);
1422 /* Stay in the circle of death */
1423 if (k > r) continue;
1424 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1426 /* Lose room and vault */
1427 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1429 /* Lose light and knowledge */
1430 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1432 if (!in_generate) /* Normal */
1435 g_ptr->info &= ~(CAVE_UNSAFE);
1437 /* Hack -- Notice player affect */
1438 if (player_bold(y, x))
1440 /* Hurt the player later */
1443 /* Do not hurt this grid */
1448 /* Hack -- Skip the epicenter */
1449 if ((y == y1) && (x == x1)) continue;
1453 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1454 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1456 if (in_generate) /* In generation */
1458 /* Delete the monster (if any) */
1459 delete_monster(y, x);
1461 else if (r_ptr->flags1 & RF1_QUESTOR)
1463 /* Heal the monster */
1464 m_ptr->hp = m_ptr->maxhp;
1466 /* Try to teleport away quest monsters */
1467 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1471 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1473 GAME_TEXT m_name[MAX_NLEN];
1475 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1476 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1479 /* Delete the monster (if any) */
1480 delete_monster(y, x);
1484 /* During generation, destroyed artifacts are "preserved" */
1485 if (preserve_mode || in_generate)
1487 OBJECT_IDX this_o_idx, next_o_idx = 0;
1489 /* Scan all objects in the grid */
1490 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1493 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
1494 next_o_idx = o_ptr->next_o_idx;
1496 /* Hack -- Preserve unknown artifacts */
1497 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1499 /* Mega-Hack -- Preserve the artifact */
1500 a_info[o_ptr->name1].cur_num = 0;
1502 if (in_generate && cheat_peek)
1504 GAME_TEXT o_name[MAX_NLEN];
1505 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1506 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1509 else if (in_generate && cheat_peek && o_ptr->art_name)
1511 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1512 "One of the random artifacts was *destroyed* during generation."));
1517 delete_object(y, x);
1519 /* Destroy "non-permanent" grids */
1520 if (!cave_perma_grid(g_ptr))
1522 /* Wall (or floor) type */
1525 if (!in_generate) /* Normal */
1529 /* Create granite wall */
1530 cave_set_feat(y, x, feat_granite);
1534 /* Create quartz vein */
1535 cave_set_feat(y, x, feat_quartz_vein);
1539 /* Create magma vein */
1540 cave_set_feat(y, x, feat_magma_vein);
1545 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1548 else /* In generation */
1552 /* Create granite wall */
1553 place_extra_grid(g_ptr);
1557 /* Create quartz vein */
1558 g_ptr->feat = feat_quartz_vein;
1562 /* Create magma vein */
1563 g_ptr->feat = feat_magma_vein;
1568 place_floor_grid(g_ptr);
1571 /* Clear garbage of hidden trap or door */
1580 /* Process "re-glowing" */
1581 for (y = (y1 - r); y <= (y1 + r); y++)
1583 for (x = (x1 - r); x <= (x1 + r); x++)
1585 /* Skip illegal grids */
1586 if (!in_bounds(y, x)) continue;
1588 /* Extract the distance */
1589 k = distance(y1, x1, y, x);
1591 /* Stay in the circle of death */
1592 if (k > r) continue;
1593 g_ptr = ¤t_floor_ptr->grid_array[y][x];
1595 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1596 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1602 for (i = 0; i < 9; i++)
1604 yy = y + ddy_ddd[i];
1605 xx = x + ddx_ddd[i];
1606 if (!in_bounds2(yy, xx)) continue;
1607 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1608 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1610 g_ptr->info |= CAVE_GLOW;
1618 /* Hack -- Affect player */
1621 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1623 /* Blind the player */
1624 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1627 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1633 /* Mega-Hack -- Forget the view and lite */
1634 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1635 p_ptr->redraw |= (PR_MAP);
1636 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1638 if (p_ptr->special_defense & NINJA_S_STEALTH)
1640 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1650 * @brief 地震処理(サブルーチン) /
1651 * Induce an "earthquake" of the given radius at the given location.
1652 * @return 効力があった場合TRUEを返す
1656 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1660 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1662 * The player will take damage and "jump" into a safe grid if possible,
1663 * otherwise, he will "tunnel" through the rubble instantaneously.
1665 * Monsters will take damage, and "jump" into a safe grid if possible,
1666 * otherwise they will be "buried" in the rubble, disappearing from
1667 * the level in the same way that they do when genocided.
1669 * Note that thus the player and monsters (except eaters of walls and
1670 * passers through walls) will never occupy the same grid as a wall.
1671 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1672 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1673 * This has allowed massive simplification of the "monster" code.
1676 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1680 POSITION y, x, yy, xx, dy, dx;
1683 POSITION sy = 0, sx = 0;
1688 /* Prevent destruction of quest levels and town */
1689 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1694 /* Paranoia -- Enforce maximum range */
1697 /* Clear the "maximal blast" area */
1698 for (y = 0; y < 32; y++)
1700 for (x = 0; x < 32; x++)
1706 /* Check around the epicenter */
1707 for (dy = -r; dy <= r; dy++)
1709 for (dx = -r; dx <= r; dx++)
1711 /* Extract the location */
1715 /* Skip illegal grids */
1716 if (!in_bounds(yy, xx)) continue;
1718 /* Skip distant grids */
1719 if (distance(cy, cx, yy, xx) > r) continue;
1720 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1722 /* Lose room and vault / Lose light and knowledge */
1723 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1724 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1726 /* Skip the epicenter */
1727 if (!dx && !dy) continue;
1729 /* Skip most grids */
1730 if (randint0(100) < 85) continue;
1732 /* Damage this grid */
1733 map[16+yy-cy][16+xx-cx] = TRUE;
1735 /* Hack -- Take note of player damage */
1736 if (player_bold(yy, xx)) hurt = TRUE;
1740 /* First, affect the player (if necessary) */
1741 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1743 /* Check around the player */
1744 for (i = 0; i < 8; i++)
1746 /* Access the location */
1747 y = p_ptr->y + ddy_ddd[i];
1748 x = p_ptr->x + ddx_ddd[i];
1750 /* Skip non-empty grids */
1751 if (!cave_empty_bold(y, x)) continue;
1753 /* Important -- Skip "quake" grids */
1754 if (map[16+y-cy][16+x-cx]) continue;
1756 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1758 /* Count "safe" grids */
1761 /* Randomize choice */
1762 if (randint0(sn) > 0) continue;
1764 /* Save the safe location */
1768 /* Random message */
1769 switch (randint1(3))
1773 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1778 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1783 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1788 /* Hurt the player a lot */
1791 /* Message and damage */
1792 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1796 /* Destroy the grid, and push the player to safety */
1799 /* Calculate results */
1800 switch (randint1(3))
1804 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1810 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1811 damage = damroll(10, 4);
1812 (void)set_stun(p_ptr->stun + randint1(50));
1817 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1818 damage = damroll(10, 4);
1819 (void)set_stun(p_ptr->stun + randint1(50));
1824 /* Move the player to the safe location */
1825 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1828 /* Important -- no wall on player */
1829 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1837 GAME_TEXT m_name[MAX_NLEN];
1838 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
1840 /* Get the monster's real name */
1841 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1843 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1847 killer = _("地震", "an earthquake");
1850 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1854 /* Examine the quaked region */
1855 for (dy = -r; dy <= r; dy++)
1857 for (dx = -r; dx <= r; dx++)
1859 /* Extract the location */
1863 /* Skip unaffected grids */
1864 if (!map[16+yy-cy][16+xx-cx]) continue;
1865 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1867 if (g_ptr->m_idx == p_ptr->riding) continue;
1869 /* Process monsters */
1872 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
1873 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1875 /* Quest monsters */
1876 if (r_ptr->flags1 & RF1_QUESTOR)
1878 /* No wall on quest monsters */
1879 map[16+yy-cy][16+xx-cx] = FALSE;
1884 /* Most monsters cannot co-exist with rock */
1885 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1886 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1888 GAME_TEXT m_name[MAX_NLEN];
1890 /* Assume not safe */
1893 /* Monster can move to escape the wall */
1894 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1896 /* Look for safety */
1897 for (i = 0; i < 8; i++)
1899 y = yy + ddy_ddd[i];
1900 x = xx + ddx_ddd[i];
1902 /* Skip non-empty grids */
1903 if (!cave_empty_bold(y, x)) continue;
1905 /* Hack -- no safety on glyph of warding */
1906 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1907 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
1909 /* ... nor on the Pattern */
1910 if (pattern_tile(y, x)) continue;
1912 /* Important -- Skip "quake" grids */
1913 if (map[16+y-cy][16+x-cx]) continue;
1915 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1916 if (player_bold(y, x)) continue;
1918 /* Count "safe" grids */
1921 /* Randomize choice */
1922 if (randint0(sn) > 0) continue;
1924 /* Save the safe grid */
1929 monster_desc(m_name, m_ptr, 0);
1931 /* Scream in pain */
1932 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1934 /* Take damage from the quake */
1935 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1937 /* Monster is certainly awake */
1938 (void)set_monster_csleep(g_ptr->m_idx, 0);
1940 /* Apply damage directly */
1941 m_ptr->hp -= damage;
1943 /* Delete (not kill) "dead" monsters */
1946 if (!ignore_unview || is_seen(m_ptr))
1947 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1951 if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1953 char m2_name[MAX_NLEN];
1955 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1956 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1960 delete_monster(yy, xx);
1962 /* No longer safe */
1966 /* Hack -- Escape from the rock */
1969 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1971 /* Update the old location */
1972 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1974 /* Update the new location */
1975 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1977 /* Move the monster */
1981 update_monster(m_idx, TRUE);
1990 /* Lose monster light */
1993 /* Examine the quaked region */
1994 for (dy = -r; dy <= r; dy++)
1996 for (dx = -r; dx <= r; dx++)
1998 /* Extract the location */
2002 /* Skip unaffected grids */
2003 if (!map[16+yy-cy][16+xx-cx]) continue;
2005 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2007 /* Paranoia -- never affect player */
2008 /* if (player_bold(yy, xx)) continue; */
2010 /* Destroy location (if valid) */
2011 if (cave_valid_bold(yy, xx))
2013 delete_object(yy, xx);
2015 /* Wall (or floor) type */
2016 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2021 /* Create granite wall */
2022 cave_set_feat(yy, xx, feat_granite);
2028 /* Create quartz vein */
2029 cave_set_feat(yy, xx, feat_quartz_vein);
2035 /* Create magma vein */
2036 cave_set_feat(yy, xx, feat_magma_vein);
2043 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2049 /* Process "re-glowing" */
2050 for (dy = -r; dy <= r; dy++)
2052 for (dx = -r; dx <= r; dx++)
2054 /* Extract the location */
2058 /* Skip illegal grids */
2059 if (!in_bounds(yy, xx)) continue;
2061 /* Skip distant grids */
2062 if (distance(cy, cx, yy, xx) > r) continue;
2063 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
2065 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2066 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2072 for (ii = 0; ii < 9; ii++)
2074 yyy = yy + ddy_ddd[ii];
2075 xxx = xx + ddx_ddd[ii];
2076 if (!in_bounds2(yyy, xxx)) continue;
2077 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
2078 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2080 g_ptr->info |= CAVE_GLOW;
2088 /* Mega-Hack -- Forget the view and lite */
2089 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2090 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2091 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2093 if (p_ptr->special_defense & NINJA_S_STEALTH)
2095 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2103 * @brief 地震処理(プレイヤーの中心発動) /
2104 * Induce an "earthquake" of the given radius at the given location.
2105 * @return 効力があった場合TRUEを返す
2110 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2112 return earthquake_aux(cy, cx, r, 0);
2119 void discharge_minion(void)
2124 for (i = 1; i < m_max; i++)
2126 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2127 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2128 if (m_ptr->nickname) okay = FALSE;
2130 if (!okay || p_ptr->riding)
2132 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2135 for (i = 1; i < m_max; i++)
2138 monster_type *m_ptr = ¤t_floor_ptr->m_list[i];
2139 monster_race *r_ptr;
2141 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2142 r_ptr = &r_info[m_ptr->r_idx];
2144 /* Uniques resist discharging */
2145 if (r_ptr->flags1 & RF1_UNIQUE)
2147 GAME_TEXT m_name[MAX_NLEN];
2148 monster_desc(m_name, m_ptr, 0x00);
2149 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2150 delete_monster_idx(i);
2153 dam = m_ptr->maxhp / 2;
2154 if (dam > 100) dam = (dam - 100) / 2 + 100;
2155 if (dam > 400) dam = (dam - 400) / 2 + 400;
2156 if (dam > 800) dam = 800;
2157 project(i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
2158 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2160 if (record_named_pet && m_ptr->nickname)
2162 GAME_TEXT m_name[MAX_NLEN];
2164 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2165 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2168 delete_monster_idx(i);
2174 * @brief 部屋全体を照らすサブルーチン
2178 * This routine clears the entire "temp" set.
2179 * This routine will Perma-Lite all "temp" grids.
2180 * This routine is used (only) by "lite_room()"
2181 * Dark grids are illuminated.
2182 * Also, process all affected monsters.
2184 * SMART monsters always wake up when illuminated
2185 * NORMAL monsters wake up 1/4 the time when illuminated
2186 * STUPID monsters wake up 1/10 the time when illuminated
2189 static void cave_temp_room_lite(void)
2193 /* Clear them all */
2194 for (i = 0; i < tmp_pos.n; i++)
2196 POSITION y = tmp_pos.y[i];
2197 POSITION x = tmp_pos.x[i];
2199 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2201 /* No longer in the array */
2202 g_ptr->info &= ~(CAVE_TEMP);
2204 /* Update only non-CAVE_GLOW grids */
2205 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
2208 g_ptr->info |= (CAVE_GLOW);
2210 /* Process affected monsters */
2213 PERCENTAGE chance = 25;
2214 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2215 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2216 update_monster(g_ptr->m_idx, FALSE);
2218 /* Stupid monsters rarely wake up */
2219 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2221 /* Smart monsters always wake up */
2222 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2224 /* Sometimes monsters wake up */
2225 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2228 (void)set_monster_csleep(g_ptr->m_idx, 0);
2230 /* Notice the "waking up" */
2233 GAME_TEXT m_name[MAX_NLEN];
2234 monster_desc(m_name, m_ptr, 0);
2235 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2242 update_local_illumination(y, x);
2252 * @brief 部屋全体を暗くするサブルーチン
2256 * This routine clears the entire "temp" set.
2257 * This routine will "darken" all "temp" grids.
2258 * In addition, some of these grids will be "unmarked".
2259 * This routine is used (only) by "unlite_room()"
2260 * Also, process all affected monsters
2263 static void cave_temp_room_unlite(void)
2267 /* Clear them all */
2268 for (i = 0; i < tmp_pos.n; i++)
2270 POSITION y = tmp_pos.y[i];
2271 POSITION x = tmp_pos.x[i];
2274 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
2275 bool do_dark = !is_mirror_grid(g_ptr);
2277 /* No longer in the array */
2278 g_ptr->info &= ~(CAVE_TEMP);
2280 /* Darken the grid */
2283 if (current_floor_ptr->dun_level || !is_daytime())
2285 for (j = 0; j < 9; j++)
2287 POSITION by = y + ddy_ddd[j];
2288 POSITION bx = x + ddx_ddd[j];
2290 if (in_bounds2(by, bx))
2292 grid_type *cc_ptr = ¤t_floor_ptr->grid_array[by][bx];
2294 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2302 if (!do_dark) continue;
2305 g_ptr->info &= ~(CAVE_GLOW);
2307 /* Hack -- Forget "boring" grids */
2308 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
2310 /* Forget the grid */
2311 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
2315 /* Process affected monsters */
2318 update_monster(g_ptr->m_idx, FALSE);
2322 update_local_illumination(y, x);
2332 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2335 * @param pass_bold 地形条件を返す関数ポインタ
2338 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2345 for (i = 0; i < 16; i++)
2347 y = cy + ddy_cdd[i % 8];
2348 x = cx + ddx_cdd[i % 8];
2350 /* Found a wall, break the length */
2351 if (!pass_bold(y, x))
2353 /* Track best length */
2367 return (MAX(len, blen));
2371 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2374 * @param pass_bold 地形条件を返す関数ポインタ
2377 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2383 for (i = 0; i < 8; i++)
2385 y = cy + ddy_ddd[i];
2386 x = cx + ddx_ddd[i];
2388 if (!pass_bold(y, x)) c++;
2396 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2397 * @param y 部屋内のy座標1点
2398 * @param x 部屋内のx座標1点
2399 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2400 * @param pass_bold 地形条件を返す関数ポインタ
2403 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2406 g_ptr = ¤t_floor_ptr->grid_array[y][x];
2408 /* Avoid infinite recursion */
2409 if (g_ptr->info & (CAVE_TEMP)) return;
2411 /* Do not "leave" the current room */
2412 if (!(g_ptr->info & (CAVE_ROOM)))
2414 if (only_room) return;
2417 if (!in_bounds2(y, x)) return;
2419 /* Do not exceed the maximum spell range */
2420 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2422 /* Verify this grid */
2424 * The reason why it is ==6 instead of >5 is that 8 is impossible
2425 * due to the check for cave_bold above.
2426 * 7 lights dead-end corridors (you need to do this for the
2427 * checkboard interesting rooms, so that the boundary is lit
2429 * This leaves only a check for 6 bounding walls!
2431 if (in_bounds(y, x) && pass_bold(y, x) &&
2432 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2435 /* Paranoia -- verify space */
2436 if (tmp_pos.n == TEMP_MAX) return;
2438 /* Mark the grid as "seen" */
2439 g_ptr->info |= (CAVE_TEMP);
2441 /* Add it to the "seen" set */
2442 tmp_pos.y[tmp_pos.n] = y;
2443 tmp_pos.x[tmp_pos.n] = x;
2448 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2451 * @return 光を通すならばtrueを返す。
2453 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2455 return cave_los_bold(y, x);
2459 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2464 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2466 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2470 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2473 * @return 射線を通すならばtrueを返す。
2475 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2477 return cave_have_flag_bold(y, x, FF_PROJECT);
2482 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
2487 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2489 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2494 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2499 void lite_room(POSITION y1, POSITION x1)
2504 /* Add the initial grid */
2505 cave_temp_lite_room_aux(y1, x1);
2507 /* While grids are in the queue, add their neighbors */
2508 for (i = 0; i < tmp_pos.n; i++)
2510 x = tmp_pos.x[i], y = tmp_pos.y[i];
2512 /* Walls get lit, but stop light */
2513 if (!cave_pass_lite_bold(y, x)) continue;
2515 /* Spread adjacent */
2516 cave_temp_lite_room_aux(y + 1, x);
2517 cave_temp_lite_room_aux(y - 1, x);
2518 cave_temp_lite_room_aux(y, x + 1);
2519 cave_temp_lite_room_aux(y, x - 1);
2521 /* Spread diagonal */
2522 cave_temp_lite_room_aux(y + 1, x + 1);
2523 cave_temp_lite_room_aux(y - 1, x - 1);
2524 cave_temp_lite_room_aux(y - 1, x + 1);
2525 cave_temp_lite_room_aux(y + 1, x - 1);
2528 /* Now, lite them all up at once */
2529 cave_temp_room_lite();
2531 if (p_ptr->special_defense & NINJA_S_STEALTH)
2533 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2539 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2544 void unlite_room(POSITION y1, POSITION x1)
2549 /* Add the initial grid */
2550 cave_temp_unlite_room_aux(y1, x1);
2552 /* Spread, breadth first */
2553 for (i = 0; i < tmp_pos.n; i++)
2555 x = tmp_pos.x[i], y = tmp_pos.y[i];
2557 /* Walls get dark, but stop darkness */
2558 if (!cave_pass_dark_bold(y, x)) continue;
2560 /* Spread adjacent */
2561 cave_temp_unlite_room_aux(y + 1, x);
2562 cave_temp_unlite_room_aux(y - 1, x);
2563 cave_temp_unlite_room_aux(y, x + 1);
2564 cave_temp_unlite_room_aux(y, x - 1);
2566 /* Spread diagonal */
2567 cave_temp_unlite_room_aux(y + 1, x + 1);
2568 cave_temp_unlite_room_aux(y - 1, x - 1);
2569 cave_temp_unlite_room_aux(y - 1, x + 1);
2570 cave_temp_unlite_room_aux(y + 1, x - 1);
2573 /* Now, darken them all at once */
2574 cave_temp_room_unlite();
2577 bool starlight(bool magic)
2579 HIT_POINT num = damroll(5, 3);
2580 POSITION y = 0, x = 0;
2584 if (!p_ptr->blind && !magic)
2586 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
2588 for (k = 0; k < num; k++)
2594 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
2595 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
2596 if (!player_bold(y, x)) break;
2599 project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
2600 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
2608 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2611 * @return 作用が実際にあった場合TRUEを返す
2613 bool lite_area(HIT_POINT dam, POSITION rad)
2615 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2617 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
2619 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2625 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2628 /* Hook into the "project()" function */
2629 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2631 lite_room(p_ptr->y, p_ptr->x);
2639 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2642 * @return 作用が実際にあった場合TRUEを返す
2644 bool unlite_area(HIT_POINT dam, POSITION rad)
2646 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2648 /* Hack -- Message */
2651 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2654 /* Hook into the "project()" function */
2655 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2657 unlite_room(p_ptr->y, p_ptr->x);
2666 * @brief ボール系スペルの発動 / Cast a ball spell
2668 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2671 * @return 作用が実際にあった場合TRUEを返す
2674 * Stop if we hit a monster, act as a "ball"
2675 * Allow "target" mode to pass over monsters
2676 * Affect grids, objects, and monsters
2679 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2683 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2685 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2686 /* Use the given direction */
2687 tx = p_ptr->x + 99 * ddx[dir];
2688 ty = p_ptr->y + 99 * ddy[dir];
2690 /* Hack -- Use an actual "target" */
2691 if ((dir == 5) && target_okay())
2693 flg &= ~(PROJECT_STOP);
2698 /* Analyze the "dir" and the "target". Hurt items on floor. */
2699 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2703 * @brief ブレス系スペルの発動 / Cast a breath spell
2705 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2708 * @return 作用が実際にあった場合TRUEを返す
2711 * Stop if we hit a monster, act as a "ball"
2712 * Allow "target" mode to pass over monsters
2713 * Affect grids, objects, and monsters
2716 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2718 return fire_ball(typ, dir, dam, -rad);
2723 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2725 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2728 * @return 作用が実際にあった場合TRUEを返す
2731 * Stop if we hit a monster, act as a "ball"
2732 * Allow "target" mode to pass over monsters
2733 * Affect grids, objects, and monsters
2736 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2739 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2741 /* Use the given direction */
2742 tx = p_ptr->x + 99 * ddx[dir];
2743 ty = p_ptr->y + 99 * ddy[dir];
2745 /* Hack -- Use an actual "target" */
2746 if ((dir == 5) && target_okay())
2752 /* Analyze the "dir" and the "target". Hurt items on floor. */
2753 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2758 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2760 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2763 * @return 作用が実際にあった場合TRUEを返す
2766 * Stop if we hit a monster, act as a "ball"
2767 * Allow "target" mode to pass over monsters
2768 * Affect grids, objects, and monsters
2771 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2774 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2776 /* Use the given direction */
2777 tx = p_ptr->x + 99 * ddx[dir];
2778 ty = p_ptr->y + 99 * ddy[dir];
2780 /* Hack -- Use an actual "target" */
2781 if ((dir == 5) && target_okay())
2783 flg &= ~(PROJECT_STOP);
2788 /* Analyze the "dir" and the "target". Hurt items on floor. */
2789 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2794 * @brief メテオ系スペルの発動 / Cast a meteor spell
2795 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2801 * @return 作用が実際にあった場合TRUEを返す
2804 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2805 * player, or outside source, that starts out at an arbitrary location, and
2806 * leaving no trail from the "caster" to the target. This function is
2807 * especially useful for bombardments and similar. -LM-
2808 * Option to hurt the player.
2811 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2813 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2815 /* Analyze the "target" and the caster. */
2816 return (project(who, rad, y, x, dam, typ, flg, -1));
2821 * @brief ブラスト系スペルの発動 / Cast a blast spell
2823 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2828 * @return 作用が実際にあった場合TRUEを返す
2830 bool fire_blast(EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2834 POSITION ty, tx, y, x;
2837 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2842 /* Use the given direction */
2845 ly = ty = p_ptr->y + 20 * ddy[dir];
2846 lx = tx = p_ptr->x + 20 * ddx[dir];
2849 /* Use an actual "target" */
2850 else /* if (dir == 5) */
2855 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2856 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2859 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2862 for (i = 0; i < num; i++)
2866 /* Get targets for some bolts */
2867 y = rand_spread(ly, ld * dev / 20);
2868 x = rand_spread(lx, ld * dev / 20);
2870 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2873 /* Analyze the "dir" and the "target". */
2874 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2885 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2886 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2887 * @return 作用が実際にあった場合TRUEを返す
2889 bool teleport_swap(DIRECTION dir)
2893 monster_type* m_ptr;
2894 monster_race* r_ptr;
2896 if ((dir == 5) && target_okay())
2903 tx = p_ptr->x + ddx[dir];
2904 ty = p_ptr->y + ddy[dir];
2906 g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
2908 if (p_ptr->anti_tele)
2910 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2914 if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
2916 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2920 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2922 msg_print(_("失敗した。", "Failed to swap."));
2926 m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
2927 r_ptr = &r_info[m_ptr->r_idx];
2929 (void)set_monster_csleep(g_ptr->m_idx, 0);
2931 if (r_ptr->flagsr & RFR_RES_TELE)
2933 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2934 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2938 sound(SOUND_TELEPORT);
2940 /* Swap the player and monster */
2941 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2949 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2951 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2954 * @return 作用が実際にあった場合TRUEを返す
2956 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2960 /* Pass through the target if needed */
2961 flg |= (PROJECT_THRU);
2963 /* Use the given direction */
2964 tx = p_ptr->x + ddx[dir];
2965 ty = p_ptr->y + ddy[dir];
2967 /* Hack -- Use an actual "target" */
2968 if ((dir == 5) && target_okay())
2974 /* Analyze the "dir" and the "target", do NOT explode */
2975 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2980 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2982 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2984 * @return 作用が実際にあった場合TRUEを返す
2987 * Stop if we hit a monster, as a "bolt".
2988 * Affect monsters and grids (not objects).
2991 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2993 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2994 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2995 return (project_hook(typ, dir, dam, flg));
3000 * @brief ビーム系スペルの発動 / Cast a beam spell.
3002 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3004 * @return 作用が実際にあった場合TRUEを返す
3007 * Pass through monsters, as a "beam".
3008 * Affect monsters, grids and objects.
3011 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3013 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
3014 return (project_hook(typ, dir, dam, flg));
3019 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3020 * @param prob ビーム化する確率(%)
3022 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3024 * @return 作用が実際にあった場合TRUEを返す
3027 * Pass through monsters, as a "beam".
3028 * Affect monsters, grids and objects.
3031 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3033 if (randint0(100) < prob)
3035 return (fire_beam(typ, dir, dam));
3039 return (fire_bolt(typ, dir, dam));
3044 * @brief LITE_WEAK属性による光源ビーム処理
3045 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3047 * @return 作用が実際にあった場合TRUEを返す
3049 bool lite_line(DIRECTION dir, HIT_POINT dam)
3051 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3052 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3057 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3059 * @return 作用が実際にあった場合TRUEを返す
3061 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3063 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3064 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3069 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3071 * @return 作用が実際にあった場合TRUEを返す
3073 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3075 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3076 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3081 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3082 * @return 作用が実際にあった場合TRUEを返す
3084 bool wizard_lock(DIRECTION dir)
3086 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3087 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3092 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3093 * @return 作用が実際にあった場合TRUEを返す
3095 bool destroy_door(DIRECTION dir)
3097 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3098 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3103 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3104 * @return 作用が実際にあった場合TRUEを返す
3106 bool disarm_trap(DIRECTION dir)
3108 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3109 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3115 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3116 * @param plev プレイヤーレベル(効力はplev*200)
3117 * @return 作用が実際にあった場合TRUEを返す
3119 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3121 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3122 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3126 * @brief モンスター用テレポート処理
3127 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3128 * @param distance 移動距離
3129 * @return 作用が実際にあった場合TRUEを返す
3131 bool teleport_monster(DIRECTION dir, int distance)
3133 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3134 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3138 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3139 * @return 作用が実際にあった場合TRUEを返す
3141 bool door_creation(void)
3143 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3144 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3148 * @brief トラップ生成処理(起点から周囲1マス)
3151 * @return 作用が実際にあった場合TRUEを返す
3153 bool trap_creation(POSITION y, POSITION x)
3155 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3156 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3160 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3161 * @return 作用が実際にあった場合TRUEを返す
3163 bool tree_creation(void)
3165 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3166 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3170 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3171 * @return 作用が実際にあった場合TRUEを返す
3173 bool glyph_creation(void)
3175 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3176 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3180 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3181 * @return 作用が実際にあった場合TRUEを返す
3183 bool wall_stone(void)
3185 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3186 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3187 p_ptr->update |= (PU_FLOW);
3188 p_ptr->redraw |= (PR_MAP);
3193 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3194 * @return 作用が実際にあった場合TRUEを返す
3196 bool destroy_doors_touch(void)
3198 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3199 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3203 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3204 * @return 作用が実際にあった場合TRUEを返す
3206 bool disarm_traps_touch(void)
3208 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3209 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3213 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3214 * @return 作用が実際にあった場合TRUEを返す
3216 bool sleep_monsters_touch(void)
3218 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3219 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3224 * @brief 死者復活処理(起点より周囲5マス)
3225 * @param who 術者モンスターID(0ならばプレイヤー)
3228 * @return 作用が実際にあった場合TRUEを返す
3230 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3232 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3233 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3238 * @return 作用が実際にあった場合TRUEを返す
3240 void call_chaos(void)
3242 int Chaos_type, dummy, dir;
3243 PLAYER_LEVEL plev = p_ptr->lev;
3244 bool line_chaos = FALSE;
3246 int hurt_types[31] =
3248 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3249 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3250 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3251 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3252 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3253 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3254 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3255 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3258 Chaos_type = hurt_types[randint0(31)];
3259 if (one_in_(4)) line_chaos = TRUE;
3263 for (dummy = 1; dummy < 10; dummy++)
3268 fire_beam(Chaos_type, dummy, 150);
3270 fire_ball(Chaos_type, dummy, 150, 2);
3274 else if (one_in_(3))
3276 fire_ball(Chaos_type, 0, 500, 8);
3280 if (!get_aim_dir(&dir)) return;
3282 fire_beam(Chaos_type, dir, 250);
3284 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3289 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3290 * @param stop_ty 再帰処理停止フラグ
3292 * @return 作用が実際にあった場合TRUEを返す
3295 * rr9: Stop the nasty things when a Cyberdemon is summoned
3296 * or the player gets paralyzed.
3299 bool activate_ty_curse(bool stop_ty, int *count)
3302 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3306 switch (randint1(34))
3311 msg_print(_("地面が揺れた...", "The ground trembles..."));
3312 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3313 if (!one_in_(6)) break;
3318 HIT_POINT dam = damroll(10, 10);
3319 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3320 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3321 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3322 if (!one_in_(6)) break;
3327 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3328 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3329 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3330 if (!one_in_(6)) break;
3333 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3337 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3338 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3340 if (!one_in_(6)) break;
3341 case 1: case 2: case 3: case 16: case 17:
3342 aggravate_monsters(0);
3343 if (!one_in_(6)) break;
3344 case 4: case 5: case 6:
3345 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3346 if (!one_in_(6)) break;
3347 case 7: case 8: case 9: case 18:
3348 (*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');
3349 if (!one_in_(6)) break;
3350 case 10: case 11: case 12:
3351 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3352 lose_exp(p_ptr->exp / 16);
3353 if (!one_in_(6)) break;
3354 case 13: case 14: case 15: case 19: case 20:
3355 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3361 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3362 if (p_ptr->free_act)
3363 set_paralyzed(p_ptr->paralyzed + randint1(3));
3365 set_paralyzed(p_ptr->paralyzed + randint1(13));
3368 if (!one_in_(6)) break;
3369 case 21: case 22: case 23:
3370 (void)do_dec_stat(randint0(6));
3371 if (!one_in_(6)) break;
3373 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3375 if (!one_in_(6)) break;
3378 * Only summon Cyberdemons deep in the dungeon.
3380 if ((current_floor_ptr->dun_level > 65) && !stop_ty)
3382 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3386 if (!one_in_(6)) break;
3392 (void)do_dec_stat(i);
3400 while (one_in_(3) && !stop_ty);
3406 * @brief HI_SUMMON(上級召喚)処理発動
3409 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3410 * @return 作用が実際にあった場合TRUEを返す
3412 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3417 BIT_FLAGS mode = PM_ALLOW_GROUP;
3424 mode |= PM_FORCE_FRIENDLY;
3428 mode |= PM_FORCE_PET;
3433 if (!pet) mode |= PM_NO_PET;
3435 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
3437 for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
3439 switch (randint1(25) + (current_floor_ptr->dun_level / 20))
3442 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
3445 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
3448 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
3451 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
3454 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
3457 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
3460 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
3463 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
3467 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
3471 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
3474 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3475 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
3478 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3479 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
3482 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
3485 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3486 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
3494 * @brief 周辺破壊効果(プレイヤー中心)
3495 * @return 作用が実際にあった場合TRUEを返す
3497 void wall_breaker(void)
3500 POSITION y = 0, x = 0;
3501 int attempts = 1000;
3503 if (randint1(80 + p_ptr->lev) < 70)
3507 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3509 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3511 if (!player_bold(y, x)) break;
3514 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3515 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3517 else if (randint1(100) > 30)
3519 earthquake(p_ptr->y, p_ptr->x, 1);
3523 int num = damroll(5, 3);
3525 for (i = 0; i < num; i++)
3529 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3531 if (!player_bold(y, x)) break;
3534 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3535 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3542 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3544 * @return 作用が実際にあった場合TRUEを返す
3546 bool confuse_monsters(HIT_POINT dam)
3548 return (project_all_los(GF_OLD_CONF, dam));
3553 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3555 * @return 作用が実際にあった場合TRUEを返す
3557 bool charm_monsters(HIT_POINT dam)
3559 return (project_all_los(GF_CHARM, dam));
3564 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3566 * @return 作用が実際にあった場合TRUEを返す
3568 bool charm_animals(HIT_POINT dam)
3570 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3575 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3577 * @return 作用が実際にあった場合TRUEを返す
3579 bool stun_monsters(HIT_POINT dam)
3581 return (project_all_los(GF_STUN, dam));
3586 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3588 * @return 作用が実際にあった場合TRUEを返す
3590 bool stasis_monsters(HIT_POINT dam)
3592 return (project_all_los(GF_STASIS, dam));
3597 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3599 * @return 作用が実際にあった場合TRUEを返す
3601 bool mindblast_monsters(HIT_POINT dam)
3603 return (project_all_los(GF_PSI, dam));
3608 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3609 * @param dist 効力(距離)
3610 * @return 作用が実際にあった場合TRUEを返す
3612 bool banish_monsters(int dist)
3614 return (project_all_los(GF_AWAY_ALL, dist));
3619 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3621 * @return 作用が実際にあった場合TRUEを返す
3623 bool turn_evil(HIT_POINT dam)
3625 return (project_all_los(GF_TURN_EVIL, dam));
3630 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3632 * @return 作用が実際にあった場合TRUEを返す
3634 bool turn_monsters(HIT_POINT dam)
3636 return (project_all_los(GF_TURN_ALL, dam));
3641 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3642 * @return 作用が実際にあった場合TRUEを返す
3644 bool deathray_monsters(void)
3646 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3650 * @brief チャーム・モンスター(1体)
3651 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3653 * @return 作用が実際にあった場合TRUEを返す
3655 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3657 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3658 return (project_hook(GF_CHARM, dir, plev, flg));
3662 * @brief アンデッド支配(1体)
3663 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3665 * @return 作用が実際にあった場合TRUEを返す
3667 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3669 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3670 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3675 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3677 * @return 作用が実際にあった場合TRUEを返す
3679 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3681 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3682 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3687 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3689 * @return 作用が実際にあった場合TRUEを返す
3691 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3693 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3694 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3700 * @param success 判定成功上の処理ならばTRUE
3701 * @return 作用が実際にあった場合TRUEを返す
3703 bool kawarimi(bool success)
3706 object_type *q_ptr = &forge;
3709 if (p_ptr->is_dead) return FALSE;
3710 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3711 if (randint0(200) < p_ptr->stun) return FALSE;
3713 if (!success && one_in_(3))
3715 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3716 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3717 p_ptr->redraw |= (PR_STATUS);
3724 teleport_player(10 + randint1(90), 0L);
3726 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3728 q_ptr->pval = MON_NINJA;
3729 (void)drop_near(q_ptr, -1, y, x);
3731 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3732 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3734 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3735 p_ptr->redraw |= (PR_STATUS);
3743 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3744 * @param mdeath 目標モンスターが死亡したかを返す
3745 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3747 bool rush_attack(bool *mdeath)
3754 bool tmp_mdeath = FALSE;
3757 if (mdeath) *mdeath = FALSE;
3760 if (!get_aim_dir(&dir)) return FALSE;
3762 /* Use the given direction */
3763 tx = p_ptr->x + project_length * ddx[dir];
3764 ty = p_ptr->y + project_length * ddy[dir];
3766 /* Hack -- Use an actual "target" */
3767 if ((dir == 5) && target_okay())
3773 if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
3775 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3778 /* No need to move */
3779 if (!path_n) return TRUE;
3781 /* Use ty and tx as to-move point */
3785 /* Project along the path */
3786 for (i = 0; i < path_n; i++)
3788 monster_type *m_ptr;
3790 int ny = GRID_Y(path_g[i]);
3791 int nx = GRID_X(path_g[i]);
3793 if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
3798 /* Go to next grid */
3802 if (!current_floor_ptr->grid_array[ny][nx].m_idx)
3806 msg_print(_("失敗!", "Failed!"));
3810 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3817 /* Move player before updating the monster */
3818 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3819 update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3821 /* Found a monster */
3822 m_ptr = ¤t_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
3824 if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
3827 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3829 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3832 else if (!player_bold(ty, tx))
3834 /* Hold the monster name */
3835 GAME_TEXT m_name[MAX_NLEN];
3837 /* Get the monster name (BEFORE polymorphing) */
3838 monster_desc(m_name, m_ptr, 0);
3839 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3842 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3844 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
3849 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3851 if (mdeath) *mdeath = tmp_mdeath;
3857 * @brief 全鏡の消去 / Remove all mirrors in this floor
3858 * @param explode 爆発処理を伴うならばTRUE
3861 void remove_all_mirrors(bool explode)
3865 for (x = 0; x < current_floor_ptr->width; x++)
3867 for (y = 0; y < current_floor_ptr->height; y++)
3869 if (is_mirror_grid(¤t_floor_ptr->grid_array[y][x]))
3871 remove_mirror(y, x);
3873 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
3874 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3881 * @brief 『一つの指輪』の効果処理 /
3882 * Hack -- activate the ring of power
3883 * @param dir 発動の方向ID
3886 void ring_of_power(DIRECTION dir)
3888 /* Pick a random effect */
3889 switch (randint1(10))
3894 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3897 /* Decrease all stats (permanently) */
3898 (void)dec_stat(A_STR, 50, TRUE);
3899 (void)dec_stat(A_INT, 50, TRUE);
3900 (void)dec_stat(A_WIS, 50, TRUE);
3901 (void)dec_stat(A_DEX, 50, TRUE);
3902 (void)dec_stat(A_CON, 50, TRUE);
3903 (void)dec_stat(A_CHR, 50, TRUE);
3905 /* Lose some experience (permanently) */
3906 p_ptr->exp -= (p_ptr->exp / 4);
3907 p_ptr->max_exp -= (p_ptr->exp / 4);
3915 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3916 dispel_monsters(1000);
3924 fire_ball(GF_MANA, dir, 600, 3);
3933 fire_bolt(GF_MANA, dir, 500);
3940 * @brief 運命の輪、並びにカオス的な効果の発動
3941 * @param spell ランダムな効果を選択するための基準ID
3944 void wild_magic(int spell)
3947 int type = SUMMON_MOLD + randint0(6);
3949 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3950 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3952 switch (randint1(spell) + randint1(8) + 1)
3957 teleport_player(10, TELEPORT_PASSIVE);
3962 teleport_player(100, TELEPORT_PASSIVE);
3966 teleport_player(200, TELEPORT_PASSIVE);
3976 lite_area(damroll(2, 3), 2);
3979 destroy_doors_touch();
3984 sleep_monsters_touch();
3988 trap_creation(p_ptr->y, p_ptr->x);
3997 aggravate_monsters(0);
4000 earthquake(p_ptr->y, p_ptr->x, 5);
4004 (void)gain_mutation(p_ptr, 0);
4008 apply_disenchant(1);
4014 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4021 while (counter++ < 8)
4023 (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');
4028 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4031 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4036 (void)activate_ty_curse(FALSE, &count);
4045 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4046 * / Drop 10+1d10 meteor ball at random places near the player
4051 void cast_meteor(HIT_POINT dam, POSITION rad)
4054 int b = 10 + randint1(10);
4056 for (i = 0; i < b; i++)
4058 POSITION y = 0, x = 0;
4061 for (count = 0; count <= 20; count++)
4065 x = p_ptr->x - 8 + randint0(17);
4066 y = p_ptr->y - 8 + randint0(17);
4068 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4069 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4071 /* Approximate distance */
4072 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4074 if (d >= 9) continue;
4076 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4077 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4079 /* Valid position */
4083 if (count > 20) continue;
4085 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4091 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4094 * @return ターゲットを指定し、実行したならばTRUEを返す。
4096 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4098 POSITION x, y, tx, ty;
4102 int b = 10 + randint1(10);
4104 if (!get_aim_dir(&dir)) return FALSE;
4106 /* Use the given direction */
4107 tx = p_ptr->x + 99 * ddx[dir];
4108 ty = p_ptr->y + 99 * ddy[dir];
4110 /* Hack -- Use an actual "target" */
4111 if ((dir == 5) && target_okay())
4122 /* Hack -- Stop at the target */
4123 if ((y == ty) && (x == tx)) break;
4127 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4129 /* Stop at maximum range */
4130 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4132 /* Stopped by walls/doors */
4133 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4135 /* Stopped by monsters */
4136 if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
4138 /* Save the new location */
4145 for (i = 0; i < b; i++)
4147 int count = 20, d = 0;
4153 x = tx - 5 + randint0(11);
4154 y = ty - 5 + randint0(11);
4156 dx = (tx > x) ? (tx - x) : (x - tx);
4157 dy = (ty > y) ? (ty - y) : (y - ty);
4159 /* Approximate distance */
4160 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4161 /* Within the radius */
4165 if (count < 0) continue;
4167 /* Cannot penetrate perm walls */
4168 if (!in_bounds(y, x) ||
4169 cave_stop_disintegration(y, x) ||
4170 !in_disintegration_range(ty, tx, y, x))
4173 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4180 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4184 * This spell should become more useful (more controlled) as the\n
4185 * player gains experience levels. Thus, add 1/5 of the player's\n
4186 * level to the die roll. This eliminates the worst effects later on,\n
4187 * while keeping the results quite random. It also allows some potent\n
4188 * effects only at high level.
4190 void cast_wonder(DIRECTION dir)
4192 PLAYER_LEVEL plev = p_ptr->lev;
4193 int die = randint1(100) + plev / 5;
4194 int vir = virtue_number(V_CHANCE);
4198 if (p_ptr->virtues[vir - 1] > 0)
4200 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4204 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4209 chg_virtue(V_CHANCE, 1);
4213 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4216 if (die < 8) clone_monster(dir);
4217 else if (die < 14) speed_monster(dir, plev);
4218 else if (die < 26) heal_monster(dir, damroll(4, 6));
4219 else if (die < 31) poly_monster(dir, plev);
4221 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4222 damroll(3 + ((plev - 1) / 5), 4));
4223 else if (die < 41) confuse_monster(dir, plev);
4224 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4225 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4227 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4228 damroll(3 + ((plev - 5) / 4), 8));
4230 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4231 damroll(5 + ((plev - 5) / 4), 8));
4233 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4234 damroll(6 + ((plev - 5) / 4), 8));
4236 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4237 damroll(8 + ((plev - 5) / 4), 8));
4238 else if (die < 76) hypodynamic_bolt(dir, 75);
4239 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4240 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4241 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4242 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4243 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4246 earthquake(p_ptr->y, p_ptr->x, 12);
4250 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4254 symbol_genocide(plev + 50, TRUE);
4256 else if (die < 110) dispel_monsters(120);
4259 dispel_monsters(150);
4260 slow_monsters(plev);
4261 sleep_monsters(plev);
4268 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4272 void cast_invoke_spirits(DIRECTION dir)
4274 PLAYER_LEVEL plev = p_ptr->lev;
4275 int die = randint1(100) + plev / 5;
4276 int vir = virtue_number(V_CHANCE);
4280 if (p_ptr->virtues[vir - 1] > 0)
4282 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4286 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4290 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4292 chg_virtue(V_CHANCE, 1);
4296 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4301 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4302 "Oh no! Mouldering forms rise from the earth around you!"));
4304 (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');
4305 chg_virtue(V_UNLIFE, 1);
4309 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4311 set_afraid(p_ptr->afraid + randint1(4) + 4);
4315 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4316 "Your head is invaded by a horde of gibbering spectral voices..."));
4318 set_confused(p_ptr->confused + randint1(4) + 4);
4322 poly_monster(dir, plev);
4326 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4327 damroll(3 + ((plev - 1) / 5), 4));
4331 confuse_monster(dir, plev);
4335 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4339 (void)lite_line(dir, damroll(6, 8));
4343 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4344 damroll(3 + ((plev - 5) / 4), 8));
4348 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4349 damroll(5 + ((plev - 5) / 4), 8));
4353 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4354 damroll(6 + ((plev - 5) / 4), 8));
4358 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4359 damroll(8 + ((plev - 5) / 4), 8));
4363 hypodynamic_bolt(dir, 75);
4367 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4371 fire_ball(GF_ACID, dir, 40 + plev, 2);
4375 fire_ball(GF_ICE, dir, 70 + plev, 3);
4379 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4383 hypodynamic_bolt(dir, 100 + plev);
4387 earthquake(p_ptr->y, p_ptr->x, 12);
4391 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4395 symbol_genocide(plev + 50, TRUE);
4399 dispel_monsters(120);
4403 dispel_monsters(150);
4404 slow_monsters(plev);
4405 sleep_monsters(plev);
4411 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4412 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4417 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4420 void cast_shuffle(void)
4422 PLAYER_LEVEL plev = p_ptr->lev;
4425 int vir = virtue_number(V_CHANCE);
4428 /* Card sharks and high mages get a level bonus */
4429 if ((p_ptr->pclass == CLASS_ROGUE) ||
4430 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4431 (p_ptr->pclass == CLASS_SORCERER))
4432 die = (randint1(110)) + plev / 5;
4434 die = randint1(120);
4439 if (p_ptr->virtues[vir - 1] > 0)
4441 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4445 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4449 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4452 chg_virtue(V_CHANCE, 1);
4456 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4458 for (i = 0; i < randint1(3); i++)
4459 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4463 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4464 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');
4469 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4470 activate_ty_curse(FALSE, &count);
4474 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4475 aggravate_monsters(0);
4479 msg_print(_("《愚者》だ。", "It's the Fool."));
4485 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4486 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);
4490 msg_print(_("《月》だ。", "It's the Moon."));
4495 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4496 wild_magic(randint0(32));
4500 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4501 teleport_player(10, TELEPORT_PASSIVE);
4505 msg_print(_("《正義》だ。", "It's Justice."));
4506 set_blessed(p_ptr->lev, FALSE);
4510 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4511 teleport_player(100, TELEPORT_PASSIVE);
4515 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4516 teleport_player(200, TELEPORT_PASSIVE);
4520 msg_print(_("《塔》だ。", "It's the Tower."));
4525 msg_print(_("《節制》だ。", "It's Temperance."));
4526 sleep_monsters_touch();
4530 msg_print(_("《塔》だ。", "It's the Tower."));
4532 earthquake(p_ptr->y, p_ptr->x, 5);
4536 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4537 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
4541 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4542 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
4546 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4547 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4551 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4552 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4556 msg_print(_("《恋人》だ。", "It's the Lovers."));
4558 if (get_aim_dir(&dir))
4559 charm_monster(dir, MIN(p_ptr->lev, 20));
4563 msg_print(_("《隠者》だ。", "It's the Hermit."));
4568 msg_print(_("《審判》だ。", "It's the Judgement."));
4569 roll_hitdice(p_ptr, 0L);
4570 lose_all_mutations();
4574 msg_print(_("《太陽》だ。", "It's the Sun."));
4575 chg_virtue(V_KNOWLEDGE, 1);
4576 chg_virtue(V_ENLIGHTEN, 1);
4581 msg_print(_("《世界》だ。", "It's the World."));
4582 if (p_ptr->exp < PY_MAX_EXP)
4584 s32b ee = (p_ptr->exp / 25) + 1;
4585 if (ee > 5000) ee = 5000;
4586 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4593 * @brief 口を使う継続的な処理を中断する
4596 void stop_mouth(void)
4598 if (music_singing_any()) stop_singing(p_ptr);
4599 if (hex_spelling_any()) stop_hex_spell_all();
4603 bool_hack vampirism(void)
4610 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4612 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4616 /* Only works on adjacent monsters */
4617 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4618 y = p_ptr->y + ddy[dir];
4619 x = p_ptr->x + ddx[dir];
4620 g_ptr = ¤t_floor_ptr->grid_array[y][x];
4624 if (!(g_ptr->m_idx))
4626 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4630 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4632 dummy = p_ptr->lev * 2;
4634 if (hypodynamic_bolt(dir, dummy))
4636 if (p_ptr->food < PY_FOOD_FULL)
4637 /* No heal if we are "full" */
4638 (void)hp_player(dummy);
4640 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4642 /* Gain nutritional sustenance: 150/hp drained */
4643 /* A Food ration gives 5000 food points (by contrast) */
4644 /* Don't ever get more than "Full" this way */
4645 /* But if we ARE Gorged, it won't cure us */
4646 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4647 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4648 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4651 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4655 bool panic_hit(void)
4660 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4661 y = p_ptr->y + ddy[dir];
4662 x = p_ptr->x + ddx[dir];
4663 if (current_floor_ptr->grid_array[y][x].m_idx)
4666 if (randint0(p_ptr->skill_dis) < 7)
4667 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4669 teleport_player(30, 0L);
4674 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4682 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4685 * currently this function allows pseudo-id of any object,
4686 * including silly ones like potions & scrolls, which always
4687 * get '{average}'. This should be changed, either to stop such
4688 * items from being pseudo-id'd, or to allow psychometry to
4689 * detect whether the unidentified potion/scroll/etc is
4690 * good (Cure Light Wounds, Restore Strength, etc) or
4691 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4693 bool psychometry(void)
4697 GAME_TEXT o_name[MAX_NLEN];
4702 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4703 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4705 o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
4706 if (!o_ptr) return (FALSE);
4708 /* It is fully known, no information needed */
4709 if (object_is_known(o_ptr))
4711 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4715 /* Check for a feeling */
4716 feel = value_check_aux1(o_ptr);
4718 /* Get an object description */
4719 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4721 /* Skip non-feelings */
4724 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4729 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4731 msg_format("You feel that the %s %s %s...",
4732 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4736 o_ptr->ident |= (IDENT_SENSE);
4737 o_ptr->feeling = feel;
4738 o_ptr->marked |= OM_TOUCHED;
4740 p_ptr->update |= (PU_COMBINE | PU_REORDER);
4741 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4743 /* Valid "tval" codes */
4744 switch (o_ptr->tval)
4772 /* Auto-inscription/destroy */
4773 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4775 /* Something happened */
4780 bool draconian_breath(player_type *creature_ptr)
4783 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4784 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4786 if (!get_aim_dir(&dir)) return FALSE;
4788 if (randint1(100) < creature_ptr->lev)
4790 switch (creature_ptr->pclass)
4793 case CLASS_BERSERKER:
4796 case CLASS_IMITATOR:
4802 Type_desc = _("エレメント", "the elements");
4807 Type_desc = _("破片", "shards");
4811 case CLASS_WARRIOR_MAGE:
4812 case CLASS_HIGH_MAGE:
4813 case CLASS_SORCERER:
4814 case CLASS_MAGIC_EATER:
4815 case CLASS_RED_MAGE:
4816 case CLASS_BLUE_MAGE:
4817 case CLASS_MIRROR_MASTER:
4821 Type_desc = _("魔力", "mana");
4825 Type = GF_DISENCHANT;
4826 Type_desc = _("劣化", "disenchantment");
4829 case CLASS_CHAOS_WARRIOR:
4832 Type = GF_CONFUSION;
4833 Type_desc = _("混乱", "confusion");
4838 Type_desc = _("カオス", "chaos");
4843 case CLASS_FORCETRAINER:
4846 Type = GF_CONFUSION;
4847 Type_desc = _("混乱", "confusion");
4852 Type_desc = _("轟音", "sound");
4855 case CLASS_MINDCRAFTER:
4858 Type = GF_CONFUSION;
4859 Type_desc = _("混乱", "confusion");
4864 Type_desc = _("精神エネルギー", "mental energy");
4871 Type = GF_HELL_FIRE;
4872 Type_desc = _("地獄の劫火", "hellfire");
4876 Type = GF_HOLY_FIRE;
4877 Type_desc = _("聖なる炎", "holy fire");
4885 Type_desc = _("暗黒", "darkness");
4890 Type_desc = _("毒", "poison");
4897 Type_desc = _("轟音", "sound");
4901 Type = GF_CONFUSION;
4902 Type_desc = _("混乱", "confusion");
4909 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4911 fire_breath(Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4915 bool android_inside_weapon(player_type *creature_ptr)
4918 if (!get_aim_dir(&dir)) return FALSE;
4919 if (creature_ptr->lev < 10)
4921 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4922 fire_bolt(GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4924 else if (creature_ptr->lev < 25)
4926 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4927 fire_bolt(GF_MISSILE, dir, creature_ptr->lev);
4929 else if (creature_ptr->lev < 35)
4931 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4932 fire_ball(GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4934 else if (creature_ptr->lev < 45)
4936 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4937 fire_beam(GF_MISSILE, dir, creature_ptr->lev * 2);
4941 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4942 fire_rocket(GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4947 bool create_ration(player_type *crature_ptr)
4953 /* Create the food ration */
4954 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4956 /* Drop the object from heaven */
4957 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4958 msg_print(_("食事を料理して作った。", "You cook some food."));
4962 void hayagake(player_type *creature_ptr)
4964 if (creature_ptr->action == ACTION_HAYAGAKE)
4966 set_action(ACTION_NONE);
4970 grid_type *g_ptr = ¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4971 feature_type *f_ptr = &f_info[g_ptr->feat];
4973 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4974 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4976 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4980 set_action(ACTION_HAYAGAKE);
4983 creature_ptr->energy_use = 0;
4986 bool double_attack(player_type *creature_ptr)
4991 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4992 y = creature_ptr->y + ddy[dir];
4993 x = creature_ptr->x + ddx[dir];
4994 if (current_floor_ptr->grid_array[y][x].m_idx)
4997 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4998 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
5000 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
5001 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
5003 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
5004 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
5007 if (current_floor_ptr->grid_array[y][x].m_idx)
5012 creature_ptr->energy_need += ENERGY_NEED();
5016 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
5022 bool comvert_hp_to_mp(player_type *creature_ptr)
5024 int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
5027 creature_ptr->csp += gain_sp;
5028 if (creature_ptr->csp > creature_ptr->msp)
5030 creature_ptr->csp = creature_ptr->msp;
5031 creature_ptr->csp_frac = 0;
5036 msg_print(_("変換に失敗した。", "You failed to convert."));
5038 creature_ptr->redraw |= (PR_HP | PR_MANA);
5042 bool comvert_mp_to_hp(player_type *creature_ptr)
5044 if (creature_ptr->csp >= creature_ptr->lev / 5)
5046 creature_ptr->csp -= creature_ptr->lev / 5;
5047 hp_player(creature_ptr->lev);
5051 msg_print(_("変換に失敗した。", "You failed to convert."));
5053 creature_ptr->redraw |= (PR_HP | PR_MANA);
5057 bool demonic_breath(player_type *creature_ptr)
5060 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
5061 if (!get_aim_dir(&dir)) return FALSE;
5063 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
5064 fire_breath(type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
5068 bool mirror_concentration(player_type *creature_ptr)
5072 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5075 if (is_mirror_grid(¤t_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
5077 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5079 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
5080 if (creature_ptr->csp >= creature_ptr->msp)
5082 creature_ptr->csp = creature_ptr->msp;
5083 creature_ptr->csp_frac = 0;
5085 creature_ptr->redraw |= (PR_MANA);
5089 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
5094 bool sword_dancing(player_type *creature_ptr)
5097 POSITION y = 0, x = 0;
5101 for (i = 0; i < 6; i++)
5104 y = creature_ptr->y + ddy_ddd[dir];
5105 x = creature_ptr->x + ddx_ddd[dir];
5106 g_ptr = ¤t_floor_ptr->grid_array[y][x];
5108 /* Hack -- attack monsters */
5113 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
5119 bool confusing_light(player_type *creature_ptr)
5121 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
5122 slow_monsters(creature_ptr->lev);
5123 stun_monsters(creature_ptr->lev * 4);
5124 confuse_monsters(creature_ptr->lev * 4);
5125 turn_monsters(creature_ptr->lev * 4);
5126 stasis_monsters(creature_ptr->lev * 4);
5130 bool rodeo(player_type *creature_ptr)
5132 GAME_TEXT m_name[MAX_NLEN];
5133 monster_type *m_ptr;
5134 monster_race *r_ptr;
5137 if (creature_ptr->riding)
5139 msg_print(_("今は乗馬中だ。", "You ARE riding."));
5142 if (!do_riding(TRUE)) return TRUE;
5144 m_ptr = ¤t_floor_ptr->m_list[creature_ptr->riding];
5145 r_ptr = &r_info[m_ptr->r_idx];
5146 monster_desc(m_name, m_ptr, 0);
5147 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
5149 if (is_pet(m_ptr)) return TRUE;
5151 rlev = r_ptr->level;
5153 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
5154 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
5155 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
5156 && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
5157 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
5158 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
5160 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
5165 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
5169 /* 落馬処理に失敗してもとにかく乗馬解除 */
5170 creature_ptr->riding = 0;
5175 bool clear_mind(player_type *creature_ptr)
5179 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5182 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
5184 creature_ptr->csp += (3 + creature_ptr->lev / 20);
5185 if (creature_ptr->csp >= creature_ptr->msp)
5187 creature_ptr->csp = creature_ptr->msp;
5188 creature_ptr->csp_frac = 0;
5190 creature_ptr->redraw |= (PR_MANA);
5194 bool concentration(player_type *creature_ptr)
5196 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
5200 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
5203 if (creature_ptr->special_defense & KATA_MASK)
5205 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
5208 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
5210 creature_ptr->csp += creature_ptr->msp / 2;
5211 if (creature_ptr->csp >= max_csp)
5213 creature_ptr->csp = max_csp;
5214 creature_ptr->csp_frac = 0;
5216 creature_ptr->redraw |= (PR_MANA);