From cb487ab07bc9fcebbce570c6fa4b524ef96afa5b Mon Sep 17 00:00:00 2001 From: Hourier Date: Sat, 27 Jun 2020 22:01:51 +0900 Subject: [PATCH] [Refactor] #40482 Separated spells-chaos.c/h from spells3.c/h --- Hengband/Hengband/Hengband.vcxproj | 2 + Hengband/Hengband/Hengband.vcxproj.filters | 6 + src/Makefile.am | 1 + src/realm/realm-chaos.c | 1 + src/realm/realm-life.c | 1 + src/spell-realm/spells-chaos.c | 173 +++++++++++++++++++++++++++++ src/spell-realm/spells-chaos.h | 6 + src/spell/spells3.c | 159 -------------------------- src/spell/spells3.h | 2 - src/wizard/wizard-spells.c | 2 +- 10 files changed, 191 insertions(+), 162 deletions(-) create mode 100644 src/spell-realm/spells-chaos.c create mode 100644 src/spell-realm/spells-chaos.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index b5274e62c..b76d3a05e 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -217,6 +217,7 @@ + @@ -627,6 +628,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index dfd6efcf2..e412664a8 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -1457,6 +1457,9 @@ spell-kind + + spell-realm + @@ -3205,6 +3208,9 @@ spell-kind + + spell-realm + diff --git a/src/Makefile.am b/src/Makefile.am index 6c3597015..ac875b016 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -532,6 +532,7 @@ hengband_SOURCES = \ spell-kind/spells-specific-bolt.c spell-kind/spells-specific-bolt.h \ spell-kind/spells-teleport.c spell-kind/spells-teleport.h \ \ + spell-realm/spells-chaos.c spell-realm/spells-chaos.h \ spell-realm/spells-crusade.c spell-realm/spells-crusade.h \ spell-realm/spells-hex.c spell-realm/spells-hex.h \ spell-realm/spells-song.c spell-realm/spells-song.h \ diff --git a/src/realm/realm-chaos.c b/src/realm/realm-chaos.c index 162c36ccb..1ab9af66d 100644 --- a/src/realm/realm-chaos.c +++ b/src/realm/realm-chaos.c @@ -13,6 +13,7 @@ #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" #include "spell-kind/spells-teleport.h" +#include "spell-realm/spells-chaos.h" #include "spell/spells-object.h" #include "spell/spells-status.h" #include "spell/spells-summon.h" diff --git a/src/realm/realm-life.c b/src/realm/realm-life.c index af73a72df..9376f41ed 100644 --- a/src/realm/realm-life.c +++ b/src/realm/realm-life.c @@ -12,6 +12,7 @@ #include "spell-kind/spells-lite.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell/spells-status.h" #include "spell/spell-types.h" diff --git a/src/spell-realm/spells-chaos.c b/src/spell-realm/spells-chaos.c new file mode 100644 index 000000000..2e0ede1c2 --- /dev/null +++ b/src/spell-realm/spells-chaos.c @@ -0,0 +1,173 @@ +#include "spell-realm/spells-chaos.h" +#include "dungeon/quest.h" +#include "floor/floor.h" +#include "grid/feature.h" +#include "grid/grid.h" +#include "monster/monster-describer.h" +#include "monster/monster-status.h" +#include "player/player-damage.h" +#include "player/player-class.h" +#include "spell-kind/spells-floor.h" +#include "spell-kind/spells-launcher.h" +#include "spell/spell-types.h" +#include "util/bit-flags-calculator.h" +#include "view/display-messages.h" + +/*! + * @brief 虚無招来処理 / + * @param caster_ptr プレーヤーへの参照ポインタ + * @return なし + * @details + * Sorry, it becomes not (void)... + */ +void call_the_void(player_type *caster_ptr) +{ + grid_type *g_ptr; + bool do_call = TRUE; + for (int i = 0; i < 9; i++) { + g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]]; + + if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) { + if (!g_ptr->mimic || !have_flag(f_info[g_ptr->mimic].flags, FF_PROJECT) || !permanent_wall(&f_info[g_ptr->feat])) { + do_call = FALSE; + break; + } + } + } + + if (do_call) { + for (int i = 1; i < 10; i++) { + if (i - 5) + fire_ball(caster_ptr, GF_ROCKET, i, 175, 2); + } + + for (int i = 1; i < 10; i++) { + if (i - 5) + fire_ball(caster_ptr, GF_MANA, i, 175, 3); + } + + for (int i = 1; i < 10; i++) { + if (i - 5) + fire_ball(caster_ptr, GF_NUKE, i, 175, 4); + } + + return; + } + + bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest); + is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level; + if (is_special_fllor) { + msg_print(_("地面が揺れた。", "The ground trembles.")); + return; + } + +#ifdef JP + msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文")); +#else + msg_format("You %s the %s too close to a wall!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"), + ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell")); +#endif + msg_print(_("大きな爆発音があった!", "There is a loud explosion!")); + + if (one_in_(666)) { + if (!vanish_dungeon(caster_ptr)) + msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon becomes quiet for a moment.")); + take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); + return; + } + + if (destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE)) + msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses...")); + else + msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles.")); + take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); +} + +/*! + * @brief 虚無招来によるフロア中の全壁除去処理 / + * Vanish all walls in this floor + * @param caster_ptr プレーヤーへの参照ポインタ + * @params caster_ptr 術者の参照ポインタ + * @return 実際に処理が反映された場合TRUE + */ +bool vanish_dungeon(player_type *caster_ptr) +{ + bool is_special_floor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest); + is_special_floor |= !caster_ptr->current_floor_ptr->dun_level; + if (is_special_floor) + return FALSE; + + grid_type *g_ptr; + feature_type *f_ptr; + monster_type *m_ptr; + GAME_TEXT m_name[MAX_NLEN]; + for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++) { + for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++) { + g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x]; + + f_ptr = &f_info[g_ptr->feat]; + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; + if (g_ptr->m_idx && monster_csleep_remaining(m_ptr)) { + (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0); + if (m_ptr->ml) { + monster_desc(caster_ptr, m_name, m_ptr, 0); + msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name); + } + } + + if (have_flag(f_ptr->flags, FF_HURT_DISI)) + cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI); + } + } + + for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) { + g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x]; + f_ptr = &f_info[g_ptr->mimic]; + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) + g_ptr->info &= ~(CAVE_MARK); + } + + g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x]; + f_ptr = &f_info[g_ptr->mimic]; + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) + g_ptr->info &= ~(CAVE_MARK); + } + } + + /* Special boundary walls -- Left and right */ + for (POSITION y = 1; y < (caster_ptr->current_floor_ptr->height - 1); y++) { + g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0]; + f_ptr = &f_info[g_ptr->mimic]; + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) + g_ptr->info &= ~(CAVE_MARK); + } + + g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1]; + f_ptr = &f_info[g_ptr->mimic]; + g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); + + if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { + g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); + if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) + g_ptr->info &= ~(CAVE_MARK); + } + } + + caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS); + caster_ptr->redraw |= (PR_MAP); + caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); + return TRUE; +} diff --git a/src/spell-realm/spells-chaos.h b/src/spell-realm/spells-chaos.h new file mode 100644 index 000000000..0837df19c --- /dev/null +++ b/src/spell-realm/spells-chaos.h @@ -0,0 +1,6 @@ +#pragma once + +#include "system/angband.h" + +void call_the_void(player_type *caster_ptr); +bool vanish_dungeon(player_type *caster_ptr); diff --git a/src/spell/spells3.c b/src/spell/spells3.c index 8743fa58f..45cc1c81b 100644 --- a/src/spell/spells3.c +++ b/src/spell/spells3.c @@ -213,165 +213,6 @@ bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode) } /*! - * @brief 虚無招来によるフロア中の全壁除去処理 / - * Vanish all walls in this floor - * @param caster_ptr プレーヤーへの参照ポインタ - * @params caster_ptr 術者の参照ポインタ - * @return 実際に処理が反映された場合TRUE - */ -bool vanish_dungeon(player_type *caster_ptr) -{ - bool is_special_floor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest); - is_special_floor |= !caster_ptr->current_floor_ptr->dun_level; - if (is_special_floor) - return FALSE; - - grid_type *g_ptr; - feature_type *f_ptr; - monster_type *m_ptr; - GAME_TEXT m_name[MAX_NLEN]; - for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++) { - for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++) { - g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x]; - - f_ptr = &f_info[g_ptr->feat]; - g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx]; - if (g_ptr->m_idx && monster_csleep_remaining(m_ptr)) { - (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0); - if (m_ptr->ml) { - monster_desc(caster_ptr, m_name, m_ptr, 0); - msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name); - } - } - - if (have_flag(f_ptr->flags, FF_HURT_DISI)) - cave_alter_feat(caster_ptr, y, x, FF_HURT_DISI); - } - } - - for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++) { - g_ptr = &caster_ptr->current_floor_ptr->grid_array[0][x]; - f_ptr = &f_info[g_ptr->mimic]; - g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - - if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); - if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) - g_ptr->info &= ~(CAVE_MARK); - } - - g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x]; - f_ptr = &f_info[g_ptr->mimic]; - g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - - if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); - if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) - g_ptr->info &= ~(CAVE_MARK); - } - } - - /* Special boundary walls -- Left and right */ - for (POSITION y = 1; y < (caster_ptr->current_floor_ptr->height - 1); y++) { - g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][0]; - f_ptr = &f_info[g_ptr->mimic]; - g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - - if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); - if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) - g_ptr->info &= ~(CAVE_MARK); - } - - g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1]; - f_ptr = &f_info[g_ptr->mimic]; - g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY); - - if (g_ptr->mimic && have_flag(f_ptr->flags, FF_HURT_DISI)) { - g_ptr->mimic = feat_state(caster_ptr, g_ptr->mimic, FF_HURT_DISI); - if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) - g_ptr->info &= ~(CAVE_MARK); - } - } - - caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS); - caster_ptr->redraw |= (PR_MAP); - caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON); - return TRUE; -} - -/*! - * @brief 虚無招来処理 / - * @param caster_ptr プレーヤーへの参照ポインタ - * @return なし - * @details - * Sorry, it becomes not (void)... - */ -void call_the_void(player_type *caster_ptr) -{ - grid_type *g_ptr; - bool do_call = TRUE; - for (int i = 0; i < 9; i++) { - g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]]; - - if (!cave_have_flag_grid(g_ptr, FF_PROJECT)) { - if (!g_ptr->mimic || !have_flag(f_info[g_ptr->mimic].flags, FF_PROJECT) || !permanent_wall(&f_info[g_ptr->feat])) { - do_call = FALSE; - break; - } - } - } - - if (do_call) { - for (int i = 1; i < 10; i++) { - if (i - 5) - fire_ball(caster_ptr, GF_ROCKET, i, 175, 2); - } - - for (int i = 1; i < 10; i++) { - if (i - 5) - fire_ball(caster_ptr, GF_MANA, i, 175, 3); - } - - for (int i = 1; i < 10; i++) { - if (i - 5) - fire_ball(caster_ptr, GF_NUKE, i, 175, 4); - } - - return; - } - - bool is_special_fllor = caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest); - is_special_fllor |= !caster_ptr->current_floor_ptr->dun_level; - if (is_special_fllor) { - msg_print(_("地面が揺れた。", "The ground trembles.")); - return; - } - -#ifdef JP - msg_format("あなたは%sを壁に近すぎる場所で唱えてしまった!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "祈り" : "呪文")); -#else - msg_format("You %s the %s too close to a wall!", ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "recite" : "cast"), - ((mp_ptr->spell_book == TV_LIFE_BOOK) ? "prayer" : "spell")); -#endif - msg_print(_("大きな爆発音があった!", "There is a loud explosion!")); - - if (one_in_(666)) { - if (!vanish_dungeon(caster_ptr)) - msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon becomes quiet for a moment.")); - take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); - return; - } - - if (destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE)) - msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses...")); - else - msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles.")); - take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1); -} - -/*! * @brief アイテム引き寄せ処理 / * Fetch an item (teleport it right underneath the caster) * @param caster_ptr プレーヤーへの参照ポインタ diff --git a/src/spell/spells3.h b/src/spell/spells3.h index 6f7822215..6c7f515c9 100644 --- a/src/spell/spells3.h +++ b/src/spell/spells3.h @@ -7,7 +7,6 @@ bool eat_magic(player_type *caster_ptr, int power); bool apply_disenchant(player_type* target_ptr, BIT_FLAGS mode); -void call_the_void(player_type* caster_ptr); void fetch(player_type* caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los); void reserve_alter_reality(player_type* caster_ptr); void identify_pack(player_type* target_ptr); @@ -37,4 +36,3 @@ bool booze(player_type* creature_ptr); bool detonation(player_type* creature_ptr); void blood_curse_to_enemy(player_type* caster_ptr, MONSTER_IDX m_idx); bool fire_crimson(player_type* shooter_ptr); -bool vanish_dungeon(player_type *caster_ptr); diff --git a/src/wizard/wizard-spells.c b/src/wizard/wizard-spells.c index 7115d97a6..77b76c980 100644 --- a/src/wizard/wizard-spells.c +++ b/src/wizard/wizard-spells.c @@ -14,8 +14,8 @@ #include "mspell/mspells3.h" #include "player/player-effects.h" #include "spell-kind/spells-teleport.h" +#include "spell-realm/spells-chaos.h" #include "spell/spells-status.h" -#include "spell/spells3.h" #include "view/display-messages.h" debug_spell_command debug_spell_commands_list[SPELL_MAX] = { -- 2.11.0