workaround stealth interaction with Death and Decay and GameObject casts

This commit is contained in:
hondacrx
2017-11-13 13:12:07 -05:00
parent a5e8da2a57
commit 7edcdb6ea2
3 changed files with 22 additions and 9 deletions
+2 -1
View File
@@ -2916,7 +2916,8 @@ namespace Game.Entities
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
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;
// can't attack dead
+15 -7
View File
@@ -1549,13 +1549,17 @@ namespace Game.Spells
m_hitMask = ProcFlagsHit.None;
// Hunter trap spells - activation proc for Lock and Load, Entrapment and Misdirection
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Hunter &&
(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
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Hunter && (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.SpellFamilyFlags[2].HasAnyFlag(0x00024000u))) // Explosive and Immolation Trap
{
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
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Warlock && m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000040u))
{
@@ -1586,7 +1590,7 @@ namespace Game.Spells
return;
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;
// 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)))
{
// 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)
return castResult;
}
@@ -4493,7 +4501,7 @@ namespace Game.Spells
Unit unitTarget = m_targets.GetUnitTarget();
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)
return castResult;
+5 -1
View File
@@ -2330,6 +2330,9 @@ namespace Game.Entities
case 44544: // Fingers of Frost
spellInfo.GetEffect(0).SpellClassMask = new FlagArray128(685904631, 1151048, 0, 0);
break;
case 52212: // Death and Decay
spellInfo.AttributesEx6 |= SpellAttr6.CanTargetInvisible;
break;
case 37408: // Oscillation Field
spellInfo.AttributesEx3 |= SpellAttr3.StackForDiffCasters;
break;
@@ -2839,13 +2842,14 @@ namespace Game.Entities
switch (type)
{
case AuraType.OverrideClassScripts:
case AuraType.ModStealth:
case AuraType.ModConfuse:
case AuraType.ModFear:
case AuraType.ModRoot:
case AuraType.ModStun:
case AuraType.Transform:
case AuraType.SpellMagnet:
case AuraType.SchoolAbsorb:
case AuraType.ModStealth:
case AuraType.ModRoot2:
return true;
}