Core/Combat Improve extra attacks handling

Port From (https://github.com/TrinityCore/TrinityCore/commit/6c9bde098b40f38905ea7407d0cd77437b0b953c)
This commit is contained in:
hondacrx
2022-05-29 23:42:17 -04:00
parent 44b70d8db9
commit faa937a9da
8 changed files with 71 additions and 48 deletions
+10 -2
View File
@@ -645,8 +645,16 @@ namespace Game.Spells
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId, GetBase().GetCastDifficulty());
if (triggeredSpellInfo != null)
if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
return false;
{
if (triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
{
uint lastExtraAttackSpell = eventInfo.GetActor().GetLastExtraAttackSpell();
// Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
if (lastExtraAttackSpell == triggerSpellId)
return false;
}
}
break;
}
case AuraType.ModSpellCritChance:
+5 -9
View File
@@ -140,7 +140,7 @@ namespace Game.Spells
void InitExplicitTargets(SpellCastTargets targets)
{
m_targets = targets;
m_targets.SetOrigUnitTarget(m_targets.GetUnitTarget());
// this function tries to correct spell explicit targets for spell
// client doesn't send explicit targets correctly sometimes - we need to fix such spells serverside
// this also makes sure that we correctly send explicit targets to client (removes redundant data)
@@ -3132,14 +3132,8 @@ namespace Game.Spells
if (m_comboPointGain != 0)
unitCaster.AddComboPoints(m_comboPointGain);
if (unitCaster.ExtraAttacks != 0 && m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
{
Unit victim = Global.ObjAccessor.GetUnit(unitCaster, m_targets.GetOrigUnitTargetGUID());
if (victim)
unitCaster.HandleProcExtraAttackFor(victim);
else
unitCaster.ExtraAttacks = 0;
}
if (m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
unitCaster.SetLastExtraAttackSpell(m_spellInfo.Id);
}
// Handle procs on finish
@@ -8337,6 +8331,8 @@ namespace Game.Spells
}
else
{
caster.SetLastDamagedTargetGuid(spell.unitTarget.GetGUID());
// Add bonuses and fill damageInfo struct
caster.CalculateSpellDamageTaken(damageInfo, spell.m_damage, spell.m_spellInfo, spell.m_attackType, IsCrit);
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
-23
View File
@@ -114,28 +114,6 @@ namespace Game.Spells
data.Name = m_strTarget;
}
public ObjectGuid GetOrigUnitTargetGUID()
{
switch (m_origObjectTargetGUID.GetHigh())
{
case HighGuid.Player:
case HighGuid.Vehicle:
case HighGuid.Creature:
case HighGuid.Pet:
return m_origObjectTargetGUID;
default:
return ObjectGuid.Empty;
}
}
public void SetOrigUnitTarget(Unit target)
{
if (!target)
return;
m_origObjectTargetGUID = target.GetGUID();
}
public ObjectGuid GetUnitTargetGUID()
{
if (m_objectTargetGUID.IsUnit())
@@ -420,7 +398,6 @@ namespace Game.Spells
Item m_itemTarget;
// object GUID/etc, can be used always
ObjectGuid m_origObjectTargetGUID;
ObjectGuid m_objectTargetGUID;
ObjectGuid m_itemTargetGUID;
uint m_itemTargetEntry;
+1 -4
View File
@@ -3487,10 +3487,7 @@ namespace Game.Spells
if (!unitTarget || !unitTarget.IsAlive())
return;
if (unitTarget.ExtraAttacks != 0)
return;
unitTarget.ExtraAttacks = (uint)damage;
unitTarget.AddExtraAttacks((uint)damage);
ExecuteLogEffectExtraAttacks(effectInfo.Effect, unitTarget, (uint)damage);
}