mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Entities): extend combo point system to all Units (#9816)
- Closes #1140
This commit is contained in:
@@ -572,6 +572,8 @@ Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags,
|
||||
m_referencedFromCurrentSpell = false;
|
||||
m_executedCurrently = false;
|
||||
m_needComboPoints = m_spellInfo->NeedsComboPoints();
|
||||
m_comboPointGain = 0;
|
||||
m_comboTarget = nullptr;
|
||||
m_delayStart = 0;
|
||||
m_delayAtDamageCount = 0;
|
||||
|
||||
@@ -3315,7 +3317,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
|
||||
m_powerCost = m_CastItem ? 0 : m_spellInfo->CalcPowerCost(m_caster, m_spellSchoolMask, this);
|
||||
|
||||
// Set combo point requirement
|
||||
if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem || !m_caster->m_movedByPlayer)
|
||||
if ((_triggeredCastFlags & TRIGGERED_IGNORE_COMBO_POINTS) || m_CastItem)
|
||||
m_needComboPoints = false;
|
||||
|
||||
SpellCastResult result = CheckCast(true);
|
||||
@@ -3946,16 +3948,16 @@ void Spell::_handle_immediate_phase()
|
||||
|
||||
void Spell::_handle_finish_phase()
|
||||
{
|
||||
if (m_caster->m_movedByPlayer && m_needComboPoints)
|
||||
// Take for real after all targets are processed
|
||||
if (m_needComboPoints)
|
||||
{
|
||||
// Take for real after all targets are processed
|
||||
m_caster->m_movedByPlayer->ToPlayer()->ClearComboPoints();
|
||||
m_caster->ClearComboPoints();
|
||||
}
|
||||
|
||||
// Real add combo points from effects
|
||||
if( m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->IsInWorld() && m_targets.GetUnitTarget()->IsAlive() )
|
||||
m_caster->m_movedByPlayer->ToPlayer()->AddComboPoints(m_targets.GetUnitTarget(), m_caster->m_movedByPlayer->ToPlayer()->GetComboPointGain());
|
||||
|
||||
m_caster->m_movedByPlayer->ToPlayer()->SetComboPointGain(0);
|
||||
// Real add combo points from effects
|
||||
if (m_comboTarget && m_comboPointGain)
|
||||
{
|
||||
m_caster->AddComboPoints(m_comboTarget, m_comboPointGain);
|
||||
}
|
||||
|
||||
if (m_caster->m_extraAttacks && GetSpellInfo()->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
|
||||
@@ -6322,11 +6324,24 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_ITEM_ALREADY_ENCHANTED;
|
||||
}
|
||||
|
||||
// check if caster has at least 1 combo point for spells that require combo points
|
||||
// check if caster has at least 1 combo point on target for spells that require combo points
|
||||
if (m_needComboPoints)
|
||||
if (Player* plrCaster = m_caster->ToPlayer())
|
||||
if (!plrCaster->GetComboPoints())
|
||||
{
|
||||
if (m_spellInfo->NeedsExplicitUnitTarget())
|
||||
{
|
||||
if (!m_caster->GetComboPoints(m_targets.GetUnitTarget()))
|
||||
{
|
||||
return SPELL_FAILED_NO_COMBO_POINTS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_caster->GetComboPoints())
|
||||
{
|
||||
return SPELL_FAILED_NO_COMBO_POINTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// xinef: check relic cooldown
|
||||
if (m_CastItem && m_CastItem->GetTemplate()->InventoryType == INVTYPE_RELIC && m_triggeredByAuraSpell)
|
||||
|
||||
Reference in New Issue
Block a user