3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
26 #include "monsterrace-hook.h"
30 #include "spells-summon.h"
35 #include "spells-status.h"
36 #include "spells-floor.h"
37 #include "spells-diceroll.h"
38 #include "realm-hex.h"
40 #include "object-flavor.h"
41 #include "object-hook.h"
42 #include "monster-status.h"
43 #include "player-move.h"
44 #include "player-status.h"
45 #include "player-effects.h"
46 #include "player-skill.h"
47 #include "player-class.h"
48 #include "player-damage.h"
49 #include "player-inventory.h"
52 #include "floor-events.h"
54 #include "view-mainwindow.h"
55 #include "objectkind.h"
56 #include "monsterrace.h"
57 #include "targeting.h"
58 #include "realm-song.h"
62 * @brief プレイヤー周辺の地形を感知する
63 * @param caster_ptr プレーヤーへの参照ポインタ
66 * @param known 地形から危険フラグを外すならTRUE
67 * @return 効力があった場合TRUEを返す
69 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
71 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
73 /* Scan the current panel */
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];
87 /* Mark as detected */
88 if (dist <= range && known)
90 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
92 g_ptr->info &= ~(CAVE_UNSAFE);
98 if (cave_have_flag_grid(g_ptr, flag))
100 disclose_grid(caster_ptr, y, x);
101 g_ptr->info |= (CAVE_MARK);
113 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
114 * @param caster_ptr プレーヤーへの参照ポインタ
116 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
117 * @return 効力があった場合TRUEを返す
119 bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
121 bool detect = detect_feat_flag(caster_ptr, range, FF_TRAP, known);
123 if (known) caster_ptr->dtrap = TRUE;
125 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
128 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
136 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
137 * @param caster_ptr プレーヤーへの参照ポインタ
139 * @return 効力があった場合TRUEを返す
141 bool detect_doors(player_type *caster_ptr, POSITION range)
143 bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
145 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
148 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
156 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
157 * @param caster_ptr プレーヤーへの参照ポインタ
159 * @return 効力があった場合TRUEを返す
161 bool detect_stairs(player_type *caster_ptr, POSITION range)
163 bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
165 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
168 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
176 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
177 * @param caster_ptr プレーヤーへの参照ポインタ
179 * @return 効力があった場合TRUEを返す
181 bool detect_treasure(player_type *caster_ptr, POSITION range)
183 bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
185 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
188 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
196 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
197 * @param caster_ptr プレーヤーへの参照ポインタ
199 * @return 効力があった場合TRUEを返す
201 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
203 POSITION range2 = range;
204 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
209 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
211 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
213 if (!OBJECT_IS_VALID(o_ptr)) continue;
214 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
219 /* Only detect nearby objects */
220 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
222 /* Detect "gold" objects */
223 if (o_ptr->tval == TV_GOLD)
225 o_ptr->marked |= OM_FOUND;
231 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
234 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
237 if (detect_monsters_string(caster_ptr, range, "$"))
247 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
248 * @param caster_ptr プレーヤーへの参照ポインタ
250 * @return 効力があった場合TRUEを返す
252 bool detect_objects_normal(player_type *caster_ptr, POSITION range)
254 POSITION range2 = range;
255 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
260 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
262 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
264 if (!OBJECT_IS_VALID(o_ptr)) continue;
265 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
270 /* Only detect nearby objects */
271 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
273 /* Detect "real" objects */
274 if (o_ptr->tval != TV_GOLD)
276 o_ptr->marked |= OM_FOUND;
282 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
285 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
288 if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
298 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
299 * @param caster_ptr プレーヤーへの参照ポインタ
301 * @return 効力があった場合TRUEを返す
304 * This will light up all spaces with "magic" items, including artifacts,
305 * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
306 * and "enchanted" items of the "good" variety.
308 * It can probably be argued that this function is now too powerful.
311 bool detect_objects_magic(player_type *caster_ptr, POSITION range)
313 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
315 /* Scan all objects */
316 OBJECT_TYPE_VALUE tv;
319 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
321 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
323 if (!OBJECT_IS_VALID(o_ptr)) continue;
324 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
329 /* Only detect nearby objects */
330 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
332 /* Examine the tval */
335 /* Artifacts, misc magic items, or enchanted wearables */
336 if (object_is_artifact(o_ptr) ||
337 object_is_ego(o_ptr) ||
338 (tv == TV_WHISTLE) ||
346 (tv == TV_LIFE_BOOK) ||
347 (tv == TV_SORCERY_BOOK) ||
348 (tv == TV_NATURE_BOOK) ||
349 (tv == TV_CHAOS_BOOK) ||
350 (tv == TV_DEATH_BOOK) ||
351 (tv == TV_TRUMP_BOOK) ||
352 (tv == TV_ARCANE_BOOK) ||
353 (tv == TV_CRAFT_BOOK) ||
354 (tv == TV_DAEMON_BOOK) ||
355 (tv == TV_CRUSADE_BOOK) ||
356 (tv == TV_MUSIC_BOOK) ||
357 (tv == TV_HISSATSU_BOOK) ||
358 (tv == TV_HEX_BOOK) ||
359 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
361 /* Memorize the item */
362 o_ptr->marked |= OM_FOUND;
370 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
378 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
379 * @param caster_ptr プレーヤーへの参照ポインタ
381 * @return 効力があった場合TRUEを返す
383 bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
385 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
389 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
391 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
392 monster_race *r_ptr = &r_info[m_ptr->r_idx];
393 if (!monster_is_valid(m_ptr)) continue;
398 /* Only detect nearby monsters */
399 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
401 /* Detect all non-invisible monsters */
402 if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
404 /* Repair visibility later */
405 repair_monsters = TRUE;
407 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
408 update_monster(caster_ptr, i, FALSE);
413 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
416 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
424 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
425 * @param caster_ptr プレーヤーへの参照ポインタ
427 * @return 効力があった場合TRUEを返す
429 bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
431 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
435 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
437 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
438 monster_race *r_ptr = &r_info[m_ptr->r_idx];
440 if (!monster_is_valid(m_ptr)) continue;
445 /* Only detect nearby monsters */
446 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
448 /* Detect invisible monsters */
449 if (r_ptr->flags2 & RF2_INVISIBLE)
451 /* Update monster recall window */
452 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
454 caster_ptr->window |= (PW_MONSTER);
457 /* Repair visibility later */
458 repair_monsters = TRUE;
460 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
461 update_monster(caster_ptr, i, FALSE);
466 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
469 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
476 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
477 * @param caster_ptr プレーヤーへの参照ポインタ
479 * @return 効力があった場合TRUEを返す
481 bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
483 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
487 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
489 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
490 monster_race *r_ptr = &r_info[m_ptr->r_idx];
491 if (!monster_is_valid(m_ptr)) continue;
496 /* Only detect nearby monsters */
497 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
499 /* Detect evil monsters */
500 if (r_ptr->flags3 & RF3_EVIL)
502 if (is_original_ap(m_ptr))
504 /* Take note that they are evil */
505 r_ptr->r_flags3 |= (RF3_EVIL);
507 /* Update monster recall window */
508 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
510 caster_ptr->window |= (PW_MONSTER);
514 /* Repair visibility later */
515 repair_monsters = TRUE;
517 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
518 update_monster(caster_ptr, i, FALSE);
525 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
532 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
533 * @param caster_ptr プレーヤーへの参照ポインタ
535 * @return 効力があった場合TRUEを返す
537 bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
539 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
543 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
545 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
546 if (!monster_is_valid(m_ptr)) continue;
551 /* Only detect nearby monsters */
552 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
554 /* Detect non-living monsters */
555 if (!monster_living(m_ptr->r_idx))
557 /* Update monster recall window */
558 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
560 caster_ptr->window |= (PW_MONSTER);
563 /* Repair visibility later */
564 repair_monsters = TRUE;
566 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
567 update_monster(caster_ptr, i, FALSE);
574 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
581 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
582 * @param caster_ptr プレーヤーへの参照ポインタ
584 * @return 効力があった場合TRUEを返す
586 bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
588 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
592 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
594 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
595 monster_race *r_ptr = &r_info[m_ptr->r_idx];
596 if (!monster_is_valid(m_ptr)) continue;
601 /* Only detect nearby monsters */
602 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
604 /* Detect non-living monsters */
605 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
607 /* Update monster recall window */
608 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
610 caster_ptr->window |= (PW_MONSTER);
613 /* Repair visibility later */
614 repair_monsters = TRUE;
616 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
617 update_monster(caster_ptr, i, FALSE);
624 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
632 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
633 * @param caster_ptr プレーヤーへの参照ポインタ
635 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
636 * @return 効力があった場合TRUEを返す
638 bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
640 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;
653 /* Only detect nearby monsters */
654 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
656 /* Detect monsters with the same symbol */
657 if (my_strchr(Match, r_ptr->d_char))
659 /* Update monster recall window */
660 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
662 caster_ptr->window |= (PW_MONSTER);
665 /* Repair visibility later */
666 repair_monsters = TRUE;
668 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
669 update_monster(caster_ptr, i, FALSE);
674 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
677 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
684 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
685 * @param caster_ptr プレーヤーへの参照ポインタ
687 * @param match_flag 感知フラグ
688 * @return 効力があった場合TRUEを返す
690 bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
692 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
696 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
698 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
699 monster_race *r_ptr = &r_info[m_ptr->r_idx];
700 if (!monster_is_valid(m_ptr)) continue;
705 /* Only detect nearby monsters */
706 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
708 /* Detect evil monsters */
709 if (r_ptr->flags3 & (match_flag))
711 if (is_original_ap(m_ptr))
713 /* Take note that they are something */
714 r_ptr->r_flags3 |= (match_flag);
716 /* Update monster recall window */
717 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
719 caster_ptr->window |= (PW_MONSTER);
723 /* Repair visibility later */
724 repair_monsters = TRUE;
726 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
727 update_monster(caster_ptr, i, FALSE);
732 concptr desc_monsters = _("変なモンスター", "weird monsters");
738 desc_monsters = _("デーモン", "demons");
741 desc_monsters = _("アンデッド", "the undead");
745 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
754 * @brief 全感知処理 / Detect everything
755 * @param caster_ptr プレーヤーへの参照ポインタ
757 * @return 効力があった場合TRUEを返す
759 bool detect_all(player_type *caster_ptr, POSITION range)
763 /* Detect everything */
764 if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
765 if (detect_doors(caster_ptr, range)) detect = TRUE;
766 if (detect_stairs(caster_ptr, range)) detect = TRUE;
768 /* There are too many hidden treasure. So... */
769 /* if (detect_treasure(range)) detect = TRUE; */
771 if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
772 if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
773 if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
774 if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
780 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
783 * @return 効力があった場合TRUEを返す
786 * Note that affected monsters are NOT auto-tracked by this usage.
788 * To avoid misbehavior when monster deaths have side-effects,
789 * this is done in two passes. -- JDL
792 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
794 /* Mark all (nearby) monsters */
796 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
798 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
799 if (!monster_is_valid(m_ptr)) continue;
804 /* Require line of sight */
805 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
807 /* Mark the monster */
808 m_ptr->mflag |= (MFLAG_LOS);
811 /* Affect all marked monsters */
812 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
813 bool obvious = FALSE;
814 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
816 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
818 /* Skip unmarked monsters */
819 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
822 m_ptr->mflag &= ~(MFLAG_LOS);
827 /* Jump directly to the target monster */
828 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
836 * @brief 視界内モンスターを加速する処理 / Speed monsters
837 * @param caster_ptr プレーヤーへの参照ポインタ
838 * @return 効力があった場合TRUEを返す
840 bool speed_monsters(player_type *caster_ptr)
842 return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
847 * @brief 視界内モンスターを加速する処理 / Slow monsters
848 * @param caster_ptr プレーヤーへの参照ポインタ
849 * @return 効力があった場合TRUEを返す
851 bool slow_monsters(player_type *caster_ptr, int power)
853 return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
858 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
859 * @param caster_ptr プレーヤーへの参照ポインタ
860 * @return 効力があった場合TRUEを返す
862 bool sleep_monsters(player_type *caster_ptr, int power)
864 return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
869 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
870 * @param caster_ptr プレーヤーへの参照ポインタ
871 * @return 効力があった場合TRUEを返す
873 bool banish_evil(player_type *caster_ptr, int dist)
875 return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
880 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
881 * @return 効力があった場合TRUEを返す
883 bool turn_undead(player_type *caster_ptr)
885 bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
887 chg_virtue(caster_ptr, V_UNLIFE, -1);
893 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
894 * @param caster_ptr プレーヤーへの参照ポインタ
895 * @return 効力があった場合TRUEを返す
897 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
899 bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
901 chg_virtue(caster_ptr, V_UNLIFE, -2);
907 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
908 * @param caster_ptr プレーヤーへの参照ポインタ
909 * @return 効力があった場合TRUEを返す
911 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
913 return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
918 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
919 * @param caster_ptr プレーヤーへの参照ポインタ
920 * @return 効力があった場合TRUEを返す
922 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
924 return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
929 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
930 * @param caster_ptr プレーヤーへの参照ポインタ
931 * @return 効力があった場合TRUEを返す
933 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
935 return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
939 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
942 if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
943 int k = 3 * creature_ptr->lev;
944 if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
945 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
946 if (set_afraid(creature_ptr, 0)) ident = TRUE;
947 if (hp_player(creature_ptr, 50)) ident = TRUE;
948 if (set_stun(creature_ptr, 0)) ident = TRUE;
949 if (set_cut(creature_ptr,0)) ident = TRUE;
954 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
956 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
957 project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
958 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
960 bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
961 is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
962 is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
963 is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
964 is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
965 if (is_special_class)
967 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
975 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
976 * @param caster_ptr プレーヤーへの参照ポインタ
977 * @return 効力があった場合TRUEを返す
979 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
981 return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
986 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
987 * @param caster_ptr プレーヤーへの参照ポインタ
988 * @return 効力があった場合TRUEを返す
990 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
992 return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
997 * @brief 視界内のモンスターに「聖戦」効果を与える処理
998 * @param caster_ptr プレーヤーへの参照ポインタ
999 * @return 効力があった場合TRUEを返す
1001 bool crusade(player_type *caster_ptr)
1003 return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev*4));
1008 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
1009 * @param caster_ptr プレーヤーへの参照ポインタ
1010 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
1013 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
1015 /* Aggravate everyone nearby */
1018 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1020 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1021 if (!monster_is_valid(m_ptr)) continue;
1023 /* Skip aggravating monster (or player) */
1024 if (i == who) continue;
1026 /* Wake up nearby sleeping monsters */
1027 if (m_ptr->cdis < MAX_SIGHT * 2)
1030 if (MON_CSLEEP(m_ptr))
1032 (void)set_monster_csleep(caster_ptr, i, 0);
1035 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
1038 /* Speed up monsters in line of sight */
1039 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
1043 (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
1049 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
1050 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
1051 if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
1056 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
1057 * @param m_idx 抹殺するモンスターID
1058 * @param power 抹殺の威力
1059 * @param player_cast プレイヤーの魔法によるものならば TRUE
1060 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
1061 * @param spell_name 抹殺効果を起こした魔法の名前
1062 * @return 効力があった場合TRUEを返す
1064 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
1066 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
1067 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1068 if (is_pet(m_ptr) && !player_cast) return FALSE;
1070 /* Hack -- Skip Unique Monsters or Quest Monsters */
1071 bool resist = FALSE;
1072 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1073 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1074 else if (m_idx == caster_ptr->riding) resist = TRUE;
1075 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;
1076 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1077 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1080 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1082 GAME_TEXT m_name[MAX_NLEN];
1084 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1085 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1088 delete_monster_idx(m_idx);
1091 if (resist && player_cast)
1093 bool see_m = is_seen(m_ptr);
1094 GAME_TEXT m_name[MAX_NLEN];
1096 monster_desc(m_name, m_ptr, 0);
1099 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1102 if (MON_CSLEEP(m_ptr))
1104 (void)set_monster_csleep(caster_ptr, m_idx, 0);
1107 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1111 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1115 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1121 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1126 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1129 /* Visual feedback */
1130 move_cursor_relative(caster_ptr->y, caster_ptr->x);
1132 caster_ptr->redraw |= (PR_HP);
1133 caster_ptr->window |= (PW_PLAYER);
1135 handle_stuff(caster_ptr);
1138 int msec = delay_factor * delay_factor * delay_factor;
1139 Term_xtra(TERM_XTRA_DELAY, msec);
1146 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1147 * @param power 抹殺の威力
1148 * @param player_cast プレイヤーの魔法によるものならば TRUE
1149 * @return 効力があった場合TRUEを返す
1151 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
1153 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1154 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1155 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1156 is_special_floor |= caster_ptr->phase_out;
1157 if (is_special_floor)
1159 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1163 /* Mega-Hack -- Get a monster symbol */
1165 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
1167 /* Delete the monsters of that "type" */
1168 bool result = FALSE;
1169 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1171 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1172 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1173 if (!monster_is_valid(m_ptr)) continue;
1175 /* Skip "wrong" monsters */
1176 if (r_ptr->d_char != typ) continue;
1178 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
1183 chg_virtue(caster_ptr, V_VITALITY, -2);
1184 chg_virtue(caster_ptr, V_CHANCE, -1);
1192 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1193 * @param power 抹殺の威力
1194 * @param player_cast プレイヤーの魔法によるものならば TRUE
1195 * @return 効力があった場合TRUEを返す
1197 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
1199 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1200 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1201 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1202 is_special_floor |= caster_ptr->phase_out;
1203 if (is_special_floor)
1208 /* Delete the (nearby) monsters */
1209 bool result = FALSE;
1210 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1212 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1213 if (!monster_is_valid(m_ptr)) continue;
1215 /* Skip distant monsters */
1216 if (m_ptr->cdis > MAX_SIGHT) continue;
1219 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1224 chg_virtue(caster_ptr, V_VITALITY, -2);
1225 chg_virtue(caster_ptr, V_CHANCE, -1);
1233 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1234 * @param power 抹殺の威力
1235 * @param player_cast プレイヤーの魔法によるものならば TRUE
1236 * @return 効力があった場合TRUEを返す
1238 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
1240 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1241 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1242 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1243 is_special_floor |= caster_ptr->phase_out;
1244 if (is_special_floor)
1249 /* Delete the (nearby) monsters */
1250 bool result = FALSE;
1251 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1253 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1254 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1255 if (!monster_is_valid(m_ptr)) continue;
1257 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1259 /* Skip distant monsters */
1260 if (m_ptr->cdis > MAX_SIGHT) continue;
1263 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1268 chg_virtue(caster_ptr, V_UNLIFE, -2);
1269 chg_virtue(caster_ptr, V_CHANCE, -1);
1277 * @brief 周辺モンスターを調査する / Probe nearby monsters
1278 * @return 効力があった場合TRUEを返す
1280 bool probing(player_type *caster_ptr)
1282 bool_hack cu = Term->scr->cu;
1283 bool_hack cv = Term->scr->cv;
1291 for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1293 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1294 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1295 if (!monster_is_valid(m_ptr)) continue;
1297 /* Require line of sight */
1298 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
1300 if (!m_ptr->ml) continue;
1302 GAME_TEXT m_name[MAX_NLEN];
1304 /* Start the message */
1305 if (!probe) msg_print(_("調査中...", "Probing..."));
1308 if (!is_original_ap(m_ptr))
1310 if (m_ptr->mflag2 & MFLAG2_KAGE)
1311 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1313 m_ptr->ap_r_idx = m_ptr->r_idx;
1314 lite_spot(m_ptr->fy, m_ptr->fx);
1317 /* Get "the monster" or "something" */
1318 monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1320 speed = m_ptr->mspeed - 110;
1321 if (MON_FAST(m_ptr)) speed += 10;
1322 if (MON_SLOW(m_ptr)) speed -= 10;
1323 if (ironman_nightmare) speed += 5;
1325 /* Get the monster's alignment */
1326 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1327 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1328 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1329 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
1330 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1331 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1332 else align = _("中立", "neutral");
1334 sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1335 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1337 if (r_ptr->next_r_idx)
1339 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1343 strcat(buf, "xxx ");
1346 if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
1347 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1348 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1349 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1350 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1351 buf[strlen(buf) - 1] = '\0';
1354 /* HACK : Add the line to message buffer */
1357 caster_ptr->window |= (PW_MESSAGE);
1358 handle_stuff(caster_ptr);
1359 move_cursor_relative(m_ptr->fy, m_ptr->fx);
1363 Term_erase(0, 0, 255);
1365 if (lore_do_probe(m_ptr->r_idx))
1367 strcpy(buf, (r_name + r_ptr->name));
1369 msg_format("%sについてさらに詳しくなった気がする。", buf);
1372 msg_format("You now know more about %s.", buf);
1386 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
1387 msg_print(_("これで全部です。", "That's all."));
1398 void discharge_minion(player_type *caster_ptr)
1402 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1404 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1405 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1406 if (m_ptr->nickname) okay = FALSE;
1409 if (!okay || caster_ptr->riding)
1411 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
1415 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1417 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1418 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1420 monster_race *r_ptr;
1421 r_ptr = &r_info[m_ptr->r_idx];
1423 /* Uniques resist discharging */
1424 if (r_ptr->flags1 & RF1_UNIQUE)
1426 GAME_TEXT m_name[MAX_NLEN];
1427 monster_desc(m_name, m_ptr, 0x00);
1428 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
1429 delete_monster_idx(i);
1433 HIT_POINT dam = m_ptr->maxhp / 2;
1434 if (dam > 100) dam = (dam - 100) / 2 + 100;
1435 if (dam > 400) dam = (dam - 400) / 2 + 400;
1436 if (dam > 800) dam = 800;
1437 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
1438 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
1440 if (record_named_pet && m_ptr->nickname)
1442 GAME_TEXT m_name[MAX_NLEN];
1444 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1445 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
1448 delete_monster_idx(i);
1454 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1455 * @brief 部屋全体を照らすサブルーチン
1456 * @param caster_ptr プレーヤーへの参照ポインタ
1460 * This routine clears the entire "temp" set.
1461 * This routine will Perma-Lite all "temp" grids.
1462 * This routine is used (only) by "lite_room()"
1463 * Dark grids are illuminated.
1464 * Also, process all affected monsters.
1466 * SMART monsters always wake up when illuminated
1467 * NORMAL monsters wake up 1/4 the time when illuminated
1468 * STUPID monsters wake up 1/10 the time when illuminated
1471 static void cave_temp_room_lite(player_type *caster_ptr)
1473 /* Clear them all */
1474 for (int i = 0; i < tmp_pos.n; i++)
1476 POSITION y = tmp_pos.y[i];
1477 POSITION x = tmp_pos.x[i];
1479 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1481 /* No longer in the array */
1482 g_ptr->info &= ~(CAVE_TEMP);
1485 g_ptr->info |= (CAVE_GLOW);
1487 /* Process affected monsters */
1490 PERCENTAGE chance = 25;
1491 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1492 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1493 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1495 /* Stupid monsters rarely wake up */
1496 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
1498 /* Smart monsters always wake up */
1499 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
1501 /* Sometimes monsters wake up */
1502 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
1505 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1507 /* Notice the "waking up" */
1510 GAME_TEXT m_name[MAX_NLEN];
1511 monster_desc(m_name, m_ptr, 0);
1512 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1519 update_local_illumination(caster_ptr, y, x);
1527 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1528 * @brief 部屋全体を暗くするサブルーチン
1529 * @param caster_ptr プレーヤーへの参照ポインタ
1533 * This routine clears the entire "temp" set.
1534 * This routine will "darken" all "temp" grids.
1535 * In addition, some of these grids will be "unmarked".
1536 * This routine is used (only) by "unlite_room()"
1537 * Also, process all affected monsters
1540 static void cave_temp_room_unlite(player_type *caster_ptr)
1542 /* Clear them all */
1543 for (int i = 0; i < tmp_pos.n; i++)
1545 POSITION y = tmp_pos.y[i];
1546 POSITION x = tmp_pos.x[i];
1548 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1549 bool do_dark = !is_mirror_grid(g_ptr);
1551 /* No longer in the array */
1552 g_ptr->info &= ~(CAVE_TEMP);
1554 /* Darken the grid */
1555 if (!do_dark) continue;
1557 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
1559 for (int j = 0; j < 9; j++)
1561 POSITION by = y + ddy_ddd[j];
1562 POSITION bx = x + ddx_ddd[j];
1564 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
1566 grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
1568 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1576 if (!do_dark) continue;
1579 g_ptr->info &= ~(CAVE_GLOW);
1581 /* Hack -- Forget "boring" grids */
1582 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
1584 /* Forget the grid */
1585 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
1589 /* Process affected monsters */
1592 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1596 update_local_illumination(caster_ptr, y, x);
1604 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1605 * @param floor_ptr 配置するフロアの参照ポインタ
1608 * @param pass_bold 地形条件を返す関数ポインタ
1611 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1616 for (int i = 0; i < 16; i++)
1618 y = cy + ddy_cdd[i % 8];
1619 x = cx + ddx_cdd[i % 8];
1621 /* Found a wall, break the length */
1622 if (!pass_bold(floor_ptr, y, x))
1624 /* Track best length */
1638 return MAX(len, blen);
1643 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1644 * @param floor_ptr 配置するフロアの参照ポインタ
1647 * @param pass_bold 地形条件を返す関数ポインタ
1650 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1654 for (DIRECTION i = 0; i < 8; i++)
1656 y = cy + ddy_ddd[i];
1657 x = cx + ddx_ddd[i];
1659 if (!pass_bold(floor_ptr, y, x)) c++;
1667 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1668 * @param caster_ptr プレーヤーへの参照ポインタ
1669 * @param y 部屋内のy座標1点
1670 * @param x 部屋内のx座標1点
1671 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
1672 * @param pass_bold 地形条件を返す関数ポインタ
1675 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool (*pass_bold)(floor_type*, POSITION, POSITION))
1678 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1679 g_ptr = &floor_ptr->grid_array[y][x];
1681 /* Avoid infinite recursion */
1682 if (g_ptr->info & (CAVE_TEMP)) return;
1684 /* Do not "leave" the current room */
1685 if (!(g_ptr->info & (CAVE_ROOM)))
1687 if (only_room) return;
1690 if (!in_bounds2(floor_ptr, y, x)) return;
1692 /* Do not exceed the maximum spell range */
1693 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
1695 /* Verify this grid */
1697 * The reason why it is ==6 instead of >5 is that 8 is impossible
1698 * due to the check for cave_bold above.
1699 * 7 lights dead-end corridors (you need to do this for the
1700 * checkboard interesting rooms, so that the boundary is lit
1702 * This leaves only a check for 6 bounding walls!
1704 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
1705 (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
1708 /* Paranoia -- verify space */
1709 if (tmp_pos.n == TEMP_MAX) return;
1711 /* Mark the grid as "seen" */
1712 g_ptr->info |= (CAVE_TEMP);
1714 /* Add it to the "seen" set */
1715 tmp_pos.y[tmp_pos.n] = y;
1716 tmp_pos.x[tmp_pos.n] = x;
1722 * todo このシンタックスシュガーは不要だが、関数ポインタなので安易には消せず……
1723 * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
1724 * @param floor_ptr 配置するフロアの参照ポインタ
1727 * @return 光を通すならばtrueを返す。
1729 static bool cave_pass_lite_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1731 return cave_los_bold(floor_ptr, y, x);
1736 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1737 * @param caster_ptr プレーヤーへの参照ポインタ
1742 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1744 cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_pass_lite_bold);
1749 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
1750 * @param floor_ptr 配置するフロアの参照ポインタ
1753 * @return 射線を通すならばtrueを返す。
1755 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1757 return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
1762 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1763 * @param caster_ptr プレーヤーへの参照ポインタ
1768 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1770 cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
1775 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
1776 * @param caster_ptr プレーヤーへの参照ポインタ
1781 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1783 /* Add the initial grid */
1784 cave_temp_lite_room_aux(caster_ptr, y1, x1);
1786 /* While grids are in the queue, add their neighbors */
1787 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1789 for (int i = 0; i < tmp_pos.n; i++)
1791 x = tmp_pos.x[i], y = tmp_pos.y[i];
1793 /* Walls get lit, but stop light */
1794 if (!cave_pass_lite_bold(floor_ptr, y, x)) continue;
1796 /* Spread adjacent */
1797 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
1798 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
1799 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
1800 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
1802 /* Spread diagonal */
1803 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
1804 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
1805 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1806 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1809 /* Now, lite them all up at once */
1810 cave_temp_room_lite(caster_ptr);
1812 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1814 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
1820 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1821 * @param caster_ptr プレーヤーへの参照ポインタ
1826 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1828 /* Add the initial grid */
1829 cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1831 /* Spread, breadth first */
1833 for (int i = 0; i < tmp_pos.n; i++)
1835 x = tmp_pos.x[i], y = tmp_pos.y[i];
1837 /* Walls get dark, but stop darkness */
1838 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1840 /* Spread adjacent */
1841 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1842 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1843 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1844 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1846 /* Spread diagonal */
1847 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1848 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1849 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1850 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1853 /* Now, darken them all at once */
1854 cave_temp_room_unlite(caster_ptr);
1859 * @brief スターライトの効果を発生させる
1860 * @param caster_ptr プレーヤーへの参照ポインタ
1861 * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1864 bool starlight(player_type *caster_ptr, bool magic)
1866 if (!caster_ptr->blind && !magic)
1868 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1871 HIT_POINT num = damroll(5, 3);
1873 POSITION y = 0, x = 0;
1874 for (int k = 0; k < num; k++)
1880 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1881 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1882 if (!player_bold(caster_ptr, y, x)) break;
1885 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1886 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1894 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1895 * @param caster_ptr プレーヤーへの参照ポインタ
1898 * @return 作用が実際にあった場合TRUEを返す
1900 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1902 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1904 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
1908 if (!caster_ptr->blind)
1910 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1913 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1914 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1916 lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1923 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1924 * @param caster_ptr プレーヤーへの参照ポインタ
1927 * @return 作用が実際にあった場合TRUEを返す
1929 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1931 if (!caster_ptr->blind)
1933 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
1936 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1937 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
1939 unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1946 * @brief ボール系スペルの発動 / Cast a ball spell
1947 * @param caster_ptr プレーヤーへの参照ポインタ
1949 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1952 * @return 作用が実際にあった場合TRUEを返す
1955 * Stop if we hit a monster, act as a "ball"
1956 * Allow "target" mode to pass over monsters
1957 * Affect grids, objects, and monsters
1960 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1962 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1963 if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
1965 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1966 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1968 /* Hack -- Use an actual "target" */
1969 if ((dir == 5) && target_okay(caster_ptr))
1971 flg &= ~(PROJECT_STOP);
1976 /* Analyze the "dir" and the "target". Hurt items on floor. */
1977 return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
1982 * @brief ブレス系スペルの発動 / Cast a breath spell
1983 * @param caster_ptr プレーヤーへの参照ポインタ
1985 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1988 * @return 作用が実際にあった場合TRUEを返す
1991 * Stop if we hit a monster, act as a "ball"
1992 * Allow "target" mode to pass over monsters
1993 * Affect grids, objects, and monsters
1996 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1998 return fire_ball(caster_ptr, typ, dir, dam, -rad);
2003 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
2004 * @param caster_ptr プレーヤーへの参照ポインタ
2006 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2009 * @return 作用が実際にあった場合TRUEを返す
2012 * Stop if we hit a monster, act as a "ball"
2013 * Allow "target" mode to pass over monsters
2014 * Affect grids, objects, and monsters
2017 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2019 POSITION tx = caster_ptr->x + 99 * ddx[dir];
2020 POSITION ty = caster_ptr->y + 99 * ddy[dir];
2022 /* Hack -- Use an actual "target" */
2023 if ((dir == 5) && target_okay(caster_ptr))
2029 /* Analyze the "dir" and the "target". Hurt items on floor. */
2030 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2031 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
2036 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
2037 * @param caster_ptr プレーヤーへの参照ポインタ
2039 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2042 * @return 作用が実際にあった場合TRUEを返す
2045 * Stop if we hit a monster, act as a "ball"
2046 * Allow "target" mode to pass over monsters
2047 * Affect grids, objects, and monsters
2050 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
2052 POSITION tx = caster_ptr->x + 99 * ddx[dir];
2053 POSITION ty = caster_ptr->y + 99 * ddy[dir];
2055 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
2056 if ((dir == 5) && target_okay(caster_ptr))
2058 flg &= ~(PROJECT_STOP);
2063 /* Analyze the "dir" and the "target". Hurt items on floor. */
2064 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
2069 * @brief メテオ系スペルの発動 / Cast a meteor spell
2070 * @param caster_ptr プレーヤーへの参照ポインタ
2071 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
2077 * @return 作用が実際にあった場合TRUEを返す
2080 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
2081 * player, or outside source, that starts out at an arbitrary location, and
2082 * leaving no trail from the "caster" to the target. This function is
2083 * especially useful for bombardments and similar. -LM-
2084 * Option to hurt the player.
2087 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
2089 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2091 /* Analyze the "target" and the caster. */
2092 return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
2097 * @brief ブラスト系スペルの発動 / Cast a blast spell
2098 * @param caster_ptr プレーヤーへの参照ポインタ
2100 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2105 * @return 作用が実際にあった場合TRUEを返す
2107 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
2109 POSITION ty, tx, y, x;
2116 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
2117 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
2121 ly = ty = caster_ptr->y + 20 * ddy[dir];
2122 lx = tx = caster_ptr->x + 20 * ddx[dir];
2125 int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
2126 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
2128 for (int i = 0; i < num; i++)
2132 /* Get targets for some bolts */
2133 y = rand_spread(ly, ld * dev / 20);
2134 x = rand_spread(lx, ld * dev / 20);
2136 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
2139 /* Analyze the "dir" and the "target". */
2140 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
2151 * @brief モンスターとの位置交換処理 / Switch position with a monster.
2152 * @param caster_ptr プレーヤーへの参照ポインタ
2153 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2154 * @return 作用が実際にあった場合TRUEを返す
2156 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
2159 if ((dir == 5) && target_okay(caster_ptr))
2166 tx = caster_ptr->x + ddx[dir];
2167 ty = caster_ptr->y + ddy[dir];
2170 if (caster_ptr->anti_tele)
2172 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
2177 g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
2178 if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
2180 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2184 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
2186 msg_print(_("失敗した。", "Failed to swap."));
2190 monster_type* m_ptr;
2191 monster_race* r_ptr;
2192 m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2193 r_ptr = &r_info[m_ptr->r_idx];
2195 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
2197 if (r_ptr->flagsr & RFR_RES_TELE)
2199 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2200 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2204 sound(SOUND_TELEPORT);
2206 /* Swap the player and monster */
2207 (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2215 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2216 * @param caster_ptr プレーヤーへの参照ポインタ
2218 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2221 * @return 作用が実際にあった場合TRUEを返す
2223 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2225 /* Pass through the target if needed */
2226 flg |= (PROJECT_THRU);
2228 POSITION tx = caster_ptr->x + ddx[dir];
2229 POSITION ty = caster_ptr->y + ddy[dir];
2230 if ((dir == 5) && target_okay(caster_ptr))
2236 /* Analyze the "dir" and the "target", do NOT explode */
2237 return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
2242 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2243 * @param caster_ptr プレーヤーへの参照ポインタ
2245 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2247 * @return 作用が実際にあった場合TRUEを返す
2250 * Stop if we hit a monster, as a "bolt".
2251 * Affect monsters and grids (not objects).
2254 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2256 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2257 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2258 return (project_hook(caster_ptr, typ, dir, dam, flg));
2263 * @brief ビーム系スペルの発動 / Cast a beam spell.
2264 * @param caster_ptr プレーヤーへの参照ポインタ
2266 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2268 * @return 作用が実際にあった場合TRUEを返す
2271 * Pass through monsters, as a "beam".
2272 * Affect monsters, grids and objects.
2275 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2277 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2278 return (project_hook(caster_ptr, typ, dir, dam, flg));
2283 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2284 * @param caster_ptr プレーヤーへの参照ポインタ
2285 * @param prob ビーム化する確率(%)
2287 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2289 * @return 作用が実際にあった場合TRUEを返す
2292 * Pass through monsters, as a "beam".
2293 * Affect monsters, grids and objects.
2296 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2298 if (randint0(100) < prob)
2300 return (fire_beam(caster_ptr, typ, dir, dam));
2303 return (fire_bolt(caster_ptr, typ, dir, dam));
2308 * @brief LITE_WEAK属性による光源ビーム処理
2309 * @param caster_ptr プレーヤーへの参照ポインタ
2310 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2312 * @return 作用が実際にあった場合TRUEを返す
2314 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2316 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
2317 return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
2323 * @param caster_ptr プレーヤーへの参照ポインタ
2324 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2326 * @return 作用が実際にあった場合TRUEを返す
2328 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2330 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2331 return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
2337 * @param caster_ptr プレーヤーへの参照ポインタ
2338 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2340 * @return 作用が実際にあった場合TRUEを返す
2342 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2344 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2345 return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
2351 * @param caster_ptr プレーヤーへの参照ポインタ
2352 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2353 * @return 作用が実際にあった場合TRUEを返す
2355 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
2357 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2358 return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
2364 * @param caster_ptr プレーヤーへの参照ポインタ
2365 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2366 * @return 作用が実際にあった場合TRUEを返す
2368 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
2370 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2371 return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
2377 * @param caster_ptr プレーヤーへの参照ポインタ
2378 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2379 * @return 作用が実際にあった場合TRUEを返す
2381 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
2383 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2384 return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
2390 * @param caster_ptr プレーヤーへの参照ポインタ
2391 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2392 * @param plev プレイヤーレベル(効力はplev*200)
2393 * @return 作用が実際にあった場合TRUEを返す
2395 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2397 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2398 return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
2403 * @brief モンスター用テレポート処理
2404 * @param caster_ptr プレーヤーへの参照ポインタ
2405 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2406 * @param distance 移動距離
2407 * @return 作用が実際にあった場合TRUEを返す
2409 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
2411 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
2412 return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
2417 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
2418 * @param caster_ptr プレーヤーへの参照ポインタ
2419 * @return 作用が実際にあった場合TRUEを返す
2421 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
2423 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2424 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
2429 * @brief トラップ生成処理(起点から周囲1マス)
2430 * @param caster_ptr プレーヤーへの参照ポインタ
2433 * @return 作用が実際にあった場合TRUEを返す
2435 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
2437 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2438 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
2443 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
2444 * @param caster_ptr プレーヤーへの参照ポインタ
2445 * @return 作用が実際にあった場合TRUEを返す
2447 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
2449 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2450 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
2455 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
2456 * @param caster_ptr プレーヤーへの参照ポインタ
2457 * @return 作用が実際にあった場合TRUEを返す
2459 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
2461 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
2462 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
2467 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
2468 * @param caster_ptr プレーヤーへの参照ポインタ
2469 * @return 作用が実際にあった場合TRUEを返す
2471 bool wall_stone(player_type *caster_ptr)
2473 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2474 bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
2475 caster_ptr->update |= (PU_FLOW);
2476 caster_ptr->redraw |= (PR_MAP);
2482 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
2483 * @param caster_ptr プレーヤーへの参照ポインタ
2484 * @return 作用が実際にあった場合TRUEを返す
2486 bool destroy_doors_touch(player_type *caster_ptr)
2488 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2489 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
2494 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
2495 * @param caster_ptr プレーヤーへの参照ポインタ
2496 * @return 作用が実際にあった場合TRUEを返す
2498 bool disarm_traps_touch(player_type *caster_ptr)
2500 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2501 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
2506 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
2507 * @param caster_ptr プレーヤーへの参照ポインタ
2508 * @return 作用が実際にあった場合TRUEを返す
2510 bool sleep_monsters_touch(player_type *caster_ptr)
2512 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
2513 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
2518 * @brief 死者復活処理(起点より周囲5マス)
2519 * @param caster_ptr プレーヤーへの参照ポインタ
2520 * @param who 術者モンスターID(0ならばプレイヤー)
2523 * @return 作用が実際にあった場合TRUEを返す
2525 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
2527 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
2528 return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
2534 * @return 作用が実際にあった場合TRUEを返す
2536 void call_chaos(player_type *caster_ptr)
2538 int hurt_types[31] =
2540 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
2541 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
2542 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
2543 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
2544 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
2545 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
2546 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
2547 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
2550 int chaos_type = hurt_types[randint0(31)];
2551 bool line_chaos = FALSE;
2552 if (one_in_(4)) line_chaos = TRUE;
2557 for (int dummy = 1; dummy < 10; dummy++)
2562 fire_beam(caster_ptr, chaos_type, dummy, 150);
2564 fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
2573 fire_ball(caster_ptr, chaos_type, 0, 500, 8);
2577 if (!get_aim_dir(caster_ptr, &dir)) return;
2579 fire_beam(caster_ptr, chaos_type, dir, 250);
2581 fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
2586 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
2587 * @param target_ptr プレーヤーへの参照ポインタ
2588 * @param stop_ty 再帰処理停止フラグ
2590 * @return 作用が実際にあった場合TRUEを返す
2593 * rr9: Stop the nasty things when a Cyberdemon is summoned
2594 * or the player gets paralyzed.
2597 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
2599 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
2600 bool is_first_curse = TRUE;
2601 floor_type *floor_ptr = target_ptr->current_floor_ptr;
2602 while (is_first_curse || one_in_(3) && !stop_ty)
2604 is_first_curse = FALSE;
2605 switch (randint1(34))
2610 msg_print(_("地面が揺れた...", "The ground trembles..."));
2611 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
2612 if (!one_in_(6)) break;
2617 HIT_POINT dam = damroll(10, 10);
2618 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
2619 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
2620 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
2621 if (!one_in_(6)) break;
2626 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
2627 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
2628 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2629 if (!one_in_(6)) break;
2632 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
2633 wall_breaker(target_ptr);
2636 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
2637 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
2640 if (!one_in_(6)) break;
2641 case 1: case 2: case 3: case 16: case 17:
2642 aggravate_monsters(target_ptr, 0);
2643 if (!one_in_(6)) break;
2644 case 4: case 5: case 6:
2645 (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2646 if (!one_in_(6)) break;
2647 case 7: case 8: case 9: case 18:
2648 (*count) += summon_specific(0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2649 if (!one_in_(6)) break;
2650 case 10: case 11: case 12:
2651 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
2652 lose_exp(target_ptr, target_ptr->exp / 16);
2653 if (!one_in_(6)) break;
2654 case 13: case 14: case 15: case 19: case 20:
2655 if (stop_ty || (target_ptr->free_act && (randint1(125) < target_ptr->skill_sav)) || (target_ptr->pclass == CLASS_BERSERKER))
2661 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
2662 if (target_ptr->free_act)
2663 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
2665 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
2669 if (!one_in_(6)) break;
2670 case 21: case 22: case 23:
2671 (void)do_dec_stat(target_ptr, randint0(6));
2672 if (!one_in_(6)) break;
2674 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
2675 lose_all_info(target_ptr);
2676 if (!one_in_(6)) break;
2678 if ((floor_ptr->dun_level > 65) && !stop_ty)
2680 (*count) += summon_cyber(floor_ptr, -1, target_ptr->y, target_ptr->x);
2685 if (!one_in_(6)) break;
2687 for (int i = 0; i < A_MAX; i++)
2689 bool is_first_dec_stat = TRUE;
2690 while (is_first_dec_stat || one_in_(2))
2692 is_first_dec_stat = FALSE;
2693 (void)do_dec_stat(target_ptr, i);
2704 * todo 引数にPOSITION x/yは必要か? 要調査
2705 * @brief HI_SUMMON(上級召喚)処理発動
2706 * @param caster_ptr プレーヤーへの参照ポインタ
2709 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
2710 * @return 作用が実際にあった場合TRUEを返す
2712 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
2714 BIT_FLAGS mode = PM_ALLOW_GROUP;
2720 mode |= PM_FORCE_FRIENDLY;
2724 mode |= PM_FORCE_PET;
2729 if (!pet) mode |= PM_NO_PET;
2731 DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
2732 DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
2735 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
2737 switch (randint1(25) + (dungeon_level / 20))
2740 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
2743 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
2746 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
2749 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
2752 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
2755 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
2758 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
2761 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
2765 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
2769 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
2772 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2773 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
2776 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2777 count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
2780 count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
2783 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2784 count += summon_specific((pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
2793 * @brief 周辺破壊効果(プレイヤー中心)
2794 * @param caster_ptr プレーヤーへの参照ポインタ
2795 * @return 作用が実際にあった場合TRUEを返す
2797 void wall_breaker(player_type *caster_ptr)
2799 POSITION y = 0, x = 0;
2800 int attempts = 1000;
2801 if (randint1(80 + caster_ptr->lev) < 70)
2805 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
2807 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
2809 if (!player_bold(caster_ptr, y, x)) break;
2812 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2813 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2817 if (randint1(100) > 30)
2819 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2823 int num = damroll(5, 3);
2824 for (int i = 0; i < num; i++)
2828 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2830 if (!player_bold(caster_ptr, y, x)) break;
2833 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2834 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2840 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2841 * @param caster_ptr プレーヤーへの参照ポインタ
2843 * @return 作用が実際にあった場合TRUEを返す
2845 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2847 return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2852 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2853 * @param caster_ptr プレーヤーへの参照ポインタ
2855 * @return 作用が実際にあった場合TRUEを返す
2857 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2859 return (project_all_los(caster_ptr, GF_CHARM, dam));
2864 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2865 * @param caster_ptr プレーヤーへの参照ポインタ
2867 * @return 作用が実際にあった場合TRUEを返す
2869 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2871 return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2876 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2877 * @param caster_ptr プレーヤーへの参照ポインタ
2879 * @return 作用が実際にあった場合TRUEを返す
2881 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2883 return (project_all_los(caster_ptr, GF_STUN, dam));
2888 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2889 * @param caster_ptr プレーヤーへの参照ポインタ
2891 * @return 作用が実際にあった場合TRUEを返す
2893 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2895 return (project_all_los(caster_ptr, GF_STASIS, dam));
2900 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
2901 * @param caster_ptr プレーヤーへの参照ポインタ
2903 * @return 作用が実際にあった場合TRUEを返す
2905 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
2907 return (project_all_los(caster_ptr, GF_PSI, dam));
2912 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
2913 * @param caster_ptr プレーヤーへの参照ポインタ
2914 * @param dist 効力(距離)
2915 * @return 作用が実際にあった場合TRUEを返す
2917 bool banish_monsters(player_type *caster_ptr, int dist)
2919 return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
2924 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
2925 * @param caster_ptr プレーヤーへの参照ポインタ
2927 * @return 作用が実際にあった場合TRUEを返す
2929 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
2931 return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
2936 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
2937 * @param caster_ptr プレーヤーへの参照ポインタ
2939 * @return 作用が実際にあった場合TRUEを返す
2941 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
2943 return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
2948 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
2949 * @param caster_ptr プレーヤーへの参照ポインタ
2950 * @return 作用が実際にあった場合TRUEを返す
2952 bool deathray_monsters(player_type *caster_ptr)
2954 return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
2959 * @brief チャーム・モンスター(1体)
2960 * @param caster_ptr プレーヤーへの参照ポインタ
2961 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2963 * @return 作用が実際にあった場合TRUEを返す
2965 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2967 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2968 return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
2973 * @brief アンデッド支配(1体)
2974 * @param caster_ptr プレーヤーへの参照ポインタ
2975 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2977 * @return 作用が実際にあった場合TRUEを返す
2979 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2981 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2982 return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
2988 * @param caster_ptr プレーヤーへの参照ポインタ
2989 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2991 * @return 作用が実際にあった場合TRUEを返す
2993 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2995 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2996 return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
3002 * @param caster_ptr プレーヤーへの参照ポインタ
3003 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
3005 * @return 作用が実際にあった場合TRUEを返す
3007 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
3009 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
3010 return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
3016 * @param caster_ptr プレーヤーへの参照ポインタ
3017 * @param success 判定成功上の処理ならばTRUE
3018 * @return 作用が実際にあった場合TRUEを返す
3020 bool kawarimi(player_type *caster_ptr, bool success)
3023 object_type *q_ptr = &forge;
3025 if (caster_ptr->is_dead) return FALSE;
3026 if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
3027 if (randint0(200) < caster_ptr->stun) return FALSE;
3029 if (!success && one_in_(3))
3031 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
3032 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
3033 caster_ptr->redraw |= (PR_STATUS);
3037 POSITION y = caster_ptr->y;
3038 POSITION x = caster_ptr->x;
3040 teleport_player(caster_ptr, 10 + randint1(90), 0L);
3042 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
3044 q_ptr->pval = MON_NINJA;
3045 (void)drop_near(caster_ptr, q_ptr, -1, y, x);
3047 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
3048 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
3050 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
3051 caster_ptr->redraw |= (PR_STATUS);
3059 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
3060 * @param caster_ptr プレーヤーへの参照ポインタ
3061 * @param mdeath 目標モンスターが死亡したかを返す
3062 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
3064 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
3066 if (mdeath) *mdeath = FALSE;
3070 if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
3072 /* Use the given direction */
3073 int tx = attacker_ptr->x + project_length * ddx[dir];
3074 int ty = attacker_ptr->y + project_length * ddy[dir];
3076 if ((dir == 5) && target_okay(attacker_ptr))
3083 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
3084 if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
3087 int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
3090 /* No need to move */
3091 if (!path_n) return TRUE;
3093 /* Use ty and tx as to-move point */
3094 ty = attacker_ptr->y;
3095 tx = attacker_ptr->x;
3097 /* Project along the path */
3098 bool tmp_mdeath = FALSE;
3100 for (int i = 0; i < path_n; i++)
3102 monster_type *m_ptr;
3104 int ny = GRID_Y(path_g[i]);
3105 int nx = GRID_X(path_g[i]);
3107 if (cave_empty_bold(floor_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
3112 /* Go to next grid */
3116 if (!floor_ptr->grid_array[ny][nx].m_idx)
3120 msg_print(_("失敗!", "Failed!"));
3124 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
3131 /* Move player before updating the monster */
3132 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3133 update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
3135 /* Found a monster */
3136 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
3138 if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
3141 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
3143 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
3146 else if (!player_bold(attacker_ptr, ty, tx))
3148 /* Hold the monster name */
3149 GAME_TEXT m_name[MAX_NLEN];
3151 /* Get the monster name (BEFORE polymorphing) */
3152 monster_desc(m_name, m_ptr, 0);
3153 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
3156 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3158 tmp_mdeath = py_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
3163 if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
3165 if (mdeath) *mdeath = tmp_mdeath;
3171 * @brief 全鏡の消去 / Remove all mirrors in this floor
3172 * @param caster_ptr プレーヤーへの参照ポインタ
3173 * @param explode 爆発処理を伴うならばTRUE
3176 void remove_all_mirrors(player_type *caster_ptr, bool explode)
3178 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
3180 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
3182 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
3185 remove_mirror(caster_ptr, y, x);
3186 if (!explode) continue;
3188 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
3189 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3196 * @brief 『一つの指輪』の効果処理 /
3197 * Hack -- activate the ring of power
3198 * @param caster_ptr プレーヤーへの参照ポインタ
3199 * @param dir 発動の方向ID
3202 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
3204 switch (randint1(10))
3209 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3212 /* Decrease all stats (permanently) */
3213 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
3214 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
3215 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
3216 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
3217 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
3218 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
3220 /* Lose some experience (permanently) */
3221 caster_ptr->exp -= (caster_ptr->exp / 4);
3222 caster_ptr->max_exp -= (caster_ptr->exp / 4);
3223 check_experience(caster_ptr);
3230 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3231 dispel_monsters(caster_ptr, 1000);
3239 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
3248 fire_bolt(caster_ptr, GF_MANA, dir, 500);
3256 * @brief 運命の輪、並びにカオス的な効果の発動
3257 * @param caster_ptr プレーヤーへの参照ポインタ
3258 * @param spell ランダムな効果を選択するための基準ID
3261 void wild_magic(player_type *caster_ptr, int spell)
3263 int type = SUMMON_MOLD + randint0(6);
3264 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3265 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3267 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3268 switch (randint1(spell) + randint1(8) + 1)
3273 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3278 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3282 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3287 unlite_area(caster_ptr, 10, 3);
3292 lite_area(caster_ptr, damroll(2, 3), 2);
3295 destroy_doors_touch(caster_ptr);
3298 wall_breaker(caster_ptr);
3300 sleep_monsters_touch(caster_ptr);
3304 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3308 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3313 aggravate_monsters(caster_ptr, 0);
3316 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3320 (void)gain_mutation(caster_ptr, 0);
3324 apply_disenchant(caster_ptr, 1);
3327 lose_all_info(caster_ptr);
3330 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3333 wall_stone(caster_ptr);
3337 for (int counter = 0; counter < 8; counter++)
3339 (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
3345 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3348 (void)summon_cyber(floor_ptr, -1, caster_ptr->y, caster_ptr->x);
3353 (void)activate_ty_curse(caster_ptr, FALSE, &count);
3361 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
3362 * / Drop 10+1d10 meteor ball at random places near the player
3363 * @param caster_ptr プレーヤーへの参照ポインタ
3368 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3370 int b = 10 + randint1(10);
3371 for (int i = 0; i < b; i++)
3373 POSITION y = 0, x = 0;
3376 for (count = 0; count <= 20; count++)
3380 x = caster_ptr->x - 8 + randint0(17);
3381 y = caster_ptr->y - 8 + randint0(17);
3383 dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
3384 dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
3386 /* Approximate distance */
3387 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3389 if (d >= 9) continue;
3391 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3392 if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
3393 || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
3398 if (count > 20) continue;
3400 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
3406 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
3407 * @param caster_ptr プレーヤーへの参照ポインタ
3410 * @return ターゲットを指定し、実行したならばTRUEを返す。
3412 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3415 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
3417 /* Use the given direction */
3418 POSITION tx = caster_ptr->x + 99 * ddx[dir];
3419 POSITION ty = caster_ptr->y + 99 * ddy[dir];
3421 /* Hack -- Use an actual "target" */
3422 if ((dir == 5) && target_okay(caster_ptr))
3428 POSITION x = caster_ptr->x;
3429 POSITION y = caster_ptr->y;
3433 /* Hack -- Stop at the target */
3434 if ((y == ty) && (x == tx)) break;
3438 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
3440 /* Stop at maximum range */
3441 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
3443 /* Stopped by walls/doors */
3444 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
3446 /* Stopped by monsters */
3447 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
3449 /* Save the new location */
3457 int b = 10 + randint1(10);
3458 for (int i = 0; i < b; i++)
3460 int count = 20, d = 0;
3466 x = tx - 5 + randint0(11);
3467 y = ty - 5 + randint0(11);
3469 dx = (tx > x) ? (tx - x) : (x - tx);
3470 dy = (ty > y) ? (ty - y) : (y - ty);
3472 /* Approximate distance */
3473 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3474 /* Within the radius */
3478 if (count < 0) continue;
3480 /* Cannot penetrate perm walls */
3481 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
3482 cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
3483 !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
3486 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
3493 * @brief 「ワンダー」のランダムな効果を決定して処理する。
3494 * @param caster_ptr プレーヤーへの参照ポインタ
3498 * This spell should become more useful (more controlled) as the\n
3499 * player gains experience levels. Thus, add 1/5 of the player's\n
3500 * level to the die roll. This eliminates the worst effects later on,\n
3501 * while keeping the results quite random. It also allows some potent\n
3502 * effects only at high level.
3504 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
3506 PLAYER_LEVEL plev = caster_ptr->lev;
3507 int die = randint1(100) + plev / 5;
3508 int vir = virtue_number(caster_ptr, V_CHANCE);
3511 if (caster_ptr->virtues[vir - 1] > 0)
3513 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3517 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3523 chg_virtue(caster_ptr, V_CHANCE, 1);
3528 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
3533 clone_monster(caster_ptr, dir);
3539 speed_monster(caster_ptr, dir, plev);
3545 heal_monster(caster_ptr, dir, damroll(4, 6));
3551 poly_monster(caster_ptr, dir, plev);
3557 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3558 damroll(3 + ((plev - 1) / 5), 4));
3564 confuse_monster(caster_ptr, dir, plev);
3570 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3576 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3582 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3583 damroll(3 + ((plev - 5) / 4), 8));
3589 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3590 damroll(5 + ((plev - 5) / 4), 8));
3596 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3597 damroll(6 + ((plev - 5) / 4), 8));
3603 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3604 damroll(8 + ((plev - 5) / 4), 8));
3610 hypodynamic_bolt(caster_ptr, dir, 75);
3616 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3622 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3628 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3634 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3640 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3646 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3652 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3658 symbol_genocide(caster_ptr, plev + 50, TRUE);
3664 dispel_monsters(caster_ptr, 120);
3668 dispel_monsters(caster_ptr, 150);
3669 slow_monsters(caster_ptr, plev);
3670 sleep_monsters(caster_ptr, plev);
3671 hp_player(caster_ptr, 300);
3676 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
3677 * @param caster_ptr プレーヤーへの参照ポインタ
3681 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
3683 PLAYER_LEVEL plev = caster_ptr->lev;
3684 int die = randint1(100) + plev / 5;
3685 int vir = virtue_number(caster_ptr, V_CHANCE);
3689 if (caster_ptr->virtues[vir - 1] > 0)
3691 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3695 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3699 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
3701 chg_virtue(caster_ptr, V_CHANCE, 1);
3705 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
3710 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
3711 "Oh no! Mouldering forms rise from the earth around you!"));
3713 (void)summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3714 chg_virtue(caster_ptr, V_UNLIFE, 1);
3718 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
3720 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
3724 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
3725 "Your head is invaded by a horde of gibbering spectral voices..."));
3727 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
3731 poly_monster(caster_ptr, dir, plev);
3735 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3736 damroll(3 + ((plev - 1) / 5), 4));
3740 confuse_monster(caster_ptr, dir, plev);
3744 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3748 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3752 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3753 damroll(3 + ((plev - 5) / 4), 8));
3757 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3758 damroll(5 + ((plev - 5) / 4), 8));
3762 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3763 damroll(6 + ((plev - 5) / 4), 8));
3767 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3768 damroll(8 + ((plev - 5) / 4), 8));
3772 hypodynamic_bolt(caster_ptr, dir, 75);
3776 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3780 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3784 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3788 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3792 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3796 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3800 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3804 symbol_genocide(caster_ptr, plev + 50, TRUE);
3808 dispel_monsters(caster_ptr, 120);
3812 dispel_monsters(caster_ptr, 150);
3813 slow_monsters(caster_ptr, plev);
3814 sleep_monsters(caster_ptr, plev);
3815 hp_player(caster_ptr, 300);
3820 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
3821 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
3826 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
3827 * @param caster_ptr プレーヤーへの参照ポインタ
3830 void cast_shuffle(player_type *caster_ptr)
3832 PLAYER_LEVEL plev = caster_ptr->lev;
3835 int vir = virtue_number(caster_ptr, V_CHANCE);
3838 /* Card sharks and high mages get a level bonus */
3839 if ((caster_ptr->pclass == CLASS_ROGUE) ||
3840 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
3841 (caster_ptr->pclass == CLASS_SORCERER))
3842 die = (randint1(110)) + plev / 5;
3844 die = randint1(120);
3848 if (caster_ptr->virtues[vir - 1] > 0)
3850 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3854 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3858 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3862 chg_virtue(caster_ptr, V_CHANCE, 1);
3865 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3868 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3870 for (i = 0; i < randint1(3); i++)
3872 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3880 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3881 summon_specific(0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3888 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3889 activate_ty_curse(caster_ptr, FALSE, &count);
3895 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3896 aggravate_monsters(caster_ptr, 0);
3902 msg_print(_("《愚者》だ。", "It's the Fool."));
3903 do_dec_stat(caster_ptr, A_INT);
3904 do_dec_stat(caster_ptr, A_WIS);
3910 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3911 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);
3917 msg_print(_("《月》だ。", "It's the Moon."));
3918 unlite_area(caster_ptr, 10, 3);
3924 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3925 wild_magic(caster_ptr, randint0(32));
3931 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3932 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3938 msg_print(_("《正義》だ。", "It's Justice."));
3939 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3945 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3946 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3952 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3953 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3959 msg_print(_("《塔》だ。", "It's the Tower."));
3960 wall_breaker(caster_ptr);
3966 msg_print(_("《節制》だ。", "It's Temperance."));
3967 sleep_monsters_touch(caster_ptr);
3973 msg_print(_("《塔》だ。", "It's the Tower."));
3974 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3980 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3981 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3987 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3988 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3994 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3995 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
4001 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
4002 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
4008 msg_print(_("《恋人》だ。", "It's the Lovers."));
4010 if (get_aim_dir(caster_ptr, &dir))
4012 charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
4020 msg_print(_("《隠者》だ。", "It's the Hermit."));
4021 wall_stone(caster_ptr);
4027 msg_print(_("《審判》だ。", "It's the Judgement."));
4028 roll_hitdice(caster_ptr, 0L);
4029 lose_all_mutations(caster_ptr);
4035 msg_print(_("《太陽》だ。", "It's the Sun."));
4036 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
4037 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
4038 wiz_lite(caster_ptr, FALSE);
4042 msg_print(_("《世界》だ。", "It's the World."));
4043 if (caster_ptr->exp >= PY_MAX_EXP)
4048 s32b ee = (caster_ptr->exp / 25) + 1;
4049 if (ee > 5000) ee = 5000;
4050 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
4051 gain_exp(caster_ptr, ee);
4055 * @brief 口を使う継続的な処理を中断する
4056 * @param caster_ptr プレーヤーへの参照ポインタ
4059 void stop_mouth(player_type *caster_ptr)
4061 if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
4062 if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
4066 bool_hack vampirism(player_type *caster_ptr)
4068 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
4070 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
4074 /* Only works on adjacent monsters */
4076 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
4078 POSITION y = caster_ptr->y + ddy[dir];
4079 POSITION x = caster_ptr->x + ddx[dir];
4081 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
4083 stop_mouth(caster_ptr);
4085 if (!(g_ptr->m_idx))
4087 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
4091 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
4093 int dummy = caster_ptr->lev * 2;
4094 if (!hypodynamic_bolt(caster_ptr, dir, dummy))
4096 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
4100 if (caster_ptr->food < PY_FOOD_FULL)
4101 (void)hp_player(caster_ptr, dummy);
4103 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
4105 /* Gain nutritional sustenance: 150/hp drained */
4106 /* A Food ration gives 5000 food points (by contrast) */
4107 /* Don't ever get more than "Full" this way */
4108 /* But if we ARE Gorged, it won't cure us */
4109 dummy = caster_ptr->food + MIN(5000, 100 * dummy);
4110 if (caster_ptr->food < PY_FOOD_MAX) /* Not gorged already */
4111 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
4117 * ヒット&アウェイのレイシャルパワー/突然変異
4118 * @param caster_ptr プレーヤーへの参照ポインタ
4119 * @return コマンドの入力先にモンスターがいたらTRUE
4121 bool hit_and_away(player_type *caster_ptr)
4124 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
4125 POSITION y = caster_ptr->y + ddy[dir];
4126 POSITION x = caster_ptr->x + ddx[dir];
4127 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4129 py_attack(caster_ptr, y, x, 0);
4130 if (randint0(caster_ptr->skill_dis) < 7)
4131 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
4133 teleport_player(caster_ptr, 30, 0L);
4137 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4144 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
4145 * @param caster_ptr プレーヤーへの参照ポインタ
4148 * currently this function allows pseudo-id of any object,
4149 * including silly ones like potions & scrolls, which always
4150 * get '{average}'. This should be changed, either to stop such
4151 * items from being pseudo-id'd, or to allow psychometry to
4152 * detect whether the unidentified potion/scroll/etc is
4153 * good (Cure Light Wounds, Restore Strength, etc) or
4154 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
4156 bool psychometry(player_type *caster_ptr)
4158 concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
4159 concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
4162 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
4163 if (!o_ptr) return FALSE;
4165 if (object_is_known(o_ptr))
4167 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
4171 /* Check for a feeling */
4172 byte feel = value_check_aux1(o_ptr);
4174 /* Get an object description */
4175 GAME_TEXT o_name[MAX_NLEN];
4176 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
4178 /* Skip non-feelings */
4181 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
4186 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
4188 msg_format("You feel that the %s %s %s...",
4189 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
4192 o_ptr->ident |= (IDENT_SENSE);
4193 o_ptr->feeling = feel;
4194 o_ptr->marked |= OM_TOUCHED;
4196 caster_ptr->update |= (PU_COMBINE | PU_REORDER);
4197 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
4200 switch (o_ptr->tval)
4228 /* Auto-inscription/destroy */
4229 autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
4235 bool draconian_breath(player_type *creature_ptr)
4237 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4238 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4241 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4243 if (randint1(100) < creature_ptr->lev)
4245 switch (creature_ptr->pclass)
4248 case CLASS_BERSERKER:
4251 case CLASS_IMITATOR:
4257 Type_desc = _("エレメント", "the elements");
4262 Type_desc = _("破片", "shards");
4267 case CLASS_WARRIOR_MAGE:
4268 case CLASS_HIGH_MAGE:
4269 case CLASS_SORCERER:
4270 case CLASS_MAGIC_EATER:
4271 case CLASS_RED_MAGE:
4272 case CLASS_BLUE_MAGE:
4273 case CLASS_MIRROR_MASTER:
4277 Type_desc = _("魔力", "mana");
4281 Type = GF_DISENCHANT;
4282 Type_desc = _("劣化", "disenchantment");
4286 case CLASS_CHAOS_WARRIOR:
4289 Type = GF_CONFUSION;
4290 Type_desc = _("混乱", "confusion");
4295 Type_desc = _("カオス", "chaos");
4301 case CLASS_FORCETRAINER:
4304 Type = GF_CONFUSION;
4305 Type_desc = _("混乱", "confusion");
4310 Type_desc = _("轟音", "sound");
4314 case CLASS_MINDCRAFTER:
4317 Type = GF_CONFUSION;
4318 Type_desc = _("混乱", "confusion");
4323 Type_desc = _("精神エネルギー", "mental energy");
4331 Type = GF_HELL_FIRE;
4332 Type_desc = _("地獄の劫火", "hellfire");
4336 Type = GF_HOLY_FIRE;
4337 Type_desc = _("聖なる炎", "holy fire");
4346 Type_desc = _("暗黒", "darkness");
4351 Type_desc = _("毒", "poison");
4359 Type_desc = _("轟音", "sound");
4363 Type = GF_CONFUSION;
4364 Type_desc = _("混乱", "confusion");
4371 stop_mouth(creature_ptr);
4372 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4374 fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4379 bool android_inside_weapon(player_type *creature_ptr)
4382 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4384 if (creature_ptr->lev < 10)
4386 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4387 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4391 if (creature_ptr->lev < 25)
4393 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4394 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
4398 if (creature_ptr->lev < 35)
4400 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4401 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4405 if (creature_ptr->lev < 45)
4407 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4408 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
4412 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4413 fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4418 bool create_ration(player_type *creature_ptr)
4424 /* Create the food ration */
4425 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4427 /* Drop the object from heaven */
4428 (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
4429 msg_print(_("食事を料理して作った。", "You cook some food."));
4434 void hayagake(player_type *creature_ptr)
4436 if (creature_ptr->action == ACTION_HAYAGAKE)
4438 set_action(creature_ptr, ACTION_NONE);
4439 creature_ptr->energy_use = 0;
4443 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4444 feature_type *f_ptr = &f_info[g_ptr->feat];
4446 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4447 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4449 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4453 set_action(creature_ptr, ACTION_HAYAGAKE);
4456 creature_ptr->energy_use = 0;
4460 bool double_attack(player_type *creature_ptr)
4463 if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
4464 POSITION y = creature_ptr->y + ddy[dir];
4465 POSITION x = creature_ptr->x + ddx[dir];
4466 if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4468 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4474 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4475 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4476 else if (one_in_(2))
4477 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4478 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4480 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4481 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4483 py_attack(creature_ptr, y, x, 0);
4484 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4486 handle_stuff(creature_ptr);
4487 py_attack(creature_ptr, y, x, 0);
4490 creature_ptr->energy_need += ENERGY_NEED();
4495 bool comvert_hp_to_mp(player_type *creature_ptr)
4497 int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
4500 msg_print(_("変換に失敗した。", "You failed to convert."));
4501 creature_ptr->redraw |= (PR_HP | PR_MANA);
4505 creature_ptr->csp += gain_sp;
4506 if (creature_ptr->csp > creature_ptr->msp)
4508 creature_ptr->csp = creature_ptr->msp;
4509 creature_ptr->csp_frac = 0;
4512 creature_ptr->redraw |= (PR_HP | PR_MANA);
4517 bool comvert_mp_to_hp(player_type *creature_ptr)
4519 if (creature_ptr->csp >= creature_ptr->lev / 5)
4521 creature_ptr->csp -= creature_ptr->lev / 5;
4522 hp_player(creature_ptr, creature_ptr->lev);
4526 msg_print(_("変換に失敗した。", "You failed to convert."));
4529 creature_ptr->redraw |= (PR_HP | PR_MANA);
4534 bool demonic_breath(player_type *creature_ptr)
4537 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
4538 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4539 stop_mouth(creature_ptr);
4540 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
4541 fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
4548 * @param creature_ptr プレーヤーへの参照ポインタ
4549 * @return ペットを操っている場合を除きTRUE
4551 bool mirror_concentration(player_type *creature_ptr)
4555 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4559 if (!is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
4561 msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
4565 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4567 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
4568 if (creature_ptr->csp >= creature_ptr->msp)
4570 creature_ptr->csp = creature_ptr->msp;
4571 creature_ptr->csp_frac = 0;
4574 creature_ptr->redraw |= PR_MANA;
4581 * @param creature_ptr プレーヤーへの参照ポインタ
4584 bool sword_dancing(player_type *creature_ptr)
4587 POSITION y = 0, x = 0;
4589 for (int i = 0; i < 6; i++)
4592 y = creature_ptr->y + ddy_ddd[dir];
4593 x = creature_ptr->x + ddx_ddd[dir];
4594 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
4596 /* Hack -- attack monsters */
4598 py_attack(creature_ptr, y, x, 0);
4601 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
4611 * @param creature_ptr プレーヤーへの参照ポインタ
4614 bool confusing_light(player_type *creature_ptr)
4616 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
4617 slow_monsters(creature_ptr, creature_ptr->lev);
4618 stun_monsters(creature_ptr, creature_ptr->lev * 4);
4619 confuse_monsters(creature_ptr, creature_ptr->lev * 4);
4620 turn_monsters(creature_ptr, creature_ptr->lev * 4);
4621 stasis_monsters(creature_ptr, creature_ptr->lev * 4);
4628 * @param creature_ptr プレーヤーへの参照ポインタ
4629 * @return 結果はどうあれ騎乗したらTRUE
4631 bool rodeo(player_type *creature_ptr)
4633 GAME_TEXT m_name[MAX_NLEN];
4634 monster_type *m_ptr;
4635 monster_race *r_ptr;
4638 if (creature_ptr->riding)
4640 msg_print(_("今は乗馬中だ。", "You ARE riding."));
4644 if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
4646 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4647 r_ptr = &r_info[m_ptr->r_idx];
4648 monster_desc(m_name, m_ptr, 0);
4649 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
4651 if (is_pet(m_ptr)) return TRUE;
4653 rlev = r_ptr->level;
4655 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
4656 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
4657 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
4658 && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
4659 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
4660 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
4662 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
4667 msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
4668 rakuba(creature_ptr, 1, TRUE);
4669 /* 落馬処理に失敗してもとにかく乗馬解除 */
4670 creature_ptr->riding = 0;
4677 bool clear_mind(player_type *creature_ptr)
4681 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4685 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4687 creature_ptr->csp += (3 + creature_ptr->lev / 20);
4688 if (creature_ptr->csp >= creature_ptr->msp)
4690 creature_ptr->csp = creature_ptr->msp;
4691 creature_ptr->csp_frac = 0;
4694 creature_ptr->redraw |= (PR_MANA);
4699 bool concentration(player_type *creature_ptr)
4701 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
4705 msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
4709 if (creature_ptr->special_defense & KATA_MASK)
4711 msg_print(_("今は構えに集中している。", "You need concentration on your form."));
4715 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
4717 creature_ptr->csp += creature_ptr->msp / 2;
4718 if (creature_ptr->csp >= max_csp)
4720 creature_ptr->csp = max_csp;
4721 creature_ptr->csp_frac = 0;
4724 creature_ptr->redraw |= PR_MANA;