1 #include "spell-kind/spells-neighbor.h"
2 #include "effect/attribute-types.h"
3 #include "effect/effect-characteristics.h"
4 #include "effect/effect-processor.h"
5 #include "floor/cave.h"
6 #include "floor/floor-util.h"
7 #include "grid/feature-flag-types.h"
9 #include "spell-kind/earthquake.h"
10 #include "system/player-type-definition.h"
11 #include "system/redrawing-flags-updater.h"
12 #include "util/bit-flags-calculator.h"
15 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
16 * @param player_ptr プレイヤーへの参照ポインタ
17 * @return 作用が実際にあった場合TRUEを返す
19 bool door_creation(PlayerType *player_ptr, POSITION y, POSITION x)
21 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
22 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_DOOR, flg).notice;
26 * @brief トラップ生成処理(起点から周囲1マス)
27 * @param player_ptr プレイヤーへの参照ポインタ
30 * @return 作用が実際にあった場合TRUEを返す
32 bool trap_creation(PlayerType *player_ptr, POSITION y, POSITION x)
34 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
35 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_TRAP, flg).notice;
39 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
40 * @param player_ptr プレイヤーへの参照ポインタ
41 * @return 作用が実際にあった場合TRUEを返す
43 bool tree_creation(PlayerType *player_ptr, POSITION y, POSITION x)
45 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
46 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_TREE, flg).notice;
50 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
51 * @param player_ptr プレイヤーへの参照ポインタ
52 * @return 作用が実際にあった場合TRUEを返す
54 bool create_rune_protection_area(PlayerType *player_ptr, POSITION y, POSITION x)
56 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
57 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_RUNE_PROTECTION, flg).notice;
61 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
62 * @param player_ptr プレイヤーへの参照ポインタ
63 * @return 作用が実際にあった場合TRUEを返す
65 bool wall_stone(PlayerType *player_ptr)
67 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
68 bool dummy = project(player_ptr, 0, 1, player_ptr->y, player_ptr->x, 0, AttributeType::STONE_WALL, flg).notice;
69 auto &rfu = RedrawingFlagsUpdater::get_instance();
70 rfu.set_flag(StatusRecalculatingFlag::FLOW);
71 rfu.set_flag(MainWindowRedrawingFlag::MAP);
76 * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
77 * @param player_ptr プレイヤーへの参照ポインタ
78 * @return 作用が実際にあった場合TRUEを返す
80 bool destroy_doors_touch(PlayerType *player_ptr)
82 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
83 return project(player_ptr, 0, 1, player_ptr->y, player_ptr->x, 0, AttributeType::KILL_DOOR, flg).notice;
87 * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
88 * @param player_ptr プレイヤーへの参照ポインタ
89 * @return 作用が実際にあった場合TRUEを返す
91 bool disarm_traps_touch(PlayerType *player_ptr)
93 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
94 return project(player_ptr, 0, 1, player_ptr->y, player_ptr->x, 0, AttributeType::KILL_TRAP, flg).notice;
98 * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
99 * @param player_ptr プレイヤーへの参照ポインタ
100 * @return 作用が実際にあった場合TRUEを返す
102 bool sleep_monsters_touch(PlayerType *player_ptr)
104 BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
105 return project(player_ptr, 0, 1, player_ptr->y, player_ptr->x, player_ptr->lev, AttributeType::OLD_SLEEP, flg).notice;
109 * @brief 死者復活処理(起点より周囲5マス)
110 * @param player_ptr プレイヤーへの参照ポインタ
111 * @param who 術者モンスターID(0ならばプレイヤー)
114 * @return 作用が実際にあった場合TRUEを返す
116 bool animate_dead(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x)
118 BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
119 return project(player_ptr, who, 5, y, x, 0, AttributeType::ANIM_DEAD, flg).notice;
123 * @brief 周辺破壊効果(プレイヤー中心)
124 * @param player_ptr プレイヤーへの参照ポインタ
126 void wall_breaker(PlayerType *player_ptr)
128 POSITION y = 0, x = 0;
130 if (randint1(80 + player_ptr->lev) < 70) {
132 scatter(player_ptr, &y, &x, player_ptr->y, player_ptr->x, 4, PROJECT_NONE);
134 if (!cave_has_flag_bold(player_ptr->current_floor_ptr, y, x, TerrainCharacteristics::PROJECT)) {
138 if (!player_bold(player_ptr, y, x)) {
143 constexpr auto flags = PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
144 project(player_ptr, 0, 0, y, x, 20 + randint1(30), AttributeType::KILL_WALL, flags);
148 if (randint1(100) > 30) {
149 earthquake(player_ptr, player_ptr->y, player_ptr->x, 1, 0);
153 int num = damroll(5, 3);
154 for (int i = 0; i < num; i++) {
156 scatter(player_ptr, &y, &x, player_ptr->y, player_ptr->x, 10, PROJECT_NONE);
158 if (!player_bold(player_ptr, y, x)) {
163 constexpr auto flags = PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
164 project(player_ptr, 0, 0, y, x, 20 + randint1(30), AttributeType::KILL_WALL, flags);