1 #include "spell-kind/spells-neighbor.h"
2 #include "core/player-redraw-types.h"
3 #include "core/player-update-types.h"
4 #include "effect/attribute-types.h"
5 #include "effect/effect-characteristics.h"
6 #include "effect/effect-processor.h"
7 #include "floor/cave.h"
8 #include "floor/floor-util.h"
9 #include "grid/feature-flag-types.h"
10 #include "grid/grid.h"
11 #include "spell-kind/earthquake.h"
12 #include "system/player-type-definition.h"
13 #include "util/bit-flags-calculator.h"
16 * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
17 * @param player_ptr プレイヤーへの参照ポインタ
18 * @return 作用が実際にあった場合TRUEを返す
20 bool door_creation(PlayerType *player_ptr, POSITION y, POSITION x)
22 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
23 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_DOOR, flg).notice;
27 * @brief トラップ生成処理(起点から周囲1マス)
28 * @param player_ptr プレイヤーへの参照ポインタ
31 * @return 作用が実際にあった場合TRUEを返す
33 bool trap_creation(PlayerType *player_ptr, POSITION y, POSITION x)
35 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
36 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_TRAP, flg).notice;
40 * @brief 森林生成処理(プレイヤー中心に周囲1マス)
41 * @param player_ptr プレイヤーへの参照ポインタ
42 * @return 作用が実際にあった場合TRUEを返す
44 bool tree_creation(PlayerType *player_ptr, POSITION y, POSITION x)
46 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
47 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_TREE, flg).notice;
51 * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
52 * @param player_ptr プレイヤーへの参照ポインタ
53 * @return 作用が実際にあった場合TRUEを返す
55 bool create_rune_protection_area(PlayerType *player_ptr, POSITION y, POSITION x)
57 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
58 return project(player_ptr, 0, 1, y, x, 0, AttributeType::MAKE_RUNE_PROTECTION, flg).notice;
62 * @brief 壁生成処理(プレイヤー中心に周囲1マス)
63 * @param player_ptr プレイヤーへの参照ポインタ
64 * @return 作用が実際にあった場合TRUEを返す
66 bool wall_stone(PlayerType *player_ptr)
68 BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
69 bool dummy = project(player_ptr, 0, 1, player_ptr->y, player_ptr->x, 0, AttributeType::STONE_WALL, flg).notice;
70 player_ptr->update |= (PU_FLOW);
71 player_ptr->redraw |= (PR_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, FloorFeatureType::PROJECT)) {
138 if (!player_bold(player_ptr, y, x)) {
143 project(player_ptr, 0, 0, y, x, 20 + randint1(30), AttributeType::KILL_WALL, (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL));
147 if (randint1(100) > 30) {
148 earthquake(player_ptr, player_ptr->y, player_ptr->x, 1, 0);
152 int num = damroll(5, 3);
153 for (int i = 0; i < num; i++) {
155 scatter(player_ptr, &y, &x, player_ptr->y, player_ptr->x, 10, PROJECT_NONE);
157 if (!player_bold(player_ptr, y, x)) {
162 project(player_ptr, 0, 0, y, x, 20 + randint1(30), AttributeType::KILL_WALL, (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL));