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.
21 #include "io/write-diary.h"
22 #include "cmd/cmd-pet.h"
23 #include "cmd/cmd-dump.h"
27 #include "monsterrace-hook.h"
31 #include "spells-summon.h"
36 #include "spells-status.h"
37 #include "spells-floor.h"
38 #include "spells-diceroll.h"
39 #include "realm-hex.h"
41 #include "object-flavor.h"
42 #include "object-hook.h"
43 #include "monster-status.h"
44 #include "player-move.h"
45 #include "player-status.h"
46 #include "player-effects.h"
47 #include "player-skill.h"
48 #include "player-class.h"
49 #include "player-damage.h"
50 #include "player-inventory.h"
53 #include "floor-events.h"
55 #include "view-mainwindow.h"
56 #include "objectkind.h"
57 #include "monsterrace.h"
58 #include "targeting.h"
59 #include "realm-song.h"
63 * @brief プレイヤー周辺の地形を感知する
64 * @param caster_ptr プレーヤーへの参照ポインタ
67 * @param known 地形から危険フラグを外すならTRUE
68 * @return 効力があった場合TRUEを返す
70 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
72 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
76 for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
78 for (POSITION x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
80 int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
81 if (dist > range) continue;
82 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
85 /* Mark as detected */
86 if (dist <= range && known)
88 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
90 g_ptr->info &= ~(CAVE_UNSAFE);
92 lite_spot(caster_ptr, y, x);
96 if (cave_have_flag_grid(g_ptr, flag))
98 disclose_grid(caster_ptr, y, x);
99 g_ptr->info |= (CAVE_MARK);
100 lite_spot(caster_ptr, y, x);
111 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
112 * @param caster_ptr プレーヤーへの参照ポインタ
114 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
115 * @return 効力があった場合TRUEを返す
117 bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
119 bool detect = detect_feat_flag(caster_ptr, range, FF_TRAP, known);
121 if (known) caster_ptr->dtrap = TRUE;
123 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
126 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
134 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
135 * @param caster_ptr プレーヤーへの参照ポインタ
137 * @return 効力があった場合TRUEを返す
139 bool detect_doors(player_type *caster_ptr, POSITION range)
141 bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
143 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
146 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
154 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
155 * @param caster_ptr プレーヤーへの参照ポインタ
157 * @return 効力があった場合TRUEを返す
159 bool detect_stairs(player_type *caster_ptr, POSITION range)
161 bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
163 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
166 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
174 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
175 * @param caster_ptr プレーヤーへの参照ポインタ
177 * @return 効力があった場合TRUEを返す
179 bool detect_treasure(player_type *caster_ptr, POSITION range)
181 bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
183 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
186 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
194 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
195 * @param caster_ptr プレーヤーへの参照ポインタ
197 * @return 効力があった場合TRUEを返す
199 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
201 POSITION range2 = range;
202 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
207 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
209 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
211 if (!OBJECT_IS_VALID(o_ptr)) continue;
212 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
216 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
218 if (o_ptr->tval == TV_GOLD)
220 o_ptr->marked |= OM_FOUND;
221 lite_spot(caster_ptr, y, x);
226 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
229 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
232 if (detect_monsters_string(caster_ptr, range, "$"))
242 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
243 * @param caster_ptr プレーヤーへの参照ポインタ
245 * @return 効力があった場合TRUEを返す
247 bool detect_objects_normal(player_type *caster_ptr, POSITION range)
249 POSITION range2 = range;
250 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
253 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
255 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
257 if (!OBJECT_IS_VALID(o_ptr)) continue;
258 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
260 POSITION y = o_ptr->iy;
261 POSITION x = o_ptr->ix;
263 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
265 if (o_ptr->tval != TV_GOLD)
267 o_ptr->marked |= OM_FOUND;
268 lite_spot(caster_ptr, y, x);
273 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
276 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
279 if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
289 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
290 * @param caster_ptr プレーヤーへの参照ポインタ
292 * @return 効力があった場合TRUEを返す
295 * This will light up all spaces with "magic" items, including artifacts,
296 * ego-items, potions, scrolls, books, rods, wands, staffs, amulets, rings,
297 * and "enchanted" items of the "good" variety.
299 * It can probably be argued that this function is now too powerful.
302 bool detect_objects_magic(player_type *caster_ptr, POSITION range)
304 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
306 OBJECT_TYPE_VALUE tv;
308 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
310 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
312 if (!OBJECT_IS_VALID(o_ptr)) continue;
313 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
315 POSITION y = o_ptr->iy;
316 POSITION x = o_ptr->ix;
318 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
321 if (object_is_artifact(o_ptr) ||
322 object_is_ego(o_ptr) ||
323 (tv == TV_WHISTLE) ||
331 (tv == TV_LIFE_BOOK) ||
332 (tv == TV_SORCERY_BOOK) ||
333 (tv == TV_NATURE_BOOK) ||
334 (tv == TV_CHAOS_BOOK) ||
335 (tv == TV_DEATH_BOOK) ||
336 (tv == TV_TRUMP_BOOK) ||
337 (tv == TV_ARCANE_BOOK) ||
338 (tv == TV_CRAFT_BOOK) ||
339 (tv == TV_DAEMON_BOOK) ||
340 (tv == TV_CRUSADE_BOOK) ||
341 (tv == TV_MUSIC_BOOK) ||
342 (tv == TV_HISSATSU_BOOK) ||
343 (tv == TV_HEX_BOOK) ||
344 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
346 o_ptr->marked |= OM_FOUND;
347 lite_spot(caster_ptr, y, x);
354 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
362 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
363 * @param caster_ptr プレーヤーへの参照ポインタ
365 * @return 効力があった場合TRUEを返す
367 bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
369 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
372 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
374 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
375 monster_race *r_ptr = &r_info[m_ptr->r_idx];
376 if (!monster_is_valid(m_ptr)) continue;
378 POSITION y = m_ptr->fy;
379 POSITION x = m_ptr->fx;
380 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
382 if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
384 repair_monsters = TRUE;
385 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
386 update_monster(caster_ptr, i, FALSE);
391 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
394 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
402 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
403 * @param caster_ptr プレーヤーへの参照ポインタ
405 * @return 効力があった場合TRUEを返す
407 bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
409 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
412 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
414 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
415 monster_race *r_ptr = &r_info[m_ptr->r_idx];
417 if (!monster_is_valid(m_ptr)) continue;
419 POSITION y = m_ptr->fy;
420 POSITION x = m_ptr->fx;
422 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
424 if (r_ptr->flags2 & RF2_INVISIBLE)
426 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
428 caster_ptr->window |= (PW_MONSTER);
431 repair_monsters = TRUE;
432 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
433 update_monster(caster_ptr, i, FALSE);
438 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
441 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
449 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
450 * @param caster_ptr プレーヤーへの参照ポインタ
452 * @return 効力があった場合TRUEを返す
454 bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
456 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
459 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
461 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
462 monster_race *r_ptr = &r_info[m_ptr->r_idx];
463 if (!monster_is_valid(m_ptr)) continue;
465 POSITION y = m_ptr->fy;
466 POSITION x = m_ptr->fx;
468 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
470 if (r_ptr->flags3 & RF3_EVIL)
472 if (is_original_ap(m_ptr))
474 r_ptr->r_flags3 |= (RF3_EVIL);
475 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
477 caster_ptr->window |= (PW_MONSTER);
481 repair_monsters = TRUE;
482 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
483 update_monster(caster_ptr, i, FALSE);
490 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
498 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
499 * @param caster_ptr プレーヤーへの参照ポインタ
501 * @return 効力があった場合TRUEを返す
503 bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
505 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
508 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
510 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
511 if (!monster_is_valid(m_ptr)) continue;
513 POSITION y = m_ptr->fy;
514 POSITION x = m_ptr->fx;
515 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
517 if (!monster_living(m_ptr->r_idx))
519 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
521 caster_ptr->window |= (PW_MONSTER);
524 repair_monsters = TRUE;
525 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
526 update_monster(caster_ptr, i, FALSE);
533 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
541 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
542 * @param caster_ptr プレーヤーへの参照ポインタ
544 * @return 効力があった場合TRUEを返す
546 bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
548 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
551 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
553 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
554 monster_race *r_ptr = &r_info[m_ptr->r_idx];
555 if (!monster_is_valid(m_ptr)) continue;
557 POSITION y = m_ptr->fy;
558 POSITION x = m_ptr->fx;
560 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
562 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
564 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
566 caster_ptr->window |= (PW_MONSTER);
569 repair_monsters = TRUE;
570 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
571 update_monster(caster_ptr, i, FALSE);
578 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
586 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
587 * @param caster_ptr プレーヤーへの参照ポインタ
589 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
590 * @return 効力があった場合TRUEを返す
592 bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
594 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
597 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
599 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
600 monster_race *r_ptr = &r_info[m_ptr->r_idx];
601 if (!monster_is_valid(m_ptr)) continue;
603 POSITION y = m_ptr->fy;
604 POSITION x = m_ptr->fx;
606 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
608 if (my_strchr(Match, r_ptr->d_char))
610 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
612 caster_ptr->window |= (PW_MONSTER);
615 repair_monsters = TRUE;
616 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
617 update_monster(caster_ptr, i, FALSE);
622 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
625 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
633 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
634 * @param caster_ptr プレーヤーへの参照ポインタ
636 * @param match_flag 感知フラグ
637 * @return 効力があった場合TRUEを返す
639 bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
641 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
644 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
646 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
647 monster_race *r_ptr = &r_info[m_ptr->r_idx];
648 if (!monster_is_valid(m_ptr)) continue;
650 POSITION y = m_ptr->fy;
651 POSITION x = m_ptr->fx;
653 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
655 if (r_ptr->flags3 & (match_flag))
657 if (is_original_ap(m_ptr))
659 r_ptr->r_flags3 |= (match_flag);
660 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
662 caster_ptr->window |= (PW_MONSTER);
666 repair_monsters = TRUE;
667 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
668 update_monster(caster_ptr, i, FALSE);
673 concptr desc_monsters = _("変なモンスター", "weird monsters");
679 desc_monsters = _("デーモン", "demons");
682 desc_monsters = _("アンデッド", "the undead");
686 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
695 * @brief 全感知処理 / Detect everything
696 * @param caster_ptr プレーヤーへの参照ポインタ
698 * @return 効力があった場合TRUEを返す
700 bool detect_all(player_type *caster_ptr, POSITION range)
703 if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
704 if (detect_doors(caster_ptr, range)) detect = TRUE;
705 if (detect_stairs(caster_ptr, range)) detect = TRUE;
706 if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
707 if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
708 if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
709 if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
715 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
718 * @return 効力があった場合TRUEを返す
721 * Note that affected monsters are NOT auto-tracked by this usage.
723 * To avoid misbehavior when monster deaths have side-effects,
724 * this is done in two passes. -- JDL
727 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
729 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
731 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
732 if (!monster_is_valid(m_ptr)) continue;
734 POSITION y = m_ptr->fy;
735 POSITION x = m_ptr->fx;
736 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
738 m_ptr->mflag |= (MFLAG_LOS);
741 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
742 bool obvious = FALSE;
743 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
745 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
746 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
748 m_ptr->mflag &= ~(MFLAG_LOS);
749 POSITION y = m_ptr->fy;
750 POSITION x = m_ptr->fx;
752 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
760 * @brief 視界内モンスターを加速する処理 / Speed monsters
761 * @param caster_ptr プレーヤーへの参照ポインタ
762 * @return 効力があった場合TRUEを返す
764 bool speed_monsters(player_type *caster_ptr)
766 return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
771 * @brief 視界内モンスターを加速する処理 / Slow monsters
772 * @param caster_ptr プレーヤーへの参照ポインタ
773 * @return 効力があった場合TRUEを返す
775 bool slow_monsters(player_type *caster_ptr, int power)
777 return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
782 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
783 * @param caster_ptr プレーヤーへの参照ポインタ
784 * @return 効力があった場合TRUEを返す
786 bool sleep_monsters(player_type *caster_ptr, int power)
788 return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
793 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
794 * @param caster_ptr プレーヤーへの参照ポインタ
795 * @return 効力があった場合TRUEを返す
797 bool banish_evil(player_type *caster_ptr, int dist)
799 return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
804 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
805 * @return 効力があった場合TRUEを返す
807 bool turn_undead(player_type *caster_ptr)
809 bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
811 chg_virtue(caster_ptr, V_UNLIFE, -1);
817 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
818 * @param caster_ptr プレーヤーへの参照ポインタ
819 * @return 効力があった場合TRUEを返す
821 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
823 bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
825 chg_virtue(caster_ptr, V_UNLIFE, -2);
831 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
832 * @param caster_ptr プレーヤーへの参照ポインタ
833 * @return 効力があった場合TRUEを返す
835 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
837 return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
842 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
843 * @param caster_ptr プレーヤーへの参照ポインタ
844 * @return 効力があった場合TRUEを返す
846 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
848 return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
853 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
854 * @param caster_ptr プレーヤーへの参照ポインタ
855 * @return 効力があった場合TRUEを返す
857 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
859 return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
864 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
866 * @param creature_ptr プレーヤーへの参照ポインタ
867 * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
868 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
870 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
873 if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
874 int k = 3 * creature_ptr->lev;
875 if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
876 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
877 if (set_afraid(creature_ptr, 0)) ident = TRUE;
878 if (hp_player(creature_ptr, 50)) ident = TRUE;
879 if (set_stun(creature_ptr, 0)) ident = TRUE;
880 if (set_cut(creature_ptr, 0)) ident = TRUE;
886 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
888 * @param creature_ptr プレーヤーへの参照ポインタ
889 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
891 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
893 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
894 project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
895 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
897 bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
898 is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
899 is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
900 is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
901 is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
902 if (is_special_class)
904 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
912 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
913 * @param caster_ptr プレーヤーへの参照ポインタ
914 * @return 効力があった場合TRUEを返す
916 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
918 return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
923 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
924 * @param caster_ptr プレーヤーへの参照ポインタ
925 * @return 効力があった場合TRUEを返す
927 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
929 return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
934 * @brief 視界内のモンスターに「聖戦」効果を与える処理
935 * @param caster_ptr プレーヤーへの参照ポインタ
936 * @return 効力があった場合TRUEを返す
938 bool crusade(player_type *caster_ptr)
940 return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
945 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
946 * @param caster_ptr プレーヤーへの参照ポインタ
947 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
950 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
954 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
956 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
957 if (!monster_is_valid(m_ptr)) continue;
958 if (i == who) continue;
960 if (m_ptr->cdis < MAX_SIGHT * 2)
962 if (MON_CSLEEP(m_ptr))
964 (void)set_monster_csleep(caster_ptr, i, 0);
968 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
971 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
975 (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
981 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
982 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
983 if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
988 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
989 * @param m_idx 抹殺するモンスターID
991 * @param player_cast プレイヤーの魔法によるものならば TRUE
992 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
993 * @param spell_name 抹殺効果を起こした魔法の名前
994 * @return 効力があった場合TRUEを返す
996 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
998 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
999 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1000 if (is_pet(m_ptr) && !player_cast) return FALSE;
1002 bool resist = FALSE;
1003 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1004 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1005 else if (m_idx == caster_ptr->riding) resist = TRUE;
1006 else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr, caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
1007 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1008 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1011 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1013 GAME_TEXT m_name[MAX_NLEN];
1014 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1015 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1018 delete_monster_idx(caster_ptr, m_idx);
1021 if (resist && player_cast)
1023 bool see_m = is_seen(m_ptr);
1024 GAME_TEXT m_name[MAX_NLEN];
1025 monster_desc(caster_ptr, m_name, m_ptr, 0);
1028 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1031 if (MON_CSLEEP(m_ptr))
1033 (void)set_monster_csleep(caster_ptr, m_idx, 0);
1036 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1040 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1044 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1047 set_hostile(caster_ptr, m_ptr);
1050 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1055 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1058 move_cursor_relative(caster_ptr->y, caster_ptr->x);
1059 caster_ptr->redraw |= (PR_HP);
1060 caster_ptr->window |= (PW_PLAYER);
1061 handle_stuff(caster_ptr);
1064 int msec = delay_factor * delay_factor * delay_factor;
1065 Term_xtra(TERM_XTRA_DELAY, msec);
1072 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1073 * @param power 抹殺の威力
1074 * @param player_cast プレイヤーの魔法によるものならば TRUE
1075 * @return 効力があった場合TRUEを返す
1077 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
1079 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1080 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1081 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1082 is_special_floor |= caster_ptr->phase_out;
1083 if (is_special_floor)
1085 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1090 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
1091 bool result = FALSE;
1092 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1094 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1095 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1096 if (!monster_is_valid(m_ptr)) continue;
1097 if (r_ptr->d_char != typ) continue;
1099 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
1104 chg_virtue(caster_ptr, V_VITALITY, -2);
1105 chg_virtue(caster_ptr, V_CHANCE, -1);
1113 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1114 * @param power 抹殺の威力
1115 * @param player_cast プレイヤーの魔法によるものならば TRUE
1116 * @return 効力があった場合TRUEを返す
1118 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
1120 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1121 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1122 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1123 is_special_floor |= caster_ptr->phase_out;
1124 if (is_special_floor)
1129 bool result = FALSE;
1130 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1132 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1133 if (!monster_is_valid(m_ptr)) continue;
1134 if (m_ptr->cdis > MAX_SIGHT) continue;
1136 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1141 chg_virtue(caster_ptr, V_VITALITY, -2);
1142 chg_virtue(caster_ptr, V_CHANCE, -1);
1150 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1151 * @param power 抹殺の威力
1152 * @param player_cast プレイヤーの魔法によるものならば TRUE
1153 * @return 効力があった場合TRUEを返す
1155 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
1157 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1158 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1159 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1160 is_special_floor |= caster_ptr->phase_out;
1161 if (is_special_floor)
1166 bool result = FALSE;
1167 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1169 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1170 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1171 if (!monster_is_valid(m_ptr)) continue;
1172 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1173 if (m_ptr->cdis > MAX_SIGHT) continue;
1175 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1180 chg_virtue(caster_ptr, V_UNLIFE, -2);
1181 chg_virtue(caster_ptr, V_CHANCE, -1);
1189 * @brief 周辺モンスターを調査する / Probe nearby monsters
1190 * @return 効力があった場合TRUEを返す
1192 bool probing(player_type *caster_ptr)
1194 bool_hack cu = Term->scr->cu;
1195 bool_hack cv = Term->scr->cv;
1203 for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1205 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1206 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1207 if (!monster_is_valid(m_ptr)) continue;
1208 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
1209 if (!m_ptr->ml) continue;
1211 GAME_TEXT m_name[MAX_NLEN];
1212 if (!probe) msg_print(_("調査中...", "Probing..."));
1215 if (!is_original_ap(m_ptr))
1217 if (m_ptr->mflag2 & MFLAG2_KAGE)
1218 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1220 m_ptr->ap_r_idx = m_ptr->r_idx;
1221 lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
1224 monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1225 speed = m_ptr->mspeed - 110;
1226 if (MON_FAST(m_ptr)) speed += 10;
1227 if (MON_SLOW(m_ptr)) speed -= 10;
1228 if (ironman_nightmare) speed += 5;
1230 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1231 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1232 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1233 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
1234 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1235 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1236 else align = _("中立", "neutral");
1238 sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1239 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1241 if (r_ptr->next_r_idx)
1243 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1247 strcat(buf, "xxx ");
1250 if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
1251 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1252 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1253 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1254 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1255 buf[strlen(buf) - 1] = '\0';
1259 caster_ptr->window |= (PW_MESSAGE);
1260 handle_stuff(caster_ptr);
1261 move_cursor_relative(m_ptr->fy, m_ptr->fx);
1263 Term_erase(0, 0, 255);
1264 if (lore_do_probe(caster_ptr, m_ptr->r_idx))
1266 strcpy(buf, (r_name + r_ptr->name));
1268 msg_format("%sについてさらに詳しくなった気がする。", buf);
1271 msg_format("You now know more about %s.", buf);
1285 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
1286 msg_print(_("これで全部です。", "That's all."));
1297 void discharge_minion(player_type *caster_ptr)
1300 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1302 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1303 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1304 if (m_ptr->nickname) okay = FALSE;
1307 if (!okay || caster_ptr->riding)
1309 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
1313 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1315 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1316 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1318 monster_race *r_ptr;
1319 r_ptr = &r_info[m_ptr->r_idx];
1320 if (r_ptr->flags1 & RF1_UNIQUE)
1322 GAME_TEXT m_name[MAX_NLEN];
1323 monster_desc(caster_ptr, m_name, m_ptr, 0x00);
1324 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
1325 delete_monster_idx(caster_ptr, i);
1329 HIT_POINT dam = m_ptr->maxhp / 2;
1330 if (dam > 100) dam = (dam - 100) / 2 + 100;
1331 if (dam > 400) dam = (dam - 400) / 2 + 400;
1332 if (dam > 800) dam = 800;
1333 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
1334 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
1336 if (record_named_pet && m_ptr->nickname)
1338 GAME_TEXT m_name[MAX_NLEN];
1340 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1341 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
1344 delete_monster_idx(caster_ptr, i);
1350 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1351 * @brief 部屋全体を照らすサブルーチン
1352 * @param caster_ptr プレーヤーへの参照ポインタ
1356 * This routine clears the entire "temp" set.
1357 * This routine will Perma-Lite all "temp" grids.
1358 * This routine is used (only) by "lite_room()"
1359 * Dark grids are illuminated.
1360 * Also, process all affected monsters.
1362 * SMART monsters always wake up when illuminated
1363 * NORMAL monsters wake up 1/4 the time when illuminated
1364 * STUPID monsters wake up 1/10 the time when illuminated
1367 static void cave_temp_room_lite(player_type *caster_ptr)
1369 for (int i = 0; i < tmp_pos.n; i++)
1371 POSITION y = tmp_pos.y[i];
1372 POSITION x = tmp_pos.x[i];
1373 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1374 g_ptr->info &= ~(CAVE_TEMP);
1375 g_ptr->info |= (CAVE_GLOW);
1378 PERCENTAGE chance = 25;
1379 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1380 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1381 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1382 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
1383 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
1385 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
1387 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1390 GAME_TEXT m_name[MAX_NLEN];
1391 monster_desc(caster_ptr, m_name, m_ptr, 0);
1392 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1397 note_spot(caster_ptr, y, x);
1398 lite_spot(caster_ptr, y, x);
1399 update_local_illumination(caster_ptr, y, x);
1407 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1408 * @brief 部屋全体を暗くするサブルーチン
1409 * @param caster_ptr プレーヤーへの参照ポインタ
1413 * This routine clears the entire "temp" set.
1414 * This routine will "darken" all "temp" grids.
1415 * In addition, some of these grids will be "unmarked".
1416 * This routine is used (only) by "unlite_room()"
1417 * Also, process all affected monsters
1420 static void cave_temp_room_unlite(player_type *caster_ptr)
1422 for (int i = 0; i < tmp_pos.n; i++)
1424 POSITION y = tmp_pos.y[i];
1425 POSITION x = tmp_pos.x[i];
1426 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1427 bool do_dark = !is_mirror_grid(g_ptr);
1428 g_ptr->info &= ~(CAVE_TEMP);
1429 if (!do_dark) continue;
1431 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
1433 for (int j = 0; j < 9; j++)
1435 POSITION by = y + ddy_ddd[j];
1436 POSITION bx = x + ddx_ddd[j];
1438 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
1440 grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
1442 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1450 if (!do_dark) continue;
1453 g_ptr->info &= ~(CAVE_GLOW);
1454 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
1456 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
1457 note_spot(caster_ptr, y, x);
1462 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1465 lite_spot(caster_ptr, y, x);
1466 update_local_illumination(caster_ptr, y, x);
1474 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1475 * @param floor_ptr 配置するフロアの参照ポインタ
1478 * @param pass_bold 地形条件を返す関数ポインタ
1481 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1485 for (int i = 0; i < 16; i++)
1487 POSITION y = cy + ddy_cdd[i % 8];
1488 POSITION x = cx + ddx_cdd[i % 8];
1489 if (!pass_bold(floor_ptr, y, x))
1504 return MAX(len, blen);
1509 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1510 * @param floor_ptr 配置するフロアの参照ポインタ
1513 * @param pass_bold 地形条件を返す関数ポインタ
1516 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1520 for (DIRECTION i = 0; i < 8; i++)
1522 y = cy + ddy_ddd[i];
1523 x = cx + ddx_ddd[i];
1525 if (!pass_bold(floor_ptr, y, x)) c++;
1533 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1534 * @param caster_ptr プレーヤーへの参照ポインタ
1535 * @param y 部屋内のy座標1点
1536 * @param x 部屋内のx座標1点
1537 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
1538 * @param pass_bold 地形条件を返す関数ポインタ
1541 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1544 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1545 g_ptr = &floor_ptr->grid_array[y][x];
1546 if (g_ptr->info & (CAVE_TEMP)) return;
1548 if (!(g_ptr->info & (CAVE_ROOM)))
1550 if (only_room) return;
1551 if (!in_bounds2(floor_ptr, y, x)) return;
1552 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
1554 /* Verify this grid */
1556 * The reason why it is ==6 instead of >5 is that 8 is impossible
1557 * due to the check for cave_bold above.
1558 * 7 lights dead-end corridors (you need to do this for the
1559 * checkboard interesting rooms, so that the boundary is lit
1561 * This leaves only a check for 6 bounding walls!
1563 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
1564 (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
1567 if (tmp_pos.n == TEMP_MAX) return;
1569 g_ptr->info |= (CAVE_TEMP);
1570 tmp_pos.y[tmp_pos.n] = y;
1571 tmp_pos.x[tmp_pos.n] = x;
1577 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1578 * @param caster_ptr プレーヤーへの参照ポインタ
1583 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1585 cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_los_bold);
1590 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
1591 * @param floor_ptr 配置するフロアの参照ポインタ
1594 * @return 射線を通すならばtrueを返す。
1596 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1598 return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
1603 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1604 * @param caster_ptr プレーヤーへの参照ポインタ
1609 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1611 cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
1616 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
1617 * @param caster_ptr プレーヤーへの参照ポインタ
1622 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1624 cave_temp_lite_room_aux(caster_ptr, y1, x1);
1625 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1626 for (int i = 0; i < tmp_pos.n; i++)
1628 POSITION x = tmp_pos.x[i];
1629 POSITION y = tmp_pos.y[i];
1631 if (!cave_los_bold(floor_ptr, y, x)) continue;
1633 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
1634 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
1635 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
1636 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
1638 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
1639 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
1640 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1641 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1644 cave_temp_room_lite(caster_ptr);
1645 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1647 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW)
1648 set_superstealth(caster_ptr, FALSE);
1654 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1655 * @param caster_ptr プレーヤーへの参照ポインタ
1660 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1662 cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1663 for (int i = 0; i < tmp_pos.n; i++)
1665 POSITION x = tmp_pos.x[i];
1666 POSITION y = tmp_pos.y[i];
1667 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1669 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1670 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1671 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1672 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1674 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1675 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1676 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1677 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1680 cave_temp_room_unlite(caster_ptr);
1685 * @brief スターライトの効果を発生させる
1686 * @param caster_ptr プレーヤーへの参照ポインタ
1687 * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1690 bool starlight(player_type *caster_ptr, bool magic)
1692 if (!caster_ptr->blind && !magic)
1694 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1697 HIT_POINT num = damroll(5, 3);
1699 POSITION y = 0, x = 0;
1700 for (int k = 0; k < num; k++)
1706 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1707 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1708 if (!player_bold(caster_ptr, y, x)) break;
1711 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1712 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1720 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1721 * @param caster_ptr プレーヤーへの参照ポインタ
1724 * @return 作用が実際にあった場合TRUEを返す
1726 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1728 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1730 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs your light."));
1734 if (!caster_ptr->blind)
1736 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1739 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1740 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1742 lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1749 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1750 * @param caster_ptr プレーヤーへの参照ポインタ
1753 * @return 作用が実際にあった場合TRUEを返す
1755 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1757 if (!caster_ptr->blind)
1759 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
1762 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1763 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
1765 unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1772 * @brief ボール系スペルの発動 / Cast a ball spell
1773 * @param caster_ptr プレーヤーへの参照ポインタ
1775 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1778 * @return 作用が実際にあった場合TRUEを返す
1781 * Stop if we hit a monster, act as a "ball"
1782 * Allow "target" mode to pass over monsters
1783 * Affect grids, objects, and monsters
1786 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1788 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1789 if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
1791 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1792 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1794 if ((dir == 5) && target_okay(caster_ptr))
1796 flg &= ~(PROJECT_STOP);
1801 return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
1806 * @brief ブレス系スペルの発動 / Cast a breath spell
1807 * @param caster_ptr プレーヤーへの参照ポインタ
1809 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1812 * @return 作用が実際にあった場合TRUEを返す
1815 * Stop if we hit a monster, act as a "ball"
1816 * Allow "target" mode to pass over monsters
1817 * Affect grids, objects, and monsters
1820 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1822 return fire_ball(caster_ptr, typ, dir, dam, -rad);
1827 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
1828 * @param caster_ptr プレーヤーへの参照ポインタ
1830 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1833 * @return 作用が実際にあった場合TRUEを返す
1836 * Stop if we hit a monster, act as a "ball"
1837 * Allow "target" mode to pass over monsters
1838 * Affect grids, objects, and monsters
1841 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1843 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1844 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1845 if ((dir == 5) && target_okay(caster_ptr))
1851 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1852 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1857 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
1858 * @param caster_ptr プレーヤーへの参照ポインタ
1860 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1863 * @return 作用が実際にあった場合TRUEを返す
1866 * Stop if we hit a monster, act as a "ball"
1867 * Allow "target" mode to pass over monsters
1868 * Affect grids, objects, and monsters
1871 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1873 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1874 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1875 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
1876 if ((dir == 5) && target_okay(caster_ptr))
1878 flg &= ~(PROJECT_STOP);
1883 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1888 * @brief メテオ系スペルの発動 / Cast a meteor spell
1889 * @param caster_ptr プレーヤーへの参照ポインタ
1890 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
1896 * @return 作用が実際にあった場合TRUEを返す
1899 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
1900 * player, or outside source, that starts out at an arbitrary location, and
1901 * leaving no trail from the "caster" to the target. This function is
1902 * especially useful for bombardments and similar. -LM-
1903 * Option to hurt the player.
1906 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
1908 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1909 return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
1914 * @brief ブラスト系スペルの発動 / Cast a blast spell
1915 * @param caster_ptr プレーヤーへの参照ポインタ
1917 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1922 * @return 作用が実際にあった場合TRUEを返す
1924 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
1926 POSITION ty, tx, y, x;
1933 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
1934 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
1938 ly = ty = caster_ptr->y + 20 * ddy[dir];
1939 lx = tx = caster_ptr->x + 20 * ddx[dir];
1942 int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
1943 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
1945 for (int i = 0; i < num; i++)
1949 /* Get targets for some bolts */
1950 y = rand_spread(ly, ld * dev / 20);
1951 x = rand_spread(lx, ld * dev / 20);
1953 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
1956 /* Analyze the "dir" and the "target". */
1957 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
1968 * @brief モンスターとの位置交換処理 / Switch position with a monster.
1969 * @param caster_ptr プレーヤーへの参照ポインタ
1970 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1971 * @return 作用が実際にあった場合TRUEを返す
1973 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
1976 if ((dir == 5) && target_okay(caster_ptr))
1983 tx = caster_ptr->x + ddx[dir];
1984 ty = caster_ptr->y + ddy[dir];
1987 if (caster_ptr->anti_tele)
1989 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
1994 g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
1995 if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
1997 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2001 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
2003 msg_print(_("失敗した。", "Failed to swap."));
2007 monster_type* m_ptr;
2008 monster_race* r_ptr;
2009 m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2010 r_ptr = &r_info[m_ptr->r_idx];
2012 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
2014 if (r_ptr->flagsr & RFR_RES_TELE)
2016 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2017 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2021 sound(SOUND_TELEPORT);
2022 (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2028 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2029 * @param caster_ptr プレーヤーへの参照ポインタ
2031 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2034 * @return 作用が実際にあった場合TRUEを返す
2036 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2038 flg |= (PROJECT_THRU);
2039 POSITION tx = caster_ptr->x + ddx[dir];
2040 POSITION ty = caster_ptr->y + ddy[dir];
2041 if ((dir == 5) && target_okay(caster_ptr))
2047 return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
2052 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2053 * @param caster_ptr プレーヤーへの参照ポインタ
2055 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2057 * @return 作用が実際にあった場合TRUEを返す
2060 * Stop if we hit a monster, as a "bolt".
2061 * Affect monsters and grids (not objects).
2064 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2066 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2067 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2068 return (project_hook(caster_ptr, typ, dir, dam, flg));
2073 * @brief ビーム系スペルの発動 / Cast a beam spell.
2074 * @param caster_ptr プレーヤーへの参照ポインタ
2076 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2078 * @return 作用が実際にあった場合TRUEを返す
2081 * Pass through monsters, as a "beam".
2082 * Affect monsters, grids and objects.
2085 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2087 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2088 return (project_hook(caster_ptr, typ, dir, dam, flg));
2093 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2094 * @param caster_ptr プレーヤーへの参照ポインタ
2095 * @param prob ビーム化する確率(%)
2097 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2099 * @return 作用が実際にあった場合TRUEを返す
2102 * Pass through monsters, as a "beam".
2103 * Affect monsters, grids and objects.
2106 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2108 if (randint0(100) < prob)
2110 return (fire_beam(caster_ptr, typ, dir, dam));
2113 return (fire_bolt(caster_ptr, typ, dir, dam));
2118 * @brief LITE_WEAK属性による光源ビーム処理
2119 * @param caster_ptr プレーヤーへの参照ポインタ
2120 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2122 * @return 作用が実際にあった場合TRUEを返す
2124 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2126 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
2127 return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
2133 * @param caster_ptr プレーヤーへの参照ポインタ
2134 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2136 * @return 作用が実際にあった場合TRUEを返す
2138 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2140 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2141 return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
2147 * @param caster_ptr プレーヤーへの参照ポインタ
2148 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2150 * @return 作用が実際にあった場合TRUEを返す
2152 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2154 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2155 return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
2161 * @param caster_ptr プレーヤーへの参照ポインタ
2162 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2163 * @return 作用が実際にあった場合TRUEを返す
2165 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
2167 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2168 return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
2174 * @param caster_ptr プレーヤーへの参照ポインタ
2175 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2176 * @return 作用が実際にあった場合TRUEを返す
2178 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
2180 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2181 return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
2187 * @param caster_ptr プレーヤーへの参照ポインタ
2188 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2189 * @return 作用が実際にあった場合TRUEを返す
2191 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
2193 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2194 return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
2200 * @param caster_ptr プレーヤーへの参照ポインタ
2201 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2202 * @param plev プレイヤーレベル(効力はplev*200)
2203 * @return 作用が実際にあった場合TRUEを返す
2205 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2207 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2208 return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
2213 * @brief モンスター用テレポート処理
2214 * @param caster_ptr プレーヤーへの参照ポインタ
2215 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2216 * @param distance 移動距離
2217 * @return 作用が実際にあった場合TRUEを返す
2219 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
2221 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
2222 return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
2227 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
2228 * @param caster_ptr プレーヤーへの参照ポインタ
2229 * @return 作用が実際にあった場合TRUEを返す
2231 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
2233 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2234 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
2239 * @brief トラップ生成処理(起点から周囲1マス)
2240 * @param caster_ptr プレーヤーへの参照ポインタ
2243 * @return 作用が実際にあった場合TRUEを返す
2245 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
2247 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2248 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
2253 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
2254 * @param caster_ptr プレーヤーへの参照ポインタ
2255 * @return 作用が実際にあった場合TRUEを返す
2257 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
2259 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2260 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
2265 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
2266 * @param caster_ptr プレーヤーへの参照ポインタ
2267 * @return 作用が実際にあった場合TRUEを返す
2269 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
2271 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
2272 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
2277 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
2278 * @param caster_ptr プレーヤーへの参照ポインタ
2279 * @return 作用が実際にあった場合TRUEを返す
2281 bool wall_stone(player_type *caster_ptr)
2283 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2284 bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
2285 caster_ptr->update |= (PU_FLOW);
2286 caster_ptr->redraw |= (PR_MAP);
2292 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
2293 * @param caster_ptr プレーヤーへの参照ポインタ
2294 * @return 作用が実際にあった場合TRUEを返す
2296 bool destroy_doors_touch(player_type *caster_ptr)
2298 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2299 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
2304 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
2305 * @param caster_ptr プレーヤーへの参照ポインタ
2306 * @return 作用が実際にあった場合TRUEを返す
2308 bool disarm_traps_touch(player_type *caster_ptr)
2310 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2311 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
2316 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
2317 * @param caster_ptr プレーヤーへの参照ポインタ
2318 * @return 作用が実際にあった場合TRUEを返す
2320 bool sleep_monsters_touch(player_type *caster_ptr)
2322 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
2323 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
2328 * @brief 死者復活処理(起点より周囲5マス)
2329 * @param caster_ptr プレーヤーへの参照ポインタ
2330 * @param who 術者モンスターID(0ならばプレイヤー)
2333 * @return 作用が実際にあった場合TRUEを返す
2335 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
2337 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
2338 return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
2344 * @return 作用が実際にあった場合TRUEを返す
2346 void call_chaos(player_type *caster_ptr)
2348 int hurt_types[31] =
2350 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
2351 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
2352 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
2353 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
2354 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
2355 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
2356 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
2357 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
2360 int chaos_type = hurt_types[randint0(31)];
2361 bool line_chaos = FALSE;
2362 if (one_in_(4)) line_chaos = TRUE;
2367 for (int dummy = 1; dummy < 10; dummy++)
2372 fire_beam(caster_ptr, chaos_type, dummy, 150);
2374 fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
2383 fire_ball(caster_ptr, chaos_type, 0, 500, 8);
2387 if (!get_aim_dir(caster_ptr, &dir)) return;
2389 fire_beam(caster_ptr, chaos_type, dir, 250);
2391 fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
2396 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
2397 * @param target_ptr プレーヤーへの参照ポインタ
2398 * @param stop_ty 再帰処理停止フラグ
2400 * @return 作用が実際にあった場合TRUEを返す
2403 * rr9: Stop the nasty things when a Cyberdemon is summoned
2404 * or the player gets paralyzed.
2407 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
2409 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
2410 bool is_first_curse = TRUE;
2411 floor_type *floor_ptr = target_ptr->current_floor_ptr;
2412 while (is_first_curse || (one_in_(3) && !stop_ty))
2414 is_first_curse = FALSE;
2415 switch (randint1(34))
2420 msg_print(_("地面が揺れた...", "The ground trembles..."));
2421 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
2422 if (!one_in_(6)) break;
2427 HIT_POINT dam = damroll(10, 10);
2428 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
2429 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
2430 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
2431 if (!one_in_(6)) break;
2436 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
2437 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
2438 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2439 if (!one_in_(6)) break;
2442 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
2443 wall_breaker(target_ptr);
2446 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
2447 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
2450 if (!one_in_(6)) break;
2451 case 1: case 2: case 3: case 16: case 17:
2452 aggravate_monsters(target_ptr, 0);
2453 if (!one_in_(6)) break;
2454 case 4: case 5: case 6:
2455 (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2456 if (!one_in_(6)) break;
2457 case 7: case 8: case 9: case 18:
2458 (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2459 if (!one_in_(6)) break;
2460 case 10: case 11: case 12:
2461 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
2462 lose_exp(target_ptr, target_ptr->exp / 16);
2463 if (!one_in_(6)) break;
2464 case 13: case 14: case 15: case 19: case 20:
2466 bool is_statue = stop_ty;
2467 is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
2468 is_statue |= target_ptr->pclass == CLASS_BERSERKER;
2471 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
2472 if (target_ptr->free_act)
2473 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
2475 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
2479 if (!one_in_(6)) break;
2481 case 21: case 22: case 23:
2482 (void)do_dec_stat(target_ptr, randint0(6));
2483 if (!one_in_(6)) break;
2485 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
2486 lose_all_info(target_ptr);
2487 if (!one_in_(6)) break;
2489 if ((floor_ptr->dun_level > 65) && !stop_ty)
2491 (*count) += summon_cyber(target_ptr, -1, target_ptr->y, target_ptr->x);
2496 if (!one_in_(6)) break;
2498 for (int i = 0; i < A_MAX; i++)
2500 bool is_first_dec_stat = TRUE;
2501 while (is_first_dec_stat || one_in_(2))
2503 is_first_dec_stat = FALSE;
2504 (void)do_dec_stat(target_ptr, i);
2515 * todo 引数にPOSITION x/yは必要か? 要調査
2516 * @brief HI_SUMMON(上級召喚)処理発動
2517 * @param caster_ptr プレーヤーへの参照ポインタ
2520 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
2521 * @return 作用が実際にあった場合TRUEを返す
2523 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
2525 BIT_FLAGS mode = PM_ALLOW_GROUP;
2531 mode |= PM_FORCE_FRIENDLY;
2535 mode |= PM_FORCE_PET;
2540 if (!pet) mode |= PM_NO_PET;
2542 DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
2543 DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
2545 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
2547 switch (randint1(25) + (dungeon_level / 20))
2550 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
2553 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
2556 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
2559 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
2562 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
2565 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
2568 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
2571 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
2575 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
2579 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
2582 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2583 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
2586 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2587 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
2590 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
2593 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2594 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
2603 * @brief 周辺破壊効果(プレイヤー中心)
2604 * @param caster_ptr プレーヤーへの参照ポインタ
2605 * @return 作用が実際にあった場合TRUEを返す
2607 void wall_breaker(player_type *caster_ptr)
2609 POSITION y = 0, x = 0;
2610 int attempts = 1000;
2611 if (randint1(80 + caster_ptr->lev) < 70)
2615 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
2617 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
2619 if (!player_bold(caster_ptr, y, x)) break;
2622 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2623 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2627 if (randint1(100) > 30)
2629 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2633 int num = damroll(5, 3);
2634 for (int i = 0; i < num; i++)
2638 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2640 if (!player_bold(caster_ptr, y, x)) break;
2643 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2644 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2650 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2651 * @param caster_ptr プレーヤーへの参照ポインタ
2653 * @return 作用が実際にあった場合TRUEを返す
2655 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2657 return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2662 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2663 * @param caster_ptr プレーヤーへの参照ポインタ
2665 * @return 作用が実際にあった場合TRUEを返す
2667 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2669 return (project_all_los(caster_ptr, GF_CHARM, dam));
2674 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2675 * @param caster_ptr プレーヤーへの参照ポインタ
2677 * @return 作用が実際にあった場合TRUEを返す
2679 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2681 return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2686 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2687 * @param caster_ptr プレーヤーへの参照ポインタ
2689 * @return 作用が実際にあった場合TRUEを返す
2691 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2693 return (project_all_los(caster_ptr, GF_STUN, dam));
2698 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2699 * @param caster_ptr プレーヤーへの参照ポインタ
2701 * @return 作用が実際にあった場合TRUEを返す
2703 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2705 return (project_all_los(caster_ptr, GF_STASIS, dam));
2710 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
2711 * @param caster_ptr プレーヤーへの参照ポインタ
2713 * @return 作用が実際にあった場合TRUEを返す
2715 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
2717 return (project_all_los(caster_ptr, GF_PSI, dam));
2722 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
2723 * @param caster_ptr プレーヤーへの参照ポインタ
2724 * @param dist 効力(距離)
2725 * @return 作用が実際にあった場合TRUEを返す
2727 bool banish_monsters(player_type *caster_ptr, int dist)
2729 return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
2734 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
2735 * @param caster_ptr プレーヤーへの参照ポインタ
2737 * @return 作用が実際にあった場合TRUEを返す
2739 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
2741 return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
2746 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
2747 * @param caster_ptr プレーヤーへの参照ポインタ
2749 * @return 作用が実際にあった場合TRUEを返す
2751 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
2753 return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
2758 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
2759 * @param caster_ptr プレーヤーへの参照ポインタ
2760 * @return 作用が実際にあった場合TRUEを返す
2762 bool deathray_monsters(player_type *caster_ptr)
2764 return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
2769 * @brief チャーム・モンスター(1体)
2770 * @param caster_ptr プレーヤーへの参照ポインタ
2771 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2773 * @return 作用が実際にあった場合TRUEを返す
2775 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2777 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2778 return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
2783 * @brief アンデッド支配(1体)
2784 * @param caster_ptr プレーヤーへの参照ポインタ
2785 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2787 * @return 作用が実際にあった場合TRUEを返す
2789 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2791 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2792 return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
2798 * @param caster_ptr プレーヤーへの参照ポインタ
2799 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2801 * @return 作用が実際にあった場合TRUEを返す
2803 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2805 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2806 return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
2812 * @param caster_ptr プレーヤーへの参照ポインタ
2813 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2815 * @return 作用が実際にあった場合TRUEを返す
2817 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2819 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2820 return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
2826 * @param caster_ptr プレーヤーへの参照ポインタ
2827 * @param success 判定成功上の処理ならばTRUE
2828 * @return 作用が実際にあった場合TRUEを返す
2830 bool kawarimi(player_type *caster_ptr, bool success)
2833 object_type *q_ptr = &forge;
2835 if (caster_ptr->is_dead) return FALSE;
2836 if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
2837 if (randint0(200) < caster_ptr->stun) return FALSE;
2839 if (!success && one_in_(3))
2841 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
2842 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2843 caster_ptr->redraw |= (PR_STATUS);
2847 POSITION y = caster_ptr->y;
2848 POSITION x = caster_ptr->x;
2850 teleport_player(caster_ptr, 10 + randint1(90), 0L);
2852 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
2854 q_ptr->pval = MON_NINJA;
2855 (void)drop_near(caster_ptr, q_ptr, -1, y, x);
2857 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
2858 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
2860 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2861 caster_ptr->redraw |= (PR_STATUS);
2867 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
2868 * @param caster_ptr プレーヤーへの参照ポインタ
2869 * @param mdeath 目標モンスターが死亡したかを返す
2870 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
2872 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
2874 if (mdeath) *mdeath = FALSE;
2878 if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
2880 int tx = attacker_ptr->x + project_length * ddx[dir];
2881 int ty = attacker_ptr->y + project_length * ddy[dir];
2883 if ((dir == 5) && target_okay(attacker_ptr))
2890 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
2891 if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
2894 int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
2896 if (!path_n) return TRUE;
2898 ty = attacker_ptr->y;
2899 tx = attacker_ptr->x;
2900 bool tmp_mdeath = FALSE;
2902 for (int i = 0; i < path_n; i++)
2904 monster_type *m_ptr;
2906 int ny = GRID_Y(path_g[i]);
2907 int nx = GRID_X(path_g[i]);
2909 if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
2916 if (!floor_ptr->grid_array[ny][nx].m_idx)
2920 msg_print(_("失敗!", "Failed!"));
2924 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
2930 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2931 update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
2933 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
2934 if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
2937 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
2939 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
2942 else if (!player_bold(attacker_ptr, ty, tx))
2944 GAME_TEXT m_name[MAX_NLEN];
2945 monster_desc(attacker_ptr, m_name, m_ptr, 0);
2946 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
2949 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2951 tmp_mdeath = py_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
2956 if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2958 if (mdeath) *mdeath = tmp_mdeath;
2964 * @brief 全鏡の消去 / Remove all mirrors in this floor
2965 * @param caster_ptr プレーヤーへの参照ポインタ
2966 * @param explode 爆発処理を伴うならばTRUE
2969 void remove_all_mirrors(player_type *caster_ptr, bool explode)
2971 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
2973 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
2975 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
2978 remove_mirror(caster_ptr, y, x);
2979 if (!explode) continue;
2981 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
2982 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
2989 * @brief 『一つの指輪』の効果処理 /
2990 * Hack -- activate the ring of power
2991 * @param caster_ptr プレーヤーへの参照ポインタ
2992 * @param dir 発動の方向ID
2995 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
2997 switch (randint1(10))
3002 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3005 /* Decrease all stats (permanently) */
3006 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
3007 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
3008 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
3009 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
3010 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
3011 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
3013 /* Lose some experience (permanently) */
3014 caster_ptr->exp -= (caster_ptr->exp / 4);
3015 caster_ptr->max_exp -= (caster_ptr->exp / 4);
3016 check_experience(caster_ptr);
3023 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3024 dispel_monsters(caster_ptr, 1000);
3032 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
3041 fire_bolt(caster_ptr, GF_MANA, dir, 500);
3049 * @brief 運命の輪、並びにカオス的な効果の発動
3050 * @param caster_ptr プレーヤーへの参照ポインタ
3051 * @param spell ランダムな効果を選択するための基準ID
3054 void wild_magic(player_type *caster_ptr, int spell)
3056 int type = SUMMON_MOLD + randint0(6);
3057 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3058 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3060 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3061 switch (randint1(spell) + randint1(8) + 1)
3066 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3071 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3075 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3080 unlite_area(caster_ptr, 10, 3);
3085 lite_area(caster_ptr, damroll(2, 3), 2);
3088 destroy_doors_touch(caster_ptr);
3091 wall_breaker(caster_ptr);
3093 sleep_monsters_touch(caster_ptr);
3097 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3101 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3106 aggravate_monsters(caster_ptr, 0);
3109 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3113 (void)gain_mutation(caster_ptr, 0);
3117 apply_disenchant(caster_ptr, 1);
3120 lose_all_info(caster_ptr);
3123 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3126 wall_stone(caster_ptr);
3130 for (int counter = 0; counter < 8; counter++)
3132 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
3138 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3141 (void)summon_cyber(caster_ptr, -1, caster_ptr->y, caster_ptr->x);
3146 (void)activate_ty_curse(caster_ptr, FALSE, &count);
3154 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
3155 * / Drop 10+1d10 meteor ball at random places near the player
3156 * @param caster_ptr プレーヤーへの参照ポインタ
3161 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3163 int b = 10 + randint1(10);
3164 for (int i = 0; i < b; i++)
3166 POSITION y = 0, x = 0;
3169 for (count = 0; count <= 20; count++)
3173 x = caster_ptr->x - 8 + randint0(17);
3174 y = caster_ptr->y - 8 + randint0(17);
3175 dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
3176 dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
3177 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3179 if (d >= 9) continue;
3181 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3182 if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
3183 || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
3188 if (count > 20) continue;
3190 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
3196 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
3197 * @param caster_ptr プレーヤーへの参照ポインタ
3200 * @return ターゲットを指定し、実行したならばTRUEを返す。
3202 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3205 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
3207 POSITION tx = caster_ptr->x + 99 * ddx[dir];
3208 POSITION ty = caster_ptr->y + 99 * ddy[dir];
3209 if ((dir == 5) && target_okay(caster_ptr))
3215 POSITION x = caster_ptr->x;
3216 POSITION y = caster_ptr->y;
3220 if ((y == ty) && (x == tx)) break;
3224 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
3225 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
3226 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
3227 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
3236 int b = 10 + randint1(10);
3237 for (int i = 0; i < b; i++)
3239 int count = 20, d = 0;
3245 x = tx - 5 + randint0(11);
3246 y = ty - 5 + randint0(11);
3248 dx = (tx > x) ? (tx - x) : (x - tx);
3249 dy = (ty > y) ? (ty - y) : (y - ty);
3251 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3255 if (count < 0) continue;
3257 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
3258 cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
3259 !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
3262 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
3270 * @brief 「ワンダー」のランダムな効果を決定して処理する。
3271 * @param caster_ptr プレーヤーへの参照ポインタ
3275 * This spell should become more useful (more controlled) as the\n
3276 * player gains experience levels. Thus, add 1/5 of the player's\n
3277 * level to the die roll. This eliminates the worst effects later on,\n
3278 * while keeping the results quite random. It also allows some potent\n
3279 * effects only at high level.
3281 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
3283 PLAYER_LEVEL plev = caster_ptr->lev;
3284 int die = randint1(100) + plev / 5;
3285 int vir = virtue_number(caster_ptr, V_CHANCE);
3288 if (caster_ptr->virtues[vir - 1] > 0)
3290 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3294 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3300 chg_virtue(caster_ptr, V_CHANCE, 1);
3305 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
3310 clone_monster(caster_ptr, dir);
3316 speed_monster(caster_ptr, dir, plev);
3322 heal_monster(caster_ptr, dir, damroll(4, 6));
3328 poly_monster(caster_ptr, dir, plev);
3334 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3335 damroll(3 + ((plev - 1) / 5), 4));
3341 confuse_monster(caster_ptr, dir, plev);
3347 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3353 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3359 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3360 damroll(3 + ((plev - 5) / 4), 8));
3366 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3367 damroll(5 + ((plev - 5) / 4), 8));
3373 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3374 damroll(6 + ((plev - 5) / 4), 8));
3380 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3381 damroll(8 + ((plev - 5) / 4), 8));
3387 hypodynamic_bolt(caster_ptr, dir, 75);
3393 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3399 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3405 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3411 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3417 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3423 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3429 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3435 symbol_genocide(caster_ptr, plev + 50, TRUE);
3441 dispel_monsters(caster_ptr, 120);
3445 dispel_monsters(caster_ptr, 150);
3446 slow_monsters(caster_ptr, plev);
3447 sleep_monsters(caster_ptr, plev);
3448 hp_player(caster_ptr, 300);
3453 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
3454 * @param caster_ptr プレーヤーへの参照ポインタ
3458 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
3460 PLAYER_LEVEL plev = caster_ptr->lev;
3461 int die = randint1(100) + plev / 5;
3462 int vir = virtue_number(caster_ptr, V_CHANCE);
3466 if (caster_ptr->virtues[vir - 1] > 0)
3468 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3472 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3476 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
3478 chg_virtue(caster_ptr, V_CHANCE, 1);
3482 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
3487 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
3488 "Oh no! Mouldering forms rise from the earth around you!"));
3490 (void)summon_specific(caster_ptr, 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));
3491 chg_virtue(caster_ptr, V_UNLIFE, 1);
3495 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
3497 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
3501 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
3502 "Your head is invaded by a horde of gibbering spectral voices..."));
3504 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
3508 poly_monster(caster_ptr, dir, plev);
3512 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3513 damroll(3 + ((plev - 1) / 5), 4));
3517 confuse_monster(caster_ptr, dir, plev);
3521 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3525 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3529 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3530 damroll(3 + ((plev - 5) / 4), 8));
3534 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3535 damroll(5 + ((plev - 5) / 4), 8));
3539 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3540 damroll(6 + ((plev - 5) / 4), 8));
3544 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3545 damroll(8 + ((plev - 5) / 4), 8));
3549 hypodynamic_bolt(caster_ptr, dir, 75);
3553 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3557 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3561 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3565 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3569 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3573 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3577 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3581 symbol_genocide(caster_ptr, plev + 50, TRUE);
3585 dispel_monsters(caster_ptr, 120);
3589 dispel_monsters(caster_ptr, 150);
3590 slow_monsters(caster_ptr, plev);
3591 sleep_monsters(caster_ptr, plev);
3592 hp_player(caster_ptr, 300);
3597 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
3598 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
3604 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
3605 * @param caster_ptr プレーヤーへの参照ポインタ
3608 void cast_shuffle(player_type *caster_ptr)
3610 PLAYER_LEVEL plev = caster_ptr->lev;
3613 int vir = virtue_number(caster_ptr, V_CHANCE);
3616 if ((caster_ptr->pclass == CLASS_ROGUE) ||
3617 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
3618 (caster_ptr->pclass == CLASS_SORCERER))
3619 die = (randint1(110)) + plev / 5;
3621 die = randint1(120);
3625 if (caster_ptr->virtues[vir - 1] > 0)
3627 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3631 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3635 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3639 chg_virtue(caster_ptr, V_CHANCE, 1);
3642 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3645 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3647 for (i = 0; i < randint1(3); i++)
3649 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3657 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3658 summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3665 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3666 activate_ty_curse(caster_ptr, FALSE, &count);
3672 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3673 aggravate_monsters(caster_ptr, 0);
3679 msg_print(_("《愚者》だ。", "It's the Fool."));
3680 do_dec_stat(caster_ptr, A_INT);
3681 do_dec_stat(caster_ptr, A_WIS);
3687 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3688 trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
3694 msg_print(_("《月》だ。", "It's the Moon."));
3695 unlite_area(caster_ptr, 10, 3);
3701 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3702 wild_magic(caster_ptr, randint0(32));
3708 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3709 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3715 msg_print(_("《正義》だ。", "It's Justice."));
3716 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3722 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3723 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3729 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3730 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3736 msg_print(_("《塔》だ。", "It's the Tower."));
3737 wall_breaker(caster_ptr);
3743 msg_print(_("《節制》だ。", "It's Temperance."));
3744 sleep_monsters_touch(caster_ptr);
3750 msg_print(_("《塔》だ。", "It's the Tower."));
3751 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3757 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3758 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3764 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3765 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3771 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3772 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
3778 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3779 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
3785 msg_print(_("《恋人》だ。", "It's the Lovers."));
3787 if (get_aim_dir(caster_ptr, &dir))
3789 charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
3797 msg_print(_("《隠者》だ。", "It's the Hermit."));
3798 wall_stone(caster_ptr);
3804 msg_print(_("《審判》だ。", "It's the Judgement."));
3805 roll_hitdice(caster_ptr, 0L);
3806 lose_all_mutations(caster_ptr);
3812 msg_print(_("《太陽》だ。", "It's the Sun."));
3813 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
3814 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
3815 wiz_lite(caster_ptr, FALSE);
3819 msg_print(_("《世界》だ。", "It's the World."));
3820 if (caster_ptr->exp >= PY_MAX_EXP)
3825 s32b ee = (caster_ptr->exp / 25) + 1;
3826 if (ee > 5000) ee = 5000;
3827 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
3828 gain_exp(caster_ptr, ee);
3832 bool_hack vampirism(player_type *caster_ptr)
3834 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
3836 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
3841 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3843 POSITION y = caster_ptr->y + ddy[dir];
3844 POSITION x = caster_ptr->x + ddx[dir];
3846 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
3847 stop_mouth(caster_ptr);
3848 if (!(g_ptr->m_idx))
3850 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
3854 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
3856 int dummy = caster_ptr->lev * 2;
3857 if (!hypodynamic_bolt(caster_ptr, dir, dummy))
3859 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
3863 if (caster_ptr->food < PY_FOOD_FULL)
3864 (void)hp_player(caster_ptr, dummy);
3866 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
3868 /* Gain nutritional sustenance: 150/hp drained */
3869 /* A Food ration gives 5000 food points (by contrast) */
3870 /* Don't ever get more than "Full" this way */
3871 /* But if we ARE Gorged, it won't cure us */
3872 dummy = caster_ptr->food + MIN(5000, 100 * dummy);
3873 if (caster_ptr->food < PY_FOOD_MAX) /* Not gorged already */
3874 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
3880 * ヒット&アウェイのレイシャルパワー/突然変異
3881 * @param caster_ptr プレーヤーへの参照ポインタ
3882 * @return コマンドの入力先にモンスターがいたらTRUE
3884 bool hit_and_away(player_type *caster_ptr)
3887 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3888 POSITION y = caster_ptr->y + ddy[dir];
3889 POSITION x = caster_ptr->x + ddx[dir];
3890 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3892 py_attack(caster_ptr, y, x, 0);
3893 if (randint0(caster_ptr->skill_dis) < 7)
3894 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
3896 teleport_player(caster_ptr, 30, 0L);
3900 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
3907 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
3908 * @param caster_ptr プレーヤーへの参照ポインタ
3911 * currently this function allows pseudo-id of any object,
3912 * including silly ones like potions & scrolls, which always
3913 * get '{average}'. This should be changed, either to stop such
3914 * items from being pseudo-id'd, or to allow psychometry to
3915 * detect whether the unidentified potion/scroll/etc is
3916 * good (Cure Light Wounds, Restore Strength, etc) or
3917 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
3919 bool psychometry(player_type *caster_ptr)
3921 concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
3922 concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
3925 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
3926 if (!o_ptr) return FALSE;
3928 if (object_is_known(o_ptr))
3930 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
3934 byte feel = value_check_aux1(o_ptr);
3935 GAME_TEXT o_name[MAX_NLEN];
3936 object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3940 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
3945 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
3947 msg_format("You feel that the %s %s %s...",
3948 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
3951 o_ptr->ident |= (IDENT_SENSE);
3952 o_ptr->feeling = feel;
3953 o_ptr->marked |= OM_TOUCHED;
3955 caster_ptr->update |= (PU_COMBINE | PU_REORDER);
3956 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3959 switch (o_ptr->tval)
3987 autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
3992 bool draconian_breath(player_type *creature_ptr)
3994 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
3995 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
3997 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
3999 if (randint1(100) < creature_ptr->lev)
4001 switch (creature_ptr->pclass)
4004 case CLASS_BERSERKER:
4007 case CLASS_IMITATOR:
4013 Type_desc = _("エレメント", "the elements");
4018 Type_desc = _("破片", "shards");
4023 case CLASS_WARRIOR_MAGE:
4024 case CLASS_HIGH_MAGE:
4025 case CLASS_SORCERER:
4026 case CLASS_MAGIC_EATER:
4027 case CLASS_RED_MAGE:
4028 case CLASS_BLUE_MAGE:
4029 case CLASS_MIRROR_MASTER:
4033 Type_desc = _("魔力", "mana");
4037 Type = GF_DISENCHANT;
4038 Type_desc = _("劣化", "disenchantment");
4042 case CLASS_CHAOS_WARRIOR:
4045 Type = GF_CONFUSION;
4046 Type_desc = _("混乱", "confusion");
4051 Type_desc = _("カオス", "chaos");
4057 case CLASS_FORCETRAINER:
4060 Type = GF_CONFUSION;
4061 Type_desc = _("混乱", "confusion");
4066 Type_desc = _("轟音", "sound");
4070 case CLASS_MINDCRAFTER:
4073 Type = GF_CONFUSION;
4074 Type_desc = _("混乱", "confusion");
4079 Type_desc = _("精神エネルギー", "mental energy");
4087 Type = GF_HELL_FIRE;
4088 Type_desc = _("地獄の劫火", "hellfire");
4092 Type = GF_HOLY_FIRE;
4093 Type_desc = _("聖なる炎", "holy fire");
4102 Type_desc = _("暗黒", "darkness");
4107 Type_desc = _("毒", "poison");
4115 Type_desc = _("轟音", "sound");
4119 Type = GF_CONFUSION;
4120 Type_desc = _("混乱", "confusion");
4127 stop_mouth(creature_ptr);
4128 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4130 fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4135 bool android_inside_weapon(player_type *creature_ptr)
4138 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4140 if (creature_ptr->lev < 10)
4142 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4143 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4147 if (creature_ptr->lev < 25)
4149 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4150 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
4154 if (creature_ptr->lev < 35)
4156 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4157 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4161 if (creature_ptr->lev < 45)
4163 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4164 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
4168 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4169 fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4174 bool create_ration(player_type *creature_ptr)
4180 /* Create the food ration */
4181 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4183 /* Drop the object from heaven */
4184 (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
4185 msg_print(_("食事を料理して作った。", "You cook some food."));
4190 void hayagake(player_type *creature_ptr)
4192 if (creature_ptr->action == ACTION_HAYAGAKE)
4194 set_action(creature_ptr, ACTION_NONE);
4195 creature_ptr->energy_use = 0;
4199 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4200 feature_type *f_ptr = &f_info[g_ptr->feat];
4202 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4203 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4205 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4209 set_action(creature_ptr, ACTION_HAYAGAKE);
4212 creature_ptr->energy_use = 0;
4216 bool double_attack(player_type *creature_ptr)
4219 if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
4220 POSITION y = creature_ptr->y + ddy[dir];
4221 POSITION x = creature_ptr->x + ddx[dir];
4222 if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4224 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4230 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4231 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4232 else if (one_in_(2))
4233 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4234 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4236 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4237 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4239 py_attack(creature_ptr, y, x, 0);
4240 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4242 handle_stuff(creature_ptr);
4243 py_attack(creature_ptr, y, x, 0);
4246 creature_ptr->energy_need += ENERGY_NEED();
4251 bool comvert_hp_to_mp(player_type *creature_ptr)
4253 int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
4256 msg_print(_("変換に失敗した。", "You failed to convert."));
4257 creature_ptr->redraw |= (PR_HP | PR_MANA);
4261 creature_ptr->csp += gain_sp;
4262 if (creature_ptr->csp > creature_ptr->msp)
4264 creature_ptr->csp = creature_ptr->msp;
4265 creature_ptr->csp_frac = 0;
4268 creature_ptr->redraw |= (PR_HP | PR_MANA);
4273 bool comvert_mp_to_hp(player_type *creature_ptr)
4275 if (creature_ptr->csp >= creature_ptr->lev / 5)
4277 creature_ptr->csp -= creature_ptr->lev / 5;
4278 hp_player(creature_ptr, creature_ptr->lev);
4282 msg_print(_("変換に失敗した。", "You failed to convert."));
4285 creature_ptr->redraw |= (PR_HP | PR_MANA);
4290 bool demonic_breath(player_type *creature_ptr)
4293 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
4294 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4295 stop_mouth(creature_ptr);
4296 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
4297 fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
4304 * @param creature_ptr プレーヤーへの参照ポインタ
4305 * @return ペットを操っている場合を除きTRUE
4307 bool mirror_concentration(player_type *creature_ptr)
4311 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4315 if (!is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
4317 msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
4321 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4323 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
4324 if (creature_ptr->csp >= creature_ptr->msp)
4326 creature_ptr->csp = creature_ptr->msp;
4327 creature_ptr->csp_frac = 0;
4330 creature_ptr->redraw |= PR_MANA;
4337 * @param creature_ptr プレーヤーへの参照ポインタ
4340 bool sword_dancing(player_type *creature_ptr)
4343 POSITION y = 0, x = 0;
4345 for (int i = 0; i < 6; i++)
4348 y = creature_ptr->y + ddy_ddd[dir];
4349 x = creature_ptr->x + ddx_ddd[dir];
4350 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
4352 /* Hack -- attack monsters */
4354 py_attack(creature_ptr, y, x, 0);
4357 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
4367 * @param creature_ptr プレーヤーへの参照ポインタ
4370 bool confusing_light(player_type *creature_ptr)
4372 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
4373 slow_monsters(creature_ptr, creature_ptr->lev);
4374 stun_monsters(creature_ptr, creature_ptr->lev * 4);
4375 confuse_monsters(creature_ptr, creature_ptr->lev * 4);
4376 turn_monsters(creature_ptr, creature_ptr->lev * 4);
4377 stasis_monsters(creature_ptr, creature_ptr->lev * 4);
4384 * @param creature_ptr プレーヤーへの参照ポインタ
4385 * @return 結果はどうあれ騎乗したらTRUE
4387 bool rodeo(player_type *creature_ptr)
4389 GAME_TEXT m_name[MAX_NLEN];
4390 monster_type *m_ptr;
4391 monster_race *r_ptr;
4394 if (creature_ptr->riding)
4396 msg_print(_("今は乗馬中だ。", "You ARE riding."));
4400 if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
4402 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4403 r_ptr = &r_info[m_ptr->r_idx];
4404 monster_desc(creature_ptr, m_name, m_ptr, 0);
4405 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
4407 if (is_pet(m_ptr)) return TRUE;
4409 rlev = r_ptr->level;
4411 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
4412 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
4413 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
4414 && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
4415 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
4416 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
4418 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
4419 set_pet(creature_ptr, m_ptr);
4423 msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
4424 rakuba(creature_ptr, 1, TRUE);
4426 /* 落馬処理に失敗してもとにかく乗馬解除 */
4427 creature_ptr->riding = 0;
4434 bool clear_mind(player_type *creature_ptr)
4438 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4442 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4444 creature_ptr->csp += (3 + creature_ptr->lev / 20);
4445 if (creature_ptr->csp >= creature_ptr->msp)
4447 creature_ptr->csp = creature_ptr->msp;
4448 creature_ptr->csp_frac = 0;
4451 creature_ptr->redraw |= (PR_MANA);
4456 bool concentration(player_type *creature_ptr)
4458 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
4462 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4466 if (creature_ptr->special_defense & KATA_MASK)
4468 msg_print(_("今は構えに集中している。", "You're already concentrating on your stance."));
4472 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
4474 creature_ptr->csp += creature_ptr->msp / 2;
4475 if (creature_ptr->csp >= max_csp)
4477 creature_ptr->csp = max_csp;
4478 creature_ptr->csp_frac = 0;
4481 creature_ptr->redraw |= PR_MANA;