Core/Spells: Defined and implemented more spell effect attributes - AlwaysAoeLineOfSight, IsHarmful, PlayersOnly, EnforceLineOfSightToChainTargets
Port From (https://github.com/TrinityCore/TrinityCore/commit/69317c25947e682036813aa7f6e9200056232a13)
This commit is contained in:
@@ -2748,7 +2748,7 @@ namespace Game.Spells
|
||||
if (GetUnitOwner().HasUnitState(UnitState.Isolated))
|
||||
continue;
|
||||
|
||||
List<Unit> units = new();
|
||||
List<WorldObject> units = new();
|
||||
var condList = spellEffectInfo.ImplicitTargetConditions;
|
||||
|
||||
float radius = spellEffectInfo.CalcRadius(refe);
|
||||
@@ -2804,20 +2804,25 @@ namespace Game.Spells
|
||||
|
||||
if (selectionType != SpellTargetCheckTypes.Default)
|
||||
{
|
||||
WorldObjectSpellAreaTargetCheck check = new(radius, GetUnitOwner(), refe, GetUnitOwner(), GetSpellInfo(), selectionType, condList, SpellTargetObjectTypes.Unit);
|
||||
UnitListSearcher searcher = new(GetUnitOwner(), units, check);
|
||||
Cell.VisitAllObjects(GetUnitOwner(), searcher, radius + extraSearchRadius);
|
||||
var containerTypeMask = Spell.GetSearcherTypeMask(GetSpellInfo(), spellEffectInfo, SpellTargetObjectTypes.Unit, condList);
|
||||
if (containerTypeMask != 0)
|
||||
{
|
||||
WorldObjectSpellAreaTargetCheck check = new(radius, GetUnitOwner(), refe, GetUnitOwner(), GetSpellInfo(), selectionType, condList, SpellTargetObjectTypes.Unit);
|
||||
WorldObjectListSearcher searcher = new(GetUnitOwner(), units, check, containerTypeMask);
|
||||
searcher.i_phaseShift = PhasingHandler.GetAlwaysVisiblePhaseShift();
|
||||
Spell.SearchTargets(searcher, containerTypeMask, GetUnitOwner(), GetUnitOwner(), radius + extraSearchRadius);
|
||||
|
||||
// by design WorldObjectSpellAreaTargetCheck allows not-in-world units (for spells) but for auras it is not acceptable
|
||||
units.RemoveAll(unit => !unit.IsSelfOrInSameMap(GetUnitOwner()));
|
||||
// by design WorldObjectSpellAreaTargetCheck allows not-in-world units (for spells) but for auras it is not acceptable
|
||||
units.RemoveAll(unit => !unit.IsSelfOrInSameMap(GetUnitOwner()));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Unit unit in units)
|
||||
foreach (WorldObject unit in units)
|
||||
{
|
||||
if (!targets.ContainsKey(unit))
|
||||
targets[unit] = 0;
|
||||
targets[unit.ToUnit()] = 0;
|
||||
|
||||
targets[unit] |= 1u << (int)spellEffectInfo.EffectIndex;
|
||||
targets[unit.ToUnit()] |= 1u << (int)spellEffectInfo.EffectIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
GetBase().CallScriptEffectCalcAmountHandlers(this, ref amount, ref m_canBeRecalculated);
|
||||
if (!GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack))
|
||||
if (!GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.SuppressPointsStacking))
|
||||
amount *= GetBase().GetStackAmount();
|
||||
|
||||
_estimatedAmount = CalculateEstimatedAmount(caster, amount);
|
||||
@@ -126,7 +126,7 @@ namespace Game.Spells
|
||||
|
||||
public static float? CalculateEstimatedAmount(Unit caster, Unit target, SpellInfo spellInfo, SpellEffectInfo spellEffectInfo, int amount, byte stack, AuraEffect aurEff)
|
||||
{
|
||||
uint stackAmountForBonuses = !spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack) ? stack : 1u;
|
||||
uint stackAmountForBonuses = !spellEffectInfo.EffectAttributes.HasFlag(SpellEffectAttributes.SuppressPointsStacking) ? stack : 1u;
|
||||
|
||||
switch (spellEffectInfo.ApplyAuraName)
|
||||
{
|
||||
@@ -5057,7 +5057,7 @@ namespace Game.Spells
|
||||
|
||||
CleanDamage cleanDamage = new(0, 0, WeaponAttackType.BaseAttack, MeleeHitOutcome.Normal);
|
||||
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack) ? GetBase().GetStackAmount() : 1u;
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.SuppressPointsStacking) ? GetBase().GetStackAmount() : 1u;
|
||||
|
||||
// ignore non positive values (can be result apply spellmods to aura damage
|
||||
uint damage = (uint)Math.Max(GetAmount(), 0);
|
||||
@@ -5184,7 +5184,7 @@ namespace Game.Spells
|
||||
|
||||
CleanDamage cleanDamage = new(0, 0, GetSpellInfo().GetAttackType(), MeleeHitOutcome.Normal);
|
||||
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack) ? GetBase().GetStackAmount() : 1u;
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.SuppressPointsStacking) ? GetBase().GetStackAmount() : 1u;
|
||||
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
uint damage = (uint)Math.Max(GetAmount(), 0);
|
||||
@@ -5311,7 +5311,7 @@ namespace Game.Spells
|
||||
if (GetBase().IsPermanent() && target.IsFullHealth())
|
||||
return;
|
||||
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.NoScaleWithStack) ? GetBase().GetStackAmount() : 1u;
|
||||
uint stackAmountForBonuses = !GetSpellEffectInfo().EffectAttributes.HasFlag(SpellEffectAttributes.SuppressPointsStacking) ? GetBase().GetStackAmount() : 1u;
|
||||
|
||||
// ignore negative values (can be result apply spellmods to aura damage
|
||||
uint damage = (uint)Math.Max(GetAmount(), 0);
|
||||
|
||||
Reference in New Issue
Block a user