if ((!o_ptr->k_idx) || (!o_ptr->is_cursed())) {
exe_spell(player_ptr, REALM_HEX, spell, SPELL_STOP);
- SpellHex(player_ptr).reset_casting_flag(spell);
- casting_hex_num(player_ptr)--;
+ SpellHex spell_hex(player_ptr);
+ spell_hex.reset_casting_flag(spell);
+ spell_hex.add_casting_num(false);
if (get_singing_song_id(player_ptr) == 0)
set_action(player_ptr, ACTION_NONE);
}
SpellHex spell_hex(player_ptr);
spell_hex.reset_casting_flag(HEX_RESTORE);
if (cont) {
- casting_hex_num(player_ptr)--;
+ spell_hex.add_casting_num(false);
}
if (spell_hex.get_casting_num() > 0) {
if (cast && add) {
SpellHex spell_hex(player_ptr);
spell_hex.set_casting_flag(spell);
- casting_hex_num(player_ptr)++;
+ spell_hex.add_casting_num(true);
if (player_ptr->action != ACTION_SPELL)
set_action(player_ptr, ACTION_SPELL);
auto n = this->casting_spells[A2I(choice)];
exe_spell(this->player_ptr, REALM_HEX, n, SPELL_STOP);
this->reset_casting_flag(static_cast<spell_hex_type>(n));
- casting_hex_num(this->player_ptr)--;
+ this->add_casting_num(false);
}
this->player_ptr->update |= PU_BONUS | PU_HP | PU_MANA | PU_SPELLS;
{
return this->player_ptr->magic_num2[0];
}
+
+/*!
+ * @brief 詠唱番号の加減算を行う
+ * @param is_incremental 加算ならtrue、減算ならfalse
+ */
+void SpellHex::add_casting_num(bool is_incremental)
+{
+ if (is_incremental) {
+ this->player_ptr->magic_num2[0]++;
+ } else {
+ this->player_ptr->magic_num2[0]--;
+ }
+}
void set_casting_flag(spell_hex_type type);
void reset_casting_flag(spell_hex_type type);
int32_t get_casting_num() const;
+ void add_casting_num(bool is_incremental);
private:
player_type *player_ptr;
void gain_exp_master(const int spell);
};
-#define casting_hex_num(P_PTR) ((P_PTR)->magic_num2[0])
#define hex_revenge_power(P_PTR) ((P_PTR)->magic_num1[2])
#define hex_revenge_turn(P_PTR) ((P_PTR)->magic_num2[2])
#define hex_revenge_type(P_PTR) ((P_PTR)->magic_num2[1])