fix(Scripts/Spells): Sweeping Strikes - improvements. (#11666)

* fix(Scripts/Spells): Sweeping Strikes - improvements.

Fixes #11594

* Buildfix.
This commit is contained in:
UltraNix
2022-05-23 10:49:56 +02:00
committed by GitHub
parent b6d79ac89e
commit 55720eedd3
4 changed files with 37 additions and 66 deletions

View File

@@ -8205,7 +8205,6 @@ void Spell::HandleLaunchPhase()
PrepareTargetProcessing();
bool firstTarget = true;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo& target = *ihit;
@@ -8239,14 +8238,14 @@ void Spell::HandleLaunchPhase()
break;
}
}
DoAllEffectOnLaunchTarget(target, multiplier, firstTarget);
firstTarget = false;
DoAllEffectOnLaunchTarget(target, multiplier);
}
FinishTargetProcessing();
}
void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, bool firstTarget)
void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
{
Unit* unit = nullptr;
// In case spell hit target, do all effect on that target
@@ -8258,7 +8257,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
if (!unit)
return;
uint8 ssEffect = MAX_SPELL_EFFECTS;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (targetInfo.effectMask & (1 << i))
@@ -8289,18 +8287,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
m_damageMultipliers[i] *= multiplier[i];
}
targetInfo.damage += m_damage;
// Sweeping Strikes
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
ssEffect = i;
break;
}
}
}
@@ -8317,31 +8303,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
float critChance = caster->SpellDoneCritChance(unit, m_spellInfo, m_spellSchoolMask, m_attackType, false);
critChance = unit->SpellTakenCritChance(caster, m_spellInfo, m_spellSchoolMask, critChance, m_attackType, false);
targetInfo.crit = roll_chance_f(std::max(0.0f, critChance));
// Sweeping strikes
if (m_caster->getClass() == CLASS_WARRIOR && ssEffect < MAX_SPELL_EFFECTS && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&
((m_spellInfo->Id != 50622 && m_spellInfo->Id != 44949) || firstTarget))
{
if (Aura* aur = m_caster->GetAura(12328))
{
Unit* target = m_caster->SelectNearbyNoTotemTarget(unit);
if (!target || target == unit)
return; // finish
int32 mdmg = m_damage;
int32 basepoints = 0;
m_damage = 0;
HandleEffects(target, nullptr, nullptr, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET);
basepoints = (targetInfo.crit ? Unit::SpellCriticalDamageBonus(m_caster, m_spellInfo, m_damage, target) : m_damage);
m_damage = mdmg;
m_caster->CastCustomSpell(target, 26654, &basepoints, nullptr, nullptr, true);
if (m_spellInfo->Id != 44949)
aur->DropCharge();
}
}
}
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)