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.
26 #include "monsterrace-hook.h"
30 #include "spells-summon.h"
35 #include "spells-status.h"
36 #include "spells-floor.h"
37 #include "spells-diceroll.h"
38 #include "realm-hex.h"
40 #include "object-flavor.h"
41 #include "object-hook.h"
42 #include "monster-status.h"
43 #include "player-move.h"
44 #include "player-status.h"
45 #include "player-effects.h"
46 #include "player-skill.h"
47 #include "player-class.h"
48 #include "player-damage.h"
49 #include "player-inventory.h"
52 #include "floor-events.h"
54 #include "view-mainwindow.h"
55 #include "objectkind.h"
56 #include "monsterrace.h"
57 #include "targeting.h"
58 #include "realm-song.h"
62 * @brief プレイヤー周辺の地形を感知する
63 * @param caster_ptr プレーヤーへの参照ポインタ
66 * @param known 地形から危険フラグを外すならTRUE
67 * @return 効力があった場合TRUEを返す
69 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
75 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
77 /* Scan the current panel */
78 for (y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
80 for (x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
82 int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
83 if (dist > range) continue;
84 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
89 /* Mark as detected */
90 if (dist <= range && known)
92 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
94 g_ptr->info &= ~(CAVE_UNSAFE);
100 if (cave_have_flag_grid(g_ptr, flag))
102 disclose_grid(caster_ptr->current_floor_ptr, y, x);
103 g_ptr->info |= (CAVE_MARK);
115 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
116 * @param caster_ptr プレーヤーへの参照ポインタ
118 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
119 * @return 効力があった場合TRUEを返す
121 bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
123 bool detect = detect_feat_flag(caster_ptr, range, FF_TRAP, known);
125 if (known) caster_ptr->dtrap = TRUE;
127 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
130 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
138 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
139 * @param caster_ptr プレーヤーへの参照ポインタ
141 * @return 効力があった場合TRUEを返す
143 bool detect_doors(player_type *caster_ptr, POSITION range)
145 bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
147 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
150 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
158 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
159 * @param caster_ptr プレーヤーへの参照ポインタ
161 * @return 効力があった場合TRUEを返す
163 bool detect_stairs(player_type *caster_ptr, POSITION range)
165 bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
167 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
170 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
178 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
179 * @param caster_ptr プレーヤーへの参照ポインタ
181 * @return 効力があった場合TRUEを返す
183 bool detect_treasure(player_type *caster_ptr, POSITION range)
185 bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
187 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
190 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
198 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
199 * @param caster_ptr プレーヤーへの参照ポインタ
201 * @return 効力があった場合TRUEを返す
203 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
207 POSITION range2 = range;
211 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
214 for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
216 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
218 if (!OBJECT_IS_VALID(o_ptr)) continue;
219 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
224 /* Only detect nearby objects */
225 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
227 /* Detect "gold" objects */
228 if (o_ptr->tval == TV_GOLD)
230 o_ptr->marked |= OM_FOUND;
236 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
239 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
242 if (detect_monsters_string(caster_ptr, range, "$"))
252 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
253 * @param caster_ptr プレーヤーへの参照ポインタ
255 * @return 効力があった場合TRUEを返す
257 bool detect_objects_normal(player_type *caster_ptr, POSITION range)
261 POSITION range2 = range;
265 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
268 for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
270 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
272 if (!OBJECT_IS_VALID(o_ptr)) continue;
273 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
278 /* Only detect nearby objects */
279 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
281 /* Detect "real" objects */
282 if (o_ptr->tval != TV_GOLD)
284 o_ptr->marked |= OM_FOUND;
290 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
293 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
296 if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
306 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
307 * @param caster_ptr プレーヤーへの参照ポインタ
309 * @return 効力があった場合TRUEを返す
312 * This will light up all spaces with "magic" items, including artifacts,
313 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
314 * and "enchanted" items of the "good" variety.
316 * It can probably be argued that this function is now too powerful.
319 bool detect_objects_magic(player_type *caster_ptr, POSITION range)
321 OBJECT_TYPE_VALUE tv;
327 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
329 /* Scan all objects */
330 for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
332 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
334 if (!OBJECT_IS_VALID(o_ptr)) continue;
335 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
340 /* Only detect nearby objects */
341 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
343 /* Examine the tval */
346 /* Artifacts, misc magic items, or enchanted wearables */
347 if (object_is_artifact(o_ptr) ||
348 object_is_ego(o_ptr) ||
349 (tv == TV_WHISTLE) ||
357 (tv == TV_LIFE_BOOK) ||
358 (tv == TV_SORCERY_BOOK) ||
359 (tv == TV_NATURE_BOOK) ||
360 (tv == TV_CHAOS_BOOK) ||
361 (tv == TV_DEATH_BOOK) ||
362 (tv == TV_TRUMP_BOOK) ||
363 (tv == TV_ARCANE_BOOK) ||
364 (tv == TV_CRAFT_BOOK) ||
365 (tv == TV_DAEMON_BOOK) ||
366 (tv == TV_CRUSADE_BOOK) ||
367 (tv == TV_MUSIC_BOOK) ||
368 (tv == TV_HISSATSU_BOOK) ||
369 (tv == TV_HEX_BOOK) ||
370 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
372 /* Memorize the item */
373 o_ptr->marked |= OM_FOUND;
381 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
389 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
390 * @param caster_ptr プレーヤーへの参照ポインタ
392 * @return 効力があった場合TRUEを返す
394 bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
400 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
402 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
404 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
405 monster_race *r_ptr = &r_info[m_ptr->r_idx];
406 if (!monster_is_valid(m_ptr)) continue;
411 /* Only detect nearby monsters */
412 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
414 /* Detect all non-invisible monsters */
415 if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
417 /* Repair visibility later */
418 repair_monsters = TRUE;
420 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
421 update_monster(caster_ptr, i, FALSE);
426 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
429 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
437 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
438 * @param caster_ptr プレーヤーへの参照ポインタ
440 * @return 効力があった場合TRUEを返す
442 bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
448 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
450 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
452 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
453 monster_race *r_ptr = &r_info[m_ptr->r_idx];
455 if (!monster_is_valid(m_ptr)) continue;
460 /* Only detect nearby monsters */
461 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
463 /* Detect invisible monsters */
464 if (r_ptr->flags2 & RF2_INVISIBLE)
466 /* Update monster recall window */
467 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
469 caster_ptr->window |= (PW_MONSTER);
472 /* Repair visibility later */
473 repair_monsters = TRUE;
475 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
476 update_monster(caster_ptr, i, FALSE);
481 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
484 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
491 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
492 * @param caster_ptr プレーヤーへの参照ポインタ
494 * @return 効力があった場合TRUEを返す
496 bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
502 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
504 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
506 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
507 monster_race *r_ptr = &r_info[m_ptr->r_idx];
508 if (!monster_is_valid(m_ptr)) continue;
513 /* Only detect nearby monsters */
514 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
516 /* Detect evil monsters */
517 if (r_ptr->flags3 & RF3_EVIL)
519 if (is_original_ap(m_ptr))
521 /* Take note that they are evil */
522 r_ptr->r_flags3 |= (RF3_EVIL);
524 /* Update monster recall window */
525 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
527 caster_ptr->window |= (PW_MONSTER);
531 /* Repair visibility later */
532 repair_monsters = TRUE;
534 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
535 update_monster(caster_ptr, i, FALSE);
542 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
549 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
550 * @param caster_ptr プレーヤーへの参照ポインタ
552 * @return 効力があった場合TRUEを返す
554 bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
560 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
562 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
564 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
565 if (!monster_is_valid(m_ptr)) continue;
570 /* Only detect nearby monsters */
571 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
573 /* Detect non-living monsters */
574 if (!monster_living(m_ptr->r_idx))
576 /* Update monster recall window */
577 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
579 caster_ptr->window |= (PW_MONSTER);
582 /* Repair visibility later */
583 repair_monsters = TRUE;
585 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
586 update_monster(caster_ptr, i, FALSE);
593 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
600 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
601 * @param caster_ptr プレーヤーへの参照ポインタ
603 * @return 効力があった場合TRUEを返す
605 bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
611 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
613 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
615 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
616 monster_race *r_ptr = &r_info[m_ptr->r_idx];
617 if (!monster_is_valid(m_ptr)) continue;
622 /* Only detect nearby monsters */
623 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
625 /* Detect non-living monsters */
626 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
628 /* Update monster recall window */
629 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
631 caster_ptr->window |= (PW_MONSTER);
634 /* Repair visibility later */
635 repair_monsters = TRUE;
637 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
638 update_monster(caster_ptr, i, FALSE);
645 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
653 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
654 * @param caster_ptr プレーヤーへの参照ポインタ
656 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
657 * @return 効力があった場合TRUEを返す
659 bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
665 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
667 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
669 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
670 monster_race *r_ptr = &r_info[m_ptr->r_idx];
671 if (!monster_is_valid(m_ptr)) continue;
676 /* Only detect nearby monsters */
677 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
679 /* Detect monsters with the same symbol */
680 if (my_strchr(Match, r_ptr->d_char))
682 /* Update monster recall window */
683 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
685 caster_ptr->window |= (PW_MONSTER);
688 /* Repair visibility later */
689 repair_monsters = TRUE;
691 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
692 update_monster(caster_ptr, i, FALSE);
697 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
700 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
707 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
708 * @param caster_ptr プレーヤーへの参照ポインタ
710 * @param match_flag 感知フラグ
711 * @return 効力があった場合TRUEを返す
713 bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
718 concptr desc_monsters = _("変なモンスター", "weird monsters");
720 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
722 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
724 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
725 monster_race *r_ptr = &r_info[m_ptr->r_idx];
726 if (!monster_is_valid(m_ptr)) continue;
731 /* Only detect nearby monsters */
732 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
734 /* Detect evil monsters */
735 if (r_ptr->flags3 & (match_flag))
737 if (is_original_ap(m_ptr))
739 /* Take note that they are something */
740 r_ptr->r_flags3 |= (match_flag);
742 /* Update monster recall window */
743 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
745 caster_ptr->window |= (PW_MONSTER);
749 /* Repair visibility later */
750 repair_monsters = TRUE;
752 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
753 update_monster(caster_ptr, i, FALSE);
763 desc_monsters = _("デーモン", "demons");
766 desc_monsters = _("アンデッド", "the undead");
770 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
779 * @brief 全感知処理 / Detect everything
780 * @param caster_ptr プレーヤーへの参照ポインタ
782 * @return 効力があった場合TRUEを返す
784 bool detect_all(player_type *caster_ptr, POSITION range)
788 /* Detect everything */
789 if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
790 if (detect_doors(caster_ptr, range)) detect = TRUE;
791 if (detect_stairs(caster_ptr, range)) detect = TRUE;
793 /* There are too many hidden treasure. So... */
794 /* if (detect_treasure(range)) detect = TRUE; */
796 if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
797 if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
798 if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
799 if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
805 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
808 * @return 効力があった場合TRUEを返す
811 * Note that affected monsters are NOT auto-tracked by this usage.
813 * To avoid misbehavior when monster deaths have side-effects,
814 * this is done in two passes. -- JDL
817 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
821 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
822 bool obvious = FALSE;
824 /* Mark all (nearby) monsters */
825 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
827 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
828 if (!monster_is_valid(m_ptr)) continue;
833 /* Require line of sight */
834 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
836 /* Mark the monster */
837 m_ptr->mflag |= (MFLAG_LOS);
840 /* Affect all marked monsters */
841 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
843 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
845 /* Skip unmarked monsters */
846 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
849 m_ptr->mflag &= ~(MFLAG_LOS);
854 /* Jump directly to the target monster */
855 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
863 * @brief 視界内モンスターを加速する処理 / Speed monsters
864 * @param caster_ptr プレーヤーへの参照ポインタ
865 * @return 効力があった場合TRUEを返す
867 bool speed_monsters(player_type *caster_ptr)
869 return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
874 * @brief 視界内モンスターを加速する処理 / Slow monsters
875 * @param caster_ptr プレーヤーへの参照ポインタ
876 * @return 効力があった場合TRUEを返す
878 bool slow_monsters(player_type *caster_ptr, int power)
880 return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
885 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
886 * @param caster_ptr プレーヤーへの参照ポインタ
887 * @return 効力があった場合TRUEを返す
889 bool sleep_monsters(player_type *caster_ptr, int power)
891 return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
896 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
897 * @param caster_ptr プレーヤーへの参照ポインタ
898 * @return 効力があった場合TRUEを返す
900 bool banish_evil(player_type *caster_ptr, int dist)
902 return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
907 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
908 * @return 効力があった場合TRUEを返す
910 bool turn_undead(player_type *caster_ptr)
912 bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
914 chg_virtue(caster_ptr, V_UNLIFE, -1);
920 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
921 * @param caster_ptr プレーヤーへの参照ポインタ
922 * @return 効力があった場合TRUEを返す
924 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
926 bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
928 chg_virtue(caster_ptr, V_UNLIFE, -2);
934 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
935 * @param caster_ptr プレーヤーへの参照ポインタ
936 * @return 効力があった場合TRUEを返す
938 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
940 return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
945 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
946 * @param caster_ptr プレーヤーへの参照ポインタ
947 * @return 効力があった場合TRUEを返す
949 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
951 return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
956 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
957 * @param caster_ptr プレーヤーへの参照ポインタ
958 * @return 効力があった場合TRUEを返す
960 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
962 return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
966 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
969 if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
970 int k = 3 * creature_ptr->lev;
971 if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
972 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
973 if (set_afraid(creature_ptr, 0)) ident = TRUE;
974 if (hp_player(creature_ptr, 50)) ident = TRUE;
975 if (set_stun(creature_ptr, 0)) ident = TRUE;
976 if (set_cut(creature_ptr,0)) ident = TRUE;
981 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
983 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
984 project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
985 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
986 if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE))
988 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
996 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
997 * @param caster_ptr プレーヤーへの参照ポインタ
998 * @return 効力があった場合TRUEを返す
1000 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
1002 return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
1007 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
1008 * @param caster_ptr プレーヤーへの参照ポインタ
1009 * @return 効力があった場合TRUEを返す
1011 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
1013 return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
1018 * @brief 視界内のモンスターに「聖戦」効果を与える処理
1019 * @param caster_ptr プレーヤーへの参照ポインタ
1020 * @return 効力があった場合TRUEを返す
1022 bool crusade(player_type *caster_ptr)
1024 return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev*4));
1029 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
1030 * @param caster_ptr プレーヤーへの参照ポインタ
1031 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
1034 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
1040 /* Aggravate everyone nearby */
1041 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1043 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1044 if (!monster_is_valid(m_ptr)) continue;
1046 /* Skip aggravating monster (or player) */
1047 if (i == who) continue;
1049 /* Wake up nearby sleeping monsters */
1050 if (m_ptr->cdis < MAX_SIGHT * 2)
1053 if (MON_CSLEEP(m_ptr))
1055 (void)set_monster_csleep(i, 0);
1058 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1061 /* Speed up monsters in line of sight */
1062 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
1066 (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
1072 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1073 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1074 if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
1079 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1080 * @param m_idx 抹殺するモンスターID
1081 * @param power 抹殺の威力
1082 * @param player_cast プレイヤーの魔法によるものならば TRUE
1083 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1084 * @param spell_name 抹殺効果を起こした魔法の名前
1085 * @return 効力があった場合TRUEを返す
1087 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1089 int msec = delay_factor * delay_factor * delay_factor;
1090 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
1091 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1092 bool resist = FALSE;
1094 if (is_pet(m_ptr) && !player_cast) return FALSE;
1096 /* Hack -- Skip Unique Monsters or Quest Monsters */
1097 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1098 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1099 else if (m_idx == caster_ptr->riding) resist = TRUE;
1100 else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
1101 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1102 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1106 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1108 GAME_TEXT m_name[MAX_NLEN];
1110 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1111 exe_write_diary(caster_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1114 delete_monster_idx(m_idx);
1117 if (resist && player_cast)
1119 bool see_m = is_seen(m_ptr);
1120 GAME_TEXT m_name[MAX_NLEN];
1122 monster_desc(m_name, m_ptr, 0);
1125 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1128 if (MON_CSLEEP(m_ptr))
1130 (void)set_monster_csleep(m_idx, 0);
1133 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1137 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1141 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1146 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1151 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1154 /* Visual feedback */
1155 move_cursor_relative(caster_ptr->y, caster_ptr->x);
1157 caster_ptr->redraw |= (PR_HP);
1158 caster_ptr->window |= (PW_PLAYER);
1163 Term_xtra(TERM_XTRA_DELAY, msec);
1170 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1171 * @param power 抹殺の威力
1172 * @param player_cast プレイヤーの魔法によるものならば TRUE
1173 * @return 効力があった場合TRUEを返す
1175 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
1179 bool result = FALSE;
1181 /* Prevent genocide in quest levels */
1182 if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
1184 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1188 /* Mega-Hack -- Get a monster symbol */
1189 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1191 /* Delete the monsters of that "type" */
1192 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1194 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1195 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1196 if (!monster_is_valid(m_ptr)) continue;
1198 /* Skip "wrong" monsters */
1199 if (r_ptr->d_char != typ) continue;
1201 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
1206 chg_virtue(caster_ptr, V_VITALITY, -2);
1207 chg_virtue(caster_ptr, V_CHANCE, -1);
1215 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1216 * @param power 抹殺の威力
1217 * @param player_cast プレイヤーの魔法によるものならば TRUE
1218 * @return 効力があった場合TRUEを返す
1220 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
1223 bool result = FALSE;
1225 /* Prevent mass genocide in quest levels */
1226 if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
1231 /* Delete the (nearby) monsters */
1232 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1234 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1235 if (!monster_is_valid(m_ptr)) continue;
1237 /* Skip distant monsters */
1238 if (m_ptr->cdis > MAX_SIGHT) continue;
1241 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1246 chg_virtue(caster_ptr, V_VITALITY, -2);
1247 chg_virtue(caster_ptr, V_CHANCE, -1);
1255 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1256 * @param power 抹殺の威力
1257 * @param player_cast プレイヤーの魔法によるものならば TRUE
1258 * @return 効力があった場合TRUEを返す
1260 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
1263 bool result = FALSE;
1265 /* Prevent mass genocide in quest levels */
1266 if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
1271 /* Delete the (nearby) monsters */
1272 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1274 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1275 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1276 if (!monster_is_valid(m_ptr)) continue;
1278 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1280 /* Skip distant monsters */
1281 if (m_ptr->cdis > MAX_SIGHT) continue;
1284 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1289 chg_virtue(caster_ptr, V_UNLIFE, -2);
1290 chg_virtue(caster_ptr, V_CHANCE, -1);
1298 * @brief 周辺モンスターを調査する / Probe nearby monsters
1299 * @return 効力があった場合TRUEを返す
1301 bool probing(player_type *caster_ptr)
1304 int speed; /* TODO */
1315 /* Probe all (nearby) monsters */
1316 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1318 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1319 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1320 if (!monster_is_valid(m_ptr)) continue;
1322 /* Require line of sight */
1323 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
1325 /* Probe visible monsters */
1328 GAME_TEXT m_name[MAX_NLEN];
1330 /* Start the message */
1333 msg_print(_("調査中...", "Probing..."));
1338 if (!is_original_ap(m_ptr))
1340 if (m_ptr->mflag2 & MFLAG2_KAGE)
1341 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1343 m_ptr->ap_r_idx = m_ptr->r_idx;
1344 lite_spot(m_ptr->fy, m_ptr->fx);
1346 /* Get "the monster" or "something" */
1347 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1349 speed = m_ptr->mspeed - 110;
1350 if (MON_FAST(m_ptr)) speed += 10;
1351 if (MON_SLOW(m_ptr)) speed -= 10;
1352 if (ironman_nightmare) speed += 5;
1354 /* Get the monster's alignment */
1355 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1356 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1357 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1358 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
1359 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1360 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1361 else align = _("中立", "neutral");
1363 sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1364 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1366 if (r_ptr->next_r_idx)
1368 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1372 strcat(buf, "xxx ");
1375 if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
1376 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1377 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1378 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1379 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1380 buf[strlen(buf)-1] = '\0';
1383 /* HACK : Add the line to message buffer */
1386 caster_ptr->window |= (PW_MESSAGE);
1389 if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
1392 Term_erase(0, 0, 255);
1394 /* Learn everything about this monster */
1395 if (lore_do_probe(m_ptr->r_idx))
1397 /* Get base name of monster */
1398 strcpy(buf, (r_name + r_ptr->name));
1401 /* Note that we learnt some new flags -Mogami- */
1402 msg_format("%sについてさらに詳しくなった気がする。", buf);
1407 /* Note that we learnt some new flags -Mogami- */
1408 msg_format("You now know more about %s.", buf);
1410 /* Clear -more- prompt */
1425 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
1426 msg_print(_("これで全部です。", "That's all."));
1437 void discharge_minion(player_type *caster_ptr)
1442 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1444 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1445 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1446 if (m_ptr->nickname) okay = FALSE;
1449 if (!okay || caster_ptr->riding)
1451 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
1455 for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1458 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1459 monster_race *r_ptr;
1461 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1462 r_ptr = &r_info[m_ptr->r_idx];
1464 /* Uniques resist discharging */
1465 if (r_ptr->flags1 & RF1_UNIQUE)
1467 GAME_TEXT m_name[MAX_NLEN];
1468 monster_desc(m_name, m_ptr, 0x00);
1469 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
1470 delete_monster_idx(i);
1473 dam = m_ptr->maxhp / 2;
1474 if (dam > 100) dam = (dam - 100) / 2 + 100;
1475 if (dam > 400) dam = (dam - 400) / 2 + 400;
1476 if (dam > 800) dam = 800;
1477 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
1478 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
1480 if (record_named_pet && m_ptr->nickname)
1482 GAME_TEXT m_name[MAX_NLEN];
1484 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1485 exe_write_diary(caster_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
1488 delete_monster_idx(i);
1494 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1495 * @brief 部屋全体を照らすサブルーチン
1496 * @param caster_ptr プレーヤーへの参照ポインタ
1500 * This routine clears the entire "temp" set.
1501 * This routine will Perma-Lite all "temp" grids.
1502 * This routine is used (only) by "lite_room()"
1503 * Dark grids are illuminated.
1504 * Also, process all affected monsters.
1506 * SMART monsters always wake up when illuminated
1507 * NORMAL monsters wake up 1/4 the time when illuminated
1508 * STUPID monsters wake up 1/10 the time when illuminated
1511 static void cave_temp_room_lite(player_type *caster_ptr)
1515 /* Clear them all */
1516 for (i = 0; i < tmp_pos.n; i++)
1518 POSITION y = tmp_pos.y[i];
1519 POSITION x = tmp_pos.x[i];
1521 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1523 /* No longer in the array */
1524 g_ptr->info &= ~(CAVE_TEMP);
1526 /* Update only non-CAVE_GLOW grids */
1527 /* if (g_ptr->info & (CAVE_GLOW)) continue; */
1530 g_ptr->info |= (CAVE_GLOW);
1532 /* Process affected monsters */
1535 PERCENTAGE chance = 25;
1536 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1537 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1538 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1540 /* Stupid monsters rarely wake up */
1541 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
1543 /* Smart monsters always wake up */
1544 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
1546 /* Sometimes monsters wake up */
1547 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
1550 (void)set_monster_csleep(g_ptr->m_idx, 0);
1552 /* Notice the "waking up" */
1555 GAME_TEXT m_name[MAX_NLEN];
1556 monster_desc(m_name, m_ptr, 0);
1557 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1564 update_local_illumination(caster_ptr, y, x);
1572 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1573 * @brief 部屋全体を暗くするサブルーチン
1574 * @param caster_ptr プレーヤーへの参照ポインタ
1578 * This routine clears the entire "temp" set.
1579 * This routine will "darken" all "temp" grids.
1580 * In addition, some of these grids will be "unmarked".
1581 * This routine is used (only) by "unlite_room()"
1582 * Also, process all affected monsters
1585 static void cave_temp_room_unlite(player_type *caster_ptr)
1589 /* Clear them all */
1590 for (i = 0; i < tmp_pos.n; i++)
1592 POSITION y = tmp_pos.y[i];
1593 POSITION x = tmp_pos.x[i];
1596 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1597 bool do_dark = !is_mirror_grid(g_ptr);
1599 /* No longer in the array */
1600 g_ptr->info &= ~(CAVE_TEMP);
1602 /* Darken the grid */
1605 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
1607 for (j = 0; j < 9; j++)
1609 POSITION by = y + ddy_ddd[j];
1610 POSITION bx = x + ddx_ddd[j];
1612 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
1614 grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
1616 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1624 if (!do_dark) continue;
1627 g_ptr->info &= ~(CAVE_GLOW);
1629 /* Hack -- Forget "boring" grids */
1630 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
1632 /* Forget the grid */
1633 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
1637 /* Process affected monsters */
1640 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1644 update_local_illumination(caster_ptr, y, x);
1653 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1654 * @param floor_ptr 配置するフロアの参照ポインタ
1657 * @param pass_bold 地形条件を返す関数ポインタ
1660 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1667 for (i = 0; i < 16; i++)
1669 y = cy + ddy_cdd[i % 8];
1670 x = cx + ddx_cdd[i % 8];
1672 /* Found a wall, break the length */
1673 if (!pass_bold(floor_ptr, y, x))
1675 /* Track best length */
1689 return (MAX(len, blen));
1694 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1695 * @param floor_ptr 配置するフロアの参照ポインタ
1698 * @param pass_bold 地形条件を返す関数ポインタ
1701 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1707 for (i = 0; i < 8; i++)
1709 y = cy + ddy_ddd[i];
1710 x = cx + ddx_ddd[i];
1712 if (!pass_bold(floor_ptr, y, x)) c++;
1720 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1721 * @param caster_ptr プレーヤーへの参照ポインタ
1722 * @param y 部屋内のy座標1点
1723 * @param x 部屋内のx座標1点
1724 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
1725 * @param pass_bold 地形条件を返す関数ポインタ
1728 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1731 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1732 g_ptr = &floor_ptr->grid_array[y][x];
1734 /* Avoid infinite recursion */
1735 if (g_ptr->info & (CAVE_TEMP)) return;
1737 /* Do not "leave" the current room */
1738 if (!(g_ptr->info & (CAVE_ROOM)))
1740 if (only_room) return;
1743 if (!in_bounds2(floor_ptr, y, x)) return;
1745 /* Do not exceed the maximum spell range */
1746 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
1748 /* Verify this grid */
1750 * The reason why it is ==6 instead of >5 is that 8 is impossible
1751 * due to the check for cave_bold above.
1752 * 7 lights dead-end corridors (you need to do this for the
1753 * checkboard interesting rooms, so that the boundary is lit
1755 * This leaves only a check for 6 bounding walls!
1757 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
1758 (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
1761 /* Paranoia -- verify space */
1762 if (tmp_pos.n == TEMP_MAX) return;
1764 /* Mark the grid as "seen" */
1765 g_ptr->info |= (CAVE_TEMP);
1767 /* Add it to the "seen" set */
1768 tmp_pos.y[tmp_pos.n] = y;
1769 tmp_pos.x[tmp_pos.n] = x;
1775 * todo このシンタックスシュガーは不要だが、関数ポインタなので安易には消せず……
1776 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
1777 * @param floor_ptr 配置するフロアの参照ポインタ
1780 * @return 光を通すならばtrueを返す。
1782 static bool cave_pass_lite_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1784 return cave_los_bold(floor_ptr, y, x);
1789 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1790 * @param caster_ptr プレーヤーへの参照ポインタ
1795 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1797 cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_pass_lite_bold);
1802 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
1803 * @param floor_ptr 配置するフロアの参照ポインタ
1806 * @return 射線を通すならばtrueを返す。
1808 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1810 return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
1815 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1816 * @param caster_ptr プレーヤーへの参照ポインタ
1821 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1823 cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
1828 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
1829 * @param caster_ptr プレーヤーへの参照ポインタ
1834 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1839 /* Add the initial grid */
1840 cave_temp_lite_room_aux(caster_ptr, y1, x1);
1842 /* While grids are in the queue, add their neighbors */
1843 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1844 for (i = 0; i < tmp_pos.n; i++)
1846 x = tmp_pos.x[i], y = tmp_pos.y[i];
1848 /* Walls get lit, but stop light */
1849 if (!cave_pass_lite_bold(floor_ptr, y, x)) continue;
1851 /* Spread adjacent */
1852 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
1853 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
1854 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
1855 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
1857 /* Spread diagonal */
1858 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
1859 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
1860 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1861 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1864 /* Now, lite them all up at once */
1865 cave_temp_room_lite(caster_ptr);
1867 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1869 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
1875 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1876 * @param caster_ptr プレーヤーへの参照ポインタ
1881 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1886 /* Add the initial grid */
1887 cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1889 /* Spread, breadth first */
1890 for (i = 0; i < tmp_pos.n; i++)
1892 x = tmp_pos.x[i], y = tmp_pos.y[i];
1894 /* Walls get dark, but stop darkness */
1895 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1897 /* Spread adjacent */
1898 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1899 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1900 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1901 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1903 /* Spread diagonal */
1904 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1905 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1906 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1907 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1910 /* Now, darken them all at once */
1911 cave_temp_room_unlite(caster_ptr);
1916 * @brief スターライトの効果を発生させる
1917 * @param caster_ptr プレーヤーへの参照ポインタ
1918 * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1921 bool starlight(player_type *caster_ptr, bool magic)
1923 HIT_POINT num = damroll(5, 3);
1924 POSITION y = 0, x = 0;
1928 if (!caster_ptr->blind && !magic)
1930 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1933 for (k = 0; k < num; k++)
1939 scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1940 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1941 if (!player_bold(caster_ptr, y, x)) break;
1944 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1945 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1953 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1954 * @param caster_ptr プレーヤーへの参照ポインタ
1957 * @return 作用が実際にあった場合TRUEを返す
1959 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1961 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1963 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1965 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
1969 if (!caster_ptr->blind)
1971 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1974 /* Hook into the "project()" function */
1975 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1977 lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1985 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1986 * @param caster_ptr プレーヤーへの参照ポインタ
1989 * @return 作用が実際にあった場合TRUEを返す
1991 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1993 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1995 if (!caster_ptr->blind)
1997 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
2000 /* Hook into the "project()" function */
2001 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
2003 unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
2011 * @brief ボール系スペルの発動 / Cast a ball spell
2012 * @param caster_ptr プレーヤーへの参照ポインタ
2014 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2017 * @return 作用が実際にあった場合TRUEを返す
2020 * Stop if we hit a monster, act as a "ball"
2021 * Allow "target" mode to pass over monsters
2022 * Affect grids, objects, and monsters
2025 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2029 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2031 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
2032 /* Use the given direction */
2033 tx = caster_ptr->x + 99 * ddx[dir];
2034 ty = caster_ptr->y + 99 * ddy[dir];
2036 /* Hack -- Use an actual "target" */
2037 if ((dir == 5) && target_okay())
2039 flg &= ~(PROJECT_STOP);
2044 /* Analyze the "dir" and the "target". Hurt items on floor. */
2045 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
2050 * @brief ブレス系スペルの発動 / Cast a breath spell
2051 * @param caster_ptr プレーヤーへの参照ポインタ
2053 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2056 * @return 作用が実際にあった場合TRUEを返す
2059 * Stop if we hit a monster, act as a "ball"
2060 * Allow "target" mode to pass over monsters
2061 * Affect grids, objects, and monsters
2064 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2066 return fire_ball(caster_ptr, typ, dir, dam, -rad);
2071 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2072 * @param caster_ptr プレーヤーへの参照ポインタ
2074 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2077 * @return 作用が実際にあった場合TRUEを返す
2080 * Stop if we hit a monster, act as a "ball"
2081 * Allow "target" mode to pass over monsters
2082 * Affect grids, objects, and monsters
2085 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2088 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2090 /* Use the given direction */
2091 tx = caster_ptr->x + 99 * ddx[dir];
2092 ty = caster_ptr->y + 99 * ddy[dir];
2094 /* Hack -- Use an actual "target" */
2095 if ((dir == 5) && target_okay())
2101 /* Analyze the "dir" and the "target". Hurt items on floor. */
2102 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
2107 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2108 * @param caster_ptr プレーヤーへの参照ポインタ
2110 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2113 * @return 作用が実際にあった場合TRUEを返す
2116 * Stop if we hit a monster, act as a "ball"
2117 * Allow "target" mode to pass over monsters
2118 * Affect grids, objects, and monsters
2121 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2124 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2126 /* Use the given direction */
2127 tx = caster_ptr->x + 99 * ddx[dir];
2128 ty = caster_ptr->y + 99 * ddy[dir];
2130 /* Hack -- Use an actual "target" */
2131 if ((dir == 5) && target_okay())
2133 flg &= ~(PROJECT_STOP);
2138 /* Analyze the "dir" and the "target". Hurt items on floor. */
2139 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
2144 * @brief メテオ系スペルの発動 / Cast a meteor spell
2145 * @param caster_ptr プレーヤーへの参照ポインタ
2146 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2152 * @return 作用が実際にあった場合TRUEを返す
2155 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2156 * player, or outside source, that starts out at an arbitrary location, and
2157 * leaving no trail from the "caster" to the target. This function is
2158 * especially useful for bombardments and similar. -LM-
2159 * Option to hurt the player.
2162 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2164 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2166 /* Analyze the "target" and the caster. */
2167 return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
2172 * @brief ブラスト系スペルの発動 / Cast a blast spell
2173 * @param caster_ptr プレーヤーへの参照ポインタ
2175 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2180 * @return 作用が実際にあった場合TRUEを返す
2182 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2186 POSITION ty, tx, y, x;
2189 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2194 /* Use the given direction */
2197 ly = ty = caster_ptr->y + 20 * ddy[dir];
2198 lx = tx = caster_ptr->x + 20 * ddx[dir];
2201 /* Use an actual "target" */
2202 else /* if (dir == 5) */
2207 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
2208 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
2211 ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
2214 for (i = 0; i < num; i++)
2218 /* Get targets for some bolts */
2219 y = rand_spread(ly, ld * dev / 20);
2220 x = rand_spread(lx, ld * dev / 20);
2222 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2225 /* Analyze the "dir" and the "target". */
2226 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2237 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2238 * @param caster_ptr プレーヤーへの参照ポインタ
2239 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2240 * @return 作用が実際にあった場合TRUEを返す
2242 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
2246 monster_type* m_ptr;
2247 monster_race* r_ptr;
2249 if ((dir == 5) && target_okay())
2256 tx = caster_ptr->x + ddx[dir];
2257 ty = caster_ptr->y + ddy[dir];
2259 g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
2261 if (caster_ptr->anti_tele)
2263 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2267 if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
2269 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2273 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
2275 msg_print(_("失敗した。", "Failed to swap."));
2279 m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2280 r_ptr = &r_info[m_ptr->r_idx];
2282 (void)set_monster_csleep(g_ptr->m_idx, 0);
2284 if (r_ptr->flagsr & RFR_RES_TELE)
2286 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2287 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2291 sound(SOUND_TELEPORT);
2293 /* Swap the player and monster */
2294 (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2302 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2303 * @param caster_ptr プレーヤーへの参照ポインタ
2305 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2308 * @return 作用が実際にあった場合TRUEを返す
2310 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2314 /* Pass through the target if needed */
2315 flg |= (PROJECT_THRU);
2317 /* Use the given direction */
2318 tx = caster_ptr->x + ddx[dir];
2319 ty = caster_ptr->y + ddy[dir];
2321 /* Hack -- Use an actual "target" */
2322 if ((dir == 5) && target_okay())
2328 /* Analyze the "dir" and the "target", do NOT explode */
2329 return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
2334 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2335 * @param caster_ptr プレーヤーへの参照ポインタ
2337 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2339 * @return 作用が実際にあった場合TRUEを返す
2342 * Stop if we hit a monster, as a "bolt".
2343 * Affect monsters and grids (not objects).
2346 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2348 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2349 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2350 return (project_hook(caster_ptr, typ, dir, dam, flg));
2355 * @brief ビーム系スペルの発動 / Cast a beam spell.
2356 * @param caster_ptr プレーヤーへの参照ポインタ
2358 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2360 * @return 作用が実際にあった場合TRUEを返す
2363 * Pass through monsters, as a "beam".
2364 * Affect monsters, grids and objects.
2367 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2369 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2370 return (project_hook(caster_ptr, typ, dir, dam, flg));
2375 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2376 * @param caster_ptr プレーヤーへの参照ポインタ
2377 * @param prob ビーム化する確率(%)
2379 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2381 * @return 作用が実際にあった場合TRUEを返す
2384 * Pass through monsters, as a "beam".
2385 * Affect monsters, grids and objects.
2388 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2390 if (randint0(100) < prob)
2392 return (fire_beam(caster_ptr, typ, dir, dam));
2396 return (fire_bolt(caster_ptr, typ, dir, dam));
2402 * @brief LITE_WEAK属性による光源ビーム処理
2403 * @param caster_ptr プレーヤーへの参照ポインタ
2404 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2406 * @return 作用が実際にあった場合TRUEを返す
2408 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2410 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
2411 return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
2417 * @param caster_ptr プレーヤーへの参照ポインタ
2418 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2420 * @return 作用が実際にあった場合TRUEを返す
2422 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2424 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2425 return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
2431 * @param caster_ptr プレーヤーへの参照ポインタ
2432 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2434 * @return 作用が実際にあった場合TRUEを返す
2436 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2438 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2439 return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
2445 * @param caster_ptr プレーヤーへの参照ポインタ
2446 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2447 * @return 作用が実際にあった場合TRUEを返す
2449 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
2451 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2452 return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
2458 * @param caster_ptr プレーヤーへの参照ポインタ
2459 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2460 * @return 作用が実際にあった場合TRUEを返す
2462 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
2464 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2465 return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
2471 * @param caster_ptr プレーヤーへの参照ポインタ
2472 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2473 * @return 作用が実際にあった場合TRUEを返す
2475 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
2477 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2478 return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
2484 * @param caster_ptr プレーヤーへの参照ポインタ
2485 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2486 * @param plev プレイヤーレベル(効力はplev*200)
2487 * @return 作用が実際にあった場合TRUEを返す
2489 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2491 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2492 return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
2497 * @brief モンスター用テレポート処理
2498 * @param caster_ptr プレーヤーへの参照ポインタ
2499 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2500 * @param distance 移動距離
2501 * @return 作用が実際にあった場合TRUEを返す
2503 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
2505 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
2506 return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
2511 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
2512 * @param caster_ptr プレーヤーへの参照ポインタ
2513 * @return 作用が実際にあった場合TRUEを返す
2515 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
2517 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2518 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
2523 * @brief トラップ生成処理(起点から周囲1マス)
2524 * @param caster_ptr プレーヤーへの参照ポインタ
2527 * @return 作用が実際にあった場合TRUEを返す
2529 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
2531 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2532 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
2537 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
2538 * @param caster_ptr プレーヤーへの参照ポインタ
2539 * @return 作用が実際にあった場合TRUEを返す
2541 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
2543 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2544 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
2549 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
2550 * @param caster_ptr プレーヤーへの参照ポインタ
2551 * @return 作用が実際にあった場合TRUEを返す
2553 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
2555 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
2556 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
2561 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
2562 * @param caster_ptr プレーヤーへの参照ポインタ
2563 * @return 作用が実際にあった場合TRUEを返す
2565 bool wall_stone(player_type *caster_ptr)
2567 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2568 bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
2569 caster_ptr->update |= (PU_FLOW);
2570 caster_ptr->redraw |= (PR_MAP);
2576 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
2577 * @param caster_ptr プレーヤーへの参照ポインタ
2578 * @return 作用が実際にあった場合TRUEを返す
2580 bool destroy_doors_touch(player_type *caster_ptr)
2582 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2583 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
2588 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
2589 * @param caster_ptr プレーヤーへの参照ポインタ
2590 * @return 作用が実際にあった場合TRUEを返す
2592 bool disarm_traps_touch(player_type *caster_ptr)
2594 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2595 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
2600 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
2601 * @param caster_ptr プレーヤーへの参照ポインタ
2602 * @return 作用が実際にあった場合TRUEを返す
2604 bool sleep_monsters_touch(player_type *caster_ptr)
2606 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
2607 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
2612 * @brief 死者復活処理(起点より周囲5マス)
2613 * @param caster_ptr プレーヤーへの参照ポインタ
2614 * @param who 術者モンスターID(0ならばプレイヤー)
2617 * @return 作用が実際にあった場合TRUEを返す
2619 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
2621 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
2622 return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
2628 * @return 作用が実際にあった場合TRUEを返す
2630 void call_chaos(player_type *caster_ptr)
2632 int Chaos_type, dummy, dir;
2633 PLAYER_LEVEL plev = caster_ptr->lev;
2634 bool line_chaos = FALSE;
2636 int hurt_types[31] =
2638 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
2639 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
2640 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
2641 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
2642 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
2643 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
2644 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
2645 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
2648 Chaos_type = hurt_types[randint0(31)];
2649 if (one_in_(4)) line_chaos = TRUE;
2653 for (dummy = 1; dummy < 10; dummy++)
2658 fire_beam(caster_ptr, Chaos_type, dummy, 150);
2660 fire_ball(caster_ptr, Chaos_type, dummy, 150, 2);
2664 else if (one_in_(3))
2666 fire_ball(caster_ptr, Chaos_type, 0, 500, 8);
2670 if (!get_aim_dir(&dir)) return;
2672 fire_beam(caster_ptr, Chaos_type, dir, 250);
2674 fire_ball(caster_ptr, Chaos_type, dir, 250, 3 + (plev / 35));
2680 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
2681 * @param target_ptr プレーヤーへの参照ポインタ
2682 * @param stop_ty 再帰処理停止フラグ
2684 * @return 作用が実際にあった場合TRUEを返す
2687 * rr9: Stop the nasty things when a Cyberdemon is summoned
2688 * or the player gets paralyzed.
2691 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
2693 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
2695 bool is_first_curse = TRUE;
2696 while (is_first_curse || one_in_(3) && !stop_ty)
2698 is_first_curse = FALSE;
2699 switch (randint1(34))
2704 msg_print(_("地面が揺れた...", "The ground trembles..."));
2705 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
2706 if (!one_in_(6)) break;
2711 HIT_POINT dam = damroll(10, 10);
2712 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
2713 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
2714 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
2715 if (!one_in_(6)) break;
2720 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
2721 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
2722 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2723 if (!one_in_(6)) break;
2726 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
2727 wall_breaker(target_ptr);
2730 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
2731 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
2734 if (!one_in_(6)) break;
2735 case 1: case 2: case 3: case 16: case 17:
2736 aggravate_monsters(target_ptr, 0);
2737 if (!one_in_(6)) break;
2738 case 4: case 5: case 6:
2739 (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2740 if (!one_in_(6)) break;
2741 case 7: case 8: case 9: case 18:
2742 (*count) += summon_specific(0, target_ptr->y, target_ptr->x, target_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2743 if (!one_in_(6)) break;
2744 case 10: case 11: case 12:
2745 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
2746 lose_exp(target_ptr, target_ptr->exp / 16);
2747 if (!one_in_(6)) break;
2748 case 13: case 14: case 15: case 19: case 20:
2749 if (stop_ty || (target_ptr->free_act && (randint1(125) < target_ptr->skill_sav)) || (target_ptr->pclass == CLASS_BERSERKER))
2755 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
2756 if (target_ptr->free_act)
2757 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
2759 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
2763 if (!one_in_(6)) break;
2764 case 21: case 22: case 23:
2765 (void)do_dec_stat(target_ptr, randint0(6));
2766 if (!one_in_(6)) break;
2768 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
2769 lose_all_info(target_ptr);
2770 if (!one_in_(6)) break;
2773 * Only summon Cyberdemons deep in the dungeon.
2775 if ((target_ptr->current_floor_ptr->dun_level > 65) && !stop_ty)
2777 (*count) += summon_cyber(-1, target_ptr->y, target_ptr->x);
2782 if (!one_in_(6)) break;
2784 for (int i = 0; i < A_MAX; i++)
2786 bool is_first_dec_stat = TRUE;
2787 while (is_first_dec_stat || one_in_(2))
2789 is_first_dec_stat = FALSE;
2790 (void)do_dec_stat(target_ptr, i);
2801 * todo 引数にPOSITION x/yは必要か? 要調査
2802 * @brief HI_SUMMON(上級召喚)処理発動
2803 * @param caster_ptr プレーヤーへの参照ポインタ
2806 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
2807 * @return 作用が実際にあった場合TRUEを返す
2809 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
2813 BIT_FLAGS mode = PM_ALLOW_GROUP;
2820 mode |= PM_FORCE_FRIENDLY;
2824 mode |= PM_FORCE_PET;
2829 if (!pet) mode |= PM_NO_PET;
2831 summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level);
2833 for (int i = 0; i < (randint1(7) + (caster_ptr->current_floor_ptr->dun_level / 40)); i++)
2835 switch (randint1(25) + (caster_ptr->current_floor_ptr->dun_level / 20))
2838 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
2841 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
2844 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
2847 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
2850 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
2853 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
2856 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
2859 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
2863 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
2867 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
2870 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2871 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
2874 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2875 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
2878 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
2881 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2882 count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
2891 * @brief 周辺破壊効果(プレイヤー中心)
2892 * @param caster_ptr プレーヤーへの参照ポインタ
2893 * @return 作用が実際にあった場合TRUEを返す
2895 void wall_breaker(player_type *caster_ptr)
2898 POSITION y = 0, x = 0;
2899 int attempts = 1000;
2901 if (randint1(80 + caster_ptr->lev) < 70)
2905 scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
2907 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
2909 if (!player_bold(caster_ptr, y, x)) break;
2912 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2913 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2915 else if (randint1(100) > 30)
2917 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2921 int num = damroll(5, 3);
2923 for (i = 0; i < num; i++)
2927 scatter(&y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2929 if (!player_bold(caster_ptr, y, x)) break;
2932 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2933 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2940 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2941 * @param caster_ptr プレーヤーへの参照ポインタ
2943 * @return 作用が実際にあった場合TRUEを返す
2945 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2947 return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2952 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2953 * @param caster_ptr プレーヤーへの参照ポインタ
2955 * @return 作用が実際にあった場合TRUEを返す
2957 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2959 return (project_all_los(caster_ptr, GF_CHARM, dam));
2964 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2965 * @param caster_ptr プレーヤーへの参照ポインタ
2967 * @return 作用が実際にあった場合TRUEを返す
2969 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2971 return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2976 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2977 * @param caster_ptr プレーヤーへの参照ポインタ
2979 * @return 作用が実際にあった場合TRUEを返す
2981 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2983 return (project_all_los(caster_ptr, GF_STUN, dam));
2988 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2989 * @param caster_ptr プレーヤーへの参照ポインタ
2991 * @return 作用が実際にあった場合TRUEを返す
2993 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2995 return (project_all_los(caster_ptr, GF_STASIS, dam));
3000 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
3001 * @param caster_ptr プレーヤーへの参照ポインタ
3003 * @return 作用が実際にあった場合TRUEを返す
3005 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
3007 return (project_all_los(caster_ptr, GF_PSI, dam));
3012 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
3013 * @param caster_ptr プレーヤーへの参照ポインタ
3014 * @param dist 効力(距離)
3015 * @return 作用が実際にあった場合TRUEを返す
3017 bool banish_monsters(player_type *caster_ptr, int dist)
3019 return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
3024 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
3025 * @param caster_ptr プレーヤーへの参照ポインタ
3027 * @return 作用が実際にあった場合TRUEを返す
3029 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
3031 return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
3036 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
3037 * @param caster_ptr プレーヤーへの参照ポインタ
3039 * @return 作用が実際にあった場合TRUEを返す
3041 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
3043 return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
3048 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
3049 * @param caster_ptr プレーヤーへの参照ポインタ
3050 * @return 作用が実際にあった場合TRUEを返す
3052 bool deathray_monsters(player_type *caster_ptr)
3054 return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
3059 * @brief チャーム・モンスター(1体)
3060 * @param caster_ptr プレーヤーへの参照ポインタ
3061 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3063 * @return 作用が実際にあった場合TRUEを返す
3065 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
3067 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3068 return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
3073 * @brief アンデッド支配(1体)
3074 * @param caster_ptr プレーヤーへの参照ポインタ
3075 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3077 * @return 作用が実際にあった場合TRUEを返す
3079 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
3081 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3082 return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
3088 * @param caster_ptr プレーヤーへの参照ポインタ
3089 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3091 * @return 作用が実際にあった場合TRUEを返す
3093 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
3095 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3096 return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
3102 * @param caster_ptr プレーヤーへの参照ポインタ
3103 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3105 * @return 作用が実際にあった場合TRUEを返す
3107 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
3109 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3110 return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
3116 * @param caster_ptr プレーヤーへの参照ポインタ
3117 * @param success 判定成功上の処理ならばTRUE
3118 * @return 作用が実際にあった場合TRUEを返す
3120 bool kawarimi(player_type *caster_ptr, bool success)
3123 object_type *q_ptr = &forge;
3126 if (caster_ptr->is_dead) return FALSE;
3127 if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
3128 if (randint0(200) < caster_ptr->stun) return FALSE;
3130 if (!success && one_in_(3))
3132 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3133 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
3134 caster_ptr->redraw |= (PR_STATUS);
3141 teleport_player(caster_ptr, 10 + randint1(90), 0L);
3143 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3145 q_ptr->pval = MON_NINJA;
3146 (void)drop_near(q_ptr, -1, y, x);
3148 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3149 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3151 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
3152 caster_ptr->redraw |= (PR_STATUS);
3160 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3161 * @param caster_ptr プレーヤーへの参照ポインタ
3162 * @param mdeath 目標モンスターが死亡したかを返す
3163 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3165 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
3172 bool tmp_mdeath = FALSE;
3175 if (mdeath) *mdeath = FALSE;
3178 if (!get_aim_dir(&dir)) return FALSE;
3180 /* Use the given direction */
3181 tx = attacker_ptr->x + project_length * ddx[dir];
3182 ty = attacker_ptr->y + project_length * ddy[dir];
3184 /* Hack -- Use an actual "target" */
3185 if ((dir == 5) && target_okay())
3191 if (in_bounds(attacker_ptr->current_floor_ptr, ty, tx)) tm_idx = attacker_ptr->current_floor_ptr->grid_array[ty][tx].m_idx;
3193 path_n = project_path(attacker_ptr->current_floor_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3196 /* No need to move */
3197 if (!path_n) return TRUE;
3199 /* Use ty and tx as to-move point */
3200 ty = attacker_ptr->y;
3201 tx = attacker_ptr->x;
3203 /* Project along the path */
3204 for (i = 0; i < path_n; i++)
3206 monster_type *m_ptr;
3208 int ny = GRID_Y(path_g[i]);
3209 int nx = GRID_X(path_g[i]);
3211 if (cave_empty_bold(attacker_ptr->current_floor_ptr, ny, nx) && player_can_enter(attacker_ptr, attacker_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0))
3216 /* Go to next grid */
3220 if (!attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
3224 msg_print(_("失敗!", "Failed!"));
3228 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3235 /* Move player before updating the monster */
3236 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3237 update_monster(attacker_ptr, attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3239 /* Found a monster */
3240 m_ptr = &attacker_ptr->current_floor_ptr->m_list[attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx];
3242 if (tm_idx != attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
3245 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3247 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3250 else if (!player_bold(attacker_ptr, ty, tx))
3252 /* Hold the monster name */
3253 GAME_TEXT m_name[MAX_NLEN];
3255 /* Get the monster name (BEFORE polymorphing) */
3256 monster_desc(m_name, m_ptr, 0);
3257 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3260 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3262 tmp_mdeath = py_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
3267 if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3269 if (mdeath) *mdeath = tmp_mdeath;
3275 * @brief 全鏡の消去 / Remove all mirrors in this floor
3276 * @param caster_ptr プレーヤーへの参照ポインタ
3277 * @param explode 爆発処理を伴うならばTRUE
3280 void remove_all_mirrors(player_type *caster_ptr, bool explode)
3284 for (x = 0; x < caster_ptr->current_floor_ptr->width; x++)
3286 for (y = 0; y < caster_ptr->current_floor_ptr->height; y++)
3288 if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
3290 remove_mirror(caster_ptr, y, x);
3292 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
3293 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3301 * @brief 『一つの指輪』の効果処理 /
3302 * Hack -- activate the ring of power
3303 * @param caster_ptr プレーヤーへの参照ポインタ
3304 * @param dir 発動の方向ID
3307 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
3309 /* Pick a random effect */
3310 switch (randint1(10))
3315 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3318 /* Decrease all stats (permanently) */
3319 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
3320 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
3321 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
3322 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
3323 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
3324 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
3326 /* Lose some experience (permanently) */
3327 caster_ptr->exp -= (caster_ptr->exp / 4);
3328 caster_ptr->max_exp -= (caster_ptr->exp / 4);
3329 check_experience(caster_ptr);
3336 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3337 dispel_monsters(caster_ptr, 1000);
3345 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
3354 fire_bolt(caster_ptr, GF_MANA, dir, 500);
3362 * @brief 運命の輪、並びにカオス的な効果の発動
3363 * @param caster_ptr プレーヤーへの参照ポインタ
3364 * @param spell ランダムな効果を選択するための基準ID
3367 void wild_magic(player_type *caster_ptr, int spell)
3370 int type = SUMMON_MOLD + randint0(6);
3372 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3373 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3375 switch (randint1(spell) + randint1(8) + 1)
3380 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3385 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3389 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3394 unlite_area(caster_ptr, 10, 3);
3399 lite_area(caster_ptr, damroll(2, 3), 2);
3402 destroy_doors_touch(caster_ptr);
3405 wall_breaker(caster_ptr);
3407 sleep_monsters_touch(caster_ptr);
3411 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3415 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3420 aggravate_monsters(caster_ptr, 0);
3423 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3427 (void)gain_mutation(caster_ptr, 0);
3431 apply_disenchant(caster_ptr, 1);
3434 lose_all_info(caster_ptr);
3437 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3440 wall_stone(caster_ptr);
3444 while (counter++ < 8)
3446 (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
3451 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3454 (void)summon_cyber(-1, caster_ptr->y, caster_ptr->x);
3459 (void)activate_ty_curse(caster_ptr, FALSE, &count);
3467 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
3468 * / Drop 10+1d10 meteor ball at random places near the player
3469 * @param caster_ptr プレーヤーへの参照ポインタ
3474 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3477 int b = 10 + randint1(10);
3479 for (i = 0; i < b; i++)
3481 POSITION y = 0, x = 0;
3484 for (count = 0; count <= 20; count++)
3488 x = caster_ptr->x - 8 + randint0(17);
3489 y = caster_ptr->y - 8 + randint0(17);
3491 dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
3492 dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
3494 /* Approximate distance */
3495 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3497 if (d >= 9) continue;
3499 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) || !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)
3500 || !cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
3502 /* Valid position */
3506 if (count > 20) continue;
3508 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
3514 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
3515 * @param caster_ptr プレーヤーへの参照ポインタ
3518 * @return ターゲットを指定し、実行したならばTRUEを返す。
3520 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3522 POSITION x, y, tx, ty;
3526 int b = 10 + randint1(10);
3528 if (!get_aim_dir(&dir)) return FALSE;
3530 /* Use the given direction */
3531 tx = caster_ptr->x + 99 * ddx[dir];
3532 ty = caster_ptr->y + 99 * ddy[dir];
3534 /* Hack -- Use an actual "target" */
3535 if ((dir == 5) && target_okay())
3546 /* Hack -- Stop at the target */
3547 if ((y == ty) && (x == tx)) break;
3551 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
3553 /* Stop at maximum range */
3554 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
3556 /* Stopped by walls/doors */
3557 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
3559 /* Stopped by monsters */
3560 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
3562 /* Save the new location */
3570 for (i = 0; i < b; i++)
3572 int count = 20, d = 0;
3578 x = tx - 5 + randint0(11);
3579 y = ty - 5 + randint0(11);
3581 dx = (tx > x) ? (tx - x) : (x - tx);
3582 dy = (ty > y) ? (ty - y) : (y - ty);
3584 /* Approximate distance */
3585 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3586 /* Within the radius */
3590 if (count < 0) continue;
3592 /* Cannot penetrate perm walls */
3593 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
3594 cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
3595 !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
3598 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
3605 * @brief 「ワンダー」のランダムな効果を決定して処理する。
3606 * @param caster_ptr プレーヤーへの参照ポインタ
3610 * This spell should become more useful (more controlled) as the\n
3611 * player gains experience levels. Thus, add 1/5 of the player's\n
3612 * level to the die roll. This eliminates the worst effects later on,\n
3613 * while keeping the results quite random. It also allows some potent\n
3614 * effects only at high level.
3616 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
3618 PLAYER_LEVEL plev = caster_ptr->lev;
3619 int die = randint1(100) + plev / 5;
3620 int vir = virtue_number(caster_ptr, V_CHANCE);
3624 if (caster_ptr->virtues[vir - 1] > 0)
3626 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3630 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3635 chg_virtue(caster_ptr, V_CHANCE, 1);
3639 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
3642 if (die < 8) clone_monster(dir);
3643 else if (die < 14) speed_monster(dir, plev);
3644 else if (die < 26) heal_monster(dir, damroll(4, 6));
3645 else if (die < 31) poly_monster(dir, plev);
3647 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3648 damroll(3 + ((plev - 1) / 5), 4));
3649 else if (die < 41) confuse_monster(dir, plev);
3650 else if (die < 46) fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3651 else if (die < 51) (void)lite_line(caster_ptr, dir, damroll(6, 8));
3653 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3654 damroll(3 + ((plev - 5) / 4), 8));
3656 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3657 damroll(5 + ((plev - 5) / 4), 8));
3659 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3660 damroll(6 + ((plev - 5) / 4), 8));
3662 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3663 damroll(8 + ((plev - 5) / 4), 8));
3664 else if (die < 76) hypodynamic_bolt(caster_ptr, dir, 75);
3665 else if (die < 81) fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3666 else if (die < 86) fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3667 else if (die < 91) fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3668 else if (die < 96) fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3669 else if (die < 101) hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3672 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3676 (void)destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3680 symbol_genocide(caster_ptr, plev + 50, TRUE);
3684 dispel_monsters(caster_ptr, 120);
3688 dispel_monsters(caster_ptr, 150);
3689 slow_monsters(caster_ptr, plev);
3690 sleep_monsters(caster_ptr, plev);
3691 hp_player(caster_ptr, 300);
3697 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
3698 * @param caster_ptr プレーヤーへの参照ポインタ
3702 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
3704 PLAYER_LEVEL plev = caster_ptr->lev;
3705 int die = randint1(100) + plev / 5;
3706 int vir = virtue_number(caster_ptr, V_CHANCE);
3710 if (caster_ptr->virtues[vir - 1] > 0)
3712 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3716 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3720 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
3722 chg_virtue(caster_ptr, V_CHANCE, 1);
3726 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
3731 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
3732 "Oh no! Mouldering forms rise from the earth around you!"));
3734 (void)summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3735 chg_virtue(caster_ptr, V_UNLIFE, 1);
3739 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
3741 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
3745 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
3746 "Your head is invaded by a horde of gibbering spectral voices..."));
3748 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
3752 poly_monster(dir, plev);
3756 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3757 damroll(3 + ((plev - 1) / 5), 4));
3761 confuse_monster(dir, plev);
3765 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3769 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3773 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3774 damroll(3 + ((plev - 5) / 4), 8));
3778 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3779 damroll(5 + ((plev - 5) / 4), 8));
3783 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3784 damroll(6 + ((plev - 5) / 4), 8));
3788 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3789 damroll(8 + ((plev - 5) / 4), 8));
3793 hypodynamic_bolt(caster_ptr, dir, 75);
3797 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3801 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3805 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3809 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3813 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3817 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3821 (void)destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3825 symbol_genocide(caster_ptr, plev + 50, TRUE);
3829 dispel_monsters(caster_ptr, 120);
3833 dispel_monsters(caster_ptr, 150);
3834 slow_monsters(caster_ptr, plev);
3835 sleep_monsters(caster_ptr, plev);
3836 hp_player(caster_ptr, 300);
3841 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
3842 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
3847 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
3848 * @param caster_ptr プレーヤーへの参照ポインタ
3851 void cast_shuffle(player_type *caster_ptr)
3853 PLAYER_LEVEL plev = caster_ptr->lev;
3856 int vir = virtue_number(caster_ptr, V_CHANCE);
3859 /* Card sharks and high mages get a level bonus */
3860 if ((caster_ptr->pclass == CLASS_ROGUE) ||
3861 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
3862 (caster_ptr->pclass == CLASS_SORCERER))
3863 die = (randint1(110)) + plev / 5;
3865 die = randint1(120);
3869 if (caster_ptr->virtues[vir - 1] > 0)
3871 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3875 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3879 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3882 chg_virtue(caster_ptr, V_CHANCE, 1);
3886 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3888 for (i = 0; i < randint1(3); i++)
3889 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3893 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3894 summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3899 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3900 activate_ty_curse(caster_ptr, FALSE, &count);
3904 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3905 aggravate_monsters(caster_ptr, 0);
3909 msg_print(_("《愚者》だ。", "It's the Fool."));
3910 do_dec_stat(caster_ptr, A_INT);
3911 do_dec_stat(caster_ptr, A_WIS);
3915 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3916 trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
3920 msg_print(_("《月》だ。", "It's the Moon."));
3921 unlite_area(caster_ptr, 10, 3);
3925 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3926 wild_magic(caster_ptr, randint0(32));
3930 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3931 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3935 msg_print(_("《正義》だ。", "It's Justice."));
3936 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3940 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3941 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3945 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3946 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3950 msg_print(_("《塔》だ。", "It's the Tower."));
3951 wall_breaker(caster_ptr);
3955 msg_print(_("《節制》だ。", "It's Temperance."));
3956 sleep_monsters_touch(caster_ptr);
3960 msg_print(_("《塔》だ。", "It's the Tower."));
3962 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3966 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3967 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3971 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3972 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3976 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3977 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
3981 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3982 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
3986 msg_print(_("《恋人》だ。", "It's the Lovers."));
3988 if (get_aim_dir(&dir))
3989 charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
3993 msg_print(_("《隠者》だ。", "It's the Hermit."));
3994 wall_stone(caster_ptr);
3998 msg_print(_("《審判》だ。", "It's the Judgement."));
3999 roll_hitdice(caster_ptr, 0L);
4000 lose_all_mutations(caster_ptr);
4004 msg_print(_("《太陽》だ。", "It's the Sun."));
4005 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
4006 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
4007 wiz_lite(caster_ptr, FALSE);
4011 msg_print(_("《世界》だ。", "It's the World."));
4012 if (caster_ptr->exp < PY_MAX_EXP)
4014 s32b ee = (caster_ptr->exp / 25) + 1;
4015 if (ee > 5000) ee = 5000;
4016 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4017 gain_exp(caster_ptr, ee);
4023 * @brief 口を使う継続的な処理を中断する
4024 * @param caster_ptr プレーヤーへの参照ポインタ
4027 void stop_mouth(player_type *caster_ptr)
4029 if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
4030 if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
4034 bool_hack vampirism(player_type *caster_ptr)
4041 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4043 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4047 /* Only works on adjacent monsters */
4048 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
4049 y = caster_ptr->y + ddy[dir];
4050 x = caster_ptr->x + ddx[dir];
4051 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
4053 stop_mouth(caster_ptr);
4055 if (!(g_ptr->m_idx))
4057 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4061 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4063 dummy = caster_ptr->lev * 2;
4065 if (hypodynamic_bolt(caster_ptr, dir, dummy))
4067 if (caster_ptr->food < PY_FOOD_FULL)
4068 /* No heal if we are "full" */
4069 (void)hp_player(caster_ptr, dummy);
4071 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4073 /* Gain nutritional sustenance: 150/hp drained */
4074 /* A Food ration gives 5000 food points (by contrast) */
4075 /* Don't ever get more than "Full" this way */
4076 /* But if we ARE Gorged, it won't cure us */
4077 dummy = caster_ptr->food + MIN(5000, 100 * dummy);
4078 if (caster_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4079 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4082 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4087 bool panic_hit(void)
4092 if (!get_direction(p_ptr, &dir, FALSE, FALSE)) return FALSE;
4093 y = p_ptr->y + ddy[dir];
4094 x = p_ptr->x + ddx[dir];
4095 if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4097 py_attack(p_ptr, y, x, 0);
4098 if (randint0(p_ptr->skill_dis) < 7)
4099 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4101 teleport_player(p_ptr, 30, 0L);
4106 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4114 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4115 * @param caster_ptr プレーヤーへの参照ポインタ
4118 * currently this function allows pseudo-id of any object,
4119 * including silly ones like potions & scrolls, which always
4120 * get '{average}'. This should be changed, either to stop such
4121 * items from being pseudo-id'd, or to allow psychometry to
4122 * detect whether the unidentified potion/scroll/etc is
4123 * good (Cure Light Wounds, Restore Strength, etc) or
4124 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4126 bool psychometry(player_type *caster_ptr)
4130 GAME_TEXT o_name[MAX_NLEN];
4135 q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4136 s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4138 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
4139 if (!o_ptr) return (FALSE);
4141 /* It is fully known, no information needed */
4142 if (object_is_known(o_ptr))
4144 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4148 /* Check for a feeling */
4149 feel = value_check_aux1(o_ptr);
4151 /* Get an object description */
4152 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4154 /* Skip non-feelings */
4157 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4162 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4164 msg_format("You feel that the %s %s %s...",
4165 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4169 o_ptr->ident |= (IDENT_SENSE);
4170 o_ptr->feeling = feel;
4171 o_ptr->marked |= OM_TOUCHED;
4173 caster_ptr->update |= (PU_COMBINE | PU_REORDER);
4174 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4176 /* Valid "tval" codes */
4177 switch (o_ptr->tval)
4205 /* Auto-inscription/destroy */
4206 autopick_alter_item(item, (bool)(okay && destroy_feeling));
4208 /* Something happened */
4213 bool draconian_breath(player_type *creature_ptr)
4216 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4217 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4219 if (!get_aim_dir(&dir)) return FALSE;
4221 if (randint1(100) < creature_ptr->lev)
4223 switch (creature_ptr->pclass)
4226 case CLASS_BERSERKER:
4229 case CLASS_IMITATOR:
4235 Type_desc = _("エレメント", "the elements");
4240 Type_desc = _("破片", "shards");
4245 case CLASS_WARRIOR_MAGE:
4246 case CLASS_HIGH_MAGE:
4247 case CLASS_SORCERER:
4248 case CLASS_MAGIC_EATER:
4249 case CLASS_RED_MAGE:
4250 case CLASS_BLUE_MAGE:
4251 case CLASS_MIRROR_MASTER:
4255 Type_desc = _("魔力", "mana");
4259 Type = GF_DISENCHANT;
4260 Type_desc = _("劣化", "disenchantment");
4264 case CLASS_CHAOS_WARRIOR:
4267 Type = GF_CONFUSION;
4268 Type_desc = _("混乱", "confusion");
4273 Type_desc = _("カオス", "chaos");
4279 case CLASS_FORCETRAINER:
4282 Type = GF_CONFUSION;
4283 Type_desc = _("混乱", "confusion");
4288 Type_desc = _("轟音", "sound");
4292 case CLASS_MINDCRAFTER:
4295 Type = GF_CONFUSION;
4296 Type_desc = _("混乱", "confusion");
4301 Type_desc = _("精神エネルギー", "mental energy");
4309 Type = GF_HELL_FIRE;
4310 Type_desc = _("地獄の劫火", "hellfire");
4314 Type = GF_HOLY_FIRE;
4315 Type_desc = _("聖なる炎", "holy fire");
4324 Type_desc = _("暗黒", "darkness");
4329 Type_desc = _("毒", "poison");
4337 Type_desc = _("轟音", "sound");
4341 Type = GF_CONFUSION;
4342 Type_desc = _("混乱", "confusion");
4349 stop_mouth(creature_ptr);
4350 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4352 fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4357 bool android_inside_weapon(player_type *creature_ptr)
4360 if (!get_aim_dir(&dir)) return FALSE;
4361 if (creature_ptr->lev < 10)
4363 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4364 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4366 else if (creature_ptr->lev < 25)
4368 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4369 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
4371 else if (creature_ptr->lev < 35)
4373 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4374 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4376 else if (creature_ptr->lev < 45)
4378 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4379 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
4383 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4384 fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4391 bool create_ration(player_type *crature_ptr)
4397 /* Create the food ration */
4398 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4400 /* Drop the object from heaven */
4401 (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
4402 msg_print(_("食事を料理して作った。", "You cook some food."));
4407 void hayagake(player_type *creature_ptr)
4409 if (creature_ptr->action == ACTION_HAYAGAKE)
4411 set_action(creature_ptr, ACTION_NONE);
4415 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4416 feature_type *f_ptr = &f_info[g_ptr->feat];
4418 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4419 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4421 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4425 set_action(creature_ptr, ACTION_HAYAGAKE);
4429 creature_ptr->energy_use = 0;
4433 bool double_attack(player_type *creature_ptr)
4438 if (!get_rep_dir(&dir, FALSE)) return FALSE;
4439 y = creature_ptr->y + ddy[dir];
4440 x = creature_ptr->x + ddx[dir];
4441 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4444 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4445 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4447 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4448 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4450 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4451 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4453 py_attack(creature_ptr, y, x, 0);
4454 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4457 py_attack(creature_ptr, y, x, 0);
4459 creature_ptr->energy_need += ENERGY_NEED();
4463 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4471 bool comvert_hp_to_mp(player_type *creature_ptr)
4473 int gain_sp = take_hit(p_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
4476 creature_ptr->csp += gain_sp;
4477 if (creature_ptr->csp > creature_ptr->msp)
4479 creature_ptr->csp = creature_ptr->msp;
4480 creature_ptr->csp_frac = 0;
4485 msg_print(_("変換に失敗した。", "You failed to convert."));
4488 creature_ptr->redraw |= (PR_HP | PR_MANA);
4493 bool comvert_mp_to_hp(player_type *creature_ptr)
4495 if (creature_ptr->csp >= creature_ptr->lev / 5)
4497 creature_ptr->csp -= creature_ptr->lev / 5;
4498 hp_player(p_ptr, creature_ptr->lev);
4502 msg_print(_("変換に失敗した。", "You failed to convert."));
4505 creature_ptr->redraw |= (PR_HP | PR_MANA);
4510 bool demonic_breath(player_type *creature_ptr)
4513 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
4514 if (!get_aim_dir(&dir)) return FALSE;
4515 stop_mouth(creature_ptr);
4516 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
4517 fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
4522 bool mirror_concentration(player_type *creature_ptr)
4526 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4530 if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
4532 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4534 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
4535 if (creature_ptr->csp >= creature_ptr->msp)
4537 creature_ptr->csp = creature_ptr->msp;
4538 creature_ptr->csp_frac = 0;
4540 creature_ptr->redraw |= (PR_MANA);
4544 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
4551 bool sword_dancing(player_type *creature_ptr)
4554 POSITION y = 0, x = 0;
4558 for (i = 0; i < 6; i++)
4561 y = creature_ptr->y + ddy_ddd[dir];
4562 x = creature_ptr->x + ddx_ddd[dir];
4563 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
4565 /* Hack -- attack monsters */
4567 py_attack(creature_ptr, y, x, 0);
4570 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
4579 * @param creature_ptr プレーヤーへの参照ポインタ
4582 bool confusing_light(player_type *creature_ptr)
4584 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
4585 slow_monsters(creature_ptr, creature_ptr->lev);
4586 stun_monsters(creature_ptr, creature_ptr->lev * 4);
4587 confuse_monsters(creature_ptr, creature_ptr->lev * 4);
4588 turn_monsters(creature_ptr, creature_ptr->lev * 4);
4589 stasis_monsters(creature_ptr, creature_ptr->lev * 4);
4596 * @param creature_ptr プレーヤーへの参照ポインタ
4597 * @return 結果はどうあれ騎乗したらTRUE
4599 bool rodeo(player_type *creature_ptr)
4601 GAME_TEXT m_name[MAX_NLEN];
4602 monster_type *m_ptr;
4603 monster_race *r_ptr;
4606 if (creature_ptr->riding)
4608 msg_print(_("今は乗馬中だ。", "You ARE riding."));
4612 if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
4614 m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4615 r_ptr = &r_info[m_ptr->r_idx];
4616 monster_desc(m_name, m_ptr, 0);
4617 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
4619 if (is_pet(m_ptr)) return TRUE;
4621 rlev = r_ptr->level;
4623 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
4624 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
4625 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
4626 && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
4627 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
4628 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
4630 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
4635 msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
4636 rakuba(p_ptr, 1, TRUE);
4637 /* 落馬処理に失敗してもとにかく乗馬解除 */
4638 creature_ptr->riding = 0;
4645 bool clear_mind(player_type *creature_ptr)
4649 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4652 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4654 creature_ptr->csp += (3 + creature_ptr->lev / 20);
4655 if (creature_ptr->csp >= creature_ptr->msp)
4657 creature_ptr->csp = creature_ptr->msp;
4658 creature_ptr->csp_frac = 0;
4661 creature_ptr->redraw |= (PR_MANA);
4666 bool concentration(player_type *creature_ptr)
4668 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
4672 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4676 if (creature_ptr->special_defense & KATA_MASK)
4678 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
4682 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
4684 creature_ptr->csp += creature_ptr->msp / 2;
4685 if (creature_ptr->csp >= max_csp)
4687 creature_ptr->csp = max_csp;
4688 creature_ptr->csp_frac = 0;
4691 creature_ptr->redraw |= (PR_MANA);