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_hack(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_hack(GF_OLD_SPEED, p_ptr->lev));
828 * @brief 視界内モンスターを加速する処理 / Slow monsters
829 * @return 効力があった場合TRUEを返す
831 bool slow_monsters(int power)
833 return (project_hack(GF_OLD_SLOW, power));
837 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
838 * @return 効力があった場合TRUEを返す
840 bool sleep_monsters(int power)
842 return (project_hack(GF_OLD_SLEEP, power));
846 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
847 * @return 効力があった場合TRUEを返す
849 bool banish_evil(int dist)
851 return (project_hack(GF_AWAY_EVIL, dist));
855 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
856 * @return 効力があった場合TRUEを返す
858 bool turn_undead(void)
860 bool tester = (project_hack(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_hack(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_hack(GF_DISP_EVIL, dam));
888 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
889 * @return 効力があった場合TRUEを返す
891 bool dispel_good(HIT_POINT dam)
893 return (project_hack(GF_DISP_GOOD, dam));
897 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
898 * @return 効力があった場合TRUEを返す
900 bool dispel_monsters(HIT_POINT dam)
902 return (project_hack(GF_DISP_ALL, dam));
906 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
907 * @return 効力があった場合TRUEを返す
909 bool dispel_living(HIT_POINT dam)
911 return (project_hack(GF_DISP_LIVING, dam));
915 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
916 * @return 効力があった場合TRUEを返す
918 bool dispel_demons(HIT_POINT dam)
920 return (project_hack(GF_DISP_DEMON, dam));
924 * @brief 視界内のモンスターに「聖戦」効果を与える処理
925 * @return 効力があった場合TRUEを返す
929 return (project_hack(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;
1106 result |= genocide_aux(i, power, player_cast, 4, _("抹殺", "Genocide"));
1111 chg_virtue(V_VITALITY, -2);
1112 chg_virtue(V_CHANCE, -1);
1120 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1121 * @param power 抹殺の威力
1122 * @param player_cast プレイヤーの魔法によるものならば TRUE
1123 * @return 効力があった場合TRUEを返す
1125 bool mass_genocide(int power, bool player_cast)
1128 bool result = FALSE;
1130 /* Prevent mass genocide in quest levels */
1131 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1136 /* Delete the (nearby) monsters */
1137 for (i = 1; i < m_max; i++)
1139 monster_type *m_ptr = &m_list[i];
1141 /* Paranoia -- Skip dead monsters */
1142 if (!m_ptr->r_idx) continue;
1144 /* Skip distant monsters */
1145 if (m_ptr->cdis > MAX_SIGHT) continue;
1148 result |= genocide_aux(i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1153 chg_virtue(V_VITALITY, -2);
1154 chg_virtue(V_CHANCE, -1);
1162 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1163 * @param power 抹殺の威力
1164 * @param player_cast プレイヤーの魔法によるものならば TRUE
1165 * @return 効力があった場合TRUEを返す
1167 bool mass_genocide_undead(int power, bool player_cast)
1170 bool result = FALSE;
1172 /* Prevent mass genocide in quest levels */
1173 if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
1178 /* Delete the (nearby) monsters */
1179 for (i = 1; i < m_max; i++)
1181 monster_type *m_ptr = &m_list[i];
1182 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1184 /* Paranoia -- Skip dead monsters */
1185 if (!m_ptr->r_idx) continue;
1187 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1189 /* Skip distant monsters */
1190 if (m_ptr->cdis > MAX_SIGHT) continue;
1193 result |= genocide_aux(i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1198 chg_virtue(V_UNLIFE, -2);
1199 chg_virtue(V_CHANCE, -1);
1207 * @brief 周辺モンスターを調査する / Probe nearby monsters
1208 * @return 効力があった場合TRUEを返す
1213 int speed; /* TODO */
1224 /* Probe all (nearby) monsters */
1225 for (i = 1; i < m_max; i++)
1227 monster_type *m_ptr = &m_list[i];
1228 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1230 /* Paranoia -- Skip dead monsters */
1231 if (!m_ptr->r_idx) continue;
1233 /* Require line of sight */
1234 if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
1236 /* Probe visible monsters */
1241 /* Start the message */
1244 msg_print(_("調査中...", "Probing..."));
1249 if (!is_original_ap(m_ptr))
1251 if (m_ptr->mflag2 & MFLAG2_KAGE)
1252 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1254 m_ptr->ap_r_idx = m_ptr->r_idx;
1255 lite_spot(m_ptr->fy, m_ptr->fx);
1257 /* Get "the monster" or "something" */
1258 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1260 speed = m_ptr->mspeed - 110;
1261 if (MON_FAST(m_ptr)) speed += 10;
1262 if (MON_SLOW(m_ptr)) speed -= 10;
1263 if (ironman_nightmare) speed += 5;
1265 /* Get the monster's alignment */
1266 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1267 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1268 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1269 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
1270 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1271 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1272 else align = _("中立", "neutral");
1274 /* Describe the monster */
1275 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1276 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1278 if (r_ptr->next_r_idx)
1280 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1284 strcat(buf, "xxx ");
1287 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1288 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1289 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1290 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1291 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1292 buf[strlen(buf)-1] = '\0';
1295 /* HACK : Add the line to message buffer */
1298 p_ptr->window |= (PW_MESSAGE);
1301 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1304 Term_erase(0, 0, 255);
1306 /* Learn everything about this monster */
1307 if (lore_do_probe(m_ptr->r_idx))
1309 /* Get base name of monster */
1310 strcpy(buf, (r_name + r_ptr->name));
1313 /* Note that we learnt some new flags -Mogami- */
1314 msg_format("%sについてさらに詳しくなった気がする。", buf);
1319 /* Note that we learnt some new flags -Mogami- */
1320 msg_format("You now know more about %s.", buf);
1322 /* Clear -more- prompt */
1337 chg_virtue(V_KNOWLEDGE, 1);
1338 msg_print(_("これで全部です。", "That's all."));
1346 * @brief *破壊*処理を行う / The spell of destruction
1347 * @param y1 破壊の中心Y座標
1348 * @param x1 破壊の中心X座標
1350 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1351 * @return 効力があった場合TRUEを返す
1354 * This spell "deletes" monsters (instead of "killing" them).
1356 * Later we may use one function for both "destruction" and
1357 * "earthquake" by using the "full" to select "destruction".
1360 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1367 /* Prevent destruction of quest levels and town */
1368 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1373 /* Lose monster light */
1374 if (!in_generate) clear_mon_lite();
1376 /* Big area of affect */
1377 for (y = (y1 - r); y <= (y1 + r); y++)
1379 for (x = (x1 - r); x <= (x1 + r); x++)
1381 /* Skip illegal grids */
1382 if (!in_bounds(y, x)) continue;
1384 /* Extract the distance */
1385 k = distance(y1, x1, y, x);
1387 /* Stay in the circle of death */
1388 if (k > r) continue;
1389 c_ptr = &cave[y][x];
1391 /* Lose room and vault */
1392 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1394 /* Lose light and knowledge */
1395 c_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1397 if (!in_generate) /* Normal */
1400 c_ptr->info &= ~(CAVE_UNSAFE);
1402 /* Hack -- Notice player affect */
1403 if (player_bold(y, x))
1405 /* Hurt the player later */
1408 /* Do not hurt this grid */
1413 /* Hack -- Skip the epicenter */
1414 if ((y == y1) && (x == x1)) continue;
1418 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1419 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1421 if (in_generate) /* In generation */
1423 /* Delete the monster (if any) */
1424 delete_monster(y, x);
1426 else if (r_ptr->flags1 & RF1_QUESTOR)
1428 /* Heal the monster */
1429 m_ptr->hp = m_ptr->maxhp;
1431 /* Try to teleport away quest monsters */
1432 if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1436 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1440 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1441 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1444 /* Delete the monster (if any) */
1445 delete_monster(y, x);
1449 /* During generation, destroyed artifacts are "preserved" */
1450 if (preserve_mode || in_generate)
1452 OBJECT_IDX this_o_idx, next_o_idx = 0;
1454 /* Scan all objects in the grid */
1455 for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1458 o_ptr = &o_list[this_o_idx];
1460 /* Acquire next object */
1461 next_o_idx = o_ptr->next_o_idx;
1463 /* Hack -- Preserve unknown artifacts */
1464 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1466 /* Mega-Hack -- Preserve the artifact */
1467 a_info[o_ptr->name1].cur_num = 0;
1469 if (in_generate && cheat_peek)
1471 char o_name[MAX_NLEN];
1472 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1473 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1476 else if (in_generate && cheat_peek && o_ptr->art_name)
1478 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1479 "One of the random artifacts was *destroyed* during generation."));
1484 /* Delete objects */
1485 delete_object(y, x);
1487 /* Destroy "non-permanent" grids */
1488 if (!cave_perma_grid(c_ptr))
1490 /* Wall (or floor) type */
1493 if (!in_generate) /* Normal */
1497 /* Create granite wall */
1498 cave_set_feat(y, x, feat_granite);
1502 /* Create quartz vein */
1503 cave_set_feat(y, x, feat_quartz_vein);
1507 /* Create magma vein */
1508 cave_set_feat(y, x, feat_magma_vein);
1513 cave_set_feat(y, x, floor_type[randint0(100)]);
1516 else /* In generation */
1520 /* Create granite wall */
1521 place_extra_grid(c_ptr);
1525 /* Create quartz vein */
1526 c_ptr->feat = feat_quartz_vein;
1530 /* Create magma vein */
1531 c_ptr->feat = feat_magma_vein;
1536 place_floor_grid(c_ptr);
1539 /* Clear garbage of hidden trap or door */
1548 /* Process "re-glowing" */
1549 for (y = (y1 - r); y <= (y1 + r); y++)
1551 for (x = (x1 - r); x <= (x1 + r); x++)
1553 /* Skip illegal grids */
1554 if (!in_bounds(y, x)) continue;
1556 /* Extract the distance */
1557 k = distance(y1, x1, y, x);
1559 /* Stay in the circle of death */
1560 if (k > r) continue;
1561 c_ptr = &cave[y][x];
1563 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
1564 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
1569 for (i = 0; i < 9; i++)
1571 yy = y + ddy_ddd[i];
1572 xx = x + ddx_ddd[i];
1573 if (!in_bounds2(yy, xx)) continue;
1574 cc_ptr = &cave[yy][xx];
1575 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1577 c_ptr->info |= CAVE_GLOW;
1585 /* Hack -- Affect player */
1588 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1590 /* Blind the player */
1591 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1594 (void)set_blind(p_ptr->blind + 10 + randint1(10));
1600 /* Mega-Hack -- Forget the view and lite */
1601 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
1603 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1605 p_ptr->redraw |= (PR_MAP);
1607 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1609 if (p_ptr->special_defense & NINJA_S_STEALTH)
1611 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1621 * @brief 地震処理(サブルーチン) /
1622 * Induce an "earthquake" of the given radius at the given location.
1623 * @return 効力があった場合TRUEを返す
1627 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1631 * This will turn some walls into floors and some floors into walls.
1633 * The player will take damage and "jump" into a safe grid if possible,
1634 * otherwise, he will "tunnel" through the rubble instantaneously.
1636 * Monsters will take damage, and "jump" into a safe grid if possible,
1637 * otherwise they will be "buried" in the rubble, disappearing from
1638 * the level in the same way that they do when genocided.
1640 * Note that thus the player and monsters (except eaters of walls and
1641 * passers through walls) will never occupy the same grid as a wall.
1642 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1643 * for a single turn, unless that monster can pass_walls or kill_walls.
1644 * This has allowed massive simplification of the "monster" code.
1647 bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1651 POSITION y, x, yy, xx, dy, dx;
1654 POSITION sy = 0, sx = 0;
1660 /* Prevent destruction of quest levels and town */
1661 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !dun_level)
1666 /* Paranoia -- Enforce maximum range */
1669 /* Clear the "maximal blast" area */
1670 for (y = 0; y < 32; y++)
1672 for (x = 0; x < 32; x++)
1678 /* Check around the epicenter */
1679 for (dy = -r; dy <= r; dy++)
1681 for (dx = -r; dx <= r; dx++)
1683 /* Extract the location */
1687 /* Skip illegal grids */
1688 if (!in_bounds(yy, xx)) continue;
1690 /* Skip distant grids */
1691 if (distance(cy, cx, yy, xx) > r) continue;
1692 c_ptr = &cave[yy][xx];
1694 /* Lose room and vault */
1695 c_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1697 /* Lose light and knowledge */
1698 c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1700 /* Skip the epicenter */
1701 if (!dx && !dy) continue;
1703 /* Skip most grids */
1704 if (randint0(100) < 85) continue;
1706 /* Damage this grid */
1707 map[16+yy-cy][16+xx-cx] = TRUE;
1709 /* Hack -- Take note of player damage */
1710 if (player_bold(yy, xx)) hurt = TRUE;
1714 /* First, affect the player (if necessary) */
1715 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1717 /* Check around the player */
1718 for (i = 0; i < 8; i++)
1720 /* Access the location */
1721 y = p_ptr->y + ddy_ddd[i];
1722 x = p_ptr->x + ddx_ddd[i];
1724 /* Skip non-empty grids */
1725 if (!cave_empty_bold(y, x)) continue;
1727 /* Important -- Skip "quake" grids */
1728 if (map[16+y-cy][16+x-cx]) continue;
1730 if (cave[y][x].m_idx) continue;
1732 /* Count "safe" grids */
1735 /* Randomize choice */
1736 if (randint0(sn) > 0) continue;
1738 /* Save the safe location */
1742 /* Random message */
1743 switch (randint1(3))
1747 msg_print(_("ダンジョンの壁が崩れた!", "The cave ceiling collapses!"));
1752 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The cave floor twists in an unnatural way!"));
1757 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The cave quakes! You are pummeled with debris!"));
1762 /* Hurt the player a lot */
1765 /* Message and damage */
1766 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1770 /* Destroy the grid, and push the player to safety */
1773 /* Calculate results */
1774 switch (randint1(3))
1778 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1784 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1785 damage = damroll(10, 4);
1786 (void)set_stun(p_ptr->stun + randint1(50));
1791 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1792 damage = damroll(10, 4);
1793 (void)set_stun(p_ptr->stun + randint1(50));
1798 /* Move the player to the safe location */
1799 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1802 /* Important -- no wall on player */
1803 map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1812 monster_type *m_ptr = &m_list[m_idx];
1814 /* Get the monster's real name */
1815 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1817 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1821 killer = _("地震", "an earthquake");
1824 take_hit(DAMAGE_ATTACK, damage, killer, -1);
1828 /* Examine the quaked region */
1829 for (dy = -r; dy <= r; dy++)
1831 for (dx = -r; dx <= r; dx++)
1833 /* Extract the location */
1837 /* Skip unaffected grids */
1838 if (!map[16+yy-cy][16+xx-cx]) continue;
1839 c_ptr = &cave[yy][xx];
1841 if (c_ptr->m_idx == p_ptr->riding) continue;
1843 /* Process monsters */
1846 monster_type *m_ptr = &m_list[c_ptr->m_idx];
1847 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1849 /* Quest monsters */
1850 if (r_ptr->flags1 & RF1_QUESTOR)
1852 /* No wall on quest monsters */
1853 map[16+yy-cy][16+xx-cx] = FALSE;
1858 /* Most monsters cannot co-exist with rock */
1859 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1860 !(r_ptr->flags2 & (RF2_PASS_WALL)))
1864 /* Assume not safe */
1867 /* Monster can move to escape the wall */
1868 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1870 /* Look for safety */
1871 for (i = 0; i < 8; i++)
1873 y = yy + ddy_ddd[i];
1874 x = xx + ddx_ddd[i];
1876 /* Skip non-empty grids */
1877 if (!cave_empty_bold(y, x)) continue;
1879 /* Hack -- no safety on glyph of warding */
1880 if (is_glyph_grid(&cave[y][x])) continue;
1881 if (is_explosive_rune_grid(&cave[y][x])) continue;
1883 /* ... nor on the Pattern */
1884 if (pattern_tile(y, x)) continue;
1886 /* Important -- Skip "quake" grids */
1887 if (map[16+y-cy][16+x-cx]) continue;
1889 if (cave[y][x].m_idx) continue;
1890 if (player_bold(y, x)) continue;
1892 /* Count "safe" grids */
1895 /* Randomize choice */
1896 if (randint0(sn) > 0) continue;
1898 /* Save the safe grid */
1903 /* Describe the monster */
1904 monster_desc(m_name, m_ptr, 0);
1906 /* Scream in pain */
1907 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1909 /* Take damage from the quake */
1910 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1912 /* Monster is certainly awake */
1913 (void)set_monster_csleep(c_ptr->m_idx, 0);
1915 /* Apply damage directly */
1916 m_ptr->hp -= damage;
1918 /* Delete (not kill) "dead" monsters */
1921 if (!ignore_unview || is_seen(m_ptr))
1922 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1926 if (record_named_pet && is_pet(&m_list[c_ptr->m_idx]) && m_list[c_ptr->m_idx].nickname)
1930 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1931 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1936 delete_monster(yy, xx);
1938 /* No longer safe */
1942 /* Hack -- Escape from the rock */
1945 IDX m_idx_aux = cave[yy][xx].m_idx;
1947 /* Update the old location */
1948 cave[yy][xx].m_idx = 0;
1950 /* Update the new location */
1951 cave[sy][sx].m_idx = m_idx_aux;
1953 /* Move the monster */
1957 /* Update the monster (new location) */
1958 update_monster(m_idx, TRUE);
1960 /* Redraw the old grid */
1963 /* Redraw the new grid */
1971 /* Lose monster light */
1974 /* Examine the quaked region */
1975 for (dy = -r; dy <= r; dy++)
1977 for (dx = -r; dx <= r; dx++)
1979 /* Extract the location */
1983 /* Skip unaffected grids */
1984 if (!map[16+yy-cy][16+xx-cx]) continue;
1986 /* Access the cave grid */
1987 c_ptr = &cave[yy][xx];
1989 /* Paranoia -- never affect player */
1990 /* if (player_bold(yy, xx)) continue; */
1992 /* Destroy location (if valid) */
1993 if (cave_valid_bold(yy, xx))
1995 /* Delete objects */
1996 delete_object(yy, xx);
1998 /* Wall (or floor) type */
1999 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
2004 /* Create granite wall */
2005 cave_set_feat(yy, xx, feat_granite);
2011 /* Create quartz vein */
2012 cave_set_feat(yy, xx, feat_quartz_vein);
2018 /* Create magma vein */
2019 cave_set_feat(yy, xx, feat_magma_vein);
2026 cave_set_feat(yy, xx, floor_type[randint0(100)]);
2033 /* Process "re-glowing" */
2034 for (dy = -r; dy <= r; dy++)
2036 for (dx = -r; dx <= r; dx++)
2038 /* Extract the location */
2042 /* Skip illegal grids */
2043 if (!in_bounds(yy, xx)) continue;
2045 /* Skip distant grids */
2046 if (distance(cy, cx, yy, xx) > r) continue;
2047 c_ptr = &cave[yy][xx];
2049 if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
2050 else if (!(d_info[dungeon_type].flags1 & DF1_DARKNESS))
2055 for (ii = 0; ii < 9; ii++)
2057 yyy = yy + ddy_ddd[ii];
2058 xxx = xx + ddx_ddd[ii];
2059 if (!in_bounds2(yyy, xxx)) continue;
2060 cc_ptr = &cave[yyy][xxx];
2061 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2063 c_ptr->info |= CAVE_GLOW;
2072 /* Mega-Hack -- Forget the view and lite */
2073 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
2075 p_ptr->update |= (PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2077 /* Update the health bar */
2078 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH);
2080 p_ptr->redraw |= (PR_MAP);
2082 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2084 if (p_ptr->special_defense & NINJA_S_STEALTH)
2086 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2094 * @brief 地震処理(プレイヤーの中心発動) /
2095 * Induce an "earthquake" of the given radius at the given location.
2096 * @return 効力があった場合TRUEを返す
2101 bool earthquake(POSITION cy, POSITION cx, POSITION r)
2103 return earthquake_aux(cy, cx, r, 0);
2110 void discharge_minion(void)
2115 for (i = 1; i < m_max; i++)
2117 monster_type *m_ptr = &m_list[i];
2118 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2119 if (m_ptr->nickname) okay = FALSE;
2121 if (!okay || p_ptr->riding)
2123 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
2126 for (i = 1; i < m_max; i++)
2129 monster_type *m_ptr = &m_list[i];
2130 monster_race *r_ptr;
2132 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
2133 r_ptr = &r_info[m_ptr->r_idx];
2135 /* Uniques resist discharging */
2136 if (r_ptr->flags1 & RF1_UNIQUE)
2139 monster_desc(m_name, m_ptr, 0x00);
2140 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
2141 delete_monster_idx(i);
2144 dam = m_ptr->maxhp / 2;
2145 if (dam > 100) dam = (dam-100)/2 + 100;
2146 if (dam > 400) dam = (dam-400)/2 + 400;
2147 if (dam > 800) dam = 800;
2148 project(i, 2+(r_ptr->level/20), m_ptr->fy,
2149 m_ptr->fx, dam, GF_PLASMA,
2150 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
2152 if (record_named_pet && m_ptr->nickname)
2156 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
2157 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
2160 delete_monster_idx(i);
2166 * @brief 部屋全体を照らすサブルーチン
2170 * This routine clears the entire "temp" set.
2171 * This routine will Perma-Lite all "temp" grids.
2172 * This routine is used (only) by "lite_room()"
2173 * Dark grids are illuminated.
2174 * Also, process all affected monsters.
2176 * SMART monsters always wake up when illuminated
2177 * NORMAL monsters wake up 1/4 the time when illuminated
2178 * STUPID monsters wake up 1/10 the time when illuminated
2181 static void cave_temp_room_lite(void)
2185 /* Clear them all */
2186 for (i = 0; i < temp_n; i++)
2188 POSITION y = temp_y[i];
2189 POSITION x = temp_x[i];
2191 cave_type *c_ptr = &cave[y][x];
2193 /* No longer in the array */
2194 c_ptr->info &= ~(CAVE_TEMP);
2196 /* Update only non-CAVE_GLOW grids */
2197 /* if (c_ptr->info & (CAVE_GLOW)) continue; */
2200 c_ptr->info |= (CAVE_GLOW);
2202 /* Process affected monsters */
2207 monster_type *m_ptr = &m_list[c_ptr->m_idx];
2209 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2210 update_monster(c_ptr->m_idx, FALSE);
2212 /* Stupid monsters rarely wake up */
2213 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
2215 /* Smart monsters always wake up */
2216 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
2218 /* Sometimes monsters wake up */
2219 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
2222 (void)set_monster_csleep(c_ptr->m_idx, 0);
2224 /* Notice the "waking up" */
2228 monster_desc(m_name, m_ptr, 0);
2229 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
2239 update_local_illumination(y, x);
2249 * @brief 部屋全体を暗くするサブルーチン
2253 * This routine clears the entire "temp" set.
2254 * This routine will "darken" all "temp" grids.
2255 * In addition, some of these grids will be "unmarked".
2256 * This routine is used (only) by "unlite_room()"
2257 * Also, process all affected monsters
2260 static void cave_temp_room_unlite(void)
2264 /* Clear them all */
2265 for (i = 0; i < temp_n; i++)
2267 POSITION y = temp_y[i];
2268 POSITION x = temp_x[i];
2271 cave_type *c_ptr = &cave[y][x];
2272 bool do_dark = !is_mirror_grid(c_ptr);
2274 /* No longer in the array */
2275 c_ptr->info &= ~(CAVE_TEMP);
2277 /* Darken the grid */
2280 if (dun_level || !is_daytime())
2282 for (j = 0; j < 9; j++)
2284 int by = y + ddy_ddd[j];
2285 int bx = x + ddx_ddd[j];
2287 if (in_bounds2(by, bx))
2289 cave_type *cc_ptr = &cave[by][bx];
2291 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2299 if (!do_dark) continue;
2302 c_ptr->info &= ~(CAVE_GLOW);
2304 /* Hack -- Forget "boring" grids */
2305 if (!have_flag(f_info[get_feat_mimic(c_ptr)].flags, FF_REMEMBER))
2307 /* Forget the grid */
2308 if (!view_torch_grids) c_ptr->info &= ~(CAVE_MARK);
2313 /* Process affected monsters */
2316 update_monster(c_ptr->m_idx, FALSE);
2321 update_local_illumination(y, x);
2331 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2334 * @param pass_bold 地形条件を返す関数ポインタ
2337 static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2344 for (i = 0; i < 16; i++)
2346 y = cy + ddy_cdd[i % 8];
2347 x = cx + ddx_cdd[i % 8];
2349 /* Found a wall, break the length */
2350 if (!pass_bold(y, x))
2352 /* Track best length */
2366 return (MAX(len, blen));
2370 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
2373 * @param pass_bold 地形条件を返す関数ポインタ
2376 static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
2382 for (i = 0; i < 8; i++)
2384 y = cy + ddy_ddd[i];
2385 x = cx + ddx_ddd[i];
2387 if (!pass_bold(y, x)) c++;
2395 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数temp_nに返す / Aux function -- see below
2396 * @param y 部屋内のy座標1点
2397 * @param x 部屋内のx座標1点
2398 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
2399 * @param pass_bold 地形条件を返す関数ポインタ
2402 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
2407 c_ptr = &cave[y][x];
2409 /* Avoid infinite recursion */
2410 if (c_ptr->info & (CAVE_TEMP)) return;
2412 /* Do not "leave" the current room */
2413 if (!(c_ptr->info & (CAVE_ROOM)))
2415 if (only_room) return;
2418 if (!in_bounds2(y, x)) return;
2420 /* Do not exceed the maximum spell range */
2421 if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
2423 /* Verify this grid */
2425 * The reason why it is ==6 instead of >5 is that 8 is impossible
2426 * due to the check for cave_bold above.
2427 * 7 lights dead-end corridors (you need to do this for the
2428 * checkboard interesting rooms, so that the boundary is lit
2430 * This leaves only a check for 6 bounding walls!
2432 if (in_bounds(y, x) && pass_bold(y, x) &&
2433 (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
2436 /* Paranoia -- verify space */
2437 if (temp_n == TEMP_MAX) return;
2439 /* Mark the grid as "seen" */
2440 c_ptr->info |= (CAVE_TEMP);
2442 /* Add it to the "seen" set */
2449 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
2452 * @return 光を通すならばtrueを返す。
2454 static bool cave_pass_lite_bold(POSITION y, POSITION x)
2456 return cave_los_bold(y, x);
2460 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数temp_nに返す / Aux function -- see below
2465 static void cave_temp_lite_room_aux(POSITION y, POSITION x)
2467 cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
2471 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
2474 * @return 射線を通すならばtrueを返す。
2476 static bool cave_pass_dark_bold(POSITION y, POSITION x)
2478 return cave_have_flag_bold(y, x, FF_PROJECT);
2483 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数temp_nに返す / Aux function -- see below
2488 static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
2490 cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
2495 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
2500 void lite_room(POSITION y1, POSITION x1)
2505 /* Add the initial grid */
2506 cave_temp_lite_room_aux(y1, x1);
2508 /* While grids are in the queue, add their neighbors */
2509 for (i = 0; i < temp_n; i++)
2511 x = temp_x[i], y = temp_y[i];
2513 /* Walls get lit, but stop light */
2514 if (!cave_pass_lite_bold(y, x)) continue;
2516 /* Spread adjacent */
2517 cave_temp_lite_room_aux(y + 1, x);
2518 cave_temp_lite_room_aux(y - 1, x);
2519 cave_temp_lite_room_aux(y, x + 1);
2520 cave_temp_lite_room_aux(y, x - 1);
2522 /* Spread diagonal */
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);
2526 cave_temp_lite_room_aux(y + 1, x - 1);
2529 /* Now, lite them all up at once */
2530 cave_temp_room_lite();
2532 if (p_ptr->special_defense & NINJA_S_STEALTH)
2534 if (cave[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2540 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
2545 void unlite_room(POSITION y1, POSITION x1)
2550 /* Add the initial grid */
2551 cave_temp_unlite_room_aux(y1, x1);
2553 /* Spread, breadth first */
2554 for (i = 0; i < temp_n; i++)
2556 x = temp_x[i], y = temp_y[i];
2558 /* Walls get dark, but stop darkness */
2559 if (!cave_pass_dark_bold(y, x)) continue;
2561 /* Spread adjacent */
2562 cave_temp_unlite_room_aux(y + 1, x);
2563 cave_temp_unlite_room_aux(y - 1, x);
2564 cave_temp_unlite_room_aux(y, x + 1);
2565 cave_temp_unlite_room_aux(y, x - 1);
2567 /* Spread diagonal */
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);
2571 cave_temp_unlite_room_aux(y + 1, x - 1);
2574 /* Now, darken them all at once */
2575 cave_temp_room_unlite();
2581 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2584 * @return 作用が実際にあった場合TRUEを返す
2586 bool lite_area(HIT_POINT dam, POSITION rad)
2588 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2590 if (d_info[dungeon_type].flags1 & DF1_DARKNESS)
2592 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
2596 /* Hack -- Message */
2599 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
2602 /* Hook into the "project()" function */
2603 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
2605 /* Lite up the room */
2606 lite_room(p_ptr->y, p_ptr->x);
2614 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
2617 * @return 作用が実際にあった場合TRUEを返す
2619 bool unlite_area(HIT_POINT dam, POSITION rad)
2621 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
2623 /* Hack -- Message */
2626 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2629 /* Hook into the "project()" function */
2630 (void)project(0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2632 /* Lite up the room */
2633 unlite_room(p_ptr->y, p_ptr->x);
2642 * @brief ボール系スペルの発動 / Cast a ball spell
2644 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2647 * @return 作用が実際にあった場合TRUEを返す
2650 * Stop if we hit a monster, act as a "ball"
2651 * Allow "target" mode to pass over monsters
2652 * Affect grids, objects, and monsters
2655 bool fire_ball(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2659 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2661 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2662 /* Use the given direction */
2663 tx = p_ptr->x + 99 * ddx[dir];
2664 ty = p_ptr->y + 99 * ddy[dir];
2666 /* Hack -- Use an actual "target" */
2667 if ((dir == 5) && target_okay())
2669 flg &= ~(PROJECT_STOP);
2674 /* Analyze the "dir" and the "target". Hurt items on floor. */
2675 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2679 * @brief ブレス系スペルの発動 / Cast a breath spell
2681 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2684 * @return 作用が実際にあった場合TRUEを返す
2687 * Stop if we hit a monster, act as a "ball"
2688 * Allow "target" mode to pass over monsters
2689 * Affect grids, objects, and monsters
2692 bool fire_breath(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2694 return fire_ball(typ, dir, dam, -rad);
2699 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2701 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2704 * @return 作用が実際にあった場合TRUEを返す
2707 * Stop if we hit a monster, act as a "ball"
2708 * Allow "target" mode to pass over monsters
2709 * Affect grids, objects, and monsters
2712 bool fire_rocket(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2715 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2717 /* Use the given direction */
2718 tx = p_ptr->x + 99 * ddx[dir];
2719 ty = p_ptr->y + 99 * ddy[dir];
2721 /* Hack -- Use an actual "target" */
2722 if ((dir == 5) && target_okay())
2728 /* Analyze the "dir" and the "target". Hurt items on floor. */
2729 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2734 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2736 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2739 * @return 作用が実際にあった場合TRUEを返す
2742 * Stop if we hit a monster, act as a "ball"
2743 * Allow "target" mode to pass over monsters
2744 * Affect grids, objects, and monsters
2747 bool fire_ball_hide(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2750 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2752 /* Use the given direction */
2753 tx = p_ptr->x + 99 * ddx[dir];
2754 ty = p_ptr->y + 99 * ddy[dir];
2756 /* Hack -- Use an actual "target" */
2757 if ((dir == 5) && target_okay())
2759 flg &= ~(PROJECT_STOP);
2764 /* Analyze the "dir" and the "target". Hurt items on floor. */
2765 return (project(0, rad, ty, tx, dam, typ, flg, -1));
2770 * @brief メテオ系スペルの発動 / Cast a meteor spell
2771 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2777 * @return 作用が実際にあった場合TRUEを返す
2780 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2781 * player, or outside source, that starts out at an arbitrary location, and
2782 * leaving no trail from the "caster" to the target. This function is
2783 * especially useful for bombardments and similar. -LM-
2784 * Option to hurt the player.
2787 bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2789 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2791 /* Analyze the "target" and the caster. */
2792 return (project(who, rad, y, x, dam, typ, flg, -1));
2797 * @brief ブラスト系スペルの発動 / Cast a blast spell
2799 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2804 * @return 作用が実際にあった場合TRUEを返す
2806 bool fire_blast(EFFECT_ID typ, DIRECTION dir, int dd, int ds, int num, int dev)
2810 POSITION ty, tx, y, x;
2813 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2818 /* Use the given direction */
2821 ly = ty = p_ptr->y + 20 * ddy[dir];
2822 lx = tx = p_ptr->x + 20 * ddx[dir];
2825 /* Use an actual "target" */
2826 else /* if (dir == 5) */
2831 lx = 20 * (tx - p_ptr->x) + p_ptr->x;
2832 ly = 20 * (ty - p_ptr->y) + p_ptr->y;
2835 ld = distance(p_ptr->y, p_ptr->x, ly, lx);
2838 for (i = 0; i < num; i++)
2842 /* Get targets for some bolts */
2843 y = rand_spread(ly, ld * dev / 20);
2844 x = rand_spread(lx, ld * dev / 20);
2846 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2849 /* Analyze the "dir" and the "target". */
2850 if (!project(0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2861 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2862 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2863 * @return 作用が実際にあった場合TRUEを返す
2865 bool teleport_swap(DIRECTION dir)
2869 monster_type* m_ptr;
2870 monster_race* r_ptr;
2872 if ((dir == 5) && target_okay())
2879 tx = p_ptr->x + ddx[dir];
2880 ty = p_ptr->y + ddy[dir];
2882 c_ptr = &cave[ty][tx];
2884 if (p_ptr->anti_tele)
2886 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2890 if (!c_ptr->m_idx || (c_ptr->m_idx == p_ptr->riding))
2892 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2898 if ((c_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
2900 msg_print(_("失敗した。", "Failed to swap."));
2906 m_ptr = &m_list[c_ptr->m_idx];
2907 r_ptr = &r_info[m_ptr->r_idx];
2909 (void)set_monster_csleep(c_ptr->m_idx, 0);
2911 if (r_ptr->flagsr & RFR_RES_TELE)
2913 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2915 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2921 sound(SOUND_TELEPORT);
2923 /* Swap the player and monster */
2924 (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2932 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "projection()" in a direction (or at the target)
2934 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2937 * @return 作用が実際にあった場合TRUEを返す
2939 bool project_hook(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2943 /* Pass through the target if needed */
2944 flg |= (PROJECT_THRU);
2946 /* Use the given direction */
2947 tx = p_ptr->x + ddx[dir];
2948 ty = p_ptr->y + ddy[dir];
2950 /* Hack -- Use an actual "target" */
2951 if ((dir == 5) && target_okay())
2957 /* Analyze the "dir" and the "target", do NOT explode */
2958 return (project(0, 0, ty, tx, dam, typ, flg, -1));
2963 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2965 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2967 * @return 作用が実際にあった場合TRUEを返す
2970 * Stop if we hit a monster, as a "bolt".
2971 * Affect monsters and grids (not objects).
2974 bool fire_bolt(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2976 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2977 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2978 return (project_hook(typ, dir, dam, flg));
2983 * @brief ビーム系スペルの発動 / Cast a beam spell.
2985 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2987 * @return 作用が実際にあった場合TRUEを返す
2990 * Pass through monsters, as a "beam".
2991 * Affect monsters, grids and objects.
2994 bool fire_beam(EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2996 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2997 return (project_hook(typ, dir, dam, flg));
3002 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
3003 * @param prob ビーム化する確率(%)
3005 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3007 * @return 作用が実際にあった場合TRUEを返す
3010 * Pass through monsters, as a "beam".
3011 * Affect monsters, grids and objects.
3014 bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
3016 if (randint0(100) < prob)
3018 return (fire_beam(typ, dir, dam));
3022 return (fire_bolt(typ, dir, dam));
3027 * @brief LITE_WEAK属性による光源ビーム処理
3028 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3030 * @return 作用が実際にあった場合TRUEを返す
3032 bool lite_line(DIRECTION dir, HIT_POINT dam)
3034 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
3035 return (project_hook(GF_LITE_WEAK, dir, dam, flg));
3040 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3042 * @return 作用が実際にあった場合TRUEを返す
3044 bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
3046 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3047 return (project_hook(GF_HYPODYNAMIA, dir, dam, flg));
3052 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3054 * @return 作用が実際にあった場合TRUEを返す
3056 bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
3058 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3059 return (project_hook(GF_KILL_WALL, dir, dam, flg));
3064 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3065 * @return 作用が実際にあった場合TRUEを返す
3067 bool wizard_lock(DIRECTION dir)
3069 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3070 return (project_hook(GF_JAM_DOOR, dir, 20 + randint1(30), flg));
3075 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3076 * @return 作用が実際にあった場合TRUEを返す
3078 bool destroy_door(DIRECTION dir)
3080 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3081 return (project_hook(GF_KILL_DOOR, dir, 0, flg));
3086 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3087 * @return 作用が実際にあった場合TRUEを返す
3089 bool disarm_trap(DIRECTION dir)
3091 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
3092 return (project_hook(GF_KILL_TRAP, dir, 0, flg));
3097 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3099 * @return 作用が実際にあった場合TRUEを返す
3101 bool heal_monster(DIRECTION dir, HIT_POINT dam)
3103 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3104 return (project_hook(GF_OLD_HEAL, dir, dam, flg));
3109 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3111 * @return 作用が実際にあった場合TRUEを返す
3113 bool speed_monster(DIRECTION dir, int power)
3115 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3116 return (project_hook(GF_OLD_SPEED, dir, power, flg));
3121 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3123 * @return 作用が実際にあった場合TRUEを返す
3125 bool slow_monster(DIRECTION dir, int power)
3127 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3128 return (project_hook(GF_OLD_SLOW, dir, power, flg));
3133 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3135 * @return 作用が実際にあった場合TRUEを返す
3137 bool sleep_monster(DIRECTION dir, int power)
3139 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3140 return (project_hook(GF_OLD_SLEEP, dir, power, flg));
3144 * @brief モンスター拘束(STASIS)処理
3145 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3146 * @return 作用が実際にあった場合TRUEを返す
3147 * @details 威力はプレイヤーレベル*2に固定
3149 bool stasis_monster(DIRECTION dir)
3151 return (fire_ball_hide(GF_STASIS, dir, p_ptr->lev*2, 0));
3155 * @brief 邪悪なモンスター拘束(STASIS)処理
3156 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3157 * @return 作用が実際にあった場合TRUEを返す
3158 * @details 威力はプレイヤーレベル*2に固定
3160 bool stasis_evil(DIRECTION dir)
3162 return (fire_ball_hide(GF_STASIS_EVIL, dir, p_ptr->lev*2, 0));
3167 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3168 * @param plev プレイヤーレベル(=効力)
3169 * @return 作用が実際にあった場合TRUEを返す
3171 bool confuse_monster(DIRECTION dir, PLAYER_LEVEL plev)
3173 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3174 return (project_hook(GF_OLD_CONF, dir, plev, flg));
3179 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3180 * @param plev プレイヤーレベル(=効力)
3181 * @return 作用が実際にあった場合TRUEを返す
3183 bool stun_monster(DIRECTION dir, PLAYER_LEVEL plev)
3185 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3186 return (project_hook(GF_STUN, dir, plev, flg));
3190 * @brief チェンジモンスター処理
3191 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3193 * @return 作用が実際にあった場合TRUEを返す
3195 bool poly_monster(DIRECTION dir, int power)
3197 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3198 bool tester = (project_hook(GF_OLD_POLY, dir, power, flg));
3200 chg_virtue(V_CHANCE, 1);
3205 * @brief クローンモンスター処理
3206 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3207 * @return 作用が実際にあった場合TRUEを返す
3209 bool clone_monster(DIRECTION dir)
3211 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3212 return (project_hook(GF_OLD_CLONE, dir, 0, flg));
3217 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3218 * @param plev プレイヤーレベル(=効力)
3219 * @return 作用が実際にあった場合TRUEを返す
3221 bool fear_monster(DIRECTION dir, PLAYER_LEVEL plev)
3223 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3224 return (project_hook(GF_TURN_ALL, dir, plev, flg));
3229 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3230 * @param plev プレイヤーレベル(効力はplev*200)
3231 * @return 作用が実際にあった場合TRUEを返す
3233 bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
3235 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
3236 return (project_hook(GF_DEATH_RAY, dir, plev * 200, flg));
3240 * @brief モンスター用テレポート処理
3241 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3242 * @param distance 移動距離
3243 * @return 作用が実際にあった場合TRUEを返す
3245 bool teleport_monster(DIRECTION dir, int distance)
3247 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
3248 return (project_hook(GF_AWAY_ALL, dir, distance, flg));
3252 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
3253 * @return 作用が実際にあった場合TRUEを返す
3255 bool door_creation(void)
3257 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3258 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
3262 * @brief トラップ生成処理(起点から周囲1マス)
3265 * @return 作用が実際にあった場合TRUEを返す
3267 bool trap_creation(POSITION y, POSITION x)
3269 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3270 return (project(0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
3274 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
3275 * @return 作用が実際にあった場合TRUEを返す
3277 bool tree_creation(void)
3279 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3280 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
3284 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
3285 * @return 作用が実際にあった場合TRUEを返す
3287 bool glyph_creation(void)
3289 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
3290 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
3294 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
3295 * @return 作用が実際にあった場合TRUEを返す
3297 bool wall_stone(void)
3299 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3301 bool dummy = (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
3303 p_ptr->update |= (PU_FLOW);
3305 p_ptr->redraw |= (PR_MAP);
3311 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
3312 * @return 作用が実際にあった場合TRUEを返す
3314 bool destroy_doors_touch(void)
3316 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3317 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
3321 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
3322 * @return 作用が実際にあった場合TRUEを返す
3324 bool disarm_traps_touch(void)
3326 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
3327 return (project(0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
3331 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
3332 * @return 作用が実際にあった場合TRUEを返す
3334 bool sleep_monsters_touch(void)
3336 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
3337 return (project(0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
3342 * @brief 死者復活処理(起点より周囲5マス)
3343 * @param who 術者モンスターID(0ならばプレイヤー)
3346 * @return 作用が実際にあった場合TRUEを返す
3348 bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
3350 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
3351 return (project(who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
3356 * @return 作用が実際にあった場合TRUEを返す
3358 void call_chaos(void)
3360 int Chaos_type, dummy, dir;
3361 PLAYER_LEVEL plev = p_ptr->lev;
3362 bool line_chaos = FALSE;
3364 int hurt_types[31] =
3366 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
3367 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
3368 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
3369 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
3370 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
3371 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
3372 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
3373 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
3376 Chaos_type = hurt_types[randint0(31)];
3377 if (one_in_(4)) line_chaos = TRUE;
3381 for (dummy = 1; dummy < 10; dummy++)
3386 fire_beam(Chaos_type, dummy, 150);
3388 fire_ball(Chaos_type, dummy, 150, 2);
3392 else if (one_in_(3))
3394 fire_ball(Chaos_type, 0, 500, 8);
3398 if (!get_aim_dir(&dir)) return;
3400 fire_beam(Chaos_type, dir, 250);
3402 fire_ball(Chaos_type, dir, 250, 3 + (plev / 35));
3407 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
3408 * @param stop_ty 再帰処理停止フラグ
3410 * @return 作用が実際にあった場合TRUEを返す
3413 * rr9: Stop the nasty things when a Cyberdemon is summoned
3414 * or the player gets paralyzed.
3417 bool activate_ty_curse(bool stop_ty, int *count)
3421 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
3425 switch (randint1(34))
3430 msg_print(_("地面が揺れた...", "The ground trembles..."));
3431 earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
3432 if (!one_in_(6)) break;
3437 HIT_POINT dam = damroll(10, 10);
3438 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
3439 project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
3440 take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
3441 if (!one_in_(6)) break;
3446 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
3447 teleport_player(damroll(10, 10), TELEPORT_PASSIVE);
3448 if (randint0(13)) (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3449 if (!one_in_(6)) break;
3452 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
3456 project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
3457 take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
3459 if (!one_in_(6)) break;
3460 case 1: case 2: case 3: case 16: case 17:
3461 aggravate_monsters(0);
3462 if (!one_in_(6)) break;
3463 case 4: case 5: case 6:
3464 (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
3465 if (!one_in_(6)) break;
3466 case 7: case 8: case 9: case 18:
3467 (*count) += summon_specific(0, p_ptr->y, p_ptr->x, dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3468 if (!one_in_(6)) break;
3469 case 10: case 11: case 12:
3470 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
3471 lose_exp(p_ptr->exp / 16);
3472 if (!one_in_(6)) break;
3473 case 13: case 14: case 15: case 19: case 20:
3474 if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
3480 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
3481 if (p_ptr->free_act)
3482 set_paralyzed(p_ptr->paralyzed + randint1(3));
3484 set_paralyzed(p_ptr->paralyzed + randint1(13));
3487 if (!one_in_(6)) break;
3488 case 21: case 22: case 23:
3489 (void)do_dec_stat(randint0(6));
3490 if (!one_in_(6)) break;
3492 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
3494 if (!one_in_(6)) break;
3497 * Only summon Cyberdemons deep in the dungeon.
3499 if ((dun_level > 65) && !stop_ty)
3501 (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
3505 if (!one_in_(6)) break;
3511 (void)do_dec_stat(i);
3519 while (one_in_(3) && !stop_ty);
3525 * @brief HI_SUMMON(上級召喚)処理発動
3528 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
3529 * @return 作用が実際にあった場合TRUEを返す
3531 int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
3536 BIT_FLAGS mode = PM_ALLOW_GROUP;
3543 mode |= PM_FORCE_FRIENDLY;
3547 mode |= PM_FORCE_PET;
3552 if (!pet) mode |= PM_NO_PET;
3554 summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : dun_level);
3556 for (i = 0; i < (randint1(7) + (dun_level / 40)); i++)
3558 switch (randint1(25) + (dun_level / 20))
3561 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
3564 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
3567 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
3570 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
3573 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
3576 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
3579 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
3582 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
3586 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
3590 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
3593 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3594 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
3597 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3598 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
3601 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
3604 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
3605 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
3614 * @brief サイバーデーモンの召喚
3615 * @param who 召喚主のモンスターID(0ならばプレイヤー)
3618 * @return 作用が実際にあった場合TRUEを返す
3620 int summon_cyber(MONSTER_IDX who, POSITION y, POSITION x)
3623 int max_cyber = (easy_band ? 1 : (dun_level / 50) + randint1(2));
3625 BIT_FLAGS mode = PM_ALLOW_GROUP;
3627 /* Summoned by a monster */
3630 monster_type *m_ptr = &m_list[who];
3631 if (is_pet(m_ptr)) mode |= PM_FORCE_PET;
3634 if (max_cyber > 4) max_cyber = 4;
3636 for (i = 0; i < max_cyber; i++)
3638 count += summon_specific(who, y, x, 100, SUMMON_CYBER, mode);
3645 * @brief 周辺破壊効果(プレイヤー中心)
3646 * @return 作用が実際にあった場合TRUEを返す
3648 void wall_breaker(void)
3651 POSITION y = 0, x = 0;
3652 int attempts = 1000;
3654 if (randint1(80 + p_ptr->lev) < 70)
3658 scatter(&y, &x, p_ptr->y, p_ptr->x, 4, 0);
3660 if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
3662 if (!player_bold(y, x)) break;
3665 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3666 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3668 else if (randint1(100) > 30)
3670 earthquake(p_ptr->y, p_ptr->x, 1);
3674 int num = damroll(5, 3);
3676 for (i = 0; i < num; i++)
3680 scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
3682 if (!player_bold(y, x)) break;
3685 project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
3686 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
3693 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
3695 * @return 作用が実際にあった場合TRUEを返す
3697 bool confuse_monsters(HIT_POINT dam)
3699 return (project_hack(GF_OLD_CONF, dam));
3704 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
3706 * @return 作用が実際にあった場合TRUEを返す
3708 bool charm_monsters(HIT_POINT dam)
3710 return (project_hack(GF_CHARM, dam));
3715 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
3717 * @return 作用が実際にあった場合TRUEを返す
3719 bool charm_animals(HIT_POINT dam)
3721 return (project_hack(GF_CONTROL_ANIMAL, dam));
3726 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
3728 * @return 作用が実際にあった場合TRUEを返す
3730 bool stun_monsters(HIT_POINT dam)
3732 return (project_hack(GF_STUN, dam));
3737 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
3739 * @return 作用が実際にあった場合TRUEを返す
3741 bool stasis_monsters(HIT_POINT dam)
3743 return (project_hack(GF_STASIS, dam));
3748 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3750 * @return 作用が実際にあった場合TRUEを返す
3752 bool mindblast_monsters(HIT_POINT dam)
3754 return (project_hack(GF_PSI, dam));
3759 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3760 * @param dist 効力(距離)
3761 * @return 作用が実際にあった場合TRUEを返す
3763 bool banish_monsters(int dist)
3765 return (project_hack(GF_AWAY_ALL, dist));
3770 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3772 * @return 作用が実際にあった場合TRUEを返す
3774 bool turn_evil(HIT_POINT dam)
3776 return (project_hack(GF_TURN_EVIL, dam));
3781 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3783 * @return 作用が実際にあった場合TRUEを返す
3785 bool turn_monsters(HIT_POINT dam)
3787 return (project_hack(GF_TURN_ALL, dam));
3792 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3793 * @return 作用が実際にあった場合TRUEを返す
3795 bool deathray_monsters(void)
3797 return (project_hack(GF_DEATH_RAY, p_ptr->lev * 200));
3801 * @brief チャーム・モンスター(1体)
3802 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3804 * @return 作用が実際にあった場合TRUEを返す
3806 bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
3808 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3809 return (project_hook(GF_CHARM, dir, plev, flg));
3813 * @brief アンデッド支配(1体)
3814 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3816 * @return 作用が実際にあった場合TRUEを返す
3818 bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
3820 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3821 return (project_hook(GF_CONTROL_UNDEAD, dir, plev, flg));
3826 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3828 * @return 作用が実際にあった場合TRUEを返す
3830 bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
3832 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3833 return (project_hook(GF_CONTROL_DEMON, dir, plev, flg));
3838 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3840 * @return 作用が実際にあった場合TRUEを返す
3842 bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
3844 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3845 return (project_hook(GF_CONTROL_ANIMAL, dir, plev, flg));
3851 * @param success 判定成功上の処理ならばTRUE
3852 * @return 作用が実際にあった場合TRUEを返す
3854 bool kawarimi(bool success)
3857 object_type *q_ptr = &forge;
3860 if (p_ptr->is_dead) return FALSE;
3861 if (p_ptr->confused || p_ptr->blind || p_ptr->paralyzed || p_ptr->image) return FALSE;
3862 if (randint0(200) < p_ptr->stun) return FALSE;
3864 if (!success && one_in_(3))
3866 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3867 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3868 p_ptr->redraw |= (PR_STATUS);
3875 teleport_player(10 + randint1(90), 0L);
3879 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3881 q_ptr->pval = MON_NINJA;
3883 /* Drop it in the dungeon */
3884 (void)drop_near(q_ptr, -1, y, x);
3887 if (success) msg_print("攻撃を受ける前に素早く身をひるがえした。");
3888 else msg_print("失敗!攻撃を受けてしまった。");
3890 if (success) msg_print("You have turned around just before the attack hit you.");
3891 else msg_print("Failed! You are hit by the attack.");
3894 p_ptr->special_defense &= ~(NINJA_KAWARIMI);
3895 p_ptr->redraw |= (PR_STATUS);
3903 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3904 * @param mdeath 目標モンスターが死亡したかを返す
3905 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3907 bool rush_attack(bool *mdeath)
3914 bool tmp_mdeath = FALSE;
3917 if (mdeath) *mdeath = FALSE;
3920 if (!get_aim_dir(&dir)) return FALSE;
3922 /* Use the given direction */
3923 tx = p_ptr->x + project_length * ddx[dir];
3924 ty = p_ptr->y + project_length * ddy[dir];
3926 /* Hack -- Use an actual "target" */
3927 if ((dir == 5) && target_okay())
3933 if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
3935 path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3938 /* No need to move */
3939 if (!path_n) return TRUE;
3941 /* Use ty and tx as to-move point */
3945 /* Project along the path */
3946 for (i = 0; i < path_n; i++)
3948 monster_type *m_ptr;
3950 int ny = GRID_Y(path_g[i]);
3951 int nx = GRID_X(path_g[i]);
3953 if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat, 0))
3958 /* Go to next grid */
3962 if (!cave[ny][nx].m_idx)
3966 msg_print(_("失敗!", "Failed!"));
3970 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3977 /* Move player before updating the monster */
3978 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
3979 update_monster(cave[ny][nx].m_idx, TRUE);
3981 /* Found a monster */
3982 m_ptr = &m_list[cave[ny][nx].m_idx];
3984 if (tm_idx != cave[ny][nx].m_idx)
3987 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "",
3988 m_ptr->ml ? "モンスター" : "何か");
3990 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3993 else if (!player_bold(ty, tx))
3995 /* Hold the monster name */
3998 /* Get the monster name (BEFORE polymorphing) */
3999 monster_desc(m_name, m_ptr, 0);
4000 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
4003 if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4005 tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
4010 if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
4012 if (mdeath) *mdeath = tmp_mdeath;
4018 * @brief 全鏡の消去 / Remove all mirrors in this floor
4019 * @param explode 爆発処理を伴うならばTRUE
4022 void remove_all_mirrors(bool explode)
4026 for (x = 0; x < cur_wid; x++)
4028 for (y = 0; y < cur_hgt; y++)
4030 if (is_mirror_grid(&cave[y][x]))
4032 remove_mirror(y, x);
4034 project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
4035 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
4042 * @brief 『一つの指輪』の効果処理 /
4043 * Hack -- activate the ring of power
4044 * @param dir 発動の方向ID
4047 void ring_of_power(DIRECTION dir)
4049 /* Pick a random effect */
4050 switch (randint1(10))
4055 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
4058 /* Decrease all stats (permanently) */
4059 (void)dec_stat(A_STR, 50, TRUE);
4060 (void)dec_stat(A_INT, 50, TRUE);
4061 (void)dec_stat(A_WIS, 50, TRUE);
4062 (void)dec_stat(A_DEX, 50, TRUE);
4063 (void)dec_stat(A_CON, 50, TRUE);
4064 (void)dec_stat(A_CHR, 50, TRUE);
4066 /* Lose some experience (permanently) */
4067 p_ptr->exp -= (p_ptr->exp / 4);
4068 p_ptr->max_exp -= (p_ptr->exp / 4);
4076 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
4078 /* Dispel monsters */
4079 dispel_monsters(1000);
4089 fire_ball(GF_MANA, dir, 600, 3);
4100 fire_bolt(GF_MANA, dir, 500);
4108 * @brief 運命の輪、並びにカオス的な効果の発動
4109 * @param spell ランダムな効果を選択するための基準ID
4112 void wild_magic(int spell)
4115 int type = SUMMON_MOLD + randint0(6);
4117 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
4118 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
4120 switch (randint1(spell) + randint1(8) + 1)
4125 teleport_player(10, TELEPORT_PASSIVE);
4130 teleport_player(100, TELEPORT_PASSIVE);
4134 teleport_player(200, TELEPORT_PASSIVE);
4144 lite_area(damroll(2, 3), 2);
4147 destroy_doors_touch();
4152 sleep_monsters_touch();
4156 trap_creation(p_ptr->y, p_ptr->x);
4165 aggravate_monsters(0);
4168 earthquake(p_ptr->y, p_ptr->x, 5);
4172 (void)gain_random_mutation(0);
4176 apply_disenchant(1);
4182 fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
4189 while (counter++ < 8)
4191 (void)summon_specific(0, p_ptr->y, p_ptr->x, (dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
4196 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4199 (void)summon_cyber(-1, p_ptr->y, p_ptr->x);
4204 (void)activate_ty_curse(FALSE, &count);
4213 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
4214 * / Drop 10+1d10 meteor ball at random places near the player
4219 void cast_meteor(HIT_POINT dam, POSITION rad)
4222 int b = 10 + randint1(10);
4224 for (i = 0; i < b; i++)
4226 POSITION y = 0, x = 0;
4229 for (count = 0; count <= 20; count++)
4233 x = p_ptr->x - 8 + randint0(17);
4234 y = p_ptr->y - 8 + randint0(17);
4236 dx = (p_ptr->x > x) ? (p_ptr->x - x) : (x - p_ptr->x);
4237 dy = (p_ptr->y > y) ? (p_ptr->y - y) : (y - p_ptr->y);
4239 /* Approximate distance */
4240 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4242 if (d >= 9) continue;
4244 if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
4245 || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
4247 /* Valid position */
4251 if (count > 20) continue;
4253 project(0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
4259 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
4262 * @return ターゲットを指定し、実行したならばTRUEを返す。
4264 bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
4266 POSITION x, y, tx, ty;
4270 int b = 10 + randint1(10);
4272 if (!get_aim_dir(&dir)) return FALSE;
4274 /* Use the given direction */
4275 tx = p_ptr->x + 99 * ddx[dir];
4276 ty = p_ptr->y + 99 * ddy[dir];
4278 /* Hack -- Use an actual "target" */
4279 if ((dir == 5) && target_okay())
4290 /* Hack -- Stop at the target */
4291 if ((y == ty) && (x == tx)) break;
4295 mmove2(&ny, &nx, p_ptr->y, p_ptr->x, ty, tx);
4297 /* Stop at maximum range */
4298 if (MAX_RANGE <= distance(p_ptr->y, p_ptr->x, ny, nx)) break;
4300 /* Stopped by walls/doors */
4301 if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
4303 /* Stopped by monsters */
4304 if ((dir != 5) && cave[ny][nx].m_idx != 0) break;
4306 /* Save the new location */
4313 for (i = 0; i < b; i++)
4315 int count = 20, d = 0;
4321 x = tx - 5 + randint0(11);
4322 y = ty - 5 + randint0(11);
4324 dx = (tx > x) ? (tx - x) : (x - tx);
4325 dy = (ty > y) ? (ty - y) : (y - ty);
4327 /* Approximate distance */
4328 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
4329 /* Within the radius */
4333 if (count < 0) continue;
4335 /* Cannot penetrate perm walls */
4336 if (!in_bounds(y, x) ||
4337 cave_stop_disintegration(y, x) ||
4338 !in_disintegration_range(ty, tx, y, x))
4341 project(0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
4348 * @brief 「ワンダー」のランダムな効果を決定して処理する。
4352 * This spell should become more useful (more controlled) as the\n
4353 * player gains experience levels. Thus, add 1/5 of the player's\n
4354 * level to the die roll. This eliminates the worst effects later on,\n
4355 * while keeping the results quite random. It also allows some potent\n
4356 * effects only at high level.
4358 void cast_wonder(DIRECTION dir)
4360 PLAYER_LEVEL plev = p_ptr->lev;
4361 int die = randint1(100) + plev / 5;
4362 int vir = virtue_number(V_CHANCE);
4366 if (p_ptr->virtues[vir - 1] > 0)
4368 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4372 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4377 chg_virtue(V_CHANCE, 1);
4381 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
4384 if (die < 8) clone_monster(dir);
4385 else if (die < 14) speed_monster(dir, plev);
4386 else if (die < 26) heal_monster(dir, damroll(4, 6));
4387 else if (die < 31) poly_monster(dir, plev);
4389 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4390 damroll(3 + ((plev - 1) / 5), 4));
4391 else if (die < 41) confuse_monster(dir, plev);
4392 else if (die < 46) fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4393 else if (die < 51) (void)lite_line(dir, damroll(6, 8));
4395 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4396 damroll(3 + ((plev - 5) / 4), 8));
4398 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4399 damroll(5 + ((plev - 5) / 4), 8));
4401 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4402 damroll(6 + ((plev - 5) / 4), 8));
4404 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4405 damroll(8 + ((plev - 5) / 4), 8));
4406 else if (die < 76) hypodynamic_bolt(dir, 75);
4407 else if (die < 81) fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4408 else if (die < 86) fire_ball(GF_ACID, dir, 40 + plev, 2);
4409 else if (die < 91) fire_ball(GF_ICE, dir, 70 + plev, 3);
4410 else if (die < 96) fire_ball(GF_FIRE, dir, 80 + plev, 3);
4411 else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
4414 earthquake(p_ptr->y, p_ptr->x, 12);
4418 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4422 symbol_genocide(plev + 50, TRUE);
4424 else if (die < 110) dispel_monsters(120);
4427 dispel_monsters(150);
4428 slow_monsters(plev);
4429 sleep_monsters(plev);
4436 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
4440 void cast_invoke_spirits(DIRECTION dir)
4442 PLAYER_LEVEL plev = p_ptr->lev;
4443 int die = randint1(100) + plev / 5;
4444 int vir = virtue_number(V_CHANCE);
4448 if (p_ptr->virtues[vir - 1] > 0)
4450 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4454 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4458 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
4460 chg_virtue(V_CHANCE, 1);
4464 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
4469 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
4470 "Oh no! Mouldering forms rise from the earth around you!"));
4472 (void)summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4473 chg_virtue(V_UNLIFE, 1);
4477 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
4479 set_afraid(p_ptr->afraid + randint1(4) + 4);
4483 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
4484 "Your head is invaded by a horde of gibbering spectral voices..."));
4486 set_confused(p_ptr->confused + randint1(4) + 4);
4490 poly_monster(dir, plev);
4494 fire_bolt_or_beam(beam_chance() - 10, GF_MISSILE, dir,
4495 damroll(3 + ((plev - 1) / 5), 4));
4499 confuse_monster(dir, plev);
4503 fire_ball(GF_POIS, dir, 20 + (plev / 2), 3);
4507 (void)lite_line(dir, damroll(6, 8));
4511 fire_bolt_or_beam(beam_chance() - 10, GF_ELEC, dir,
4512 damroll(3 + ((plev - 5) / 4), 8));
4516 fire_bolt_or_beam(beam_chance() - 10, GF_COLD, dir,
4517 damroll(5 + ((plev - 5) / 4), 8));
4521 fire_bolt_or_beam(beam_chance(), GF_ACID, dir,
4522 damroll(6 + ((plev - 5) / 4), 8));
4526 fire_bolt_or_beam(beam_chance(), GF_FIRE, dir,
4527 damroll(8 + ((plev - 5) / 4), 8));
4531 hypodynamic_bolt(dir, 75);
4535 fire_ball(GF_ELEC, dir, 30 + plev / 2, 2);
4539 fire_ball(GF_ACID, dir, 40 + plev, 2);
4543 fire_ball(GF_ICE, dir, 70 + plev, 3);
4547 fire_ball(GF_FIRE, dir, 80 + plev, 3);
4551 hypodynamic_bolt(dir, 100 + plev);
4555 earthquake(p_ptr->y, p_ptr->x, 12);
4559 (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
4563 symbol_genocide(plev + 50, TRUE);
4567 dispel_monsters(120);
4571 dispel_monsters(150);
4572 slow_monsters(plev);
4573 sleep_monsters(plev);
4579 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
4580 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
4585 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
4588 void cast_shuffle(void)
4590 PLAYER_LEVEL plev = p_ptr->lev;
4593 int vir = virtue_number(V_CHANCE);
4596 /* Card sharks and high mages get a level bonus */
4597 if ((p_ptr->pclass == CLASS_ROGUE) ||
4598 (p_ptr->pclass == CLASS_HIGH_MAGE) ||
4599 (p_ptr->pclass == CLASS_SORCERER))
4600 die = (randint1(110)) + plev / 5;
4602 die = randint1(120);
4607 if (p_ptr->virtues[vir - 1] > 0)
4609 while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
4613 while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
4617 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
4620 chg_virtue(V_CHANCE, 1);
4624 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
4626 for (i = 0; i < randint1(3); i++)
4627 activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
4631 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
4632 summon_specific(0, p_ptr->y, p_ptr->x, dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
4637 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
4638 activate_ty_curse(FALSE, &count);
4642 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
4643 aggravate_monsters(0);
4647 msg_print(_("《愚者》だ。", "It's the Fool."));
4653 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
4654 trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
4658 msg_print(_("《月》だ。", "It's the Moon."));
4663 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
4664 wild_magic(randint0(32));
4668 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4669 teleport_player(10, TELEPORT_PASSIVE);
4673 msg_print(_("《正義》だ。", "It's Justice."));
4674 set_blessed(p_ptr->lev, FALSE);
4678 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4679 teleport_player(100, TELEPORT_PASSIVE);
4683 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
4684 teleport_player(200, TELEPORT_PASSIVE);
4688 msg_print(_("《塔》だ。", "It's the Tower."));
4693 msg_print(_("《節制》だ。", "It's Temperance."));
4694 sleep_monsters_touch();
4698 msg_print(_("《塔》だ。", "It's the Tower."));
4700 earthquake(p_ptr->y, p_ptr->x, 5);
4704 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4705 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_MOLD, 0L);
4709 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4710 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_BAT, 0L);
4714 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4715 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4719 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4720 trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4724 msg_print(_("《恋人》だ。", "It's the Lovers."));
4726 if (get_aim_dir(&dir))
4727 charm_monster(dir, MIN(p_ptr->lev, 20));
4731 msg_print(_("《隠者》だ。", "It's the Hermit."));
4736 msg_print(_("《審判》だ。", "It's the Judgement."));
4737 do_cmd_rerate(FALSE);
4738 lose_all_mutations();
4742 msg_print(_("《太陽》だ。", "It's the Sun."));
4743 chg_virtue(V_KNOWLEDGE, 1);
4744 chg_virtue(V_ENLIGHTEN, 1);
4749 msg_print(_("《世界》だ。", "It's the World."));
4750 if (p_ptr->exp < PY_MAX_EXP)
4752 s32b ee = (p_ptr->exp / 25) + 1;
4753 if (ee > 5000) ee = 5000;
4754 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4760 bool_hack life_stream(bool_hack message, bool_hack virtue)
4764 chg_virtue(V_VITALITY, 1);
4765 chg_virtue(V_UNLIFE, -5);
4769 msg_print(_("体中に生命力が満ちあふれてきた!", "You feel life flow through your body!"));
4772 (void)set_poisoned(0);
4774 (void)set_confused(0);
4778 (void)restore_all_status();
4779 (void)set_shero(0, TRUE);
4786 bool_hack heroism(int base)
4788 bool_hack ident = FALSE;
4789 if(set_afraid(0)) ident = TRUE;
4790 if(set_hero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4791 if(hp_player(10)) ident = TRUE;
4795 bool_hack berserk(int base)
4797 bool_hack ident = FALSE;
4798 if (set_afraid(0)) ident = TRUE;
4799 if (set_shero(p_ptr->hero + randint1(base) + base, FALSE)) ident = TRUE;
4800 if (hp_player(30)) ident = TRUE;
4804 bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
4806 bool_hack ident = FALSE;
4807 if (hp_player(damroll(dice, sides))) ident = TRUE;
4808 if (set_blind(0)) ident = TRUE;
4809 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
4810 if (set_shero(0, TRUE)) ident = TRUE;
4814 bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
4816 bool_hack ident = FALSE;
4817 if (hp_player(damroll(dice, sides))) ident = TRUE;
4818 if (set_blind(0)) ident = TRUE;
4819 if (set_confused(0)) ident = TRUE;
4820 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
4821 if (set_shero(0, TRUE)) ident = TRUE;
4825 bool_hack cure_critical_wounds(HIT_POINT pow)
4827 bool_hack ident = FALSE;
4828 if (hp_player(pow)) ident = TRUE;
4829 if (set_blind(0)) ident = TRUE;
4830 if (set_confused(0)) ident = TRUE;
4831 if (set_poisoned(0)) ident = TRUE;
4832 if (set_stun(0)) ident = TRUE;
4833 if (set_cut(0)) ident = TRUE;
4834 if (set_shero(0, TRUE)) ident = TRUE;
4838 bool_hack true_healing(HIT_POINT pow)
4840 bool_hack ident = FALSE;
4841 if (hp_player(pow)) ident = TRUE;
4842 if (set_blind(0)) ident = TRUE;
4843 if (set_confused(0)) ident = TRUE;
4844 if (set_poisoned(0)) ident = TRUE;
4845 if (set_stun(0)) ident = TRUE;
4846 if (set_cut(0)) ident = TRUE;
4847 if (set_image(0)) ident = TRUE;
4851 bool_hack restore_mana(bool_hack magic_eater)
4853 bool_hack ident = FALSE;
4855 if (p_ptr->pclass == CLASS_MAGIC_EATER && magic_eater)
4858 for (i = 0; i < EATER_EXT * 2; i++)
4860 p_ptr->magic_num1[i] += (p_ptr->magic_num2[i] < 10) ? EATER_CHARGE * 3 : p_ptr->magic_num2[i] * EATER_CHARGE / 3;
4861 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;
4863 for (; i < EATER_EXT * 3; i++)
4865 KIND_OBJECT_IDX k_idx = lookup_kind(TV_ROD, i - EATER_EXT * 2);
4866 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;
4867 if (p_ptr->magic_num1[i] < 0) p_ptr->magic_num1[i] = 0;
4869 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4870 p_ptr->window |= (PW_PLAYER);
4873 else if (p_ptr->csp < p_ptr->msp)
4875 p_ptr->csp = p_ptr->msp;
4876 p_ptr->csp_frac = 0;
4877 msg_print(_("頭がハッキリとした。", "You feel your head clear."));
4878 p_ptr->redraw |= (PR_MANA);
4879 p_ptr->window |= (PW_PLAYER);
4880 p_ptr->window |= (PW_SPELL);
4887 bool restore_all_status(void)
4890 if (do_res_stat(A_STR)) ident = TRUE;
4891 if (do_res_stat(A_INT)) ident = TRUE;
4892 if (do_res_stat(A_WIS)) ident = TRUE;
4893 if (do_res_stat(A_DEX)) ident = TRUE;
4894 if (do_res_stat(A_CON)) ident = TRUE;
4895 if (do_res_stat(A_CHR)) ident = TRUE;
4900 * @brief 口を使う継続的な処理を中断する
4903 void stop_mouth(void)
4905 if (music_singing_any()) stop_singing();
4906 if (hex_spelling_any()) stop_hex_spell_all();
4910 bool_hack vampirism(void)
4917 if (d_info[dungeon_type].flags1 & DF1_NO_MELEE)
4919 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4923 /* Only works on adjacent monsters */
4924 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4925 y = p_ptr->y + ddy[dir];
4926 x = p_ptr->x + ddx[dir];
4927 c_ptr = &cave[y][x];
4931 if (!(c_ptr->m_idx))
4933 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4937 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4939 dummy = p_ptr->lev * 2;
4941 if (hypodynamic_bolt(dir, dummy))
4943 if (p_ptr->food < PY_FOOD_FULL)
4944 /* No heal if we are "full" */
4945 (void)hp_player(dummy);
4947 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4949 /* Gain nutritional sustenance: 150/hp drained */
4950 /* A Food ration gives 5000 food points (by contrast) */
4951 /* Don't ever get more than "Full" this way */
4952 /* But if we ARE Gorged, it won't cure us */
4953 dummy = p_ptr->food + MIN(5000, 100 * dummy);
4954 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4955 (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4958 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4962 bool panic_hit(void)
4967 if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
4968 y = p_ptr->y + ddy[dir];
4969 x = p_ptr->x + ddx[dir];
4970 if (cave[y][x].m_idx)
4973 if (randint0(p_ptr->skill_dis) < 7)
4974 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4976 teleport_player(30, 0L);
4981 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4989 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4992 * currently this function allows pseudo-id of any object,
4993 * including silly ones like potions & scrolls, which always
4994 * get '{average}'. This should be changed, either to stop such
4995 * items from being pseudo-id'd, or to allow psychometry to
4996 * detect whether the unidentified potion/scroll/etc is
4997 * good (Cure Light Wounds, Restore Strength, etc) or
4998 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
5000 bool psychometry(void)
5004 char o_name[MAX_NLEN];
5009 item_tester_no_ryoute = TRUE;
5010 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
5011 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
5013 if (!get_item(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR))) return (FALSE);
5015 /* Get the item (in the pack) */
5018 o_ptr = &inventory[item];
5021 /* Get the item (on the floor) */
5024 o_ptr = &o_list[0 - item];
5027 /* It is fully known, no information needed */
5028 if (object_is_known(o_ptr))
5030 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
5034 /* Check for a feeling */
5035 feel = value_check_aux1(o_ptr);
5037 /* Get an object description */
5038 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
5040 /* Skip non-feelings */
5043 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
5048 msg_format("%sは%sという感じがする...",
5049 o_name, game_inscriptions[feel]);
5051 msg_format("You feel that the %s %s %s...",
5052 o_name, ((o_ptr->number == 1) ? "is" : "are"),
5053 game_inscriptions[feel]);
5057 /* We have "felt" it */
5058 o_ptr->ident |= (IDENT_SENSE);
5061 o_ptr->feeling = feel;
5063 /* Player touches it */
5064 o_ptr->marked |= OM_TOUCHED;
5066 /* Combine / Reorder the pack (later) */
5067 p_ptr->notice |= (PN_COMBINE | PN_REORDER);
5069 p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
5071 /* Valid "tval" codes */
5072 switch (o_ptr->tval)
5100 /* Auto-inscription/destroy */
5101 autopick_alter_item(item, (bool)(okay && destroy_feeling));
5103 /* Something happened */