3 * @brief 魔法効果の実装/ Spell code (part 2)
7 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
8 * This software may be copied and distributed for educational, research,
9 * and not for profit purposes provided that this copyright and statement
10 * are included in all such copies. Other copyrights may also apply.
17 #include "main/sound-definitions-table.h"
22 #include "io/write-diary.h"
23 #include "cmd/cmd-pet.h"
24 #include "cmd/cmd-dump.h"
28 #include "monsterrace-hook.h"
32 #include "spells-summon.h"
37 #include "spells-status.h"
38 #include "spells-floor.h"
39 #include "spells-diceroll.h"
40 #include "realm/realm-hex.h"
41 #include "autopick/autopick.h"
42 #include "object-flavor.h"
43 #include "object-hook.h"
44 #include "monster-status.h"
45 #include "player-move.h"
46 #include "player-status.h"
47 #include "player-effects.h"
48 #include "player-skill.h"
49 #include "player-class.h"
50 #include "player-damage.h"
51 #include "player-inventory.h"
54 #include "floor-events.h"
56 #include "view/display-main-window.h"
57 #include "object/object-kind.h"
58 #include "monsterrace.h"
59 #include "targeting.h"
60 #include "realm/realm-song.h"
64 * @brief プレイヤー周辺の地形を感知する
65 * @param caster_ptr プレーヤーへの参照ポインタ
68 * @param known 地形から危険フラグを外すならTRUE
69 * @return 効力があった場合TRUEを返す
71 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
73 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
77 for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
79 for (POSITION x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
81 int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
82 if (dist > range) continue;
83 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
86 /* Mark as detected */
87 if (dist <= range && known)
89 if (dist <= range - 1) g_ptr->info |= (CAVE_IN_DETECT);
91 g_ptr->info &= ~(CAVE_UNSAFE);
93 lite_spot(caster_ptr, y, x);
97 if (cave_have_flag_grid(g_ptr, flag))
99 disclose_grid(caster_ptr, y, x);
100 g_ptr->info |= (CAVE_MARK);
101 lite_spot(caster_ptr, y, x);
112 * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
113 * @param caster_ptr プレーヤーへの参照ポインタ
115 * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
116 * @return 効力があった場合TRUEを返す
118 bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
120 bool detect = detect_feat_flag(caster_ptr, range, FF_TRAP, known);
122 if (known) caster_ptr->dtrap = TRUE;
124 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
127 msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
135 * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
136 * @param caster_ptr プレーヤーへの参照ポインタ
138 * @return 効力があった場合TRUEを返す
140 bool detect_doors(player_type *caster_ptr, POSITION range)
142 bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
144 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
147 msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
155 * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
156 * @param caster_ptr プレーヤーへの参照ポインタ
158 * @return 効力があった場合TRUEを返す
160 bool detect_stairs(player_type *caster_ptr, POSITION range)
162 bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
164 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
167 msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
175 * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
176 * @param caster_ptr プレーヤーへの参照ポインタ
178 * @return 効力があった場合TRUEを返す
180 bool detect_treasure(player_type *caster_ptr, POSITION range)
182 bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
184 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
187 msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
195 * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
196 * @param caster_ptr プレーヤーへの参照ポインタ
198 * @return 効力があった場合TRUEを返す
200 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
202 POSITION range2 = range;
203 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
208 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
210 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
212 if (!OBJECT_IS_VALID(o_ptr)) continue;
213 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
217 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
219 if (o_ptr->tval == TV_GOLD)
221 o_ptr->marked |= OM_FOUND;
222 lite_spot(caster_ptr, y, x);
227 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
230 msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
233 if (detect_monsters_string(caster_ptr, range, "$"))
243 * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
244 * @param caster_ptr プレーヤーへの参照ポインタ
246 * @return 効力があった場合TRUEを返す
248 bool detect_objects_normal(player_type *caster_ptr, POSITION range)
250 POSITION range2 = range;
251 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
254 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
256 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
258 if (!OBJECT_IS_VALID(o_ptr)) continue;
259 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
261 POSITION y = o_ptr->iy;
262 POSITION x = o_ptr->ix;
264 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
266 if (o_ptr->tval != TV_GOLD)
268 o_ptr->marked |= OM_FOUND;
269 lite_spot(caster_ptr, y, x);
274 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
277 msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
280 if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
290 * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
291 * @param caster_ptr プレーヤーへの参照ポインタ
293 * @return 効力があった場合TRUEを返す
296 * This will light up all spaces with "magic" items, including artifacts,
297 * ego-items, potions, scrolls, books, rods, wands, staffs, amulets, rings,
298 * and "enchanted" items of the "good" variety.
300 * It can probably be argued that this function is now too powerful.
303 bool detect_objects_magic(player_type *caster_ptr, POSITION range)
305 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
307 OBJECT_TYPE_VALUE tv;
309 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
311 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
313 if (!OBJECT_IS_VALID(o_ptr)) continue;
314 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
316 POSITION y = o_ptr->iy;
317 POSITION x = o_ptr->ix;
319 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
322 if (object_is_artifact(o_ptr) ||
323 object_is_ego(o_ptr) ||
324 (tv == TV_WHISTLE) ||
332 (tv == TV_LIFE_BOOK) ||
333 (tv == TV_SORCERY_BOOK) ||
334 (tv == TV_NATURE_BOOK) ||
335 (tv == TV_CHAOS_BOOK) ||
336 (tv == TV_DEATH_BOOK) ||
337 (tv == TV_TRUMP_BOOK) ||
338 (tv == TV_ARCANE_BOOK) ||
339 (tv == TV_CRAFT_BOOK) ||
340 (tv == TV_DAEMON_BOOK) ||
341 (tv == TV_CRUSADE_BOOK) ||
342 (tv == TV_MUSIC_BOOK) ||
343 (tv == TV_HISSATSU_BOOK) ||
344 (tv == TV_HEX_BOOK) ||
345 ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
347 o_ptr->marked |= OM_FOUND;
348 lite_spot(caster_ptr, y, x);
355 msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
363 * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
364 * @param caster_ptr プレーヤーへの参照ポインタ
366 * @return 効力があった場合TRUEを返す
368 bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
370 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
373 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
375 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
376 monster_race *r_ptr = &r_info[m_ptr->r_idx];
377 if (!monster_is_valid(m_ptr)) continue;
379 POSITION y = m_ptr->fy;
380 POSITION x = m_ptr->fx;
381 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
383 if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
385 repair_monsters = TRUE;
386 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
387 update_monster(caster_ptr, i, FALSE);
392 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
395 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
403 * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
404 * @param caster_ptr プレーヤーへの参照ポインタ
406 * @return 効力があった場合TRUEを返す
408 bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
410 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
413 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
415 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
416 monster_race *r_ptr = &r_info[m_ptr->r_idx];
418 if (!monster_is_valid(m_ptr)) continue;
420 POSITION y = m_ptr->fy;
421 POSITION x = m_ptr->fx;
423 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
425 if (r_ptr->flags2 & RF2_INVISIBLE)
427 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
429 caster_ptr->window |= (PW_MONSTER);
432 repair_monsters = TRUE;
433 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
434 update_monster(caster_ptr, i, FALSE);
439 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
442 msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
450 * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
451 * @param caster_ptr プレーヤーへの参照ポインタ
453 * @return 効力があった場合TRUEを返す
455 bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
457 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
460 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
462 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
463 monster_race *r_ptr = &r_info[m_ptr->r_idx];
464 if (!monster_is_valid(m_ptr)) continue;
466 POSITION y = m_ptr->fy;
467 POSITION x = m_ptr->fx;
469 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
471 if (r_ptr->flags3 & RF3_EVIL)
473 if (is_original_ap(m_ptr))
475 r_ptr->r_flags3 |= (RF3_EVIL);
476 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
478 caster_ptr->window |= (PW_MONSTER);
482 repair_monsters = TRUE;
483 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
484 update_monster(caster_ptr, i, FALSE);
491 msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
499 * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
500 * @param caster_ptr プレーヤーへの参照ポインタ
502 * @return 効力があった場合TRUEを返す
504 bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
506 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
509 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
511 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
512 if (!monster_is_valid(m_ptr)) continue;
514 POSITION y = m_ptr->fy;
515 POSITION x = m_ptr->fx;
516 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
518 if (!monster_living(m_ptr->r_idx))
520 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
522 caster_ptr->window |= (PW_MONSTER);
525 repair_monsters = TRUE;
526 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
527 update_monster(caster_ptr, i, FALSE);
534 msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
542 * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
543 * @param caster_ptr プレーヤーへの参照ポインタ
545 * @return 効力があった場合TRUEを返す
547 bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
549 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
552 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
554 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
555 monster_race *r_ptr = &r_info[m_ptr->r_idx];
556 if (!monster_is_valid(m_ptr)) continue;
558 POSITION y = m_ptr->fy;
559 POSITION x = m_ptr->fx;
561 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
563 if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
565 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
567 caster_ptr->window |= (PW_MONSTER);
570 repair_monsters = TRUE;
571 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
572 update_monster(caster_ptr, i, FALSE);
579 msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
587 * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
588 * @param caster_ptr プレーヤーへの参照ポインタ
590 * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
591 * @return 効力があった場合TRUEを返す
593 bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
595 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
598 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
600 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
601 monster_race *r_ptr = &r_info[m_ptr->r_idx];
602 if (!monster_is_valid(m_ptr)) continue;
604 POSITION y = m_ptr->fy;
605 POSITION x = m_ptr->fx;
607 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
609 if (my_strchr(Match, r_ptr->d_char))
611 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
613 caster_ptr->window |= (PW_MONSTER);
616 repair_monsters = TRUE;
617 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
618 update_monster(caster_ptr, i, FALSE);
623 if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
626 msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
634 * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
635 * @param caster_ptr プレーヤーへの参照ポインタ
637 * @param match_flag 感知フラグ
638 * @return 効力があった場合TRUEを返す
640 bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
642 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
645 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
647 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
648 monster_race *r_ptr = &r_info[m_ptr->r_idx];
649 if (!monster_is_valid(m_ptr)) continue;
651 POSITION y = m_ptr->fy;
652 POSITION x = m_ptr->fx;
654 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
656 if (r_ptr->flags3 & (match_flag))
658 if (is_original_ap(m_ptr))
660 r_ptr->r_flags3 |= (match_flag);
661 if (caster_ptr->monster_race_idx == m_ptr->r_idx)
663 caster_ptr->window |= (PW_MONSTER);
667 repair_monsters = TRUE;
668 m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
669 update_monster(caster_ptr, i, FALSE);
674 concptr desc_monsters = _("変なモンスター", "weird monsters");
680 desc_monsters = _("デーモン", "demons");
683 desc_monsters = _("アンデッド", "the undead");
687 msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
696 * @brief 全感知処理 / Detect everything
697 * @param caster_ptr プレーヤーへの参照ポインタ
699 * @return 効力があった場合TRUEを返す
701 bool detect_all(player_type *caster_ptr, POSITION range)
704 if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
705 if (detect_doors(caster_ptr, range)) detect = TRUE;
706 if (detect_stairs(caster_ptr, range)) detect = TRUE;
707 if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
708 if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
709 if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
710 if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
716 * @brief 視界内モンスターに魔法効果を与える / Apply a "project()" directly to all viewable monsters
719 * @return 効力があった場合TRUEを返す
722 * Note that affected monsters are NOT auto-tracked by this usage.
724 * To avoid misbehavior when monster deaths have side-effects,
725 * this is done in two passes. -- JDL
728 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
730 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
732 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
733 if (!monster_is_valid(m_ptr)) continue;
735 POSITION y = m_ptr->fy;
736 POSITION x = m_ptr->fx;
737 if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
739 m_ptr->mflag |= (MFLAG_LOS);
742 BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
743 bool obvious = FALSE;
744 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
746 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
747 if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
749 m_ptr->mflag &= ~(MFLAG_LOS);
750 POSITION y = m_ptr->fy;
751 POSITION x = m_ptr->fx;
753 if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
761 * @brief 視界内モンスターを加速する処理 / Speed monsters
762 * @param caster_ptr プレーヤーへの参照ポインタ
763 * @return 効力があった場合TRUEを返す
765 bool speed_monsters(player_type *caster_ptr)
767 return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
772 * @brief 視界内モンスターを加速する処理 / Slow monsters
773 * @param caster_ptr プレーヤーへの参照ポインタ
774 * @return 効力があった場合TRUEを返す
776 bool slow_monsters(player_type *caster_ptr, int power)
778 return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
783 * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
784 * @param caster_ptr プレーヤーへの参照ポインタ
785 * @return 効力があった場合TRUEを返す
787 bool sleep_monsters(player_type *caster_ptr, int power)
789 return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
794 * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
795 * @param caster_ptr プレーヤーへの参照ポインタ
796 * @return 効力があった場合TRUEを返す
798 bool banish_evil(player_type *caster_ptr, int dist)
800 return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
805 * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
806 * @return 効力があった場合TRUEを返す
808 bool turn_undead(player_type *caster_ptr)
810 bool tester = (project_all_los(caster_ptr, GF_TURN_UNDEAD, caster_ptr->lev));
812 chg_virtue(caster_ptr, V_UNLIFE, -1);
818 * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
819 * @param caster_ptr プレーヤーへの参照ポインタ
820 * @return 効力があった場合TRUEを返す
822 bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
824 bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
826 chg_virtue(caster_ptr, V_UNLIFE, -2);
832 * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
833 * @param caster_ptr プレーヤーへの参照ポインタ
834 * @return 効力があった場合TRUEを返す
836 bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
838 return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
843 * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
844 * @param caster_ptr プレーヤーへの参照ポインタ
845 * @return 効力があった場合TRUEを返す
847 bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
849 return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
854 * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
855 * @param caster_ptr プレーヤーへの参照ポインタ
856 * @return 効力があった場合TRUEを返す
858 bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
860 return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
865 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
867 * @param creature_ptr プレーヤーへの参照ポインタ
868 * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
869 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
871 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
874 if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
875 int k = 3 * creature_ptr->lev;
876 if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
877 if (set_poisoned(creature_ptr, 0)) ident = TRUE;
878 if (set_afraid(creature_ptr, 0)) ident = TRUE;
879 if (hp_player(creature_ptr, 50)) ident = TRUE;
880 if (set_stun(creature_ptr, 0)) ident = TRUE;
881 if (set_cut(creature_ptr, 0)) ident = TRUE;
887 * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
889 * @param creature_ptr プレーヤーへの参照ポインタ
890 * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
892 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
894 msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
895 project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
896 (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
898 bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
899 is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
900 is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
901 is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
902 is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
903 if (is_special_class)
905 (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
913 * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
914 * @param caster_ptr プレーヤーへの参照ポインタ
915 * @return 効力があった場合TRUEを返す
917 bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
919 return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
924 * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
925 * @param caster_ptr プレーヤーへの参照ポインタ
926 * @return 効力があった場合TRUEを返す
928 bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
930 return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
935 * @brief 視界内のモンスターに「聖戦」効果を与える処理
936 * @param caster_ptr プレーヤーへの参照ポインタ
937 * @return 効力があった場合TRUEを返す
939 bool crusade(player_type *caster_ptr)
941 return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev * 4));
946 * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
947 * @param caster_ptr プレーヤーへの参照ポインタ
948 * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
951 void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
955 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
957 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
958 if (!monster_is_valid(m_ptr)) continue;
959 if (i == who) continue;
961 if (m_ptr->cdis < MAX_SIGHT * 2)
963 if (MON_CSLEEP(m_ptr))
965 (void)set_monster_csleep(caster_ptr, i, 0);
969 if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
972 if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
976 (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
982 if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
983 else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
984 if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
989 * @brief モンスターへの単体抹殺処理サブルーチン / Delete a non-unique/non-quest monster
990 * @param m_idx 抹殺するモンスターID
992 * @param player_cast プレイヤーの魔法によるものならば TRUE
993 * @param dam_side プレイヤーへの負担ダメージ量(1d(dam_side))
994 * @param spell_name 抹殺効果を起こした魔法の名前
995 * @return 効力があった場合TRUEを返す
997 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
999 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
1000 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1001 if (is_pet(m_ptr) && !player_cast) return FALSE;
1003 bool resist = FALSE;
1004 if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
1005 else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
1006 else if (m_idx == caster_ptr->riding) resist = TRUE;
1007 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;
1008 else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
1009 else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
1012 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1014 GAME_TEXT m_name[MAX_NLEN];
1015 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1016 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
1019 delete_monster_idx(caster_ptr, m_idx);
1022 if (resist && player_cast)
1024 bool see_m = is_seen(m_ptr);
1025 GAME_TEXT m_name[MAX_NLEN];
1026 monster_desc(caster_ptr, m_name, m_ptr, 0);
1029 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1032 if (MON_CSLEEP(m_ptr))
1034 (void)set_monster_csleep(caster_ptr, m_idx, 0);
1037 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1041 if (is_friendly(m_ptr) && !is_pet(m_ptr))
1045 msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
1048 set_hostile(caster_ptr, m_ptr);
1051 if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
1056 take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
1059 move_cursor_relative(caster_ptr->y, caster_ptr->x);
1060 caster_ptr->redraw |= (PR_HP);
1061 caster_ptr->window |= (PW_PLAYER);
1062 handle_stuff(caster_ptr);
1065 int msec = delay_factor * delay_factor * delay_factor;
1066 Term_xtra(TERM_XTRA_DELAY, msec);
1073 * @brief モンスターへのシンボル抹殺処理ルーチン / Delete all non-unique/non-quest monsters of a given "type" from the level
1074 * @param power 抹殺の威力
1075 * @param player_cast プレイヤーの魔法によるものならば TRUE
1076 * @return 効力があった場合TRUEを返す
1078 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
1080 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1081 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1082 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1083 is_special_floor |= caster_ptr->phase_out;
1084 if (is_special_floor)
1086 msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
1091 while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
1092 bool result = FALSE;
1093 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1095 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1096 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1097 if (!monster_is_valid(m_ptr)) continue;
1098 if (r_ptr->d_char != typ) continue;
1100 result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
1105 chg_virtue(caster_ptr, V_VITALITY, -2);
1106 chg_virtue(caster_ptr, V_CHANCE, -1);
1114 * @brief モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) monsters
1115 * @param power 抹殺の威力
1116 * @param player_cast プレイヤーの魔法によるものならば TRUE
1117 * @return 効力があった場合TRUEを返す
1119 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
1121 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1122 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1123 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1124 is_special_floor |= caster_ptr->phase_out;
1125 if (is_special_floor)
1130 bool result = FALSE;
1131 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1133 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1134 if (!monster_is_valid(m_ptr)) continue;
1135 if (m_ptr->cdis > MAX_SIGHT) continue;
1137 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
1142 chg_virtue(caster_ptr, V_VITALITY, -2);
1143 chg_virtue(caster_ptr, V_CHANCE, -1);
1151 * @brief アンデッド・モンスターへの周辺抹殺処理ルーチン / Delete all nearby (non-unique) undead
1152 * @param power 抹殺の威力
1153 * @param player_cast プレイヤーの魔法によるものならば TRUE
1154 * @return 効力があった場合TRUEを返す
1156 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
1158 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1159 bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
1160 is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
1161 is_special_floor |= caster_ptr->phase_out;
1162 if (is_special_floor)
1167 bool result = FALSE;
1168 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1170 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1171 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1172 if (!monster_is_valid(m_ptr)) continue;
1173 if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
1174 if (m_ptr->cdis > MAX_SIGHT) continue;
1176 result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
1181 chg_virtue(caster_ptr, V_UNLIFE, -2);
1182 chg_virtue(caster_ptr, V_CHANCE, -1);
1190 * @brief 周辺モンスターを調査する / Probe nearby monsters
1191 * @return 効力があった場合TRUEを返す
1193 bool probing(player_type *caster_ptr)
1195 bool_hack cu = Term->scr->cu;
1196 bool_hack cv = Term->scr->cv;
1204 for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1206 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1207 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1208 if (!monster_is_valid(m_ptr)) continue;
1209 if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
1210 if (!m_ptr->ml) continue;
1212 GAME_TEXT m_name[MAX_NLEN];
1213 if (!probe) msg_print(_("調査中...", "Probing..."));
1216 if (!is_original_ap(m_ptr))
1218 if (m_ptr->mflag2 & MFLAG2_KAGE)
1219 m_ptr->mflag2 &= ~(MFLAG2_KAGE);
1221 m_ptr->ap_r_idx = m_ptr->r_idx;
1222 lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
1225 monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
1226 speed = m_ptr->mspeed - 110;
1227 if (MON_FAST(m_ptr)) speed += 10;
1228 if (MON_SLOW(m_ptr)) speed -= 10;
1229 if (ironman_nightmare) speed += 5;
1231 if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
1232 else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
1233 else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
1234 else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
1235 else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
1236 else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
1237 else align = _("中立", "neutral");
1239 sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
1240 m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
1242 if (r_ptr->next_r_idx)
1244 strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
1248 strcat(buf, "xxx ");
1251 if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
1252 if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
1253 if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
1254 if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
1255 if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
1256 buf[strlen(buf) - 1] = '\0';
1260 caster_ptr->window |= (PW_MESSAGE);
1261 handle_stuff(caster_ptr);
1262 move_cursor_relative(m_ptr->fy, m_ptr->fx);
1264 Term_erase(0, 0, 255);
1265 if (lore_do_probe(caster_ptr, m_ptr->r_idx))
1267 strcpy(buf, (r_name + r_ptr->name));
1269 msg_format("%sについてさらに詳しくなった気がする。", buf);
1272 msg_format("You now know more about %s.", buf);
1286 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
1287 msg_print(_("これで全部です。", "That's all."));
1298 void discharge_minion(player_type *caster_ptr)
1301 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1303 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1304 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1305 if (m_ptr->nickname) okay = FALSE;
1308 if (!okay || caster_ptr->riding)
1310 if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
1314 for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
1316 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
1317 if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
1319 monster_race *r_ptr;
1320 r_ptr = &r_info[m_ptr->r_idx];
1321 if (r_ptr->flags1 & RF1_UNIQUE)
1323 GAME_TEXT m_name[MAX_NLEN];
1324 monster_desc(caster_ptr, m_name, m_ptr, 0x00);
1325 msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
1326 delete_monster_idx(caster_ptr, i);
1330 HIT_POINT dam = m_ptr->maxhp / 2;
1331 if (dam > 100) dam = (dam - 100) / 2 + 100;
1332 if (dam > 400) dam = (dam - 400) / 2 + 400;
1333 if (dam > 800) dam = 800;
1334 project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
1335 PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
1337 if (record_named_pet && m_ptr->nickname)
1339 GAME_TEXT m_name[MAX_NLEN];
1341 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
1342 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
1345 delete_monster_idx(caster_ptr, i);
1351 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1352 * @brief 部屋全体を照らすサブルーチン
1353 * @param caster_ptr プレーヤーへの参照ポインタ
1357 * This routine clears the entire "temp" set.
1358 * This routine will Perma-Lite all "temp" grids.
1359 * This routine is used (only) by "lite_room()"
1360 * Dark grids are illuminated.
1361 * Also, process all affected monsters.
1363 * SMART monsters always wake up when illuminated
1364 * NORMAL monsters wake up 1/4 the time when illuminated
1365 * STUPID monsters wake up 1/10 the time when illuminated
1368 static void cave_temp_room_lite(player_type *caster_ptr)
1370 for (int i = 0; i < tmp_pos.n; i++)
1372 POSITION y = tmp_pos.y[i];
1373 POSITION x = tmp_pos.x[i];
1374 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1375 g_ptr->info &= ~(CAVE_TEMP);
1376 g_ptr->info |= (CAVE_GLOW);
1379 PERCENTAGE chance = 25;
1380 monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
1381 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1382 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1383 if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
1384 if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
1386 if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
1388 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
1391 GAME_TEXT m_name[MAX_NLEN];
1392 monster_desc(caster_ptr, m_name, m_ptr, 0);
1393 msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
1398 note_spot(caster_ptr, y, x);
1399 lite_spot(caster_ptr, y, x);
1400 update_local_illumination(caster_ptr, y, x);
1408 * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
1409 * @brief 部屋全体を暗くするサブルーチン
1410 * @param caster_ptr プレーヤーへの参照ポインタ
1414 * This routine clears the entire "temp" set.
1415 * This routine will "darken" all "temp" grids.
1416 * In addition, some of these grids will be "unmarked".
1417 * This routine is used (only) by "unlite_room()"
1418 * Also, process all affected monsters
1421 static void cave_temp_room_unlite(player_type *caster_ptr)
1423 for (int i = 0; i < tmp_pos.n; i++)
1425 POSITION y = tmp_pos.y[i];
1426 POSITION x = tmp_pos.x[i];
1427 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
1428 bool do_dark = !is_mirror_grid(g_ptr);
1429 g_ptr->info &= ~(CAVE_TEMP);
1430 if (!do_dark) continue;
1432 if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
1434 for (int j = 0; j < 9; j++)
1436 POSITION by = y + ddy_ddd[j];
1437 POSITION bx = x + ddx_ddd[j];
1439 if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
1441 grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
1443 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1451 if (!do_dark) continue;
1454 g_ptr->info &= ~(CAVE_GLOW);
1455 if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
1457 if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
1458 note_spot(caster_ptr, y, x);
1463 update_monster(caster_ptr, g_ptr->m_idx, FALSE);
1466 lite_spot(caster_ptr, y, x);
1467 update_local_illumination(caster_ptr, y, x);
1475 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1476 * @param floor_ptr 配置するフロアの参照ポインタ
1479 * @param pass_bold 地形条件を返す関数ポインタ
1482 static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1486 for (int i = 0; i < 16; i++)
1488 POSITION y = cy + ddy_cdd[i % 8];
1489 POSITION x = cx + ddx_cdd[i % 8];
1490 if (!pass_bold(floor_ptr, y, x))
1505 return MAX(len, blen);
1510 * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
1511 * @param floor_ptr 配置するフロアの参照ポインタ
1514 * @param pass_bold 地形条件を返す関数ポインタ
1517 static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1521 for (DIRECTION i = 0; i < 8; i++)
1523 y = cy + ddy_ddd[i];
1524 x = cx + ddx_ddd[i];
1526 if (!pass_bold(floor_ptr, y, x)) c++;
1534 * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1535 * @param caster_ptr プレーヤーへの参照ポインタ
1536 * @param y 部屋内のy座標1点
1537 * @param x 部屋内のx座標1点
1538 * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
1539 * @param pass_bold 地形条件を返す関数ポインタ
1542 static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool(*pass_bold)(floor_type*, POSITION, POSITION))
1545 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1546 g_ptr = &floor_ptr->grid_array[y][x];
1547 if (g_ptr->info & (CAVE_TEMP)) return;
1549 if (!(g_ptr->info & (CAVE_ROOM)))
1551 if (only_room) return;
1552 if (!in_bounds2(floor_ptr, y, x)) return;
1553 if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
1555 /* Verify this grid */
1557 * The reason why it is ==6 instead of >5 is that 8 is impossible
1558 * due to the check for cave_bold above.
1559 * 7 lights dead-end corridors (you need to do this for the
1560 * checkboard interesting rooms, so that the boundary is lit
1562 * This leaves only a check for 6 bounding walls!
1564 if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
1565 (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
1568 if (tmp_pos.n == TEMP_MAX) return;
1570 g_ptr->info |= (CAVE_TEMP);
1571 tmp_pos.y[tmp_pos.n] = y;
1572 tmp_pos.x[tmp_pos.n] = x;
1578 * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1579 * @param caster_ptr プレーヤーへの参照ポインタ
1584 static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1586 cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_los_bold);
1591 * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
1592 * @param floor_ptr 配置するフロアの参照ポインタ
1595 * @return 射線を通すならばtrueを返す。
1597 static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
1599 return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
1604 * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
1605 * @param caster_ptr プレーヤーへの参照ポインタ
1610 static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
1612 cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
1617 * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
1618 * @param caster_ptr プレーヤーへの参照ポインタ
1623 void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1625 cave_temp_lite_room_aux(caster_ptr, y1, x1);
1626 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
1627 for (int i = 0; i < tmp_pos.n; i++)
1629 POSITION x = tmp_pos.x[i];
1630 POSITION y = tmp_pos.y[i];
1632 if (!cave_los_bold(floor_ptr, y, x)) continue;
1634 cave_temp_lite_room_aux(caster_ptr, y + 1, x);
1635 cave_temp_lite_room_aux(caster_ptr, y - 1, x);
1636 cave_temp_lite_room_aux(caster_ptr, y, x + 1);
1637 cave_temp_lite_room_aux(caster_ptr, y, x - 1);
1639 cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
1640 cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
1641 cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
1642 cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
1645 cave_temp_room_lite(caster_ptr);
1646 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1648 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW)
1649 set_superstealth(caster_ptr, FALSE);
1655 * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
1656 * @param caster_ptr プレーヤーへの参照ポインタ
1661 void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
1663 cave_temp_unlite_room_aux(caster_ptr, y1, x1);
1664 for (int i = 0; i < tmp_pos.n; i++)
1666 POSITION x = tmp_pos.x[i];
1667 POSITION y = tmp_pos.y[i];
1668 if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
1670 cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
1671 cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
1672 cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
1673 cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
1675 cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
1676 cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
1677 cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
1678 cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
1681 cave_temp_room_unlite(caster_ptr);
1686 * @brief スターライトの効果を発生させる
1687 * @param caster_ptr プレーヤーへの参照ポインタ
1688 * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
1691 bool starlight(player_type *caster_ptr, bool magic)
1693 if (!caster_ptr->blind && !magic)
1695 msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
1698 HIT_POINT num = damroll(5, 3);
1700 POSITION y = 0, x = 0;
1701 for (int k = 0; k < num; k++)
1707 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
1708 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
1709 if (!player_bold(caster_ptr, y, x)) break;
1712 project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
1713 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
1721 * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1722 * @param caster_ptr プレーヤーへの参照ポインタ
1725 * @return 作用が実際にあった場合TRUEを返す
1727 bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1729 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
1731 msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs your light."));
1735 if (!caster_ptr->blind)
1737 msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
1740 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1741 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
1743 lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1750 * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
1751 * @param caster_ptr プレーヤーへの参照ポインタ
1754 * @return 作用が実際にあった場合TRUEを返す
1756 bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
1758 if (!caster_ptr->blind)
1760 msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
1763 BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
1764 (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
1766 unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
1773 * @brief ボール系スペルの発動 / Cast a ball spell
1774 * @param caster_ptr プレーヤーへの参照ポインタ
1776 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1779 * @return 作用が実際にあった場合TRUEを返す
1782 * Stop if we hit a monster, act as a "ball"
1783 * Allow "target" mode to pass over monsters
1784 * Affect grids, objects, and monsters
1787 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1789 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1790 if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
1792 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1793 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1795 if ((dir == 5) && target_okay(caster_ptr))
1797 flg &= ~(PROJECT_STOP);
1802 return project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1);
1807 * @brief ブレス系スペルの発動 / Cast a breath spell
1808 * @param caster_ptr プレーヤーへの参照ポインタ
1810 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1813 * @return 作用が実際にあった場合TRUEを返す
1816 * Stop if we hit a monster, act as a "ball"
1817 * Allow "target" mode to pass over monsters
1818 * Affect grids, objects, and monsters
1821 bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1823 return fire_ball(caster_ptr, typ, dir, dam, -rad);
1828 * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
1829 * @param caster_ptr プレーヤーへの参照ポインタ
1831 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1834 * @return 作用が実際にあった場合TRUEを返す
1837 * Stop if we hit a monster, act as a "ball"
1838 * Allow "target" mode to pass over monsters
1839 * Affect grids, objects, and monsters
1842 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1844 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1845 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1846 if ((dir == 5) && target_okay(caster_ptr))
1852 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1853 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1858 * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
1859 * @param caster_ptr プレーヤーへの参照ポインタ
1861 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1864 * @return 作用が実際にあった場合TRUEを返す
1867 * Stop if we hit a monster, act as a "ball"
1868 * Allow "target" mode to pass over monsters
1869 * Affect grids, objects, and monsters
1872 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
1874 POSITION tx = caster_ptr->x + 99 * ddx[dir];
1875 POSITION ty = caster_ptr->y + 99 * ddy[dir];
1876 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
1877 if ((dir == 5) && target_okay(caster_ptr))
1879 flg &= ~(PROJECT_STOP);
1884 return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
1889 * @brief メテオ系スペルの発動 / Cast a meteor spell
1890 * @param caster_ptr プレーヤーへの参照ポインタ
1891 * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
1897 * @return 作用が実際にあった場合TRUEを返す
1900 * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
1901 * player, or outside source, that starts out at an arbitrary location, and
1902 * leaving no trail from the "caster" to the target. This function is
1903 * especially useful for bombardments and similar. -LM-
1904 * Option to hurt the player.
1907 bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
1909 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
1910 return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
1915 * @brief ブラスト系スペルの発動 / Cast a blast spell
1916 * @param caster_ptr プレーヤーへの参照ポインタ
1918 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1923 * @return 作用が実際にあった場合TRUEを返す
1925 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
1927 POSITION ty, tx, y, x;
1934 lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
1935 ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
1939 ly = ty = caster_ptr->y + 20 * ddy[dir];
1940 lx = tx = caster_ptr->x + 20 * ddx[dir];
1943 int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
1944 BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
1946 for (int i = 0; i < num; i++)
1950 /* Get targets for some bolts */
1951 y = rand_spread(ly, ld * dev / 20);
1952 x = rand_spread(lx, ld * dev / 20);
1954 if (distance(ly, lx, y, x) <= ld * dev / 20) break;
1957 /* Analyze the "dir" and the "target". */
1958 if (!project(caster_ptr, 0, 0, y, x, damroll(dd, ds), typ, flg, -1))
1969 * @brief モンスターとの位置交換処理 / Switch position with a monster.
1970 * @param caster_ptr プレーヤーへの参照ポインタ
1971 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
1972 * @return 作用が実際にあった場合TRUEを返す
1974 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
1977 if ((dir == 5) && target_okay(caster_ptr))
1984 tx = caster_ptr->x + ddx[dir];
1985 ty = caster_ptr->y + ddy[dir];
1988 if (caster_ptr->anti_tele)
1990 msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
1995 g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
1996 if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
1998 msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
2002 if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
2004 msg_print(_("失敗した。", "Failed to swap."));
2008 monster_type* m_ptr;
2009 monster_race* r_ptr;
2010 m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2011 r_ptr = &r_info[m_ptr->r_idx];
2013 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
2015 if (r_ptr->flagsr & RFR_RES_TELE)
2017 msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
2018 if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2022 sound(SOUND_TELEPORT);
2023 (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
2029 * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
2030 * @param caster_ptr プレーヤーへの参照ポインタ
2032 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2035 * @return 作用が実際にあった場合TRUEを返す
2037 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
2039 flg |= (PROJECT_THRU);
2040 POSITION tx = caster_ptr->x + ddx[dir];
2041 POSITION ty = caster_ptr->y + ddy[dir];
2042 if ((dir == 5) && target_okay(caster_ptr))
2048 return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
2053 * @brief ボルト系スペルの発動 / Cast a bolt spell.
2054 * @param caster_ptr プレーヤーへの参照ポインタ
2056 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2058 * @return 作用が実際にあった場合TRUEを返す
2061 * Stop if we hit a monster, as a "bolt".
2062 * Affect monsters and grids (not objects).
2065 bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2067 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_GRID;
2068 if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
2069 return (project_hook(caster_ptr, typ, dir, dam, flg));
2074 * @brief ビーム系スペルの発動 / Cast a beam spell.
2075 * @param caster_ptr プレーヤーへの参照ポインタ
2077 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2079 * @return 作用が実際にあった場合TRUEを返す
2082 * Pass through monsters, as a "beam".
2083 * Affect monsters, grids and objects.
2086 bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2088 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL | PROJECT_GRID | PROJECT_ITEM;
2089 return (project_hook(caster_ptr, typ, dir, dam, flg));
2094 * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
2095 * @param caster_ptr プレーヤーへの参照ポインタ
2096 * @param prob ビーム化する確率(%)
2098 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2100 * @return 作用が実際にあった場合TRUEを返す
2103 * Pass through monsters, as a "beam".
2104 * Affect monsters, grids and objects.
2107 bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
2109 if (randint0(100) < prob)
2111 return (fire_beam(caster_ptr, typ, dir, dam));
2114 return (fire_bolt(caster_ptr, typ, dir, dam));
2119 * @brief LITE_WEAK属性による光源ビーム処理
2120 * @param caster_ptr プレーヤーへの参照ポインタ
2121 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2123 * @return 作用が実際にあった場合TRUEを返す
2125 bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2127 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
2128 return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
2134 * @param caster_ptr プレーヤーへの参照ポインタ
2135 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2137 * @return 作用が実際にあった場合TRUEを返す
2139 bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2141 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2142 return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
2148 * @param caster_ptr プレーヤーへの参照ポインタ
2149 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2151 * @return 作用が実際にあった場合TRUEを返す
2153 bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
2155 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2156 return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
2162 * @param caster_ptr プレーヤーへの参照ポインタ
2163 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2164 * @return 作用が実際にあった場合TRUEを返す
2166 bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
2168 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2169 return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
2175 * @param caster_ptr プレーヤーへの参照ポインタ
2176 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2177 * @return 作用が実際にあった場合TRUEを返す
2179 bool destroy_door(player_type *caster_ptr, DIRECTION dir)
2181 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2182 return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
2188 * @param caster_ptr プレーヤーへの参照ポインタ
2189 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2190 * @return 作用が実際にあった場合TRUEを返す
2192 bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
2194 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
2195 return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
2201 * @param caster_ptr プレーヤーへの参照ポインタ
2202 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2203 * @param plev プレイヤーレベル(効力はplev*200)
2204 * @return 作用が実際にあった場合TRUEを返す
2206 bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2208 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
2209 return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
2214 * @brief モンスター用テレポート処理
2215 * @param caster_ptr プレーヤーへの参照ポインタ
2216 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2217 * @param distance 移動距離
2218 * @return 作用が実際にあった場合TRUEを返す
2220 bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
2222 BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
2223 return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
2228 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
2229 * @param caster_ptr プレーヤーへの参照ポインタ
2230 * @return 作用が実際にあった場合TRUEを返す
2232 bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
2234 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2235 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
2240 * @brief トラップ生成処理(起点から周囲1マス)
2241 * @param caster_ptr プレーヤーへの参照ポインタ
2244 * @return 作用が実際にあった場合TRUEを返す
2246 bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
2248 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2249 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
2254 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
2255 * @param caster_ptr プレーヤーへの参照ポインタ
2256 * @return 作用が実際にあった場合TRUEを返す
2258 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
2260 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2261 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
2266 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
2267 * @param caster_ptr プレーヤーへの参照ポインタ
2268 * @return 作用が実際にあった場合TRUEを返す
2270 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
2272 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
2273 return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
2278 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
2279 * @param caster_ptr プレーヤーへの参照ポインタ
2280 * @return 作用が実際にあった場合TRUEを返す
2282 bool wall_stone(player_type *caster_ptr)
2284 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2285 bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
2286 caster_ptr->update |= (PU_FLOW);
2287 caster_ptr->redraw |= (PR_MAP);
2293 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
2294 * @param caster_ptr プレーヤーへの参照ポインタ
2295 * @return 作用が実際にあった場合TRUEを返す
2297 bool destroy_doors_touch(player_type *caster_ptr)
2299 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2300 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
2305 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
2306 * @param caster_ptr プレーヤーへの参照ポインタ
2307 * @return 作用が実際にあった場合TRUEを返す
2309 bool disarm_traps_touch(player_type *caster_ptr)
2311 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
2312 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
2317 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
2318 * @param caster_ptr プレーヤーへの参照ポインタ
2319 * @return 作用が実際にあった場合TRUEを返す
2321 bool sleep_monsters_touch(player_type *caster_ptr)
2323 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
2324 return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
2329 * @brief 死者復活処理(起点より周囲5マス)
2330 * @param caster_ptr プレーヤーへの参照ポインタ
2331 * @param who 術者モンスターID(0ならばプレイヤー)
2334 * @return 作用が実際にあった場合TRUEを返す
2336 bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
2338 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
2339 return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
2345 * @return 作用が実際にあった場合TRUEを返す
2347 void call_chaos(player_type *caster_ptr)
2349 int hurt_types[31] =
2351 GF_ELEC, GF_POIS, GF_ACID, GF_COLD,
2352 GF_FIRE, GF_MISSILE, GF_ARROW, GF_PLASMA,
2353 GF_HOLY_FIRE, GF_WATER, GF_LITE, GF_DARK,
2354 GF_FORCE, GF_INERTIAL, GF_MANA, GF_METEOR,
2355 GF_ICE, GF_CHAOS, GF_NETHER, GF_DISENCHANT,
2356 GF_SHARDS, GF_SOUND, GF_NEXUS, GF_CONFUSION,
2357 GF_TIME, GF_GRAVITY, GF_ROCKET, GF_NUKE,
2358 GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
2361 int chaos_type = hurt_types[randint0(31)];
2362 bool line_chaos = FALSE;
2363 if (one_in_(4)) line_chaos = TRUE;
2368 for (int dummy = 1; dummy < 10; dummy++)
2373 fire_beam(caster_ptr, chaos_type, dummy, 150);
2375 fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
2384 fire_ball(caster_ptr, chaos_type, 0, 500, 8);
2388 if (!get_aim_dir(caster_ptr, &dir)) return;
2390 fire_beam(caster_ptr, chaos_type, dir, 250);
2392 fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
2397 * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
2398 * @param target_ptr プレーヤーへの参照ポインタ
2399 * @param stop_ty 再帰処理停止フラグ
2401 * @return 作用が実際にあった場合TRUEを返す
2404 * rr9: Stop the nasty things when a Cyberdemon is summoned
2405 * or the player gets paralyzed.
2408 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
2410 BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
2411 bool is_first_curse = TRUE;
2412 floor_type *floor_ptr = target_ptr->current_floor_ptr;
2413 while (is_first_curse || (one_in_(3) && !stop_ty))
2415 is_first_curse = FALSE;
2416 switch (randint1(34))
2421 msg_print(_("地面が揺れた...", "The ground trembles..."));
2422 earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
2423 if (!one_in_(6)) break;
2429 HIT_POINT dam = damroll(10, 10);
2430 msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
2431 project(target_ptr, 0, 8, target_ptr->y, target_ptr->x, dam, GF_MANA, flg, -1);
2432 take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
2433 if (!one_in_(6)) break;
2439 msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
2440 teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
2441 if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2442 if (!one_in_(6)) break;
2446 msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
2447 wall_breaker(target_ptr);
2450 project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
2451 take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
2454 if (!one_in_(6)) break;
2456 case 1: case 2: case 3: case 16: case 17:
2457 aggravate_monsters(target_ptr, 0);
2458 if (!one_in_(6)) break;
2460 case 4: case 5: case 6:
2461 (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
2462 if (!one_in_(6)) break;
2464 case 7: case 8: case 9: case 18:
2465 (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
2466 if (!one_in_(6)) break;
2468 case 10: case 11: case 12:
2469 msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
2470 lose_exp(target_ptr, target_ptr->exp / 16);
2471 if (!one_in_(6)) break;
2473 case 13: case 14: case 15: case 19: case 20:
2475 bool is_statue = stop_ty;
2476 is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
2477 is_statue |= target_ptr->pclass == CLASS_BERSERKER;
2480 msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
2481 if (target_ptr->free_act)
2482 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(3));
2484 set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
2488 if (!one_in_(6)) break;
2491 case 21: case 22: case 23:
2492 (void)do_dec_stat(target_ptr, randint0(6));
2493 if (!one_in_(6)) break;
2496 msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
2497 lose_all_info(target_ptr);
2498 if (!one_in_(6)) break;
2501 if ((floor_ptr->dun_level > 65) && !stop_ty)
2503 (*count) += summon_cyber(target_ptr, -1, target_ptr->y, target_ptr->x);
2508 if (!one_in_(6)) break;
2511 for (int i = 0; i < A_MAX; i++)
2513 bool is_first_dec_stat = TRUE;
2514 while (is_first_dec_stat || one_in_(2))
2516 is_first_dec_stat = FALSE;
2517 (void)do_dec_stat(target_ptr, i);
2528 * todo 引数にPOSITION x/yは必要か? 要調査
2529 * @brief HI_SUMMON(上級召喚)処理発動
2530 * @param caster_ptr プレーヤーへの参照ポインタ
2533 * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
2534 * @return 作用が実際にあった場合TRUEを返す
2536 int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
2538 BIT_FLAGS mode = PM_ALLOW_GROUP;
2544 mode |= PM_FORCE_FRIENDLY;
2548 mode |= PM_FORCE_PET;
2553 if (!pet) mode |= PM_NO_PET;
2555 DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
2556 DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
2558 for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
2560 switch (randint1(25) + (dungeon_level / 20))
2563 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
2566 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
2569 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
2572 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
2575 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
2578 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
2581 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
2584 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
2588 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
2592 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
2595 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2596 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
2599 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2600 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
2603 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
2606 if (!can_pet) mode |= PM_ALLOW_UNIQUE;
2607 count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
2616 * @brief 周辺破壊効果(プレイヤー中心)
2617 * @param caster_ptr プレーヤーへの参照ポインタ
2618 * @return 作用が実際にあった場合TRUEを返す
2620 void wall_breaker(player_type *caster_ptr)
2622 POSITION y = 0, x = 0;
2623 int attempts = 1000;
2624 if (randint1(80 + caster_ptr->lev) < 70)
2628 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
2630 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
2632 if (!player_bold(caster_ptr, y, x)) break;
2635 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2636 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2640 if (randint1(100) > 30)
2642 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
2646 int num = damroll(5, 3);
2647 for (int i = 0; i < num; i++)
2651 scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
2653 if (!player_bold(caster_ptr, y, x)) break;
2656 project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
2657 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
2663 * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
2664 * @param caster_ptr プレーヤーへの参照ポインタ
2666 * @return 作用が実際にあった場合TRUEを返す
2668 bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
2670 return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
2675 * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
2676 * @param caster_ptr プレーヤーへの参照ポインタ
2678 * @return 作用が実際にあった場合TRUEを返す
2680 bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
2682 return (project_all_los(caster_ptr, GF_CHARM, dam));
2687 * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
2688 * @param caster_ptr プレーヤーへの参照ポインタ
2690 * @return 作用が実際にあった場合TRUEを返す
2692 bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
2694 return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
2699 * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
2700 * @param caster_ptr プレーヤーへの参照ポインタ
2702 * @return 作用が実際にあった場合TRUEを返す
2704 bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
2706 return (project_all_los(caster_ptr, GF_STUN, dam));
2711 * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
2712 * @param caster_ptr プレーヤーへの参照ポインタ
2714 * @return 作用が実際にあった場合TRUEを返す
2716 bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
2718 return (project_all_los(caster_ptr, GF_STASIS, dam));
2723 * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
2724 * @param caster_ptr プレーヤーへの参照ポインタ
2726 * @return 作用が実際にあった場合TRUEを返す
2728 bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
2730 return (project_all_los(caster_ptr, GF_PSI, dam));
2735 * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
2736 * @param caster_ptr プレーヤーへの参照ポインタ
2737 * @param dist 効力(距離)
2738 * @return 作用が実際にあった場合TRUEを返す
2740 bool banish_monsters(player_type *caster_ptr, int dist)
2742 return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
2747 * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
2748 * @param caster_ptr プレーヤーへの参照ポインタ
2750 * @return 作用が実際にあった場合TRUEを返す
2752 bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
2754 return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
2759 * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
2760 * @param caster_ptr プレーヤーへの参照ポインタ
2762 * @return 作用が実際にあった場合TRUEを返す
2764 bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
2766 return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
2771 * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
2772 * @param caster_ptr プレーヤーへの参照ポインタ
2773 * @return 作用が実際にあった場合TRUEを返す
2775 bool deathray_monsters(player_type *caster_ptr)
2777 return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
2782 * @brief チャーム・モンスター(1体)
2783 * @param caster_ptr プレーヤーへの参照ポインタ
2784 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2786 * @return 作用が実際にあった場合TRUEを返す
2788 bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2790 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2791 return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
2796 * @brief アンデッド支配(1体)
2797 * @param caster_ptr プレーヤーへの参照ポインタ
2798 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2800 * @return 作用が実際にあった場合TRUEを返す
2802 bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2804 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2805 return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
2811 * @param caster_ptr プレーヤーへの参照ポインタ
2812 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2814 * @return 作用が実際にあった場合TRUEを返す
2816 bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2818 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2819 return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
2825 * @param caster_ptr プレーヤーへの参照ポインタ
2826 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
2828 * @return 作用が実際にあった場合TRUEを返す
2830 bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
2832 BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
2833 return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
2839 * @param caster_ptr プレーヤーへの参照ポインタ
2840 * @param success 判定成功上の処理ならばTRUE
2841 * @return 作用が実際にあった場合TRUEを返す
2843 bool kawarimi(player_type *caster_ptr, bool success)
2846 object_type *q_ptr = &forge;
2848 if (caster_ptr->is_dead) return FALSE;
2849 if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
2850 if (randint0(200) < caster_ptr->stun) return FALSE;
2852 if (!success && one_in_(3))
2854 msg_print(_("失敗!逃げられなかった。", "Failed! You couldn't run away."));
2855 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2856 caster_ptr->redraw |= (PR_STATUS);
2860 POSITION y = caster_ptr->y;
2861 POSITION x = caster_ptr->x;
2863 teleport_player(caster_ptr, 10 + randint1(90), 0L);
2865 object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
2867 q_ptr->pval = MON_NINJA;
2868 (void)drop_near(caster_ptr, q_ptr, -1, y, x);
2870 if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
2871 else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
2873 caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
2874 caster_ptr->redraw |= (PR_STATUS);
2880 * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
2881 * @param caster_ptr プレーヤーへの参照ポインタ
2882 * @param mdeath 目標モンスターが死亡したかを返す
2883 * @return 作用が実際にあった場合TRUEを返す / Return value is for checking "done"
2885 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
2887 if (mdeath) *mdeath = FALSE;
2891 if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
2893 int tx = attacker_ptr->x + project_length * ddx[dir];
2894 int ty = attacker_ptr->y + project_length * ddy[dir];
2896 if ((dir == 5) && target_okay(attacker_ptr))
2903 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
2904 if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
2907 int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
2909 if (!path_n) return TRUE;
2911 ty = attacker_ptr->y;
2912 tx = attacker_ptr->x;
2913 bool tmp_mdeath = FALSE;
2915 for (int i = 0; i < path_n; i++)
2917 monster_type *m_ptr;
2919 int ny = GRID_Y(path_g[i]);
2920 int nx = GRID_X(path_g[i]);
2922 if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
2929 if (!floor_ptr->grid_array[ny][nx].m_idx)
2933 msg_print(_("失敗!", "Failed!"));
2937 msg_print(_("ここには入身では入れない。", "You can't move to that place."));
2943 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2944 update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
2946 m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
2947 if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
2950 msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
2952 msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
2955 else if (!player_bold(attacker_ptr, ty, tx))
2957 GAME_TEXT m_name[MAX_NLEN];
2958 monster_desc(attacker_ptr, m_name, m_ptr, 0);
2959 msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
2962 if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2964 tmp_mdeath = py_attack(attacker_ptr, ny, nx, HISSATSU_NYUSIN);
2969 if (!moved && !player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
2971 if (mdeath) *mdeath = tmp_mdeath;
2977 * @brief 全鏡の消去 / Remove all mirrors in this floor
2978 * @param caster_ptr プレーヤーへの参照ポインタ
2979 * @param explode 爆発処理を伴うならばTRUE
2982 void remove_all_mirrors(player_type *caster_ptr, bool explode)
2984 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
2986 for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
2988 if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
2991 remove_mirror(caster_ptr, y, x);
2992 if (!explode) continue;
2994 project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
2995 (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
3002 * @brief 『一つの指輪』の効果処理 /
3003 * Hack -- activate the ring of power
3004 * @param caster_ptr プレーヤーへの参照ポインタ
3005 * @param dir 発動の方向ID
3008 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
3010 switch (randint1(10))
3015 msg_print(_("あなたは悪性のオーラに包み込まれた。", "You are surrounded by a malignant aura."));
3018 /* Decrease all stats (permanently) */
3019 (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
3020 (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
3021 (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
3022 (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
3023 (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
3024 (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
3026 /* Lose some experience (permanently) */
3027 caster_ptr->exp -= (caster_ptr->exp / 4);
3028 caster_ptr->max_exp -= (caster_ptr->exp / 4);
3029 check_experience(caster_ptr);
3036 msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
3037 dispel_monsters(caster_ptr, 1000);
3045 fire_ball(caster_ptr, GF_MANA, dir, 600, 3);
3054 fire_bolt(caster_ptr, GF_MANA, dir, 500);
3062 * @brief 運命の輪、並びにカオス的な効果の発動
3063 * @param caster_ptr プレーヤーへの参照ポインタ
3064 * @param spell ランダムな効果を選択するための基準ID
3067 void wild_magic(player_type *caster_ptr, int spell)
3069 int type = SUMMON_MOLD + randint0(6);
3070 if (type < SUMMON_MOLD) type = SUMMON_MOLD;
3071 else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
3073 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3074 switch (randint1(spell) + randint1(8) + 1)
3079 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3084 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3088 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3093 unlite_area(caster_ptr, 10, 3);
3098 lite_area(caster_ptr, damroll(2, 3), 2);
3101 destroy_doors_touch(caster_ptr);
3104 wall_breaker(caster_ptr);
3107 sleep_monsters_touch(caster_ptr);
3111 trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3115 door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
3120 aggravate_monsters(caster_ptr, 0);
3123 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3127 (void)gain_mutation(caster_ptr, 0);
3131 apply_disenchant(caster_ptr, 1);
3134 lose_all_info(caster_ptr);
3137 fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
3140 wall_stone(caster_ptr);
3144 for (int counter = 0; counter < 8; counter++)
3146 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
3152 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3155 (void)summon_cyber(caster_ptr, -1, caster_ptr->y, caster_ptr->x);
3160 (void)activate_ty_curse(caster_ptr, FALSE, &count);
3168 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
3169 * / Drop 10+1d10 meteor ball at random places near the player
3170 * @param caster_ptr プレーヤーへの参照ポインタ
3175 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3177 int b = 10 + randint1(10);
3178 for (int i = 0; i < b; i++)
3180 POSITION y = 0, x = 0;
3183 for (count = 0; count <= 20; count++)
3187 x = caster_ptr->x - 8 + randint0(17);
3188 y = caster_ptr->y - 8 + randint0(17);
3189 dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
3190 dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
3191 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3193 if (d >= 9) continue;
3195 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3196 if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
3197 || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
3202 if (count > 20) continue;
3204 project(caster_ptr, 0, rad, y, x, dam, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
3210 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
3211 * @param caster_ptr プレーヤーへの参照ポインタ
3214 * @return ターゲットを指定し、実行したならばTRUEを返す。
3216 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
3219 if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
3221 POSITION tx = caster_ptr->x + 99 * ddx[dir];
3222 POSITION ty = caster_ptr->y + 99 * ddy[dir];
3223 if ((dir == 5) && target_okay(caster_ptr))
3229 POSITION x = caster_ptr->x;
3230 POSITION y = caster_ptr->y;
3234 if ((y == ty) && (x == tx)) break;
3238 mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
3239 if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
3240 if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
3241 if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
3250 int b = 10 + randint1(10);
3251 for (int i = 0; i < b; i++)
3253 int count = 20, d = 0;
3259 x = tx - 5 + randint0(11);
3260 y = ty - 5 + randint0(11);
3262 dx = (tx > x) ? (tx - x) : (x - tx);
3263 dy = (ty > y) ? (ty - y) : (y - ty);
3265 d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
3269 if (count < 0) continue;
3271 if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
3272 cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
3273 !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
3276 project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
3284 * @brief 「ワンダー」のランダムな効果を決定して処理する。
3285 * @param caster_ptr プレーヤーへの参照ポインタ
3289 * This spell should become more useful (more controlled) as the\n
3290 * player gains experience levels. Thus, add 1/5 of the player's\n
3291 * level to the die roll. This eliminates the worst effects later on,\n
3292 * while keeping the results quite random. It also allows some potent\n
3293 * effects only at high level.
3295 void cast_wonder(player_type *caster_ptr, DIRECTION dir)
3297 PLAYER_LEVEL plev = caster_ptr->lev;
3298 int die = randint1(100) + plev / 5;
3299 int vir = virtue_number(caster_ptr, V_CHANCE);
3302 if (caster_ptr->virtues[vir - 1] > 0)
3304 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3308 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3314 chg_virtue(caster_ptr, V_CHANCE, 1);
3319 msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
3324 clone_monster(caster_ptr, dir);
3330 speed_monster(caster_ptr, dir, plev);
3336 heal_monster(caster_ptr, dir, damroll(4, 6));
3342 poly_monster(caster_ptr, dir, plev);
3348 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3349 damroll(3 + ((plev - 1) / 5), 4));
3355 confuse_monster(caster_ptr, dir, plev);
3361 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3367 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3373 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3374 damroll(3 + ((plev - 5) / 4), 8));
3380 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3381 damroll(5 + ((plev - 5) / 4), 8));
3387 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3388 damroll(6 + ((plev - 5) / 4), 8));
3394 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3395 damroll(8 + ((plev - 5) / 4), 8));
3401 hypodynamic_bolt(caster_ptr, dir, 75);
3407 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3413 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3419 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3425 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3431 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3437 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3443 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3449 symbol_genocide(caster_ptr, plev + 50, TRUE);
3455 dispel_monsters(caster_ptr, 120);
3459 dispel_monsters(caster_ptr, 150);
3460 slow_monsters(caster_ptr, plev);
3461 sleep_monsters(caster_ptr, plev);
3462 hp_player(caster_ptr, 300);
3467 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
3468 * @param caster_ptr プレーヤーへの参照ポインタ
3472 void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
3474 PLAYER_LEVEL plev = caster_ptr->lev;
3475 int die = randint1(100) + plev / 5;
3476 int vir = virtue_number(caster_ptr, V_CHANCE);
3480 if (caster_ptr->virtues[vir - 1] > 0)
3482 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3486 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3490 msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
3492 chg_virtue(caster_ptr, V_CHANCE, 1);
3496 msg_print(_("あなたはおどろおどろしい力のうねりを感じた!", "You feel a surge of eldritch force!"));
3501 msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
3502 "Oh no! Mouldering forms rise from the earth around you!"));
3504 (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3505 chg_virtue(caster_ptr, V_UNLIFE, 1);
3509 msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
3511 set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
3515 msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
3516 "Your head is invaded by a horde of gibbering spectral voices..."));
3518 set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
3522 poly_monster(caster_ptr, dir, plev);
3526 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
3527 damroll(3 + ((plev - 1) / 5), 4));
3531 confuse_monster(caster_ptr, dir, plev);
3535 fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
3539 (void)lite_line(caster_ptr, dir, damroll(6, 8));
3543 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
3544 damroll(3 + ((plev - 5) / 4), 8));
3548 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
3549 damroll(5 + ((plev - 5) / 4), 8));
3553 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
3554 damroll(6 + ((plev - 5) / 4), 8));
3558 fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
3559 damroll(8 + ((plev - 5) / 4), 8));
3563 hypodynamic_bolt(caster_ptr, dir, 75);
3567 fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
3571 fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
3575 fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
3579 fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
3583 hypodynamic_bolt(caster_ptr, dir, 100 + plev);
3587 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
3591 (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
3595 symbol_genocide(caster_ptr, plev + 50, TRUE);
3599 dispel_monsters(caster_ptr, 120);
3603 dispel_monsters(caster_ptr, 150);
3604 slow_monsters(caster_ptr, plev);
3605 sleep_monsters(caster_ptr, plev);
3606 hp_player(caster_ptr, 300);
3611 msg_print(_("陰欝な声がクスクス笑う。「もうすぐおまえは我々の仲間になるだろう。弱き者よ。」",
3612 "Sepulchral voices chuckle. 'Soon you will join us, mortal.'"));
3618 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
3619 * @param caster_ptr プレーヤーへの参照ポインタ
3622 void cast_shuffle(player_type *caster_ptr)
3624 PLAYER_LEVEL plev = caster_ptr->lev;
3627 int vir = virtue_number(caster_ptr, V_CHANCE);
3630 if ((caster_ptr->pclass == CLASS_ROGUE) ||
3631 (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
3632 (caster_ptr->pclass == CLASS_SORCERER))
3633 die = (randint1(110)) + plev / 5;
3635 die = randint1(120);
3639 if (caster_ptr->virtues[vir - 1] > 0)
3641 while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
3645 while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
3649 msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
3653 chg_virtue(caster_ptr, V_CHANCE, 1);
3656 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
3659 msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
3661 for (i = 0; i < randint1(3); i++)
3663 activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
3671 msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
3672 summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
3679 msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
3680 activate_ty_curse(caster_ptr, FALSE, &count);
3686 msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
3687 aggravate_monsters(caster_ptr, 0);
3693 msg_print(_("《愚者》だ。", "It's the Fool."));
3694 do_dec_stat(caster_ptr, A_INT);
3695 do_dec_stat(caster_ptr, A_WIS);
3701 msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
3702 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);
3708 msg_print(_("《月》だ。", "It's the Moon."));
3709 unlite_area(caster_ptr, 10, 3);
3715 msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
3716 wild_magic(caster_ptr, randint0(32));
3722 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3723 teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
3729 msg_print(_("《正義》だ。", "It's Justice."));
3730 set_blessed(caster_ptr, caster_ptr->lev, FALSE);
3736 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3737 teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
3743 msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
3744 teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
3750 msg_print(_("《塔》だ。", "It's the Tower."));
3751 wall_breaker(caster_ptr);
3757 msg_print(_("《節制》だ。", "It's Temperance."));
3758 sleep_monsters_touch(caster_ptr);
3764 msg_print(_("《塔》だ。", "It's the Tower."));
3765 earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
3771 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3772 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
3778 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3779 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
3785 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3786 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
3792 msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
3793 trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
3799 msg_print(_("《恋人》だ。", "It's the Lovers."));
3801 if (get_aim_dir(caster_ptr, &dir))
3803 charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
3811 msg_print(_("《隠者》だ。", "It's the Hermit."));
3812 wall_stone(caster_ptr);
3818 msg_print(_("《審判》だ。", "It's the Judgement."));
3819 roll_hitdice(caster_ptr, 0L);
3820 lose_all_mutations(caster_ptr);
3826 msg_print(_("《太陽》だ。", "It's the Sun."));
3827 chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
3828 chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
3829 wiz_lite(caster_ptr, FALSE);
3833 msg_print(_("《世界》だ。", "It's the World."));
3834 if (caster_ptr->exp >= PY_MAX_EXP)
3839 s32b ee = (caster_ptr->exp / 25) + 1;
3840 if (ee > 5000) ee = 5000;
3841 msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
3842 gain_exp(caster_ptr, ee);
3846 bool_hack vampirism(player_type *caster_ptr)
3848 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
3850 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
3855 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3857 POSITION y = caster_ptr->y + ddy[dir];
3858 POSITION x = caster_ptr->x + ddx[dir];
3860 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
3861 stop_mouth(caster_ptr);
3862 if (!(g_ptr->m_idx))
3864 msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
3868 msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
3870 int dummy = caster_ptr->lev * 2;
3871 if (!hypodynamic_bolt(caster_ptr, dir, dummy))
3873 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
3877 if (caster_ptr->food < PY_FOOD_FULL)
3878 (void)hp_player(caster_ptr, dummy);
3880 msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
3882 /* Gain nutritional sustenance: 150/hp drained */
3883 /* A Food ration gives 5000 food points (by contrast) */
3884 /* Don't ever get more than "Full" this way */
3885 /* But if we ARE Gorged, it won't cure us */
3886 dummy = caster_ptr->food + MIN(5000, 100 * dummy);
3887 if (caster_ptr->food < PY_FOOD_MAX) /* Not gorged already */
3888 (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
3894 * ヒット&アウェイのレイシャルパワー/突然変異
3895 * @param caster_ptr プレーヤーへの参照ポインタ
3896 * @return コマンドの入力先にモンスターがいたらTRUE
3898 bool hit_and_away(player_type *caster_ptr)
3901 if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
3902 POSITION y = caster_ptr->y + ddy[dir];
3903 POSITION x = caster_ptr->x + ddx[dir];
3904 if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
3906 py_attack(caster_ptr, y, x, 0);
3907 if (randint0(caster_ptr->skill_dis) < 7)
3908 msg_print(_("うまく逃げられなかった。", "You failed to run away."));
3910 teleport_player(caster_ptr, 30, 0L);
3914 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
3921 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
3922 * @param caster_ptr プレーヤーへの参照ポインタ
3925 * currently this function allows pseudo-id of any object,
3926 * including silly ones like potions & scrolls, which always
3927 * get '{average}'. This should be changed, either to stop such
3928 * items from being pseudo-id'd, or to allow psychometry to
3929 * detect whether the unidentified potion/scroll/etc is
3930 * good (Cure Light Wounds, Restore Strength, etc) or
3931 * bad (Poison, Weakness etc) or 'useless' (Slime Mold Juice, etc).
3933 bool psychometry(player_type *caster_ptr)
3935 concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
3936 concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
3939 o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
3940 if (!o_ptr) return FALSE;
3942 if (object_is_known(o_ptr))
3944 msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
3948 byte feel = value_check_aux1(o_ptr);
3949 GAME_TEXT o_name[MAX_NLEN];
3950 object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3954 msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
3959 msg_format("%sは%sという感じがする...", o_name, game_inscriptions[feel]);
3961 msg_format("You feel that the %s %s %s...",
3962 o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
3965 o_ptr->ident |= (IDENT_SENSE);
3966 o_ptr->feeling = feel;
3967 o_ptr->marked |= OM_TOUCHED;
3969 caster_ptr->update |= (PU_COMBINE | PU_REORDER);
3970 caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
3973 switch (o_ptr->tval)
4001 autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
4006 bool draconian_breath(player_type *creature_ptr)
4008 int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
4009 concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
4011 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4013 if (randint1(100) < creature_ptr->lev)
4015 switch (creature_ptr->pclass)
4018 case CLASS_BERSERKER:
4021 case CLASS_IMITATOR:
4027 Type_desc = _("エレメント", "the elements");
4032 Type_desc = _("破片", "shards");
4037 case CLASS_WARRIOR_MAGE:
4038 case CLASS_HIGH_MAGE:
4039 case CLASS_SORCERER:
4040 case CLASS_MAGIC_EATER:
4041 case CLASS_RED_MAGE:
4042 case CLASS_BLUE_MAGE:
4043 case CLASS_MIRROR_MASTER:
4047 Type_desc = _("魔力", "mana");
4051 Type = GF_DISENCHANT;
4052 Type_desc = _("劣化", "disenchantment");
4056 case CLASS_CHAOS_WARRIOR:
4059 Type = GF_CONFUSION;
4060 Type_desc = _("混乱", "confusion");
4065 Type_desc = _("カオス", "chaos");
4071 case CLASS_FORCETRAINER:
4074 Type = GF_CONFUSION;
4075 Type_desc = _("混乱", "confusion");
4080 Type_desc = _("轟音", "sound");
4084 case CLASS_MINDCRAFTER:
4087 Type = GF_CONFUSION;
4088 Type_desc = _("混乱", "confusion");
4093 Type_desc = _("精神エネルギー", "mental energy");
4101 Type = GF_HELL_FIRE;
4102 Type_desc = _("地獄の劫火", "hellfire");
4106 Type = GF_HOLY_FIRE;
4107 Type_desc = _("聖なる炎", "holy fire");
4116 Type_desc = _("暗黒", "darkness");
4121 Type_desc = _("毒", "poison");
4129 Type_desc = _("轟音", "sound");
4133 Type = GF_CONFUSION;
4134 Type_desc = _("混乱", "confusion");
4141 stop_mouth(creature_ptr);
4142 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), Type_desc);
4144 fire_breath(creature_ptr, Type, dir, creature_ptr->lev * 2, (creature_ptr->lev / 15) + 1);
4149 bool android_inside_weapon(player_type *creature_ptr)
4152 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4154 if (creature_ptr->lev < 10)
4156 msg_print(_("レイガンを発射した。", "You fire your ray gun."));
4157 fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
4161 if (creature_ptr->lev < 25)
4163 msg_print(_("ブラスターを発射した。", "You fire your blaster."));
4164 fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
4168 if (creature_ptr->lev < 35)
4170 msg_print(_("バズーカを発射した。", "You fire your bazooka."));
4171 fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
4175 if (creature_ptr->lev < 45)
4177 msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
4178 fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
4182 msg_print(_("ロケットを発射した。", "You fire a rocket."));
4183 fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
4188 bool create_ration(player_type *creature_ptr)
4194 /* Create the food ration */
4195 object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
4197 /* Drop the object from heaven */
4198 (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
4199 msg_print(_("食事を料理して作った。", "You cook some food."));
4204 void hayagake(player_type *creature_ptr)
4206 if (creature_ptr->action == ACTION_HAYAGAKE)
4208 set_action(creature_ptr, ACTION_NONE);
4209 creature_ptr->energy_use = 0;
4213 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
4214 feature_type *f_ptr = &f_info[g_ptr->feat];
4216 if (!have_flag(f_ptr->flags, FF_PROJECT) ||
4217 (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
4219 msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
4223 set_action(creature_ptr, ACTION_HAYAGAKE);
4226 creature_ptr->energy_use = 0;
4230 bool double_attack(player_type *creature_ptr)
4233 if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
4234 POSITION y = creature_ptr->y + ddy[dir];
4235 POSITION x = creature_ptr->x + ddx[dir];
4236 if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4238 msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
4244 msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
4245 "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
4246 else if (one_in_(2))
4247 msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
4248 "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
4250 msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
4251 "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
4253 py_attack(creature_ptr, y, x, 0);
4254 if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
4256 handle_stuff(creature_ptr);
4257 py_attack(creature_ptr, y, x, 0);
4260 creature_ptr->energy_need += ENERGY_NEED();
4265 bool comvert_hp_to_mp(player_type *creature_ptr)
4267 int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
4270 msg_print(_("変換に失敗した。", "You failed to convert."));
4271 creature_ptr->redraw |= (PR_HP | PR_MANA);
4275 creature_ptr->csp += gain_sp;
4276 if (creature_ptr->csp > creature_ptr->msp)
4278 creature_ptr->csp = creature_ptr->msp;
4279 creature_ptr->csp_frac = 0;
4282 creature_ptr->redraw |= (PR_HP | PR_MANA);
4287 bool comvert_mp_to_hp(player_type *creature_ptr)
4289 if (creature_ptr->csp >= creature_ptr->lev / 5)
4291 creature_ptr->csp -= creature_ptr->lev / 5;
4292 hp_player(creature_ptr, creature_ptr->lev);
4296 msg_print(_("変換に失敗した。", "You failed to convert."));
4299 creature_ptr->redraw |= (PR_HP | PR_MANA);
4304 bool demonic_breath(player_type *creature_ptr)
4307 int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
4308 if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
4309 stop_mouth(creature_ptr);
4310 msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
4311 fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
4318 * @param creature_ptr プレーヤーへの参照ポインタ
4319 * @return ペットを操っている場合を除きTRUE
4321 bool mirror_concentration(player_type *creature_ptr)
4325 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4329 if (!is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
4331 msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
4335 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4337 creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
4338 if (creature_ptr->csp >= creature_ptr->msp)
4340 creature_ptr->csp = creature_ptr->msp;
4341 creature_ptr->csp_frac = 0;
4344 creature_ptr->redraw |= PR_MANA;
4351 * @param creature_ptr プレーヤーへの参照ポインタ
4354 bool sword_dancing(player_type *creature_ptr)
4357 POSITION y = 0, x = 0;
4359 for (int i = 0; i < 6; i++)
4362 y = creature_ptr->y + ddy_ddd[dir];
4363 x = creature_ptr->x + ddx_ddd[dir];
4364 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
4366 /* Hack -- attack monsters */
4368 py_attack(creature_ptr, y, x, 0);
4371 msg_print(_("攻撃が空をきった。", "You attack the empty air."));
4381 * @param creature_ptr プレーヤーへの参照ポインタ
4384 bool confusing_light(player_type *creature_ptr)
4386 msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
4387 slow_monsters(creature_ptr, creature_ptr->lev);
4388 stun_monsters(creature_ptr, creature_ptr->lev * 4);
4389 confuse_monsters(creature_ptr, creature_ptr->lev * 4);
4390 turn_monsters(creature_ptr, creature_ptr->lev * 4);
4391 stasis_monsters(creature_ptr, creature_ptr->lev * 4);
4398 * @param creature_ptr プレーヤーへの参照ポインタ
4399 * @return 結果はどうあれ騎乗したらTRUE
4401 bool rodeo(player_type *creature_ptr)
4403 GAME_TEXT m_name[MAX_NLEN];
4404 monster_type *m_ptr;
4405 monster_race *r_ptr;
4408 if (creature_ptr->riding)
4410 msg_print(_("今は乗馬中だ。", "You ARE riding."));
4414 if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
4416 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
4417 r_ptr = &r_info[m_ptr->r_idx];
4418 monster_desc(creature_ptr, m_name, m_ptr, 0);
4419 msg_format(_("%sに乗った。", "You ride on %s."), m_name);
4421 if (is_pet(m_ptr)) return TRUE;
4423 rlev = r_ptr->level;
4425 if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
4426 if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
4427 if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
4428 && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
4429 && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
4430 && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
4432 msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
4433 set_pet(creature_ptr, m_ptr);
4437 msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
4438 rakuba(creature_ptr, 1, TRUE);
4440 /* 落馬処理に失敗してもとにかく乗馬解除 */
4441 creature_ptr->riding = 0;
4448 bool clear_mind(player_type *creature_ptr)
4452 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4456 msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
4458 creature_ptr->csp += (3 + creature_ptr->lev / 20);
4459 if (creature_ptr->csp >= creature_ptr->msp)
4461 creature_ptr->csp = creature_ptr->msp;
4462 creature_ptr->csp_frac = 0;
4465 creature_ptr->redraw |= (PR_MANA);
4470 bool concentration(player_type *creature_ptr)
4472 int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
4476 msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
4480 if (creature_ptr->special_defense & KATA_MASK)
4482 msg_print(_("今は構えに集中している。", "You're already concentrating on your stance."));
4486 msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
4488 creature_ptr->csp += creature_ptr->msp / 2;
4489 if (creature_ptr->csp >= max_csp)
4491 creature_ptr->csp = max_csp;
4492 creature_ptr->csp_frac = 0;
4495 creature_ptr->redraw |= PR_MANA;