2 * @brief ウィザードモード専用のスペル処理
7 #include "wizard/wizard-spells.h"
8 #include "blue-magic/blue-magic-checker.h"
9 #include "core/asking-player.h"
10 #include "effect/effect-characteristics.h"
11 #include "effect/effect-processor.h"
12 #include "floor/cave.h"
13 #include "floor/floor-util.h"
14 #include "floor/pattern-walk.h"
15 #include "mind/mind-blue-mage.h"
16 #include "monster-floor/monster-generator.h"
17 #include "monster-floor/monster-summon.h"
18 #include "monster-floor/place-monster-types.h"
19 #include "monster-race/race-ability-flags.h"
20 #include "monster-race/monster-race.h"
21 #include "mutation/mutation-processor.h"
22 #include "object-enchant/object-smith.h"
23 #include "player-base/player-class.h"
24 #include "player-info/bluemage-data-type.h"
25 #include "player-info/smith-data-type.h"
26 #include "spell-kind/spells-launcher.h"
27 #include "spell-kind/spells-random.h"
28 #include "spell-kind/spells-teleport.h"
29 #include "spell-realm/spells-chaos.h"
30 #include "spell/spells-status.h"
31 #include "spell/summon-types.h"
32 #include "system/floor-type-definition.h"
33 #include "system/player-type-definition.h"
34 #include "system/monster-race-definition.h"
35 #include "target/grid-selector.h"
36 #include "target/target-checker.h"
37 #include "target/target-getter.h"
38 #include "util/enum-converter.h"
39 #include "util/flag-group.h"
40 #include "view/display-messages.h"
44 debug_spell_command debug_spell_commands_list[SPELL_MAX] = {
45 { 2, "vanish dungeon", { .spell2 = { vanish_dungeon } } },
46 { 3, "true healing", { .spell3 = { true_healing } } },
47 { 2, "drop weapons", { .spell2 = { drop_weapons } } },
48 { 4, "ty curse", { .spell4 = { activate_ty_curse } } },
49 { 5, "pattern teleport", { .spell5 = { pattern_teleport } } },
53 * @brief コマンド入力により任意にスペル効果を起こす / Wizard spells
54 * @return 実際にテレポートを行ったらTRUEを返す
56 bool wiz_debug_spell(PlayerType *player_ptr)
58 char tmp_val[50] = "\0";
61 if (!get_string("SPELL: ", tmp_val, 32))
64 for (int i = 0; i < SPELL_MAX; i++) {
65 if (strcmp(tmp_val, debug_spell_commands_list[i].command_name) != 0)
68 switch (debug_spell_commands_list[i].type) {
70 (*(debug_spell_commands_list[i].command_function.spell2.spell_function))(player_ptr);
75 if (!get_string("POWER:", tmp_val, 32))
77 tmp_int = atoi(tmp_val);
78 (*(debug_spell_commands_list[i].command_function.spell3.spell_function))(player_ptr, tmp_int);
82 (*(debug_spell_commands_list[i].command_function.spell4.spell_function))(player_ptr, true, &tmp_int);
86 (*(debug_spell_commands_list[i].command_function.spell5.spell_function))(player_ptr);
94 msg_format("Command not found.");
99 * @brief 必ず成功するウィザードモード用次元の扉処理 / Wizard Dimension Door
100 * @param player_ptr プレイヤーへの参照ポインタ
102 void wiz_dimension_door(PlayerType *player_ptr)
104 POSITION x = 0, y = 0;
105 if (!tgt_pt(player_ptr, &x, &y))
108 teleport_player_to(player_ptr, y, x, TELEPORT_NONMAGICAL);
112 * @brief ウィザードモード用モンスターの群れ生成 / Summon a horde of monsters
113 * @param player_ptr プレイヤーへの参照ポインタ
115 void wiz_summon_horde(PlayerType *player_ptr)
117 POSITION wy = player_ptr->y, wx = player_ptr->x;
121 scatter(player_ptr, &wy, &wx, player_ptr->y, player_ptr->x, 3, PROJECT_NONE);
122 if (is_cave_empty_bold(player_ptr, wy, wx))
126 (void)alloc_horde(player_ptr, wy, wx, summon_specific);
130 * @brief ウィザードモード用処理としてターゲット中の相手をテレポートバックする / Hack -- Teleport to the target
132 void wiz_teleport_back(PlayerType *player_ptr)
137 teleport_player_to(player_ptr, target_row, target_col, TELEPORT_NONMAGICAL);
141 * @brief 青魔導師の魔法を全て習得済みにする /
142 * debug command for blue mage
144 void wiz_learn_blue_magic_all(PlayerType *player_ptr)
146 auto bluemage_data = PlayerClass(player_ptr).get_specific_data<bluemage_data_type>();
147 if (!bluemage_data) {
151 for (auto type : BLUE_MAGIC_TYPE_LIST) {
152 EnumClassFlagGroup<MonsterAbilityType> ability_flags;
153 set_rf_masks(ability_flags, type);
154 bluemage_data->learnt_blue_magics.set(ability_flags);
159 * @brief 鍛冶師の全てのエッセンスを最大所持量にする
161 void wiz_fillup_all_smith_essences(PlayerType *player_ptr)
163 auto smith_data = PlayerClass(player_ptr).get_specific_data<smith_data_type>();
168 for (auto essence : Smith::get_essence_list()) {
169 smith_data->essences[essence] = Smith::ESSENCE_AMOUNT_MAX;
174 * @brief 現在のフロアに合ったモンスターをランダムに召喚する /
175 * Summon some creatures
176 * @param player_ptr プレイヤーへの参照ポインタ
179 void wiz_summon_random_enemy(PlayerType *player_ptr, int num)
181 for (int i = 0; i < num; i++)
182 (void)summon_specific(player_ptr, 0, player_ptr->y, player_ptr->x, player_ptr->current_floor_ptr->dun_level, SUMMON_NONE, PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
186 * @brief モンスターを種族IDを指定して自然生成と同じように召喚する /
187 * Summon a creature of the specified type
188 * @param r_idx モンスター種族ID(回数指定コマンド'0'で指定した回数がIDになる)
190 * This function is rather dangerous
192 void wiz_summon_specific_enemy(PlayerType *player_ptr, MONRACE_IDX r_idx)
196 if(!get_value("MonsterID", 1, r_info.size() - 1, &val)) {
199 r_idx = static_cast<MONRACE_IDX>(val);
201 (void)summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, r_idx, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
205 * @brief モンスターを種族IDを指定してペット召喚する /
206 * Summon a creature of the specified type
207 * @param r_idx モンスター種族ID(回数指定コマンド'0'で指定した回数がIDになる)
209 * This function is rather dangerous
211 void wiz_summon_pet(PlayerType *player_ptr, MONRACE_IDX r_idx)
215 if (!get_value("MonsterID", 1, r_info.size() - 1, &val)) {
218 r_idx = static_cast<MONRACE_IDX>(val);
220 (void)summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, r_idx, PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET);
224 * @brief ターゲットを指定して指定ダメージ・指定属性・半径0のボールを放つ
226 * @param effect_idx 属性ID
227 * @details デフォルトは100万・GF_ARROW(射撃)。RES_ALL持ちも一撃で殺せる。
229 void wiz_kill_enemy(PlayerType *player_ptr, HIT_POINT dam, AttributeType effect_idx)
233 sprintf(tmp, "Damage (1-999999): ");
234 char tmp_val[10] = "1000";
235 if (!get_string(tmp, tmp_val, 6))
238 dam = (HIT_POINT)atoi(tmp_val);
240 int max = (int)AttributeType::MAX;
241 int idx = (int)effect_idx;
245 sprintf(tmp, "Effect ID (1-%d): ", max - 1);
246 char tmp_val[10] = "";
247 if (!get_string(tmp, tmp_val, 3))
250 effect_idx = (AttributeType)atoi(tmp_val);
253 if (idx <= 0 || idx >= max) {
254 msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), max - 1);
260 if (!get_aim_dir(player_ptr, &dir))
263 fire_ball(player_ptr, effect_idx, dir, dam, 0);
267 * @brief 自分に指定ダメージ・指定属性・半径0のボールを放つ
269 * @param effect_idx 属性ID
271 void wiz_kill_me(PlayerType *player_ptr, HIT_POINT dam, AttributeType effect_idx)
275 sprintf(tmp, "Damage (1-999999): ");
276 char tmp_val[10] = "1000";
277 if (!get_string(tmp, tmp_val, 6))
280 dam = (HIT_POINT)atoi(tmp_val);
282 int max = (int)AttributeType::MAX;
283 int idx = (int)effect_idx;
287 sprintf(tmp, "Effect ID (1-%d): ", max - 1);
288 char tmp_val[10] = "1";
289 if (!get_string(tmp, tmp_val, 3))
292 effect_idx = (AttributeType)atoi(tmp_val);
295 if (idx <= 0 || idx >= max) {
296 msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), max - 1);
300 project(player_ptr, -1, 0, player_ptr->y, player_ptr->x, dam, effect_idx, PROJECT_KILL | PROJECT_PLAYER);