#include "spell-realm/spells-hex.h"
#include "core/asking-player.h"
-#include "core/player-redraw-types.h"
-#include "core/player-update-types.h"
#include "core/window-redrawer.h"
#include "effect/effect-characteristics.h"
#include "effect/effect-processor.h"
-#include "monster-attack/monster-attack-util.h"
+#include "monster-attack/monster-attack-player.h"
#include "monster-race/monster-race.h"
#include "player-base/player-class.h"
#include "player-info/spell-hex-data-type.h"
#include "spell-realm/spells-crusade.h"
#include "spell-realm/spells-song.h"
#include "spell/spell-info.h"
-#include "spell/spell-types.h"
#include "spell/spells-execution.h"
#include "spell/technic-info-table.h"
#include "status/action-setter.h"
#include "system/floor-type-definition.h"
-#include "system/monster-race-definition.h"
-#include "system/monster-type-definition.h"
+#include "system/monster-entity.h"
+#include "system/monster-race-info.h"
#include "system/player-type-definition.h"
+#include "system/redrawing-flags-updater.h"
#include "term/screen-processor.h"
#include "util/bit-flags-calculator.h"
#include "util/int-char-converter.h"
#include "monster/monster-description-types.h"
#endif
-#include <bitset>
+#include <iterator>
/*!< 呪術の最大詠唱数 */
constexpr int MAX_KEEP = 4;
-SpellHex::SpellHex(player_type *player_ptr)
+SpellHex::SpellHex(PlayerType *player_ptr)
: player_ptr(player_ptr)
, spell_hex_data(PlayerClass(player_ptr).get_specific_data<spell_hex_data_type>())
{
}
}
-SpellHex::SpellHex(player_type *player_ptr, monap_type *monap_ptr)
+SpellHex::SpellHex(PlayerType *player_ptr, MonsterAttackPlayer *monap_ptr)
: player_ptr(player_ptr)
, monap_ptr(monap_ptr)
{
void SpellHex::stop_all_spells()
{
for (auto spell : this->casting_spells) {
- exe_spell(this->player_ptr, REALM_HEX, spell, SPELL_STOP);
+ exe_spell(this->player_ptr, REALM_HEX, spell, SpellProcessType::STOP);
}
this->spell_hex_data->casting_spells.clear();
set_action(this->player_ptr, ACTION_NONE);
}
- this->player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
- this->player_ptr->redraw |= PR_EXTRA | PR_HP | PR_MANA;
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ const auto flags_srf = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MP,
+ StatusRedrawingFlag::SPELLS,
+ };
+ rfu.set_flags(flags_srf);
+ const auto flags_mwrf = {
+ MainWindowRedrawingFlag::EXTRA,
+ MainWindowRedrawingFlag::HP,
+ MainWindowRedrawingFlag::MP,
+ };
+ rfu.set_flags(flags_mwrf);
}
/*!
screen_load();
if (is_selected) {
auto n = this->casting_spells[A2I(choice)];
- exe_spell(this->player_ptr, REALM_HEX, n, SPELL_STOP);
+ exe_spell(this->player_ptr, REALM_HEX, n, SpellProcessType::STOP);
this->reset_casting_flag(i2enum<spell_hex_type>(n));
}
- this->player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
- this->player_ptr->redraw |= PR_EXTRA | PR_HP | PR_MANA;
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ const auto flags_srf = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MP,
+ StatusRedrawingFlag::SPELLS,
+ };
+ rfu.set_flags(flags_srf);
+ const auto flags_mwrf = {
+ MainWindowRedrawingFlag::EXTRA,
+ MainWindowRedrawingFlag::HP,
+ MainWindowRedrawingFlag::MP,
+ };
+ rfu.set_flags(flags_mwrf);
return is_selected;
}
prt(_(" 名前", " Name"), y, x + 5);
for (auto spell : this->casting_spells) {
term_erase(x, y + n + 1, 255);
- auto spell_result = exe_spell(this->player_ptr, REALM_HEX, spell, SPELL_NAME);
- put_str(format("%c) %s", I2A(n), spell_result), y + n + 1, x + 2);
+ const auto spell_name = exe_spell(this->player_ptr, REALM_HEX, spell, SpellProcessType::NAME);
+ put_str(format("%c) %s", I2A(n), spell_name->data()), y + n + 1, x + 2);
n++;
}
}
this->gain_exp();
for (auto spell : this->casting_spells) {
- exe_spell(this->player_ptr, REALM_HEX, spell, SPELL_CONTNUATION);
+ exe_spell(this->player_ptr, REALM_HEX, spell, SpellProcessType::CONTNUATION);
}
}
}
s64b_sub(&(this->player_ptr->csp), &(this->player_ptr->csp_frac), need_mana, need_mana_frac);
- this->player_ptr->redraw |= PR_MANA;
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ rfu.set_flag(MainWindowRedrawingFlag::MP);
if (!need_restart) {
return true;
}
msg_print(_("詠唱を再開した。", "You restart casting."));
this->player_ptr->action = ACTION_SPELL;
- this->player_ptr->update |= PU_BONUS | PU_HP;
- this->player_ptr->redraw |= PR_MAP | PR_STATUS | PR_STATE;
- this->player_ptr->update |= PU_MONSTERS;
+ const auto flags_srf = {
+ StatusRedrawingFlag::BONUS,
+ StatusRedrawingFlag::HP,
+ StatusRedrawingFlag::MONSTER_STATUSES,
+ };
+ rfu.set_flags(flags_srf);
+ const auto flags_mwrf = {
+ MainWindowRedrawingFlag::MAP,
+ MainWindowRedrawingFlag::TIMED_EFFECT,
+ MainWindowRedrawingFlag::ACTION,
+ };
+ rfu.set_flags(flags_mwrf);
this->player_ptr->window_flags |= PW_OVERHEAD | PW_DUNGEON;
return true;
}
void SpellHex::gain_exp()
{
+ PlayerSkill ps(player_ptr);
for (auto spell : this->casting_spells) {
if (!this->is_spelling_specific(spell)) {
continue;
}
- if (this->player_ptr->spell_exp[spell] < SPELL_EXP_BEGINNER) {
- this->player_ptr->spell_exp[spell] += 5;
- continue;
- }
-
- if (this->gain_exp_skilled(spell)) {
- continue;
- }
-
- if (this->gain_exp_expert(spell)) {
- continue;
- }
-
- this->gain_exp_master(spell);
- }
-}
-
-bool SpellHex::gain_exp_skilled(const int spell)
-{
- if (this->player_ptr->spell_exp[spell] >= SPELL_EXP_SKILLED) {
- return false;
- }
-
- auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto gain_condition = one_in_(2);
- gain_condition &= floor_ptr->dun_level > 4;
- gain_condition &= (floor_ptr->dun_level + 10) > this->player_ptr->lev;
- if (gain_condition) {
- this->player_ptr->spell_exp[spell]++;
- }
-
- return true;
-}
-
-bool SpellHex::gain_exp_expert(const int spell)
-{
- if (this->player_ptr->spell_exp[spell] >= SPELL_EXP_EXPERT) {
- return false;
- }
-
- const auto *s_ptr = &technic_info[REALM_HEX - MIN_TECHNIC][spell];
- auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto gain_condition = one_in_(5);
- gain_condition &= (floor_ptr->dun_level + 5) > this->player_ptr->lev;
- gain_condition &= (floor_ptr->dun_level + 5) > s_ptr->slevel;
- if (gain_condition) {
- this->player_ptr->spell_exp[spell]++;
- }
-
- return true;
-}
-
-void SpellHex::gain_exp_master(const int spell)
-{
- if (this->player_ptr->spell_exp[spell] >= SPELL_EXP_MASTER) {
- return;
- }
-
- const auto *s_ptr = &technic_info[REALM_HEX - MIN_TECHNIC][spell];
- auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto gain_condition = one_in_(5);
- gain_condition &= (floor_ptr->dun_level + 5) > this->player_ptr->lev;
- gain_condition &= floor_ptr->dun_level > s_ptr->slevel;
- if (gain_condition) {
- this->player_ptr->spell_exp[spell]++;
+ ps.gain_continuous_spell_skill_exp(REALM_HEX, spell);
}
}
bool SpellHex::is_casting_full_capacity() const
{
auto k_max = (this->player_ptr->lev / 15) + 1;
- k_max = MIN(k_max, MAX_KEEP);
+ k_max = std::min(k_max, MAX_KEEP);
return this->get_casting_num() >= k_max;
}
switch (this->get_revenge_type()) {
case SpellHexRevengeType::PATIENCE:
- exe_spell(this->player_ptr, REALM_HEX, HEX_PATIENCE, SPELL_CONTNUATION);
+ exe_spell(this->player_ptr, REALM_HEX, HEX_PATIENCE, SpellProcessType::CONTNUATION);
return;
case SpellHexRevengeType::REVENGE:
- exe_spell(this->player_ptr, REALM_HEX, HEX_REVENGE, SPELL_CONTNUATION);
+ exe_spell(this->player_ptr, REALM_HEX, HEX_REVENGE, SpellProcessType::CONTNUATION);
return;
default:
return;
* @brief 復讐ダメージの追加を行う
* @param dam 蓄積されるダメージ量
*/
-void SpellHex::store_vengeful_damage(HIT_POINT dam)
+void SpellHex::store_vengeful_damage(int dam)
{
if (!this->spell_hex_data || (this->get_revenge_turn() == 0)) {
return;
bool SpellHex::check_hex_barrier(MONSTER_IDX m_idx, spell_hex_type type) const
{
const auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[m_idx];
- const auto *r_ptr = &r_info[m_ptr->r_idx];
+ const auto *r_ptr = &monraces_info[m_ptr->r_idx];
return this->is_spelling_specific(type) && ((this->player_ptr->lev * 3 / 2) >= randint1(r_ptr->level));
}
#ifdef JP
msg_format("攻撃が%s自身を傷つけた!", this->monap_ptr->m_name);
#else
- GAME_TEXT m_name_self[MAX_MONSTER_NAME];
- monster_desc(this->player_ptr, m_name_self, this->monap_ptr->m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
- msg_format("The attack of %s has wounded %s!", this->monap_ptr->m_name, m_name_self);
+ const auto m_name_self = monster_desc(this->player_ptr, this->monap_ptr->m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
+ msg_format("The attack of %s has wounded %s!", this->monap_ptr->m_name, m_name_self.data());
#endif
const auto y = this->monap_ptr->m_ptr->fy;
const auto x = this->monap_ptr->m_ptr->fx;
- project(this->player_ptr, 0, 0, y, x, this->monap_ptr->get_damage, GF_MISSILE, PROJECT_KILL);
+ project(this->player_ptr, 0, 0, y, x, this->monap_ptr->get_damage, AttributeType::MISSILE, PROJECT_KILL);
if (this->player_ptr->tim_eyeeye) {
set_tim_eyeeye(this->player_ptr, this->player_ptr->tim_eyeeye - 5, true);
}
msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But a magic barrier obstructs it."));
} else {
msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
- teleport_away(this->player_ptr, this->monap_ptr->m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
+ teleport_away(this->player_ptr, this->monap_ptr->m_idx, MAX_PLAYER_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
}
}