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.
17 #include "monsterrace-hook.h"
22 * @brief プレイヤー周辺の地形を感知する
25 * @param known 地形から危険フラグを外すならTRUE
26 * @return 効力があった場合TRUEを返す
28 static bool detect_feat_flag(POSITION range, int flag, bool known)
34 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
36 /* Scan the current panel */
37 for (y = 1; y < cur_hgt - 1; y++)
39 for (x = 1; x <= cur_wid - 1; x++)
41 int dist = distance(p_ptr->y, p_ptr->x, y, x);
42 if (dist > range) continue;
48 /* Mark as detected */
49 if (dist <= range && known)
51 if (dist <= range - 1) c_ptr->info |= (CAVE_IN_DETECT);
53 c_ptr->info &= ~(CAVE_UNSAFE);
60 if (cave_have_flag_grid(c_ptr, flag))
65 /* Hack -- Memorize */
66 c_ptr->info |= (CAVE_MARK);
79 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
81 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
82 * @return 効力があった場合TRUEを返す
84 bool detect_traps(POSITION range, bool known)
86 bool detect = detect_feat_flag(range, FF_TRAP, known);
88 if (known) p_ptr->dtrap = TRUE;
90 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
93 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
100 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
102 * @return 効力があった場合TRUEを返す
104 bool detect_doors(POSITION range)
106 bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
108 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
111 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
118 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
120 * @return 効力があった場合TRUEを返す
122 bool detect_stairs(POSITION range)
124 bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
126 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
129 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
136 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
138 * @return 効力があった場合TRUEを返す
140 bool detect_treasure(POSITION range)
142 bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
144 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
147 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
154 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
156 * @return 効力があった場合TRUEを返す
158 bool detect_objects_gold(POSITION range)
162 POSITION range2 = range;
166 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
169 for (i = 1; i < o_max; i++)
171 object_type *o_ptr = &o_list[i];
173 /* Skip dead objects */
174 if (!o_ptr->k_idx) continue;
176 /* Skip held objects */
177 if (o_ptr->held_m_idx) continue;
182 /* Only detect nearby objects */
183 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
185 /* Detect "gold" objects */
186 if (o_ptr->tval == TV_GOLD)
188 o_ptr->marked |= OM_FOUND;
194 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
197 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
200 if (detect_monsters_string(range, "$"))
209 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
211 * @return 効力があった場合TRUEを返す
213 bool detect_objects_normal(POSITION range)
217 POSITION range2 = range;
221 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range2 /= 3;
224 for (i = 1; i < o_max; i++)
226 object_type *o_ptr = &o_list[i];
228 /* Skip dead objects */
229 if (!o_ptr->k_idx) continue;
231 /* Skip held objects */
232 if (o_ptr->held_m_idx) continue;
237 /* Only detect nearby objects */
238 if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
240 /* Detect "real" objects */
241 if (o_ptr->tval != TV_GOLD)
243 o_ptr->marked |= OM_FOUND;
249 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
252 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
255 if (detect_monsters_string(range, "!=?|/`"))
264 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
266 * @return 効力があった場合TRUEを返す
269 * This will light up all spaces with "magic" items, including artifacts,
270 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
271 * and "enchanted" items of the "good" variety.
273 * It can probably be argued that this function is now too powerful.
276 bool detect_objects_magic(POSITION range)
278 OBJECT_TYPE_VALUE tv;
284 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
286 /* Scan all objects */
287 for (i = 1; i < o_max; i++)
289 object_type *o_ptr = &o_list[i];
291 /* Skip dead objects */
292 if (!o_ptr->k_idx) continue;
294 /* Skip held objects */
295 if (o_ptr->held_m_idx) continue;
300 /* Only detect nearby objects */
301 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
303 /* Examine the tval */
306 /* Artifacts, misc magic items, or enchanted wearables */
307 if (object_is_artifact(o_ptr) ||
308 object_is_ego(o_ptr) ||
309 (tv == TV_WHISTLE) ||
317 (tv == TV_LIFE_BOOK) ||
318 (tv == TV_SORCERY_BOOK) ||
319 (tv == TV_NATURE_BOOK) ||
320 (tv == TV_CHAOS_BOOK) ||
321 (tv == TV_DEATH_BOOK) ||
322 (tv == TV_TRUMP_BOOK) ||
323 (tv == TV_ARCANE_BOOK) ||
324 (tv == TV_CRAFT_BOOK) ||
325 (tv == TV_DAEMON_BOOK) ||
326 (tv == TV_CRUSADE_BOOK) ||
327 (tv == TV_MUSIC_BOOK) ||
328 (tv == TV_HISSATSU_BOOK) ||
329 (tv == TV_HEX_BOOK) ||
330 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
332 /* Memorize the item */
333 o_ptr->marked |= OM_FOUND;
340 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
349 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
351 * @return 効力があった場合TRUEを返す
353 bool detect_monsters_normal(POSITION range)
359 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
361 for (i = 1; i < m_max; i++)
363 monster_type *m_ptr = &m_list[i];
364 monster_race *r_ptr = &r_info[m_ptr->r_idx];
366 /* Skip dead monsters */
367 if (!m_ptr->r_idx) continue;
372 /* Only detect nearby monsters */
373 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
375 /* Detect all non-invisible monsters */
376 if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
378 /* Repair visibility later */
379 repair_monsters = TRUE;
381 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
382 update_monster(i, FALSE);
387 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
390 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
397 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
399 * @return 効力があった場合TRUEを返す
401 bool detect_monsters_invis(POSITION range)
407 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
409 for (i = 1; i < m_max; i++)
411 monster_type *m_ptr = &m_list[i];
412 monster_race *r_ptr = &r_info[m_ptr->r_idx];
414 /* Skip dead monsters */
415 if (!m_ptr->r_idx) continue;
420 /* Only detect nearby monsters */
421 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
423 /* Detect invisible monsters */
424 if (r_ptr->flags2 & RF2_INVISIBLE)
426 /* Update monster recall window */
427 if (p_ptr->monster_race_idx == m_ptr->r_idx)
429 p_ptr->window |= (PW_MONSTER);
432 /* Repair visibility later */
433 repair_monsters = TRUE;
435 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
436 update_monster(i, FALSE);
441 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
444 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
450 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
452 * @return 効力があった場合TRUEを返す
454 bool detect_monsters_evil(POSITION range)
460 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
462 for (i = 1; i < m_max; i++)
464 monster_type *m_ptr = &m_list[i];
465 monster_race *r_ptr = &r_info[m_ptr->r_idx];
467 /* Skip dead monsters */
468 if (!m_ptr->r_idx) continue;
473 /* Only detect nearby monsters */
474 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
476 /* Detect evil monsters */
477 if (r_ptr->flags3 & RF3_EVIL)
479 if (is_original_ap(m_ptr))
481 /* Take note that they are evil */
482 r_ptr->r_flags3 |= (RF3_EVIL);
484 /* Update monster recall window */
485 if (p_ptr->monster_race_idx == m_ptr->r_idx)
487 p_ptr->window |= (PW_MONSTER);
491 /* Repair visibility later */
492 repair_monsters = TRUE;
494 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
495 update_monster(i, FALSE);
501 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
507 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
509 * @return 効力があった場合TRUEを返す
511 bool detect_monsters_nonliving(POSITION range)
517 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
519 for (i = 1; i < m_max; i++)
521 monster_type *m_ptr = &m_list[i];
523 /* Skip dead monsters */
524 if (!m_ptr->r_idx) continue;
529 /* Only detect nearby monsters */
530 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
532 /* Detect non-living monsters */
533 if (!monster_living(m_ptr->r_idx))
535 /* Update monster recall window */
536 if (p_ptr->monster_race_idx == m_ptr->r_idx)
538 p_ptr->window |= (PW_MONSTER);
541 /* Repair visibility later */
542 repair_monsters = TRUE;
544 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
545 update_monster(i, FALSE);
551 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
557 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
559 * @return 効力があった場合TRUEを返す
561 bool detect_monsters_mind(POSITION range)
567 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
569 for (i = 1; i < m_max; i++)
571 monster_type *m_ptr = &m_list[i];
572 monster_race *r_ptr = &r_info[m_ptr->r_idx];
574 /* Skip dead monsters */
575 if (!m_ptr->r_idx) continue;
580 /* Only detect nearby monsters */
581 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
583 /* Detect non-living monsters */
584 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
586 /* Update monster recall window */
587 if (p_ptr->monster_race_idx == m_ptr->r_idx)
589 p_ptr->window |= (PW_MONSTER);
592 /* Repair visibility later */
593 repair_monsters = TRUE;
595 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
596 update_monster(i, FALSE);
602 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
609 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
611 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
612 * @return 効力があった場合TRUEを返す
614 bool detect_monsters_string(POSITION range, cptr Match)
620 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
622 for (i = 1; i < m_max; i++)
624 monster_type *m_ptr = &m_list[i];
625 monster_race *r_ptr = &r_info[m_ptr->r_idx];
627 /* Skip dead monsters */
628 if (!m_ptr->r_idx) continue;
633 /* Only detect nearby monsters */
634 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
636 /* Detect monsters with the same symbol */
637 if (my_strchr(Match, r_ptr->d_char))
639 /* Update monster recall window */
640 if (p_ptr->monster_race_idx == m_ptr->r_idx)
642 p_ptr->window |= (PW_MONSTER);
645 /* Repair visibility later */
646 repair_monsters = TRUE;
648 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
649 update_monster(i, FALSE);
654 if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
657 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
663 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
665 * @param match_flag 感知フラグ
666 * @return 効力があった場合TRUEを返す
668 bool detect_monsters_xxx(POSITION range, u32b match_flag)
673 cptr desc_monsters = _("変なモンスター", "weird monsters");
675 if (d_info[dungeon_type].flags1 & DF1_DARKNESS) range /= 3;
677 for (i = 1; i < m_max; i++)
679 monster_type *m_ptr = &m_list[i];
680 monster_race *r_ptr = &r_info[m_ptr->r_idx];
682 /* Skip dead monsters */
683 if (!m_ptr->r_idx) continue;
688 /* Only detect nearby monsters */
689 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
691 /* Detect evil monsters */
692 if (r_ptr->flags3 & (match_flag))
694 if (is_original_ap(m_ptr))
696 /* Take note that they are something */
697 r_ptr->r_flags3 |= (match_flag);
699 /* Update monster recall window */
700 if (p_ptr->monster_race_idx == m_ptr->r_idx)
702 p_ptr->window |= (PW_MONSTER);
706 /* Repair visibility later */
707 repair_monsters = TRUE;
709 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
710 update_monster(i, FALSE);
719 desc_monsters = _("デーモン", "demons");
722 desc_monsters = _("アンデッド", "the undead");
726 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
734 * @brief 全感知処理 / Detect everything
736 * @return 効力があった場合TRUEを返す
738 bool detect_all(POSITION range)
742 /* Detect everything */
743 if (detect_traps(range, TRUE)) detect = TRUE;
744 if (detect_doors(range)) detect = TRUE;
745 if (detect_stairs(range)) detect = TRUE;
747 /* There are too many hidden treasure. So... */
748 /* if (detect_treasure(range)) detect = TRUE; */
750 if (detect_objects_gold(range)) detect = TRUE;
751 if (detect_objects_normal(range)) detect = TRUE;
752 if (detect_monsters_invis(range)) detect = TRUE;
753 if (detect_monsters_normal(range)) detect = TRUE;
759 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
762 * @return 効力があった場合TRUEを返す
765 * Note that affected monsters are NOT auto-tracked by this usage.
767 * To avoid misbehavior when monster deaths have side-effects,
768 * this is done in two passes. -- JDL
771 bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
775 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
776 bool obvious = FALSE;
779 /* Mark all (nearby) monsters */
780 for (i = 1; i < m_max; i++)
782 monster_type *m_ptr = &m_list[i];
784 /* Paranoia -- Skip dead monsters */
785 if (!m_ptr->r_idx) continue;
790 /* Require line of sight */
791 if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
793 /* Mark the monster */
794 m_ptr->mflag |= (MFLAG_TEMP);
797 /* Affect all marked monsters */
798 for (i = 1; i < m_max; i++)
800 monster_type *m_ptr = &m_list[i];
802 /* Skip unmarked monsters */
803 if (!(m_ptr->mflag & (MFLAG_TEMP))) continue;
806 m_ptr->mflag &= ~(MFLAG_TEMP);
811 /* Jump directly to the target monster */
812 if (project(0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
819 * @brief 視界内モンスターを加速する処理 / Speed monsters
820 * @return 効力があった場合TRUEを返す
822 bool speed_monsters(void)
824 return (project_all_los(GF_OLD_SPEED, p_ptr->lev));
828 * @brief 視界内モンスターを加速する処理 / Slow monsters
829 * @return 効力があった場合TRUEを返す
831 bool slow_monsters(int power)
833 return (project_all_los(GF_OLD_SLOW, power));
837 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
838 * @return 効力があった場合TRUEを返す
840 bool sleep_monsters(int power)
842 return (project_all_los(GF_OLD_SLEEP, power));
846 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
847 * @return 効力があった場合TRUEを返す
849 bool banish_evil(int dist)
851 return (project_all_los(GF_AWAY_EVIL, dist));
855 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
856 * @return 効力があった場合TRUEを返す
858 bool turn_undead(void)
860 bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
862 chg_virtue(V_UNLIFE, -1);
867 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
868 * @return 効力があった場合TRUEを返す
870 bool dispel_undead(HIT_POINT dam)
872 bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
874 chg_virtue(V_UNLIFE, -2);
879 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
880 * @return 効力があった場合TRUEを返す
882 bool dispel_evil(HIT_POINT dam)
884 return (project_all_los(GF_DISP_EVIL, dam));
888 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
889 * @return 効力があった場合TRUEを返す
891 bool dispel_good(HIT_POINT dam)
893 return (project_all_los(GF_DISP_GOOD, dam));
897 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
898 * @return 効力があった場合TRUEを返す
900 bool dispel_monsters(HIT_POINT dam)
902 return (project_all_los(GF_DISP_ALL, dam));
906 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
907 * @return 効力があった場合TRUEを返す
909 bool dispel_living(HIT_POINT dam)
911 return (project_all_los(GF_DISP_LIVING, dam));
915 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
916 * @return 効力があった場合TRUEを返す
918 bool dispel_demons(HIT_POINT dam)
920 return (project_all_los(GF_DISP_DEMON, dam));
924 * @brief 視界内のモンスターに「聖戦」効果を与える処理
925 * @return 効力があった場合TRUEを返す
929 return (project_all_los(GF_CRUSADE, p_ptr->lev*4));
933 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
934 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
937 void aggravate_monsters(MONSTER_IDX who)
943 /* Aggravate everyone nearby */
944 for (i = 1; i < m_max; i++)
946 monster_type *m_ptr = &m_list[i];
948 /* Paranoia -- Skip dead monsters */
949 if (!m_ptr->r_idx) continue;
951 /* Skip aggravating monster (or player) */
952 if (i == who) continue;
954 /* Wake up nearby sleeping monsters */
955 if (m_ptr->cdis < MAX_SIGHT * 2)
958 if (MON_CSLEEP(m_ptr))
960 (void)set_monster_csleep(i, 0);
963 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
966 /* Speed up monsters in line of sight */
967 if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
971 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
977 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
978 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
979 if (p_ptr->riding) p_ptr->update |= PU_BONUS;
984 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
985 * @param m_idx 抹殺するモンスターID
987 * @param player_cast プレイヤーの魔法によるものならば TRUE
988 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
989 * @param spell_name 抹殺効果を起こした魔法の名前
990 * @return 効力があった場合TRUEを返す
992 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, cptr spell_name)
994 int msec = delay_factor * delay_factor * delay_factor;
995 monster_type *m_ptr = &m_list[m_idx];
996 monster_race *r_ptr = &r_info[m_ptr->r_idx];
999 if (is_pet(m_ptr) && !player_cast) return FALSE;
1001 /* Hack -- Skip Unique Monsters or Quest Monsters */
1002 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1003 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1004 else if (m_idx == p_ptr->riding) resist = TRUE;
1005 else if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
1006 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1007 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1012 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1016 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1017 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1020 delete_monster_idx(m_idx);
1023 if (resist && player_cast)
1025 bool see_m = is_seen(m_ptr);
1028 monster_desc(m_name, m_ptr, 0);
1031 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1033 if (MON_CSLEEP(m_ptr))
1035 (void)set_monster_csleep(m_idx, 0);
1038 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1041 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1045 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1049 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1054 take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1057 /* Visual feedback */
1058 move_cursor_relative(p_ptr->y, p_ptr->x);
1060 p_ptr->redraw |= (PR_HP);
1061 p_ptr->window |= (PW_PLAYER);
1066 Term_xtra(TERM_XTRA_DELAY, msec);
1073 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1074 * @param power 抹殺の威力
1075 * @param player_cast プレイヤーの魔法によるものならば TRUE
1076 * @return 効力があった場合TRUEを返す
1078 bool symbol_genocide(int power, bool player_cast)
1082 bool result = FALSE;
1084 /* Prevent genocide in quest levels */
1085 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1090 /* Mega-Hack -- Get a monster symbol */
1091 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1093 /* Delete the monsters of that "type" */
1094 for (i = 1; i < m_max; i++)
1096 monster_type *m_ptr = &m_list[i];
1097 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1099 /* Paranoia -- Skip dead monsters */
1100 if (!m_ptr->r_idx) continue;
1102 /* Skip "wrong" monsters */
1103 if (r_ptr->d_char != typ) continue;
1105 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1110 chg_virtue(V_VITALITY, -2);
1111 chg_virtue(V_CHANCE, -1);
1119 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1120 * @param power 抹殺の威力
1121 * @param player_cast プレイヤーの魔法によるものならば TRUE
1122 * @return 効力があった場合TRUEを返す
1124 bool mass_genocide(int power, bool player_cast)
1127 bool result = FALSE;
1129 /* Prevent mass genocide in quest levels */
1130 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1135 /* Delete the (nearby) monsters */
1136 for (i = 1; i < m_max; i++)
1138 monster_type *m_ptr = &m_list[i];
1140 /* Paranoia -- Skip dead monsters */
1141 if (!m_ptr->r_idx) continue;
1143 /* Skip distant monsters */
1144 if (m_ptr->cdis > MAX_SIGHT) continue;
1147 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1152 chg_virtue(V_VITALITY, -2);
1153 chg_virtue(V_CHANCE, -1);
1161 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1162 * @param power 抹殺の威力
1163 * @param player_cast プレイヤーの魔法によるものならば TRUE
1164 * @return 効力があった場合TRUEを返す
1166 bool mass_genocide_undead(int power, bool player_cast)
1169 bool result = FALSE;
1171 /* Prevent mass genocide in quest levels */
1172 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1177 /* Delete the (nearby) monsters */
1178 for (i = 1; i < m_max; i++)
1180 monster_type *m_ptr = &m_list[i];
1181 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1183 /* Paranoia -- Skip dead monsters */
1184 if (!m_ptr->r_idx) continue;
1186 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1188 /* Skip distant monsters */
1189 if (m_ptr->cdis > MAX_SIGHT) continue;
1192 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1197 chg_virtue(V_UNLIFE, -2);
1198 chg_virtue(V_CHANCE, -1);
1206 * @brief 周辺モンスターを調査する / Probe nearby monsters
1207 * @return 効力があった場合TRUEを返す
1212 int speed; /* TODO */
1223 /* Probe all (nearby) monsters */
1224 for (i = 1; i < m_max; i++)
1226 monster_type *m_ptr = &m_list[i];
1227 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1229 /* Paranoia -- Skip dead monsters */
1230 if (!m_ptr->r_idx) continue;
1232 /* Require line of sight */
1233 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1235 /* Probe visible monsters */
1240 /* Start the message */
1243 msg_print(_("調査中...", "Probing..."));
1248 if (!is_original_ap(m_ptr))
1250 if (m_ptr->mflag2 & MFLAG2_KAGE)
1251 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1253 m_ptr->ap_r_idx = m_ptr->r_idx;
1254 lite_spot(m_ptr->fy, m_ptr->fx);
1256 /* Get "the monster" or "something" */
1257 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1259 speed = m_ptr->mspeed - 110;
1260 if (MON_FAST(m_ptr)) speed += 10;
1261 if (MON_SLOW(m_ptr)) speed -= 10;
1262 if (ironman_nightmare) speed += 5;
1264 /* Get the monster's alignment */
1265 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1266 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1267 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1268 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1269 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1270 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1271 else align = _("中立", "neutral");
1273 /* Describe the monster */
1274 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1275 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1277 if (r_ptr->next_r_idx)
1279 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1283 strcat(buf, "xxx ");
1286 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1287 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1288 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1289 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1290 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1291 buf[strlen(buf)-1] = '\0';
1294 /* HACK : Add the line to message buffer */
1297 p_ptr->window |= (PW_MESSAGE);
1300 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1303 Term_erase(0, 0, 255);
1305 /* Learn everything about this monster */
1306 if (lore_do_probe(m_ptr->r_idx))
1308 /* Get base name of monster */
1309 strcpy(buf, (r_name + r_ptr->name));
1312 /* Note that we learnt some new flags -Mogami- */
1313 msg_format("%sについてさらに詳しくなった気がする。", buf);
1318 /* Note that we learnt some new flags -Mogami- */
1319 msg_format("You now know more about %s.", buf);
1321 /* Clear -more- prompt */
1336 chg_virtue(V_KNOWLEDGE, 1);
1337 msg_print(_("これで全部です。", "That's all."));
1345 * @brief *破壊*処理を行う / The spell of destruction
1346 * @param y1 破壊の中心Y座標
1347 * @param x1 破壊の中心X座標
1349 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1350 * @return 効力があった場合TRUEを返す
1353 * This spell "deletes" monsters (instead of "killing" them).
1355 * Later we may use one function for both "destruction" and
1356 * "earthquake" by using the "full" to select "destruction".
1359 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1366 /* Prevent destruction of quest levels and town */
1367 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1372 /* Lose monster light */
1373 if (!in_generate) clear_mon_lite();
1375 /* Big area of affect */
1376 for (y = (y1 - r); y <= (y1 + r); y++)
1378 for (x = (x1 - r); x <= (x1 + r); x++)
1380 /* Skip illegal grids */
1381 if (!in_bounds(y, x)) continue;
1383 /* Extract the distance */
1384 k = distance(y1, x1, y, x);
1386 /* Stay in the circle of death */
1387 if (k > r) continue;
1388 c_ptr = &cave[y][x];
1390 /* Lose room and vault */
1391 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1393 /* Lose light and knowledge */
1394 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1396 if (!in_generate) /* Normal */
1399 c_ptr->info &= ~(CAVE_UNSAFE);
1401 /* Hack -- Notice player affect */
1402 if (player_bold(y, x))
1404 /* Hurt the player later */
1407 /* Do not hurt this grid */
1412 /* Hack -- Skip the epicenter */
1413 if ((y == y1) && (x == x1)) continue;
1417 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1418 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1420 if (in_generate) /* In generation */
1422 /* Delete the monster (if any) */
1423 delete_monster(y, x);
1425 else if (r_ptr->flags1 & RF1_QUESTOR)
1427 /* Heal the monster */
1428 m_ptr->hp = m_ptr->maxhp;
1430 /* Try to teleport away quest monsters */
1431 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1435 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1439 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1440 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1443 /* Delete the monster (if any) */
1444 delete_monster(y, x);
1448 /* During generation, destroyed artifacts are "preserved" */
1449 if (preserve_mode || in_generate)
1451 OBJECT_IDX this_o_idx, next_o_idx = 0;
1453 /* Scan all objects in the grid */
1454 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1457 o_ptr = &o_list[this_o_idx];
1459 /* Acquire next object */
1460 next_o_idx = o_ptr->next_o_idx;
1462 /* Hack -- Preserve unknown artifacts */
1463 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1465 /* Mega-Hack -- Preserve the artifact */
1466 a_info[o_ptr->name1].cur_num = 0;
1468 if (in_generate && cheat_peek)
1470 char o_name[MAX_NLEN];
1471 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1472 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1475 else if (in_generate && cheat_peek && o_ptr->art_name)
1477 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1478 "One of the random artifacts was *destroyed* during generation."));
1483 /* Delete objects */
1484 delete_object(y, x);
1486 /* Destroy "non-permanent" grids */
1487 if (!cave_perma_grid(c_ptr))
1489 /* Wall (or floor) type */
1492 if (!in_generate) /* Normal */
1496 /* Create granite wall */
1497 cave_set_feat(y, x, feat_granite);
1501 /* Create quartz vein */
1502 cave_set_feat(y, x, feat_quartz_vein);
1506 /* Create magma vein */
1507 cave_set_feat(y, x, feat_magma_vein);
1512 cave_set_feat(y, x, floor_type[randint0(100)]);
1515 else /* In generation */
1519 /* Create granite wall */
1520 place_extra_grid(c_ptr);
1524 /* Create quartz vein */
1525 c_ptr->feat = feat_quartz_vein;
1529 /* Create magma vein */
1530 c_ptr->feat = feat_magma_vein;
1535 place_floor_grid(c_ptr);
1538 /* Clear garbage of hidden trap or door */
1547 /* Process "re-glowing" */
1548 for (y = (y1 - r); y <= (y1 + r); y++)
1550 for (x = (x1 - r); x <= (x1 + r); x++)
1552 /* Skip illegal grids */
1553 if (!in_bounds(y, x)) continue;
1555 /* Extract the distance */
1556 k = distance(y1, x1, y, x);
1558 /* Stay in the circle of death */
1559 if (k > r) continue;
1560 c_ptr = &cave[y][x];
1562 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1563 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1568 for (i = 0; i < 9; i++)
1570 yy = y + ddy_ddd[i];
1571 xx = x + ddx_ddd[i];
1572 if (!in_bounds2(yy, xx)) continue;
1573 cc_ptr = &cave[yy][xx];
1574 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1576 c_ptr->info |= CAVE_GLOW;
1584 /* Hack -- Affect player */
1587 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1589 /* Blind the player */
1590 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1593 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1599 /* Mega-Hack -- Forget the view and lite */
1600 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1602 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1604 p_ptr->redraw |= (PR_MAP);
1606 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1608 if (p_ptr->special_defense & NINJA_S_STEALTH)
1610 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1620 * @brief 地震処理(サブルーチン) /
1621 * Induce an "earthquake" of the given radius at the given location.
1622 * @return 効力があった場合TRUEを返す
1626 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1630 * This will turn some walls into floors and some floors into walls.
1632 * The player will take damage and "jump" into a safe grid if possible,
1633 * otherwise, he will "tunnel" through the rubble instantaneously.
1635 * Monsters will take damage, and "jump" into a safe grid if possible,
1636 * otherwise they will be "buried" in the rubble, disappearing from
1637 * the level in the same way that they do when genocided.
1639 * Note that thus the player and monsters (except eaters of walls and
1640 * passers through walls) will never occupy the same grid as a wall.
1641 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1642 * for a single turn, unless that monster can pass_walls or kill_walls.
1643 * This has allowed massive simplification of the "monster" code.
1646 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1650 POSITION y, x, yy, xx, dy, dx;
1653 POSITION sy = 0, sx = 0;
1659 /* Prevent destruction of quest levels and town */
1660 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1665 /* Paranoia -- Enforce maximum range */
1668 /* Clear the "maximal blast" area */
1669 for (y = 0; y < 32; y++)
1671 for (x = 0; x < 32; x++)
1677 /* Check around the epicenter */
1678 for (dy = -r; dy <= r; dy++)
1680 for (dx = -r; dx <= r; dx++)
1682 /* Extract the location */
1686 /* Skip illegal grids */
1687 if (!in_bounds(yy, xx)) continue;
1689 /* Skip distant grids */
1690 if (distance(cy, cx, yy, xx) > r) continue;
1691 c_ptr = &cave[yy][xx];
1693 /* Lose room and vault */
1694 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1696 /* Lose light and knowledge */
1697 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1699 /* Skip the epicenter */
1700 if (!dx && !dy) continue;
1702 /* Skip most grids */
1703 if (randint0(100) < 85) continue;
1705 /* Damage this grid */
1706 map[16+yy-cy][16+xx-cx] = TRUE;
1708 /* Hack -- Take note of player damage */
1709 if (player_bold(yy, xx)) hurt = TRUE;
1713 /* First, affect the player (if necessary) */
1714 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1716 /* Check around the player */
1717 for (i = 0; i < 8; i++)
1719 /* Access the location */
1720 y = p_ptr->y + ddy_ddd[i];
1721 x = p_ptr->x + ddx_ddd[i];
1723 /* Skip non-empty grids */
1724 if (!cave_empty_bold(y, x)) continue;
1726 /* Important -- Skip "quake" grids */
1727 if (map[16+y-cy][16+x-cx]) continue;
1729 if (cave[y][x].m_idx) continue;
1731 /* Count "safe" grids */
1734 /* Randomize choice */
1735 if (randint0(sn) > 0) continue;
1737 /* Save the safe location */
1741 /* Random message */
1742 switch (randint1(3))
1746 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1751 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1756 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1761 /* Hurt the player a lot */
1764 /* Message and damage */
1765 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1769 /* Destroy the grid, and push the player to safety */
1772 /* Calculate results */
1773 switch (randint1(3))
1777 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1783 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1784 damage = damroll(10, 4);
1785 (void)set_stun(p_ptr->stun + randint1(50));
1790 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1791 damage = damroll(10, 4);
1792 (void)set_stun(p_ptr->stun + randint1(50));
1797 /* Move the player to the safe location */
1798 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1801 /* Important -- no wall on player */
1802 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1811 monster_type *m_ptr = &m_list[m_idx];
1813 /* Get the monster's real name */
1814 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1816 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1820 killer = _("地震", "an earthquake");
1823 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1827 /* Examine the quaked region */
1828 for (dy = -r; dy <= r; dy++)
1830 for (dx = -r; dx <= r; dx++)
1832 /* Extract the location */
1836 /* Skip unaffected grids */
1837 if (!map[16+yy-cy][16+xx-cx]) continue;
1838 c_ptr = &cave[yy][xx];
1840 if (c_ptr->m_idx == p_ptr->riding) continue;
1842 /* Process monsters */
1845 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1846 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1848 /* Quest monsters */
1849 if (r_ptr->flags1 & RF1_QUESTOR)
1851 /* No wall on quest monsters */
1852 map[16+yy-cy][16+xx-cx] = FALSE;
1857 /* Most monsters cannot co-exist with rock */
1858 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1859 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1863 /* Assume not safe */
1866 /* Monster can move to escape the wall */
1867 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1869 /* Look for safety */
1870 for (i = 0; i < 8; i++)
1872 y = yy + ddy_ddd[i];
1873 x = xx + ddx_ddd[i];
1875 /* Skip non-empty grids */
1876 if (!cave_empty_bold(y, x)) continue;
1878 /* Hack -- no safety on glyph of warding */
1879 if (is_glyph_grid(&cave[y][x])) continue;
1880 if (is_explosive_rune_grid(&cave[y][x])) continue;
1882 /* ... nor on the Pattern */
1883 if (pattern_tile(y, x)) continue;
1885 /* Important -- Skip "quake" grids */
1886 if (map[16+y-cy][16+x-cx]) continue;
1888 if (cave[y][x].m_idx) continue;
1889 if (player_bold(y, x)) continue;
1891 /* Count "safe" grids */
1894 /* Randomize choice */
1895 if (randint0(sn) > 0) continue;
1897 /* Save the safe grid */
1902 /* Describe the monster */
1903 monster_desc(m_name, m_ptr, 0);
1905 /* Scream in pain */
1906 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1908 /* Take damage from the quake */
1909 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1911 /* Monster is certainly awake */
1912 (void)set_monster_csleep(c_ptr->m_idx, 0);
1914 /* Apply damage directly */
1915 m_ptr->hp -= damage;
1917 /* Delete (not kill) "dead" monsters */
1920 if (!ignore_unview || is_seen(m_ptr))
1921 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1925 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1929 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1930 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1935 delete_monster(yy, xx);
1937 /* No longer safe */
1941 /* Hack -- Escape from the rock */
1944 IDX m_idx_aux = cave[yy][xx].m_idx;
1946 /* Update the old location */
1947 cave[yy][xx].m_idx = 0;
1949 /* Update the new location */
1950 cave[sy][sx].m_idx = m_idx_aux;
1952 /* Move the monster */
1956 /* Update the monster (new location) */
1957 update_monster(m_idx, TRUE);
1959 /* Redraw the old grid */
1962 /* Redraw the new grid */
1970 /* Lose monster light */
1973 /* Examine the quaked region */
1974 for (dy = -r; dy <= r; dy++)
1976 for (dx = -r; dx <= r; dx++)
1978 /* Extract the location */
1982 /* Skip unaffected grids */
1983 if (!map[16+yy-cy][16+xx-cx]) continue;
1985 /* Access the cave grid */
1986 c_ptr = &cave[yy][xx];
1988 /* Paranoia -- never affect player */
1989 /* if (player_bold(yy, xx)) continue; */
1991 /* Destroy location (if valid) */
1992 if (cave_valid_bold(yy, xx))
1994 /* Delete objects */
1995 delete_object(yy, xx);
1997 /* Wall (or floor) type */
1998 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2003 /* Create granite wall */
2004 cave_set_feat(yy, xx, feat_granite);
2010 /* Create quartz vein */
2011 cave_set_feat(yy, xx, feat_quartz_vein);
2017 /* Create magma vein */
2018 cave_set_feat(yy, xx, feat_magma_vein);
2025 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2032 /* Process "re-glowing" */
2033 for (dy = -r; dy <= r; dy++)
2035 for (dx = -r; dx <= r; dx++)
2037 /* Extract the location */
2041 /* Skip illegal grids */
2042 if (!in_bounds(yy, xx)) continue;
2044 /* Skip distant grids */
2045 if (distance(cy, cx, yy, xx) > r) continue;
2046 c_ptr = &cave[yy][xx];
2048 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2049 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2054 for (ii = 0; ii < 9; ii++)
2056 yyy = yy + ddy_ddd[ii];
2057 xxx = xx + ddx_ddd[ii];
2058 if (!in_bounds2(yyy, xxx)) continue;
2059 cc_ptr = &cave[yyy][xxx];
2060 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2062 c_ptr->info |= CAVE_GLOW;
2071 /* Mega-Hack -- Forget the view and lite */
2072 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2074 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2076 /* Update the health bar */
2077 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2079 p_ptr->redraw |= (PR_MAP);
2081 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2083 if (p_ptr->special_defense & NINJA_S_STEALTH)
2085 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2093 * @brief 地震処理(プレイヤーの中心発動) /
2094 * Induce an "earthquake" of the given radius at the given location.
2095 * @return 効力があった場合TRUEを返す
2100 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2102 return earthquake_aux(cy, cx, r, 0);
2109 void discharge_minion(void)
2114 for (i = 1; i < m_max; i++)
2116 monster_type *m_ptr = &m_list[i];
2117 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2118 if (m_ptr->nickname) okay = FALSE;
2120 if (!okay || p_ptr->riding)
2122 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2125 for (i = 1; i < m_max; i++)
2128 monster_type *m_ptr = &m_list[i];
2129 monster_race *r_ptr;
2131 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2132 r_ptr = &r_info[m_ptr->r_idx];
2134 /* Uniques resist discharging */
2135 if (r_ptr->flags1 & RF1_UNIQUE)
2138 monster_desc(m_name, m_ptr, 0x00);
2139 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2140 delete_monster_idx(i);
2143 dam = m_ptr->maxhp / 2;
2144 if (dam > 100) dam = (dam-100)/2 + 100;
2145 if (dam > 400) dam = (dam-400)/2 + 400;
2146 if (dam > 800) dam = 800;
2147 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2148 m_ptr->fx, dam, GF_PLASMA,
2149 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2151 if (record_named_pet && m_ptr->nickname)
2155 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2156 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2159 delete_monster_idx(i);
2165 * @brief 部屋全体を照らすサブルーチン
2169 * This routine clears the entire "temp" set.
2170 * This routine will Perma-Lite all "temp" grids.
2171 * This routine is used (only) by "lite_room()"
2172 * Dark grids are illuminated.
2173 * Also, process all affected monsters.
2175 * SMART monsters always wake up when illuminated
2176 * NORMAL monsters wake up 1/4 the time when illuminated
2177 * STUPID monsters wake up 1/10 the time when illuminated
2180 static void cave_temp_room_lite(void)
2184 /* Clear them all */
2185 for (i = 0; i < temp_n; i++)
2187 POSITION y = temp_y[i];
2188 POSITION x = temp_x[i];
2190 cave_type *c_ptr = &cave[y][x];
2192 /* No longer in the array */
2193 c_ptr->info &= ~(CAVE_TEMP);
2195 /* Update only non-CAVE_GLOW grids */
2196 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2199 c_ptr->info |= (CAVE_GLOW);
2201 /* Process affected monsters */
2206 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2208 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2209 update_monster(c_ptr->m_idx, FALSE);
2211 /* Stupid monsters rarely wake up */
2212 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2214 /* Smart monsters always wake up */
2215 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2217 /* Sometimes monsters wake up */
2218 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2221 (void)set_monster_csleep(c_ptr->m_idx, 0);
2223 /* Notice the "waking up" */
2227 monster_desc(m_name, m_ptr, 0);
2228 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2238 update_local_illumination(y, x);
2248 * @brief 部屋全体を暗くするサブルーチン
2252 * This routine clears the entire "temp" set.
2253 * This routine will "darken" all "temp" grids.
2254 * In addition, some of these grids will be "unmarked".
2255 * This routine is used (only) by "unlite_room()"
2256 * Also, process all affected monsters
2259 static void cave_temp_room_unlite(void)
2263 /* Clear them all */
2264 for (i = 0; i < temp_n; i++)
2266 POSITION y = temp_y[i];
2267 POSITION x = temp_x[i];
2270 cave_type *c_ptr = &cave[y][x];
2271 bool do_dark = !is_mirror_grid(c_ptr);
2273 /* No longer in the array */
2274 c_ptr->info &= ~(CAVE_TEMP);
2276 /* Darken the grid */
2279 if (dun_level || !is_daytime())
2281 for (j = 0; j < 9; j++)
2283 int by = y + ddy_ddd[j];
2284 int bx = x + ddx_ddd[j];
2286 if (in_bounds2(by, bx))
2288 cave_type *cc_ptr = &cave[by][bx];
2290 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2298 if (!do_dark) continue;
2301 c_ptr->info &= ~(CAVE_GLOW);
2303 /* Hack -- Forget "boring" grids */
2304 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2306 /* Forget the grid */
2307 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2312 /* Process affected monsters */
2315 update_monster(c_ptr->m_idx, FALSE);
2320 update_local_illumination(y, x);
2330 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2333 * @param pass_bold 地形条件を返す関数ポインタ
2336 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2343 for (i = 0; i < 16; i++)
2345 y = cy + ddy_cdd[i % 8];
2346 x = cx + ddx_cdd[i % 8];
2348 /* Found a wall, break the length */
2349 if (!pass_bold(y, x))
2351 /* Track best length */
2365 return (MAX(len, blen));
2369 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2372 * @param pass_bold 地形条件を返す関数ポインタ
2375 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2381 for (i = 0; i < 8; i++)
2383 y = cy + ddy_ddd[i];
2384 x = cx + ddx_ddd[i];
2386 if (!pass_bold(y, x)) c++;
2394 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2395 * @param y 部屋内のy座標1点
2396 * @param x 部屋内のx座標1点
2397 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2398 * @param pass_bold 地形条件を返す関数ポインタ
2401 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2406 c_ptr = &cave[y][x];
2408 /* Avoid infinite recursion */
2409 if (c_ptr->info & (CAVE_TEMP)) return;
2411 /* Do not "leave" the current room */
2412 if (!(c_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 (temp_n == TEMP_MAX) return;
2438 /* Mark the grid as "seen" */
2439 c_ptr->info |= (CAVE_TEMP);
2441 /* Add it to the "seen" set */
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 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_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 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_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 < temp_n; i++)
2510 x = temp_x[i], y = temp_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 (cave[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 < temp_n; i++)
2555 x = temp_x[i], y = temp_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();
2580 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2583 * @return 作用が実際にあった場合TRUEを返す
2585 bool lite_area(HIT_POINT dam, POSITION rad)
2587 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2589 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2591 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2595 /* Hack -- Message */
2598 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2601 /* Hook into the "project()" function */
2602 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2604 /* Lite up the room */
2605 lite_room(p_ptr->y, p_ptr->x);
2613 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2616 * @return 作用が実際にあった場合TRUEを返す
2618 bool unlite_area(HIT_POINT dam, POSITION rad)
2620 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2622 /* Hack -- Message */
2625 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2628 /* Hook into the "project()" function */
2629 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2631 /* Lite up the room */
2632 unlite_room(p_ptr->y, p_ptr->x);
2641 * @brief ボール系スペルの発動 / Cast a ball spell
2643 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2646 * @return 作用が実際にあった場合TRUEを返す
2649 * Stop if we hit a monster, act as a "ball"
2650 * Allow "target" mode to pass over monsters
2651 * Affect grids, objects, and monsters
2654 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2658 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2660 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2661 /* Use the given direction */
2662 tx = p_ptr->x + 99 * ddx[dir];
2663 ty = p_ptr->y + 99 * ddy[dir];
2665 /* Hack -- Use an actual "target" */
2666 if ((dir == 5) && target_okay())
2668 flg &= ~(PROJECT_STOP);
2673 /* Analyze the "dir" and the "target". Hurt items on floor. */
2674 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2678 * @brief ブレス系スペルの発動 / Cast a breath spell
2680 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2683 * @return 作用が実際にあった場合TRUEを返す
2686 * Stop if we hit a monster, act as a "ball"
2687 * Allow "target" mode to pass over monsters
2688 * Affect grids, objects, and monsters
2691 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2693 return fire_ball(typ, dir, dam, -rad);
2698 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2700 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2703 * @return 作用が実際にあった場合TRUEを返す
2706 * Stop if we hit a monster, act as a "ball"
2707 * Allow "target" mode to pass over monsters
2708 * Affect grids, objects, and monsters
2711 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2714 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2716 /* Use the given direction */
2717 tx = p_ptr->x + 99 * ddx[dir];
2718 ty = p_ptr->y + 99 * ddy[dir];
2720 /* Hack -- Use an actual "target" */
2721 if ((dir == 5) && target_okay())
2727 /* Analyze the "dir" and the "target". Hurt items on floor. */
2728 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2733 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2735 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2738 * @return 作用が実際にあった場合TRUEを返す
2741 * Stop if we hit a monster, act as a "ball"
2742 * Allow "target" mode to pass over monsters
2743 * Affect grids, objects, and monsters
2746 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2749 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2751 /* Use the given direction */
2752 tx = p_ptr->x + 99 * ddx[dir];
2753 ty = p_ptr->y + 99 * ddy[dir];
2755 /* Hack -- Use an actual "target" */
2756 if ((dir == 5) && target_okay())
2758 flg &= ~(PROJECT_STOP);
2763 /* Analyze the "dir" and the "target". Hurt items on floor. */
2764 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2769 * @brief メテオ系スペルの発動 / Cast a meteor spell
2770 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2776 * @return 作用が実際にあった場合TRUEを返す
2779 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2780 * player, or outside source, that starts out at an arbitrary location, and
2781 * leaving no trail from the "caster" to the target. This function is
2782 * especially useful for bombardments and similar. -LM-
2783 * Option to hurt the player.
2786 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2788 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2790 /* Analyze the "target" and the caster. */
2791 return (project(who, rad, y, x, dam, typ, flg, -1));
2796 * @brief ブラスト系スペルの発動 / Cast a blast spell
2798 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2803 * @return 作用が実際にあった場合TRUEを返す
2805 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2809 POSITION ty, tx, y, x;
2812 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2817 /* Use the given direction */
2820 ly = ty = p_ptr->y + 20 * ddy[dir];
2821 lx = tx = p_ptr->x + 20 * ddx[dir];
2824 /* Use an actual "target" */
2825 else /* if (dir == 5) */
2830 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2831 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2834 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2837 for (i = 0; i < num; i++)
2841 /* Get targets for some bolts */
2842 y = rand_spread(ly, ld * dev / 20);
2843 x = rand_spread(lx, ld * dev / 20);
2845 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2848 /* Analyze the "dir" and the "target". */
2849 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2860 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2861 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2862 * @return 作用が実際にあった場合TRUEを返す
2864 bool teleport_swap(DIRECTION dir)
2868 monster_type* m_ptr;
2869 monster_race* r_ptr;
2871 if ((dir == 5) && target_okay())
2878 tx = p_ptr->x + ddx[dir];
2879 ty = p_ptr->y + ddy[dir];
2881 c_ptr = &cave[ty][tx];
2883 if (p_ptr->anti_tele)
2885 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2889 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2891 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2897 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2899 msg_print(_("失敗した。", "Failed to swap."));
2905 m_ptr = &m_list[c_ptr->m_idx];
2906 r_ptr = &r_info[m_ptr->r_idx];
2908 (void)set_monster_csleep(c_ptr->m_idx, 0);
2910 if (r_ptr->flagsr & RFR_RES_TELE)
2912 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2914 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2920 sound(SOUND_TELEPORT);
2922 /* Swap the player and monster */
2923 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2931 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2933 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2936 * @return 作用が実際にあった場合TRUEを返す
2938 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2942 /* Pass through the target if needed */
2943 flg |= (PROJECT_THRU);
2945 /* Use the given direction */
2946 tx = p_ptr->x + ddx[dir];
2947 ty = p_ptr->y + ddy[dir];
2949 /* Hack -- Use an actual "target" */
2950 if ((dir == 5) && target_okay())
2956 /* Analyze the "dir" and the "target", do NOT explode */
2957 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2962 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2964 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2966 * @return 作用が実際にあった場合TRUEを返す
2969 * Stop if we hit a monster, as a "bolt".
2970 * Affect monsters and grids (not objects).
2973 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2975 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2976 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2977 return (project_hook(typ, dir, dam, flg));
2982 * @brief ビーム系スペルの発動 / Cast a beam spell.
2984 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2986 * @return 作用が実際にあった場合TRUEを返す
2989 * Pass through monsters, as a "beam".
2990 * Affect monsters, grids and objects.
2993 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2995 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2996 return (project_hook(typ, dir, dam, flg));
3001 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3002 * @param prob ビーム化する確率(%)
3004 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3006 * @return 作用が実際にあった場合TRUEを返す
3009 * Pass through monsters, as a "beam".
3010 * Affect monsters, grids and objects.
3013 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3015 if (randint0(100) < prob)
3017 return (fire_beam(typ, dir, dam));
3021 return (fire_bolt(typ, dir, dam));
3026 * @brief LITE_WEAK属性による光源ビーム処理
3027 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3029 * @return 作用が実際にあった場合TRUEを返す
3031 bool lite_line(DIRECTION dir, HIT_POINT dam)
3033 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3034 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3039 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3041 * @return 作用が実際にあった場合TRUEを返す
3043 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3045 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3046 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3051 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3053 * @return 作用が実際にあった場合TRUEを返す
3055 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3057 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3058 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3063 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3064 * @return 作用が実際にあった場合TRUEを返す
3066 bool wizard_lock(DIRECTION dir)
3068 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3069 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3074 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3075 * @return 作用が実際にあった場合TRUEを返す
3077 bool destroy_door(DIRECTION dir)
3079 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3080 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3085 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3086 * @return 作用が実際にあった場合TRUEを返す
3088 bool disarm_trap(DIRECTION dir)
3090 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3091 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3096 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3098 * @return 作用が実際にあった場合TRUEを返す
3100 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3102 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3103 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3108 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3110 * @return 作用が実際にあった場合TRUEを返す
3112 bool speed_monster(DIRECTION dir, int power)
3114 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3115 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3120 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3122 * @return 作用が実際にあった場合TRUEを返す
3124 bool slow_monster(DIRECTION dir, int power)
3126 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3127 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3132 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3134 * @return 作用が実際にあった場合TRUEを返す
3136 bool sleep_monster(DIRECTION dir, int power)
3138 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3139 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3143 * @brief モンスター拘束(STASIS)処理
3144 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3145 * @return 作用が実際にあった場合TRUEを返す
3146 * @details 威力はプレイヤーレベル*2に固定
3148 bool stasis_monster(DIRECTION dir)
3150 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3154 * @brief 邪悪なモンスター拘束(STASIS)処理
3155 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3156 * @return 作用が実際にあった場合TRUEを返す
3157 * @details 威力はプレイヤーレベル*2に固定
3159 bool stasis_evil(DIRECTION dir)
3161 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3166 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3167 * @param plev プレイヤーレベル(=効力)
3168 * @return 作用が実際にあった場合TRUEを返す
3170 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3172 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3173 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3178 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3179 * @param plev プレイヤーレベル(=効力)
3180 * @return 作用が実際にあった場合TRUEを返す
3182 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3184 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3185 return (project_hook(GF_STUN, dir, plev, flg));
3189 * @brief チェンジモンスター処理
3190 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3192 * @return 作用が実際にあった場合TRUEを返す
3194 bool poly_monster(DIRECTION dir, int power)
3196 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3197 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3199 chg_virtue(V_CHANCE, 1);
3204 * @brief クローンモンスター処理
3205 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3206 * @return 作用が実際にあった場合TRUEを返す
3208 bool clone_monster(DIRECTION dir)
3210 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3211 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3216 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3217 * @param plev プレイヤーレベル(=効力)
3218 * @return 作用が実際にあった場合TRUEを返す
3220 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3222 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3223 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3228 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3229 * @param plev プレイヤーレベル(効力はplev*200)
3230 * @return 作用が実際にあった場合TRUEを返す
3232 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3234 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3235 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3239 * @brief モンスター用テレポート処理
3240 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3241 * @param distance 移動距離
3242 * @return 作用が実際にあった場合TRUEを返す
3244 bool teleport_monster(DIRECTION dir, int distance)
3246 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3247 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3251 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3252 * @return 作用が実際にあった場合TRUEを返す
3254 bool door_creation(void)
3256 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3257 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3261 * @brief トラップ生成処理(起点から周囲1マス)
3264 * @return 作用が実際にあった場合TRUEを返す
3266 bool trap_creation(POSITION y, POSITION x)
3268 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3269 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3273 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3274 * @return 作用が実際にあった場合TRUEを返す
3276 bool tree_creation(void)
3278 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3279 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3283 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3284 * @return 作用が実際にあった場合TRUEを返す
3286 bool glyph_creation(void)
3288 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3289 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3293 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3294 * @return 作用が実際にあった場合TRUEを返す
3296 bool wall_stone(void)
3298 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3300 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3302 p_ptr->update |= (PU_FLOW);
3304 p_ptr->redraw |= (PR_MAP);
3310 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3311 * @return 作用が実際にあった場合TRUEを返す
3313 bool destroy_doors_touch(void)
3315 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3316 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3320 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3321 * @return 作用が実際にあった場合TRUEを返す
3323 bool disarm_traps_touch(void)
3325 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3326 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3330 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3331 * @return 作用が実際にあった場合TRUEを返す
3333 bool sleep_monsters_touch(void)
3335 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3336 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3341 * @brief 死者復活処理(起点より周囲5マス)
3342 * @param who 術者モンスターID(0ならばプレイヤー)
3345 * @return 作用が実際にあった場合TRUEを返す
3347 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3349 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3350 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3355 * @return 作用が実際にあった場合TRUEを返す
3357 void call_chaos(void)
3359 int Chaos_type, dummy, dir;
3360 PLAYER_LEVEL plev = p_ptr->lev;
3361 bool line_chaos = FALSE;
3363 int hurt_types[31] =
3365 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3366 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3367 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3368 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3369 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3370 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3371 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3372 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3375 Chaos_type = hurt_types[randint0(31)];
3376 if (one_in_(4)) line_chaos = TRUE;
3380 for (dummy = 1; dummy < 10; dummy++)
3385 fire_beam(Chaos_type, dummy, 150);
3387 fire_ball(Chaos_type, dummy, 150, 2);
3391 else if (one_in_(3))
3393 fire_ball(Chaos_type, 0, 500, 8);
3397 if (!get_aim_dir(&dir)) return;
3399 fire_beam(Chaos_type, dir, 250);
3401 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3406 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3407 * @param stop_ty 再帰処理停止フラグ
3409 * @return 作用が実際にあった場合TRUEを返す
3412 * rr9: Stop the nasty things when a Cyberdemon is summoned
3413 * or the player gets paralyzed.
3416 bool activate_ty_curse(bool stop_ty, int *count)
3420 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3424 switch (randint1(34))
3429 msg_print(_("地面が揺れた...", "The ground trembles..."));
3430 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3431 if (!one_in_(6)) break;
3436 HIT_POINT dam = damroll(10, 10);
3437 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3438 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3439 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3440 if (!one_in_(6)) break;
3445 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3446 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3447 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3448 if (!one_in_(6)) break;
3451 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3455 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3456 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3458 if (!one_in_(6)) break;
3459 case 1: case 2: case 3: case 16: case 17:
3460 aggravate_monsters(0);
3461 if (!one_in_(6)) break;
3462 case 4: case 5: case 6:
3463 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3464 if (!one_in_(6)) break;
3465 case 7: case 8: case 9: case 18:
3466 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3467 if (!one_in_(6)) break;
3468 case 10: case 11: case 12:
3469 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3470 lose_exp(p_ptr->exp / 16);
3471 if (!one_in_(6)) break;
3472 case 13: case 14: case 15: case 19: case 20:
3473 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3479 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3480 if (p_ptr->free_act)
3481 set_paralyzed(p_ptr->paralyzed + randint1(3));
3483 set_paralyzed(p_ptr->paralyzed + randint1(13));
3486 if (!one_in_(6)) break;
3487 case 21: case 22: case 23:
3488 (void)do_dec_stat(randint0(6));
3489 if (!one_in_(6)) break;
3491 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3493 if (!one_in_(6)) break;
3496 * Only summon Cyberdemons deep in the dungeon.
3498 if ((dun_level > 65) && !stop_ty)
3500 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3504 if (!one_in_(6)) break;
3510 (void)do_dec_stat(i);
3518 while (one_in_(3) && !stop_ty);
3524 * @brief HI_SUMMON(上級召喚)処理発動
3527 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3528 * @return 作用が実際にあった場合TRUEを返す
3530 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3535 BIT_FLAGS mode = PM_ALLOW_GROUP;
3542 mode |= PM_FORCE_FRIENDLY;
3546 mode |= PM_FORCE_PET;
3551 if (!pet) mode |= PM_NO_PET;
3553 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3555 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3557 switch (randint1(25) + (dun_level / 20))
3560 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3563 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3566 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3569 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3572 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3575 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3578 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3581 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3585 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3589 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3592 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3593 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3596 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3597 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3600 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3603 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3604 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3613 * @brief サイバーデーモンの召喚
3614 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3617 * @return 作用が実際にあった場合TRUEを返す
3619 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3622 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3624 BIT_FLAGS mode = PM_ALLOW_GROUP;
3626 /* Summoned by a monster */
3629 monster_type *m_ptr = &m_list[who];
3630 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3633 if (max_cyber > 4) max_cyber = 4;
3635 for (i = 0; i < max_cyber; i++)
3637 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3644 * @brief 周辺破壊効果(プレイヤー中心)
3645 * @return 作用が実際にあった場合TRUEを返す
3647 void wall_breaker(void)
3650 POSITION y = 0, x = 0;
3651 int attempts = 1000;
3653 if (randint1(80 + p_ptr->lev) < 70)
3657 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3659 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3661 if (!player_bold(y, x)) break;
3664 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3665 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3667 else if (randint1(100) > 30)
3669 earthquake(p_ptr->y, p_ptr->x, 1);
3673 int num = damroll(5, 3);
3675 for (i = 0; i < num; i++)
3679 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3681 if (!player_bold(y, x)) break;
3684 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3685 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3692 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3694 * @return 作用が実際にあった場合TRUEを返す
3696 bool confuse_monsters(HIT_POINT dam)
3698 return (project_all_los(GF_OLD_CONF, dam));
3703 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3705 * @return 作用が実際にあった場合TRUEを返す
3707 bool charm_monsters(HIT_POINT dam)
3709 return (project_all_los(GF_CHARM, dam));
3714 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3716 * @return 作用が実際にあった場合TRUEを返す
3718 bool charm_animals(HIT_POINT dam)
3720 return (project_all_los(GF_CONTROL_ANIMAL, dam));
3725 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3727 * @return 作用が実際にあった場合TRUEを返す
3729 bool stun_monsters(HIT_POINT dam)
3731 return (project_all_los(GF_STUN, dam));
3736 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3738 * @return 作用が実際にあった場合TRUEを返す
3740 bool stasis_monsters(HIT_POINT dam)
3742 return (project_all_los(GF_STASIS, dam));
3747 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3749 * @return 作用が実際にあった場合TRUEを返す
3751 bool mindblast_monsters(HIT_POINT dam)
3753 return (project_all_los(GF_PSI, dam));
3758 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3759 * @param dist 効力(距離)
3760 * @return 作用が実際にあった場合TRUEを返す
3762 bool banish_monsters(int dist)
3764 return (project_all_los(GF_AWAY_ALL, dist));
3769 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3771 * @return 作用が実際にあった場合TRUEを返す
3773 bool turn_evil(HIT_POINT dam)
3775 return (project_all_los(GF_TURN_EVIL, dam));
3780 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3782 * @return 作用が実際にあった場合TRUEを返す
3784 bool turn_monsters(HIT_POINT dam)
3786 return (project_all_los(GF_TURN_ALL, dam));
3791 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3792 * @return 作用が実際にあった場合TRUEを返す
3794 bool deathray_monsters(void)
3796 return (project_all_los(GF_DEATH_RAY, p_ptr->lev * 200));
3800 * @brief チャーム・モンスター(1体)
3801 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3803 * @return 作用が実際にあった場合TRUEを返す
3805 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3807 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3808 return (project_hook(GF_CHARM, dir, plev, flg));
3812 * @brief アンデッド支配(1体)
3813 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3815 * @return 作用が実際にあった場合TRUEを返す
3817 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3819 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3820 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3825 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3827 * @return 作用が実際にあった場合TRUEを返す
3829 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3831 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3832 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3837 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3839 * @return 作用が実際にあった場合TRUEを返す
3841 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3843 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3844 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3850 * @param success 判定成功上の処理ならばTRUE
3851 * @return 作用が実際にあった場合TRUEを返す
3853 bool kawarimi(bool success)
3856 object_type *q_ptr = &forge;
3859 if (p_ptr->is_dead) return FALSE;
3860 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3861 if (randint0(200) < p_ptr->stun) return FALSE;
3863 if (!success && one_in_(3))
3865 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3866 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3867 p_ptr->redraw |= (PR_STATUS);
3874 teleport_player(10 + randint1(90), 0L);
3878 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3880 q_ptr->pval = MON_NINJA;
3882 /* Drop it in the dungeon */
3883 (void)drop_near(q_ptr, -1, y, x);
3886 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3887 else msg_print("失敗!攻撃を受けてしまった。");
3889 if (success) msg_print("You have turned around just before the attack hit you.");
3890 else msg_print("Failed! You are hit by the attack.");
3893 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3894 p_ptr->redraw |= (PR_STATUS);
3902 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3903 * @param mdeath 目標モンスターが死亡したかを返す
3904 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3906 bool rush_attack(bool *mdeath)
3913 bool tmp_mdeath = FALSE;
3916 if (mdeath) *mdeath = FALSE;
3919 if (!get_aim_dir(&dir)) return FALSE;
3921 /* Use the given direction */
3922 tx = p_ptr->x + project_length * ddx[dir];
3923 ty = p_ptr->y + project_length * ddy[dir];
3925 /* Hack -- Use an actual "target" */
3926 if ((dir == 5) && target_okay())
3932 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3934 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3937 /* No need to move */
3938 if (!path_n) return TRUE;
3940 /* Use ty and tx as to-move point */
3944 /* Project along the path */
3945 for (i = 0; i < path_n; i++)
3947 monster_type *m_ptr;
3949 int ny = GRID_Y(path_g[i]);
3950 int nx = GRID_X(path_g[i]);
3952 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3957 /* Go to next grid */
3961 if (!cave[ny][nx].m_idx)
3965 msg_print(_("失敗!", "Failed!"));
3969 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3976 /* Move player before updating the monster */
3977 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3978 update_monster(cave[ny][nx].m_idx, TRUE);
3980 /* Found a monster */
3981 m_ptr = &m_list[cave[ny][nx].m_idx];
3983 if (tm_idx != cave[ny][nx].m_idx)
3986 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
3987 m_ptr->ml ? "モンスター" : "何か");
3989 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3992 else if (!player_bold(ty, tx))
3994 /* Hold the monster name */
3997 /* Get the monster name (BEFORE polymorphing) */
3998 monster_desc(m_name, m_ptr, 0);
3999 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4002 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4004 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4009 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4011 if (mdeath) *mdeath = tmp_mdeath;
4017 * @brief 全鏡の消去 / Remove all mirrors in this floor
4018 * @param explode 爆発処理を伴うならばTRUE
4021 void remove_all_mirrors(bool explode)
4025 for (x = 0; x < cur_wid; x++)
4027 for (y = 0; y < cur_hgt; y++)
4029 if (is_mirror_grid(&cave[y][x]))
4031 remove_mirror(y, x);
4033 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4034 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4041 * @brief 『一つの指輪』の効果処理 /
4042 * Hack -- activate the ring of power
4043 * @param dir 発動の方向ID
4046 void ring_of_power(DIRECTION dir)
4048 /* Pick a random effect */
4049 switch (randint1(10))
4054 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4057 /* Decrease all stats (permanently) */
4058 (void)dec_stat(A_STR, 50, TRUE);
4059 (void)dec_stat(A_INT, 50, TRUE);
4060 (void)dec_stat(A_WIS, 50, TRUE);
4061 (void)dec_stat(A_DEX, 50, TRUE);
4062 (void)dec_stat(A_CON, 50, TRUE);
4063 (void)dec_stat(A_CHR, 50, TRUE);
4065 /* Lose some experience (permanently) */
4066 p_ptr->exp -= (p_ptr->exp / 4);
4067 p_ptr->max_exp -= (p_ptr->exp / 4);
4075 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4077 /* Dispel monsters */
4078 dispel_monsters(1000);
4088 fire_ball(GF_MANA, dir, 600, 3);
4099 fire_bolt(GF_MANA, dir, 500);
4107 * @brief 運命の輪、並びにカオス的な効果の発動
4108 * @param spell ランダムな効果を選択するための基準ID
4111 void wild_magic(int spell)
4114 int type = SUMMON_MOLD + randint0(6);
4116 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4117 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4119 switch (randint1(spell) + randint1(8) + 1)
4124 teleport_player(10, TELEPORT_PASSIVE);
4129 teleport_player(100, TELEPORT_PASSIVE);
4133 teleport_player(200, TELEPORT_PASSIVE);
4143 lite_area(damroll(2, 3), 2);
4146 destroy_doors_touch();
4151 sleep_monsters_touch();
4155 trap_creation(p_ptr->y, p_ptr->x);
4164 aggravate_monsters(0);
4167 earthquake(p_ptr->y, p_ptr->x, 5);
4171 (void)gain_random_mutation(0);
4175 apply_disenchant(1);
4181 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4188 while (counter++ < 8)
4190 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4195 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4198 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4203 (void)activate_ty_curse(FALSE, &count);
4212 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4213 * / Drop 10+1d10 meteor ball at random places near the player
4218 void cast_meteor(HIT_POINT dam, POSITION rad)
4221 int b = 10 + randint1(10);
4223 for (i = 0; i < b; i++)
4225 POSITION y = 0, x = 0;
4228 for (count = 0; count <= 20; count++)
4232 x = p_ptr->x - 8 + randint0(17);
4233 y = p_ptr->y - 8 + randint0(17);
4235 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4236 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4238 /* Approximate distance */
4239 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4241 if (d >= 9) continue;
4243 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4244 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4246 /* Valid position */
4250 if (count > 20) continue;
4252 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4258 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4261 * @return ターゲットを指定し、実行したならばTRUEを返す。
4263 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4265 POSITION x, y, tx, ty;
4269 int b = 10 + randint1(10);
4271 if (!get_aim_dir(&dir)) return FALSE;
4273 /* Use the given direction */
4274 tx = p_ptr->x + 99 * ddx[dir];
4275 ty = p_ptr->y + 99 * ddy[dir];
4277 /* Hack -- Use an actual "target" */
4278 if ((dir == 5) && target_okay())
4289 /* Hack -- Stop at the target */
4290 if ((y == ty) && (x == tx)) break;
4294 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4296 /* Stop at maximum range */
4297 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4299 /* Stopped by walls/doors */
4300 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4302 /* Stopped by monsters */
4303 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4305 /* Save the new location */
4312 for (i = 0; i < b; i++)
4314 int count = 20, d = 0;
4320 x = tx - 5 + randint0(11);
4321 y = ty - 5 + randint0(11);
4323 dx = (tx > x) ? (tx - x) : (x - tx);
4324 dy = (ty > y) ? (ty - y) : (y - ty);
4326 /* Approximate distance */
4327 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4328 /* Within the radius */
4332 if (count < 0) continue;
4334 /* Cannot penetrate perm walls */
4335 if (!in_bounds(y, x) ||
4336 cave_stop_disintegration(y, x) ||
4337 !in_disintegration_range(ty, tx, y, x))
4340 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4347 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4351 * This spell should become more useful (more controlled) as the\n
4352 * player gains experience levels. Thus, add 1/5 of the player's\n
4353 * level to the die roll. This eliminates the worst effects later on,\n
4354 * while keeping the results quite random. It also allows some potent\n
4355 * effects only at high level.
4357 void cast_wonder(DIRECTION dir)
4359 PLAYER_LEVEL plev = p_ptr->lev;
4360 int die = randint1(100) + plev / 5;
4361 int vir = virtue_number(V_CHANCE);
4365 if (p_ptr->virtues[vir - 1] > 0)
4367 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4371 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4376 chg_virtue(V_CHANCE, 1);
4380 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4383 if (die < 8) clone_monster(dir);
4384 else if (die < 14) speed_monster(dir, plev);
4385 else if (die < 26) heal_monster(dir, damroll(4, 6));
4386 else if (die < 31) poly_monster(dir, plev);
4388 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4389 damroll(3 + ((plev - 1) / 5), 4));
4390 else if (die < 41) confuse_monster(dir, plev);
4391 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4392 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4394 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4395 damroll(3 + ((plev - 5) / 4), 8));
4397 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4398 damroll(5 + ((plev - 5) / 4), 8));
4400 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4401 damroll(6 + ((plev - 5) / 4), 8));
4403 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4404 damroll(8 + ((plev - 5) / 4), 8));
4405 else if (die < 76) hypodynamic_bolt(dir, 75);
4406 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4407 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4408 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4409 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4410 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4413 earthquake(p_ptr->y, p_ptr->x, 12);
4417 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4421 symbol_genocide(plev + 50, TRUE);
4423 else if (die < 110) dispel_monsters(120);
4426 dispel_monsters(150);
4427 slow_monsters(plev);
4428 sleep_monsters(plev);
4435 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4439 void cast_invoke_spirits(DIRECTION dir)
4441 PLAYER_LEVEL plev = p_ptr->lev;
4442 int die = randint1(100) + plev / 5;
4443 int vir = virtue_number(V_CHANCE);
4447 if (p_ptr->virtues[vir - 1] > 0)
4449 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4453 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4457 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4459 chg_virtue(V_CHANCE, 1);
4463 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4468 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4469 "Oh no! Mouldering forms rise from the earth around you!"));
4471 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4472 chg_virtue(V_UNLIFE, 1);
4476 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4478 set_afraid(p_ptr->afraid + randint1(4) + 4);
4482 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4483 "Your head is invaded by a horde of gibbering spectral voices..."));
4485 set_confused(p_ptr->confused + randint1(4) + 4);
4489 poly_monster(dir, plev);
4493 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4494 damroll(3 + ((plev - 1) / 5), 4));
4498 confuse_monster(dir, plev);
4502 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4506 (void)lite_line(dir, damroll(6, 8));
4510 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4511 damroll(3 + ((plev - 5) / 4), 8));
4515 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4516 damroll(5 + ((plev - 5) / 4), 8));
4520 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4521 damroll(6 + ((plev - 5) / 4), 8));
4525 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4526 damroll(8 + ((plev - 5) / 4), 8));
4530 hypodynamic_bolt(dir, 75);
4534 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4538 fire_ball(GF_ACID, dir, 40 + plev, 2);
4542 fire_ball(GF_ICE, dir, 70 + plev, 3);
4546 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4550 hypodynamic_bolt(dir, 100 + plev);
4554 earthquake(p_ptr->y, p_ptr->x, 12);
4558 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4562 symbol_genocide(plev + 50, TRUE);
4566 dispel_monsters(120);
4570 dispel_monsters(150);
4571 slow_monsters(plev);
4572 sleep_monsters(plev);
4578 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4579 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4584 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4587 void cast_shuffle(void)
4589 PLAYER_LEVEL plev = p_ptr->lev;
4592 int vir = virtue_number(V_CHANCE);
4595 /* Card sharks and high mages get a level bonus */
4596 if ((p_ptr->pclass == CLASS_ROGUE) ||
4597 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4598 (p_ptr->pclass == CLASS_SORCERER))
4599 die = (randint1(110)) + plev / 5;
4601 die = randint1(120);
4606 if (p_ptr->virtues[vir - 1] > 0)
4608 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4612 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4616 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4619 chg_virtue(V_CHANCE, 1);
4623 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4625 for (i = 0; i < randint1(3); i++)
4626 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4630 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4631 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4636 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4637 activate_ty_curse(FALSE, &count);
4641 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4642 aggravate_monsters(0);
4646 msg_print(_("《愚者》だ。", "It's the Fool."));
4652 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4653 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4657 msg_print(_("《月》だ。", "It's the Moon."));
4662 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4663 wild_magic(randint0(32));
4667 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4668 teleport_player(10, TELEPORT_PASSIVE);
4672 msg_print(_("《正義》だ。", "It's Justice."));
4673 set_blessed(p_ptr->lev, FALSE);
4677 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4678 teleport_player(100, TELEPORT_PASSIVE);
4682 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4683 teleport_player(200, TELEPORT_PASSIVE);
4687 msg_print(_("《塔》だ。", "It's the Tower."));
4692 msg_print(_("《節制》だ。", "It's Temperance."));
4693 sleep_monsters_touch();
4697 msg_print(_("《塔》だ。", "It's the Tower."));
4699 earthquake(p_ptr->y, p_ptr->x, 5);
4703 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4704 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4708 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4709 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4713 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4714 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4718 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4719 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4723 msg_print(_("《恋人》だ。", "It's the Lovers."));
4725 if (get_aim_dir(&dir))
4726 charm_monster(dir, MIN(p_ptr->lev, 20));
4730 msg_print(_("《隠者》だ。", "It's the Hermit."));
4735 msg_print(_("《審判》だ。", "It's the Judgement."));
4736 do_cmd_rerate(FALSE);
4737 lose_all_mutations();
4741 msg_print(_("《太陽》だ。", "It's the Sun."));
4742 chg_virtue(V_KNOWLEDGE, 1);
4743 chg_virtue(V_ENLIGHTEN, 1);
4748 msg_print(_("《世界》だ。", "It's the World."));
4749 if (p_ptr->exp < PY_MAX_EXP)
4751 s32b ee = (p_ptr->exp / 25) + 1;
4752 if (ee > 5000) ee = 5000;
4753 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4759 bool_hack life_stream(bool_hack message, bool_hack virtue)
4763 chg_virtue(V_VITALITY, 1);
4764 chg_virtue(V_UNLIFE, -5);
4768 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4771 (void)set_poisoned(0);
4773 (void)set_confused(0);
4777 (void)restore_all_status();
4778 (void)set_shero(0, TRUE);
4785 bool_hack heroism(int base)
4787 bool_hack ident = FALSE;
4788 if(set_afraid(0)) ident = TRUE;
4789 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4790 if(hp_player(10)) ident = TRUE;
4794 bool_hack berserk(int base)
4796 bool_hack ident = FALSE;
4797 if (set_afraid(0)) ident = TRUE;
4798 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4799 if (hp_player(30)) ident = TRUE;
4803 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4805 bool_hack ident = FALSE;
4806 if (hp_player(damroll(dice, sides))) ident = TRUE;
4807 if (set_blind(0)) ident = TRUE;
4808 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4809 if (set_shero(0, TRUE)) ident = TRUE;
4813 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4815 bool_hack ident = FALSE;
4816 if (hp_player(damroll(dice, sides))) ident = TRUE;
4817 if (set_blind(0)) ident = TRUE;
4818 if (set_confused(0)) ident = TRUE;
4819 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4820 if (set_shero(0, TRUE)) ident = TRUE;
4824 bool_hack cure_critical_wounds(HIT_POINT pow)
4826 bool_hack ident = FALSE;
4827 if (hp_player(pow)) ident = TRUE;
4828 if (set_blind(0)) ident = TRUE;
4829 if (set_confused(0)) ident = TRUE;
4830 if (set_poisoned(0)) ident = TRUE;
4831 if (set_stun(0)) ident = TRUE;
4832 if (set_cut(0)) ident = TRUE;
4833 if (set_shero(0, TRUE)) ident = TRUE;
4837 bool_hack true_healing(HIT_POINT pow)
4839 bool_hack ident = FALSE;
4840 if (hp_player(pow)) ident = TRUE;
4841 if (set_blind(0)) ident = TRUE;
4842 if (set_confused(0)) ident = TRUE;
4843 if (set_poisoned(0)) ident = TRUE;
4844 if (set_stun(0)) ident = TRUE;
4845 if (set_cut(0)) ident = TRUE;
4846 if (set_image(0)) ident = TRUE;
4850 bool_hack restore_mana(bool_hack magic_eater)
4852 bool_hack ident = FALSE;
4854 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4857 for (i = 0; i < EATER_EXT * 2; i++)
4859 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4860 if (p_ptr->magic_num1[i] > p_ptr->magic_num2[i] * EATER_CHARGE) p_ptr->magic_num1[i] = p_ptr->magic_num2[i] * EATER_CHARGE;
4862 for (; i < EATER_EXT * 3; i++)
4864 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4865 p_ptr->magic_num1[i] -= ((p_ptr->magic_num2[i] < 10) ? EATER_ROD_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_ROD_CHARGE / 3)*k_info[k_idx].pval;
4866 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4868 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4869 p_ptr->window |= (PW_PLAYER);
4872 else if (p_ptr->csp < p_ptr->msp)
4874 p_ptr->csp = p_ptr->msp;
4875 p_ptr->csp_frac = 0;
4876 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4877 p_ptr->redraw |= (PR_MANA);
4878 p_ptr->window |= (PW_PLAYER);
4879 p_ptr->window |= (PW_SPELL);
4886 bool restore_all_status(void)
4889 if (do_res_stat(A_STR)) ident = TRUE;
4890 if (do_res_stat(A_INT)) ident = TRUE;
4891 if (do_res_stat(A_WIS)) ident = TRUE;
4892 if (do_res_stat(A_DEX)) ident = TRUE;
4893 if (do_res_stat(A_CON)) ident = TRUE;
4894 if (do_res_stat(A_CHR)) ident = TRUE;
4899 * @brief 口を使う継続的な処理を中断する
4902 void stop_mouth(void)
4904 if (music_singing_any()) stop_singing();
4905 if (hex_spelling_any()) stop_hex_spell_all();
4909 bool_hack vampirism(void)
4916 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4918 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4922 /* Only works on adjacent monsters */
4923 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4924 y = p_ptr->y + ddy[dir];
4925 x = p_ptr->x + ddx[dir];
4926 c_ptr = &cave[y][x];
4930 if (!(c_ptr->m_idx))
4932 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4936 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4938 dummy = p_ptr->lev * 2;
4940 if (hypodynamic_bolt(dir, dummy))
4942 if (p_ptr->food < PY_FOOD_FULL)
4943 /* No heal if we are "full" */
4944 (void)hp_player(dummy);
4946 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4948 /* Gain nutritional sustenance: 150/hp drained */
4949 /* A Food ration gives 5000 food points (by contrast) */
4950 /* Don't ever get more than "Full" this way */
4951 /* But if we ARE Gorged, it won't cure us */
4952 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4953 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4954 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4957 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4961 bool panic_hit(void)
4966 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4967 y = p_ptr->y + ddy[dir];
4968 x = p_ptr->x + ddx[dir];
4969 if (cave[y][x].m_idx)
4972 if (randint0(p_ptr->skill_dis) < 7)
4973 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4975 teleport_player(30, 0L);
4980 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4988 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4991 * currently this function allows pseudo-id of any object,
4992 * including silly ones like potions & scrolls, which always
4993 * get '{average}'. This should be changed, either to stop such
4994 * items from being pseudo-id'd, or to allow psychometry to
4995 * detect whether the unidentified potion/scroll/etc is
4996 * good (Cure Light Wounds, Restore Strength, etc) or
4997 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4999 bool psychometry(void)
5003 char o_name[MAX_NLEN];
5008 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5009 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5011 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT))) return (FALSE);
5013 /* Get the item (in the pack) */
5016 o_ptr = &inventory[item];
5019 /* Get the item (on the floor) */
5022 o_ptr = &o_list[0 - item];
5025 /* It is fully known, no information needed */
5026 if (object_is_known(o_ptr))
5028 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5032 /* Check for a feeling */
5033 feel = value_check_aux1(o_ptr);
5035 /* Get an object description */
5036 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5038 /* Skip non-feelings */
5041 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5046 msg_format("%sは%sという感じがする...",
5047 o_name, game_inscriptions[feel]);
5049 msg_format("You feel that the %s %s %s...",
5050 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5051 game_inscriptions[feel]);
5055 /* We have "felt" it */
5056 o_ptr->ident |= (IDENT_SENSE);
5059 o_ptr->feeling = feel;
5061 /* Player touches it */
5062 o_ptr->marked |= OM_TOUCHED;
5064 /* Combine / Reorder the pack (later) */
5065 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5067 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5069 /* Valid "tval" codes */
5070 switch (o_ptr->tval)
5098 /* Auto-inscription/destroy */
5099 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5101 /* Something happened */