mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Add Spell::HasPowerTypeCost to check which power types a spell uses
This commit is contained in:
@@ -4061,7 +4061,7 @@ void Spell::SendSpellStart()
|
||||
&& std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power != POWER_HEALTH; }) != m_powerCost.end())
|
||||
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
|
||||
|
||||
if (std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end())
|
||||
if (HasPowerTypeCost(POWER_RUNES))
|
||||
castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
|
||||
|
||||
WorldPackets::Spells::SpellStart packet;
|
||||
@@ -4164,7 +4164,7 @@ void Spell::SendSpellGo()
|
||||
|
||||
if ((m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
|
||||
&& std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end()
|
||||
&& HasPowerTypeCost(POWER_RUNES)
|
||||
&& !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
|
||||
{
|
||||
castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
|
||||
@@ -6955,6 +6955,14 @@ void Spell::DelayedChannel()
|
||||
SendChannelUpdate(m_timer);
|
||||
}
|
||||
|
||||
bool Spell::HasPowerTypeCost(Powers power) const
|
||||
{
|
||||
return std::find_if(m_powerCost.cbegin(), m_powerCost.cend(), [power](SpellPowerCost const& cost)
|
||||
{
|
||||
return cost.Power == power;
|
||||
}) != m_powerCost.cend();
|
||||
}
|
||||
|
||||
bool Spell::UpdatePointers()
|
||||
{
|
||||
if (m_originalCasterGUID == m_caster->GetGUID())
|
||||
|
||||
@@ -682,6 +682,7 @@ class TC_GAME_API Spell
|
||||
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
|
||||
Difficulty GetCastDifficulty() const;
|
||||
std::vector<SpellPowerCost> const& GetPowerCost() const { return m_powerCost; }
|
||||
bool HasPowerTypeCost(Powers power) const;
|
||||
|
||||
bool UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
|
||||
|
||||
@@ -716,7 +717,7 @@ class TC_GAME_API Spell
|
||||
SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
|
||||
WeaponAttackType m_attackType; // For weapon based attack
|
||||
|
||||
std::vector<SpellPowerCost> m_powerCost; // Calculated spell cost initialized only in Spell::prepare
|
||||
std::vector<SpellPowerCost> m_powerCost; // Calculated spell cost initialized only in Spell::prepare
|
||||
int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare
|
||||
int32 m_channeledDuration; // Calculated channeled spell duration in order to calculate correct pushback.
|
||||
bool m_canReflect; // can reflect this spell?
|
||||
|
||||
Reference in New Issue
Block a user