2 * @brief ウィザードモード専用のスペル処理
9 #include "wizard/wizard-spells.h"
10 #include "blue-magic/blue-magic-checker.h"
11 #include "core/asking-player.h"
12 #include "effect/effect-characteristics.h"
13 #include "effect/effect-processor.h"
14 #include "floor/cave.h"
15 #include "floor/floor-util.h"
16 #include "floor/pattern-walk.h"
17 #include "mind/mind-blue-mage.h"
18 #include "monster-floor/monster-generator.h"
19 #include "monster-floor/monster-summon.h"
20 #include "monster-floor/place-monster-types.h"
21 #include "monster-race/race-ability-flags.h"
22 #include "monster-race/monster-race.h"
23 #include "mutation/mutation-processor.h"
24 #include "object-enchant/object-smith.h"
25 #include "spell-kind/spells-launcher.h"
26 #include "spell-kind/spells-teleport.h"
27 #include "spell-kind/spells-random.h"
28 #include "spell-realm/spells-chaos.h"
29 #include "spell/spells-status.h"
30 #include "spell/summon-types.h"
31 #include "system/floor-type-definition.h"
32 #include "system/player-type-definition.h"
33 #include "system/monster-race-definition.h"
34 #include "target/grid-selector.h"
35 #include "target/target-checker.h"
36 #include "target/target-getter.h"
37 #include "util/enum-converter.h"
38 #include "util/flag-group.h"
39 #include "view/display-messages.h"
41 debug_spell_command debug_spell_commands_list[SPELL_MAX] = {
42 { 2, "vanish dungeon", { .spell2 = { vanish_dungeon } } },
43 { 3, "true healing", { .spell3 = { true_healing } } },
44 { 2, "drop weapons", { .spell2 = { drop_weapons } } },
45 { 4, "ty curse", { .spell4 = { activate_ty_curse } } },
46 { 5, "pattern teleport", { .spell5 = { pattern_teleport } } },
50 * @brief コマンド入力により任意にスペル効果を起こす / Wizard spells
51 * @return 実際にテレポートを行ったらTRUEを返す
53 bool wiz_debug_spell(player_type *player_ptr)
55 char tmp_val[50] = "\0";
58 if (!get_string("SPELL: ", tmp_val, 32))
61 for (int i = 0; i < SPELL_MAX; i++) {
62 if (strcmp(tmp_val, debug_spell_commands_list[i].command_name) != 0)
65 switch (debug_spell_commands_list[i].type) {
67 (*(debug_spell_commands_list[i].command_function.spell2.spell_function))(player_ptr);
72 if (!get_string("POWER:", tmp_val, 32))
74 tmp_int = atoi(tmp_val);
75 (*(debug_spell_commands_list[i].command_function.spell3.spell_function))(player_ptr, tmp_int);
79 (*(debug_spell_commands_list[i].command_function.spell4.spell_function))(player_ptr, true, &tmp_int);
83 (*(debug_spell_commands_list[i].command_function.spell5.spell_function))(player_ptr);
91 msg_format("Command not found.");
96 * @brief 必ず成功するウィザードモード用次元の扉処理 / Wizard Dimension Door
97 * @param player_ptr プレイヤーへの参照ポインタ
99 void wiz_dimension_door(player_type *player_ptr)
101 POSITION x = 0, y = 0;
102 if (!tgt_pt(player_ptr, &x, &y))
105 teleport_player_to(player_ptr, y, x, TELEPORT_NONMAGICAL);
109 * @brief ウィザードモード用モンスターの群れ生成 / Summon a horde of monsters
110 * @param player_ptr プレイヤーへの参照ポインタ
112 void wiz_summon_horde(player_type *player_ptr)
114 POSITION wy = player_ptr->y, wx = player_ptr->x;
118 scatter(player_ptr, &wy, &wx, player_ptr->y, player_ptr->x, 3, PROJECT_NONE);
119 if (is_cave_empty_bold(player_ptr, wy, wx))
123 (void)alloc_horde(player_ptr, wy, wx, summon_specific);
127 * @brief ウィザードモード用処理としてターゲット中の相手をテレポートバックする / Hack -- Teleport to the target
129 void wiz_teleport_back(player_type *player_ptr)
134 teleport_player_to(player_ptr, target_row, target_col, TELEPORT_NONMAGICAL);
138 * @brief 青魔導師の魔法を全て習得済みにする /
139 * debug command for blue mage
141 void wiz_learn_blue_magic_all(player_type *player_ptr)
143 EnumClassFlagGroup<RF_ABILITY> ability_flags;
144 for (int j = 1; j < A_MAX; j++) {
145 set_rf_masks(ability_flags, i2enum<blue_magic_type>(j));
147 std::vector<RF_ABILITY> spells;
148 EnumClassFlagGroup<RF_ABILITY>::get_flags(ability_flags, std::back_inserter(spells));
149 for (auto spell : spells) {
150 player_ptr->magic_num2[enum2i(spell)] = 1;
156 * @brief 鍛冶師の全てのエッセンスを最大所持量にする
158 void wiz_fillup_all_smith_essences(player_type *player_ptr)
160 for (auto essence : Smith::get_essence_list()) {
161 player_ptr->magic_num1[enum2i(essence)] = Smith::ESSENCE_AMOUNT_MAX;
166 * @brief 現在のフロアに合ったモンスターをランダムに召喚する /
167 * Summon some creatures
168 * @param player_ptr プレイヤーへの参照ポインタ
171 void wiz_summon_random_enemy(player_type *player_ptr, int num)
173 for (int i = 0; i < num; i++)
174 (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);
178 * @brief モンスターを種族IDを指定して自然生成と同じように召喚する /
179 * Summon a creature of the specified type
180 * @param r_idx モンスター種族ID(回数指定コマンド'0'で指定した回数がIDになる)
182 * This function is rather dangerous
184 void wiz_summon_specific_enemy(player_type *player_ptr, MONRACE_IDX r_idx)
188 if(!get_value("MonsterID", 1, r_info.size() - 1, &val)) {
191 r_idx = static_cast<MONRACE_IDX>(val);
193 (void)summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, r_idx, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
197 * @brief モンスターを種族IDを指定してペット召喚する /
198 * Summon a creature of the specified type
199 * @param r_idx モンスター種族ID(回数指定コマンド'0'で指定した回数がIDになる)
201 * This function is rather dangerous
203 void wiz_summon_pet(player_type *player_ptr, MONRACE_IDX r_idx)
207 if (!get_value("MonsterID", 1, r_info.size() - 1, &val)) {
210 r_idx = static_cast<MONRACE_IDX>(val);
212 (void)summon_named_creature(player_ptr, 0, player_ptr->y, player_ptr->x, r_idx, PM_ALLOW_SLEEP | PM_ALLOW_GROUP | PM_FORCE_PET);
216 * @brief ターゲットを指定して指定ダメージ・指定属性・半径0のボールを放つ
218 * @param effect_idx 属性ID
219 * @details デフォルトは100万・GF_ARROW(射撃)。RES_ALL持ちも一撃で殺せる。
221 void wiz_kill_enemy(player_type *player_ptr, HIT_POINT dam, EFFECT_ID effect_idx)
225 sprintf(tmp, "Damage (1-999999): ");
226 char tmp_val[10] = "1000";
227 if (!get_string(tmp, tmp_val, 6))
230 dam = (HIT_POINT)atoi(tmp_val);
233 if (effect_idx <= GF_NONE) {
235 sprintf(tmp, "Effect ID (1-%d): ", MAX_GF - 1);
236 char tmp_val[10] = "";
237 if (!get_string(tmp, tmp_val, 3))
240 effect_idx = (EFFECT_ID)atoi(tmp_val);
244 if (effect_idx <= GF_NONE || effect_idx >= MAX_GF) {
245 msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), MAX_GF - 1);
251 if (!get_aim_dir(player_ptr, &dir))
254 fire_ball(player_ptr, effect_idx, dir, dam, 0);
258 * @brief 自分に指定ダメージ・指定属性・半径0のボールを放つ
260 * @param effect_idx 属性ID
262 void wiz_kill_me(player_type *player_ptr, HIT_POINT dam, EFFECT_ID effect_idx)
266 sprintf(tmp, "Damage (1-999999): ");
267 char tmp_val[10] = "1000";
268 if (!get_string(tmp, tmp_val, 6))
271 dam = (HIT_POINT)atoi(tmp_val);
274 if (effect_idx <= GF_NONE) {
276 sprintf(tmp, "Effect ID (1-%d): ", MAX_GF - 1);
277 char tmp_val[10] = "1";
278 if (!get_string(tmp, tmp_val, 3))
281 effect_idx = (EFFECT_ID)atoi(tmp_val);
284 if (effect_idx <= GF_NONE || effect_idx >= MAX_GF) {
285 msg_format(_("番号は1から%dの間で指定して下さい。", "ID must be between 1 to %d."), MAX_GF - 1);
289 project(player_ptr, -1, 0, player_ptr->y, player_ptr->x, dam, effect_idx, PROJECT_KILL | PROJECT_PLAYER);