workaround stealth interaction with Death and Decay and GameObject casts
This commit is contained in:
@@ -2916,7 +2916,8 @@ namespace Game.Entities
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. Ignore stealth if target is player and unit in combat with same player
|
// can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. Ignore stealth if target is player and unit in combat with same player
|
||||||
if ((bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && (obj ? !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) : !CanSeeOrDetect(target, (bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) || (target.IsTypeId(TypeId.Player) && target.HasStealthAura() && target.IsInCombat() && IsInCombatWith(target)))))
|
// skip visibility check for GO casts, needs removal when go cast is implemented
|
||||||
|
if (GetEntry() != SharedConst.WorldTrigger && (bySpell == null || !bySpell.HasAttribute(SpellAttr6.CanTargetInvisible)) && (obj ? !obj.CanSeeOrDetect(target, bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) : !CanSeeOrDetect(target, (bySpell != null && bySpell.IsAffectingArea(GetMap().GetDifficultyID())) || (target.GetTypeId() == TypeId.Player && target.HasStealthAura() && target.IsInCombat() && IsInCombatWith(target)))))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// can't attack dead
|
// can't attack dead
|
||||||
|
|||||||
@@ -1549,13 +1549,17 @@ namespace Game.Spells
|
|||||||
m_hitMask = ProcFlagsHit.None;
|
m_hitMask = ProcFlagsHit.None;
|
||||||
|
|
||||||
// Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection
|
// Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection
|
||||||
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Hunter &&
|
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Hunter && (m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x18u) || // Freezing and Frost Trap, Freezing Arrow
|
||||||
(m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x18u) || // Freezing and Frost Trap, Freezing Arrow
|
m_spellInfo.Id == 57879 || // Snake Trap - done this way to avoid double proc
|
||||||
m_spellInfo.Id == 57879 || // Snake Trap - done this way to avoid double proc
|
|
||||||
m_spellInfo.SpellFamilyFlags[2].HasAnyFlag(0x00024000u))) // Explosive and Immolation Trap
|
m_spellInfo.SpellFamilyFlags[2].HasAnyFlag(0x00024000u))) // Explosive and Immolation Trap
|
||||||
|
{
|
||||||
m_procAttacker |= ProcFlags.DoneTrapActivation;
|
m_procAttacker |= ProcFlags.DoneTrapActivation;
|
||||||
|
|
||||||
|
// also fill up other flags (DoAllEffectOnTarget only fills up flag if both are not set)
|
||||||
|
m_procAttacker |= ProcFlags.DoneSpellMagicDmgClassNeg;
|
||||||
|
m_procVictim |= ProcFlags.TakenSpellMagicDmgClassNeg;
|
||||||
|
}
|
||||||
|
|
||||||
// Hellfire Effect - trigger as DOT
|
// Hellfire Effect - trigger as DOT
|
||||||
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Warlock && m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000040u))
|
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Warlock && m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000040u))
|
||||||
{
|
{
|
||||||
@@ -1586,7 +1590,7 @@ namespace Game.Spells
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (checkIfValid)
|
if (checkIfValid)
|
||||||
if (m_spellInfo.CheckTarget(m_caster, target, Implicit) != SpellCastResult.SpellCastOk)
|
if (m_spellInfo.CheckTarget(m_caster, target, Implicit || m_caster.GetEntry() == SharedConst.WorldTrigger) != SpellCastResult.SpellCastOk) // skip stealth checks for GO casts
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Check for effect immune skip if immuned
|
// Check for effect immune skip if immuned
|
||||||
@@ -4485,7 +4489,11 @@ namespace Game.Spells
|
|||||||
if (!(m_spellInfo.IsPassive() && (m_targets.GetUnitTarget() == null || m_targets.GetUnitTarget() == m_caster)))
|
if (!(m_spellInfo.IsPassive() && (m_targets.GetUnitTarget() == null || m_targets.GetUnitTarget() == m_caster)))
|
||||||
{
|
{
|
||||||
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
|
// Check explicit target for m_originalCaster - todo: get rid of such workarounds
|
||||||
castResult = m_spellInfo.CheckExplicitTarget(m_originalCaster ?? m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
|
Unit caster = m_caster;
|
||||||
|
if (m_originalCaster && m_caster.GetEntry() != SharedConst.WorldTrigger) // Do a simplified check for gameobject casts
|
||||||
|
caster = m_originalCaster;
|
||||||
|
|
||||||
|
castResult = m_spellInfo.CheckExplicitTarget(caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget());
|
||||||
if (castResult != SpellCastResult.SpellCastOk)
|
if (castResult != SpellCastResult.SpellCastOk)
|
||||||
return castResult;
|
return castResult;
|
||||||
}
|
}
|
||||||
@@ -4493,7 +4501,7 @@ namespace Game.Spells
|
|||||||
Unit unitTarget = m_targets.GetUnitTarget();
|
Unit unitTarget = m_targets.GetUnitTarget();
|
||||||
if (unitTarget != null)
|
if (unitTarget != null)
|
||||||
{
|
{
|
||||||
castResult = m_spellInfo.CheckTarget(m_caster, unitTarget, false);
|
castResult = m_spellInfo.CheckTarget(m_caster, unitTarget, m_caster.GetEntry() == SharedConst.WorldTrigger); // skip stealth checks for GO casts
|
||||||
if (castResult != SpellCastResult.SpellCastOk)
|
if (castResult != SpellCastResult.SpellCastOk)
|
||||||
return castResult;
|
return castResult;
|
||||||
|
|
||||||
|
|||||||
@@ -2330,6 +2330,9 @@ namespace Game.Entities
|
|||||||
case 44544: // Fingers of Frost
|
case 44544: // Fingers of Frost
|
||||||
spellInfo.GetEffect(0).SpellClassMask = new FlagArray128(685904631, 1151048, 0, 0);
|
spellInfo.GetEffect(0).SpellClassMask = new FlagArray128(685904631, 1151048, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
case 52212: // Death and Decay
|
||||||
|
spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible;
|
||||||
|
break;
|
||||||
case 37408: // Oscillation Field
|
case 37408: // Oscillation Field
|
||||||
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
|
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
|
||||||
break;
|
break;
|
||||||
@@ -2839,13 +2842,14 @@ namespace Game.Entities
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case AuraType.OverrideClassScripts:
|
case AuraType.OverrideClassScripts:
|
||||||
|
case AuraType.ModStealth:
|
||||||
|
case AuraType.ModConfuse:
|
||||||
case AuraType.ModFear:
|
case AuraType.ModFear:
|
||||||
case AuraType.ModRoot:
|
case AuraType.ModRoot:
|
||||||
case AuraType.ModStun:
|
case AuraType.ModStun:
|
||||||
case AuraType.Transform:
|
case AuraType.Transform:
|
||||||
case AuraType.SpellMagnet:
|
case AuraType.SpellMagnet:
|
||||||
case AuraType.SchoolAbsorb:
|
case AuraType.SchoolAbsorb:
|
||||||
case AuraType.ModStealth:
|
|
||||||
case AuraType.ModRoot2:
|
case AuraType.ModRoot2:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user