Core/Auras: Proc flag updates

Port From (https://github.com/TrinityCore/TrinityCore/commit/02979daf761a5122efa7b8fa3e70509ecd69789e)
This commit is contained in:
hondacrx
2022-05-07 22:41:24 -04:00
parent 655a4f9857
commit f67434306f
10 changed files with 164 additions and 129 deletions
+42 -39
View File
@@ -2434,45 +2434,48 @@ namespace Framework.Constants
{
None = 0x0,
Killed = 0x01, // 00 Killed by agressor - not sure about this flag
Heartbeat = 0x01, // 00 Killed by agressor - not sure about this flag
Kill = 0x02, // 01 Kill target (in most cases need XP/Honor reward)
DoneMeleeAutoAttack = 0x04, // 02 Done melee auto attack
TakenMeleeAutoAttack = 0x08, // 03 Taken melee auto attack
DealMeleeSwing = 0x04, // 02 Done melee auto attack
TakeMeleeSwing = 0x08, // 03 Taken melee auto attack
DoneSpellMeleeDmgClass = 0x10, // 04 Done attack by Spell that has dmg class melee
TakenSpellMeleeDmgClass = 0x20, // 05 Taken attack by Spell that has dmg class melee
DealMeleeAbility = 0x10, // 04 Done attack by Spell that has dmg class melee
TakeMeleeAbility = 0x20, // 05 Taken attack by Spell that has dmg class melee
DoneRangedAutoAttack = 0x40, // 06 Done ranged auto attack
TakenRangedAutoAttack = 0x80, // 07 Taken ranged auto attack
DealRangedAttack = 0x40, // 06 Done ranged auto attack
TakeRangedAttack = 0x80, // 07 Taken ranged auto attack
DoneSpellRangedDmgClass = 0x100, // 08 Done attack by Spell that has dmg class ranged
TakenSpellRangedDmgClass = 0x200, // 09 Taken attack by Spell that has dmg class ranged
DealRangedAbility = 0x100, // 08 Done attack by Spell that has dmg class ranged
TakeRangedAbility = 0x200, // 09 Taken attack by Spell that has dmg class ranged
DoneSpellNoneDmgClassPos = 0x400, // 10 Done positive spell that has dmg class none
TakenSpellNoneDmgClassPos = 0x800, // 11 Taken positive spell that has dmg class none
DealHelpfulAbility = 0x400, // 10 Done positive spell that has dmg class none
TakeHelpfulAbility = 0x800, // 11 Taken positive spell that has dmg class none
DoneSpellNoneDmgClassNeg = 0x1000, // 12 Done negative spell that has dmg class none
TakenSpellNoneDmgClassNeg = 0x2000, // 13 Taken negative spell that has dmg class none
DealHarmfulAbility = 0x1000, // 12 Done negative spell that has dmg class none
TakeHarmfulAbility = 0x2000, // 13 Taken negative spell that has dmg class none
DoneSpellMagicDmgClassPos = 0x4000, // 14 Done positive spell that has dmg class magic
TakenSpellMagicDmgClassPos = 0x8000, // 15 Taken positive spell that has dmg class magic
DealHelpfulSpell = 0x4000, // 14 Done positive spell that has dmg class magic
TakeHelpfulSpell = 0x8000, // 15 Taken positive spell that has dmg class magic
DoneSpellMagicDmgClassNeg = 0x10000, // 16 Done negative spell that has dmg class magic
TakenSpellMagicDmgClassNeg = 0x20000, // 17 Taken negative spell that has dmg class magic
DealHarmfulSpell = 0x10000, // 16 Done negative spell that has dmg class magic
TakeHarmfulSpell = 0x20000, // 17 Taken negative spell that has dmg class magic
DonePeriodic = 0x40000, // 18 Successful do periodic (damage / healing)
TakenPeriodic = 0x80000, // 19 Taken spell periodic (damage / healing)
DealHarmfulPeriodic = 0x40000, // 18 Successful do periodic damage
TakeHarmfulPeriodic = 0x80000, // 19 Taken spell periodic damage
TakenDamage = 0x100000, // 20 Taken any damage
DoneTrapActivation = 0x200000, // 21 On trap activation (possibly needs name change to ONGAMEOBJECTCAST or USE)
TakeAnyDamage = 0x100000, // 20 Taken any damage
DoneMainHandAttack = 0x400000, // 22 Done main-hand melee attacks (spell and autoattack)
DoneOffHandAttack = 0x800000, // 23 Done off-hand melee attacks (spell and autoattack)
DealHelpfulPeriodic = 0x200000, // 21 On trap activation (possibly needs name change to ONGAMEOBJECTCAST or USE)
MainHandWeaponSwing = 0x400000, // 22 Done main-hand melee attacks (spell and autoattack)
OffHandWeaponSwing = 0x800000, // 23 Done off-hand melee attacks (spell and autoattack)
Death = 0x1000000, // 24 Died in any way
Jump = 0x02000000, // 25 Jumped
CloneSpell = 0x4000000, // 26 Proc Clone Spell
EnterCombat = 0x08000000, // 27 Entered combat
EncounterStart = 0x10000000, // 28 Encounter started
@@ -2482,30 +2485,30 @@ namespace Framework.Constants
TakeHelpfulPeriodic = 0x80000000, // 31 Take Helpful Periodic
// flag masks
AutoAttackMask = DoneMeleeAutoAttack | TakenMeleeAutoAttack | DoneRangedAutoAttack | TakenRangedAutoAttack,
AutoAttackMask = DealMeleeSwing | TakeMeleeSwing | DealRangedAttack | TakeRangedAttack,
MeleeMask = DoneMeleeAutoAttack | TakenMeleeAutoAttack | DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass
| DoneMainHandAttack | DoneOffHandAttack,
MeleeMask = DealMeleeSwing | TakeMeleeSwing | DealMeleeAbility | TakeMeleeAbility
| MainHandWeaponSwing | OffHandWeaponSwing,
RangedMask = DoneRangedAutoAttack | TakenRangedAutoAttack | DoneSpellRangedDmgClass | TakenSpellRangedDmgClass,
RangedMask = DealRangedAttack | TakeRangedAttack | DealRangedAbility | TakeRangedAbility,
SpellMask = DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass | DoneRangedAutoAttack | TakenRangedAutoAttack
| DoneSpellRangedDmgClass | TakenSpellRangedDmgClass | DoneSpellNoneDmgClassPos | TakenSpellNoneDmgClassPos
| DoneSpellNoneDmgClassNeg | TakenSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | TakenSpellMagicDmgClassPos
| DoneSpellMagicDmgClassNeg | TakenSpellMagicDmgClassNeg | DonePeriodic | TakenPeriodic | DoneTrapActivation,
SpellMask = DealMeleeAbility | TakeMeleeAbility | DealRangedAttack | TakeRangedAttack
| DealRangedAbility | TakeRangedAbility | DealHelpfulAbility | TakeHelpfulAbility
| DealHarmfulAbility | TakeHarmfulAbility | DealHelpfulSpell | TakeHelpfulSpell
| DealHarmfulSpell | TakeHarmfulSpell | DealHarmfulPeriodic | TakeHarmfulPeriodic | DealHelpfulPeriodic | TakeHelpfulPeriodic,
DoneHitMask = DoneMeleeAutoAttack | DoneRangedAutoAttack | DoneSpellMeleeDmgClass | DoneSpellRangedDmgClass
| DoneSpellNoneDmgClassPos | DoneSpellNoneDmgClassNeg | DoneSpellMagicDmgClassPos | DoneSpellMagicDmgClassNeg
| DonePeriodic | DoneTrapActivation | DoneMainHandAttack | DoneOffHandAttack,
DoneHitMask = DealMeleeSwing | DealRangedAttack | DealMeleeAbility | DealRangedAbility
| DealHelpfulAbility | DealHarmfulAbility | DealHelpfulSpell | DealHarmfulSpell
| DealHarmfulPeriodic | DealHelpfulPeriodic | MainHandWeaponSwing | OffHandWeaponSwing,
TakenHitMask = TakenMeleeAutoAttack | TakenRangedAutoAttack | TakenSpellMeleeDmgClass | TakenSpellRangedDmgClass
| TakenSpellNoneDmgClassPos | TakenSpellNoneDmgClassNeg | TakenSpellMagicDmgClassPos | TakenSpellMagicDmgClassNeg
| TakenPeriodic | TakenDamage,
TakenHitMask = TakeMeleeSwing | TakeRangedAttack | TakeMeleeAbility | TakeRangedAbility
| TakeHelpfulAbility | TakeHarmfulAbility | TakeHelpfulSpell | TakeHarmfulSpell
| TakeHarmfulPeriodic | TakeAnyDamage,
ReqSpellPhaseMask = SpellMask & DoneHitMask,
MeleeBasedTriggerMask = (DoneMeleeAutoAttack | TakenMeleeAutoAttack | DoneSpellMeleeDmgClass | TakenSpellMeleeDmgClass |
DoneRangedAutoAttack | TakenRangedAutoAttack | DoneSpellRangedDmgClass | TakenSpellRangedDmgClass)
MeleeBasedTriggerMask = (DealMeleeSwing | TakeMeleeSwing | DealMeleeAbility | TakeMeleeAbility |
DealRangedAttack | TakeRangedAttack | DealRangedAbility | TakeRangedAbility)
}
public enum ProcFlags2
@@ -5873,6 +5873,8 @@ namespace Game.Entities
Item pItem = StoreNewItem(dest, lootItem.itemid, true, lootItem.randomBonusListId, null, lootItem.context, lootItem.BonusListIDs);
SendNewItem(pItem, lootItem.count, false, createdByPlayer, broadcast);
}
Unit.ProcSkillsAndAuras(this, null, new ProcFlagsInit(ProcFlags.Looted), new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, null, null, null);
}
public byte GetInventorySlotCount() { return m_activePlayerData.NumBackpackSlots; }
+6 -6
View File
@@ -798,7 +798,7 @@ namespace Game.Entities
if (!victim.IsCritter())
{
ProcSkillsAndAuras(attacker, victim, new ProcFlagsInit(ProcFlags.Kill), new ProcFlagsInit(ProcFlags.Killed), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, null, null, null);
ProcSkillsAndAuras(attacker, victim, new ProcFlagsInit(ProcFlags.Kill), new ProcFlagsInit(ProcFlags.Heartbeat), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, null, null, null);
if (player != null && player.GetGroup() != null)
{
for (GroupReference itr = player.GetGroup().GetFirstMember(); itr != null; itr = itr.Next())
@@ -1053,12 +1053,12 @@ namespace Game.Entities
switch (attackType)
{
case WeaponAttackType.BaseAttack:
damageInfo.ProcAttacker = new ProcFlagsInit(ProcFlags.DoneMeleeAutoAttack | ProcFlags.DoneMainHandAttack);
damageInfo.ProcVictim = new ProcFlagsInit(ProcFlags.TakenMeleeAutoAttack);
damageInfo.ProcAttacker = new ProcFlagsInit(ProcFlags.DealMeleeSwing | ProcFlags.MainHandWeaponSwing);
damageInfo.ProcVictim = new ProcFlagsInit(ProcFlags.TakeMeleeSwing);
break;
case WeaponAttackType.OffAttack:
damageInfo.ProcAttacker = new ProcFlagsInit(ProcFlags.DoneMeleeAutoAttack | ProcFlags.DoneOffHandAttack);
damageInfo.ProcVictim = new ProcFlagsInit(ProcFlags.TakenMeleeAutoAttack);
damageInfo.ProcAttacker = new ProcFlagsInit(ProcFlags.DealMeleeSwing | ProcFlags.OffHandWeaponSwing);
damageInfo.ProcVictim = new ProcFlagsInit(ProcFlags.TakeMeleeSwing);
damageInfo.HitInfo = HitInfo.OffHand;
break;
default:
@@ -1197,7 +1197,7 @@ namespace Game.Entities
// Calculate absorb resist
if (damageInfo.Damage > 0)
{
damageInfo.ProcVictim.Or(ProcFlags.TakenDamage);
damageInfo.ProcVictim.Or(ProcFlags.TakeAnyDamage);
// Calculate absorb & resists
DamageInfo dmgInfo = new(damageInfo);
CalcAbsorbResist(dmgInfo);
+1 -1
View File
@@ -3513,7 +3513,7 @@ namespace Game.Entities
caster.SendSpellNonMeleeDamageLog(log);
// break 'Fear' and similar auras
ProcSkillsAndAuras(damageInfo.GetAttacker(), caster, new ProcFlagsInit(ProcFlags.None), new ProcFlagsInit(ProcFlags.TakenSpellMagicDmgClassNeg), ProcFlagsSpellType.Damage, ProcFlagsSpellPhase.Hit, ProcFlagsHit.None, null, damageInfo, null);
ProcSkillsAndAuras(damageInfo.GetAttacker(), caster, new ProcFlagsInit(ProcFlags.None), new ProcFlagsInit(ProcFlags.TakeHarmfulSpell), ProcFlagsSpellType.Damage, ProcFlagsSpellPhase.Hit, ProcFlagsHit.None, null, damageInfo, null);
}
}
}
+3 -1
View File
@@ -23,7 +23,7 @@ using Game.Loots;
using Game.Maps;
using Game.Networking;
using Game.Networking.Packets;
using System;
using Game.Spells;
using System.Collections.Generic;
namespace Game
@@ -109,6 +109,8 @@ namespace Game
player.UpdateCriteria(CriteriaType.LootAnyItem, resultValue.item.GetEntry(), resultValue.count);
}
}
Unit.ProcSkillsAndAuras(player, null, new ProcFlagsInit(ProcFlags.Looted), new ProcFlagsInit(), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, null, null, null);
}
[WorldPacketHandler(ClientOpcodes.LootMoney)]
+13 -13
View File
@@ -5065,14 +5065,14 @@ namespace Game.Spells
Unit.DealDamageMods(caster, target, ref damage, ref absorb);
// Set trigger flag
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DonePeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakenPeriodic);
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic);
ProcFlagsHit hitMask = damageInfo.GetHitMask();
if (damage != 0)
{
hitMask |= crit ? ProcFlagsHit.Critical : ProcFlagsHit.Normal;
procVictim.Or(ProcFlags.TakenDamage);
procVictim.Or(ProcFlags.TakeAnyDamage);
}
int overkill = (int)(damage - target.GetHealth());
@@ -5156,14 +5156,14 @@ namespace Game.Spells
log.HitInfo |= HitInfo.CriticalHit;
// Set trigger flag
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DonePeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakenPeriodic);
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic);
ProcFlagsHit hitMask = damageInfo.GetHitMask();
if (damage != 0)
{
hitMask |= crit ? ProcFlagsHit.Critical : ProcFlagsHit.Normal;
procVictim.Or(ProcFlags.TakenDamage);
procVictim.Or(ProcFlags.TakeAnyDamage);
}
int new_damage = (int)Unit.DealDamage(caster, target, damage, cleanDamage, DamageEffectType.DOT, GetSpellInfo().GetSchoolMask(), GetSpellInfo(), false);
@@ -5182,7 +5182,7 @@ namespace Game.Spells
caster.HealBySpell(healInfo);
caster.GetThreatManager().ForwardThreatForAssistingMe(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
Unit.ProcSkillsAndAuras(caster, caster, new ProcFlagsInit(ProcFlags.DonePeriodic), new ProcFlagsInit(ProcFlags.TakenPeriodic), ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.Hit, hitMask, null, null, healInfo);
Unit.ProcSkillsAndAuras(caster, caster, new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic), new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic), ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.Hit, hitMask, null, null, healInfo);
caster.SendSpellNonMeleeDamageLog(log);
}
@@ -5214,7 +5214,7 @@ namespace Game.Spells
HealInfo healInfo = new(caster, target, damage, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.HealBySpell(healInfo);
Unit.ProcSkillsAndAuras(caster, target, new ProcFlagsInit(ProcFlags.DonePeriodic), new ProcFlagsInit(ProcFlags.TakenPeriodic), ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.Hit, ProcFlagsHit.Normal, null, null, healInfo);
Unit.ProcSkillsAndAuras(caster, target, new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic), new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic), ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.Hit, ProcFlagsHit.Normal, null, null, healInfo);
}
void HandlePeriodicHealAurasTick(Unit target, Unit caster)
@@ -5271,8 +5271,8 @@ namespace Game.Spells
if (GetAuraType() == AuraType.ObsModHealth)
return;
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DonePeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakenPeriodic);
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic);
ProcFlagsHit hitMask = crit ? ProcFlagsHit.Critical : ProcFlagsHit.Normal;
// ignore item heals
if (GetBase().GetCastItemGUID().IsEmpty())
@@ -5426,13 +5426,13 @@ namespace Game.Spells
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
// Set trigger flag
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DonePeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakenPeriodic);
ProcFlagsInit procAttacker = new ProcFlagsInit(ProcFlags.DealHarmfulPeriodic);
ProcFlagsInit procVictim = new ProcFlagsInit(ProcFlags.TakeHarmfulPeriodic);
ProcFlagsHit hitMask = Unit.CreateProcHitMask(damageInfo, SpellMissInfo.None);
ProcFlagsSpellType spellTypeMask = ProcFlagsSpellType.NoDmgHeal;
if (damageInfo.damage != 0)
{
procVictim.Or(ProcFlags.TakenDamage);
procVictim.Or(ProcFlags.TakeAnyDamage);
spellTypeMask |= ProcFlagsSpellType.Damage;
}
+89 -54
View File
@@ -1703,24 +1703,24 @@ namespace Game.Spells
switch (m_spellInfo.DmgClass)
{
case SpellDmgClass.Melee:
m_procAttacker = new ProcFlagsInit(ProcFlags.DoneSpellMeleeDmgClass);
m_procAttacker = new ProcFlagsInit(ProcFlags.DealMeleeAbility);
if (m_attackType == WeaponAttackType.OffAttack)
m_procAttacker.Or(ProcFlags.DoneOffHandAttack);
m_procAttacker.Or(ProcFlags.OffHandWeaponSwing);
else
m_procAttacker.Or(ProcFlags.DoneMainHandAttack);
m_procVictim = new ProcFlagsInit(ProcFlags.TakenSpellMeleeDmgClass);
m_procAttacker.Or(ProcFlags.MainHandWeaponSwing);
m_procVictim = new ProcFlagsInit(ProcFlags.TakeMeleeAbility);
break;
case SpellDmgClass.Ranged:
// Auto attack
if (m_spellInfo.HasAttribute(SpellAttr2.AutorepeatFlag))
{
m_procAttacker = new ProcFlagsInit(ProcFlags.DoneRangedAutoAttack);
m_procVictim = new ProcFlagsInit(ProcFlags.TakenRangedAutoAttack);
m_procAttacker = new ProcFlagsInit(ProcFlags.DealRangedAttack);
m_procVictim = new ProcFlagsInit(ProcFlags.TakeRangedAttack);
}
else // Ranged spell attack
{
m_procAttacker = new ProcFlagsInit(ProcFlags.DoneSpellRangedDmgClass);
m_procVictim = new ProcFlagsInit(ProcFlags.TakenSpellRangedDmgClass);
m_procAttacker = new ProcFlagsInit(ProcFlags.DealRangedAbility);
m_procVictim = new ProcFlagsInit(ProcFlags.TakeRangedAbility);
}
break;
default:
@@ -1728,32 +1728,13 @@ namespace Game.Spells
Convert.ToBoolean(m_spellInfo.EquippedItemSubClassMask & (1 << (int)ItemSubClassWeapon.Wand))
&& m_spellInfo.HasAttribute(SpellAttr2.AutorepeatFlag)) // Wands auto attack
{
m_procAttacker = new ProcFlagsInit(ProcFlags.DoneRangedAutoAttack);
m_procVictim = new ProcFlagsInit(ProcFlags.TakenRangedAutoAttack);
m_procAttacker = new ProcFlagsInit(ProcFlags.DealRangedAttack);
m_procVictim = new ProcFlagsInit(ProcFlags.TakeRangedAttack);
}
break;
// For other spells trigger procflags are set in Spell::TargetInfo::DoDamageAndTriggers
// Because spell positivity is dependant on target
}
// 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
m_spellInfo.SpellFamilyFlags[2].HasAnyFlag(0x00024000u))) // Explosive and Immolation Trap
{
m_procAttacker.Or(ProcFlags.DoneTrapActivation);
// also fill up other flags (TargetInfo::DoDamageAndTriggers only fills up flag if both are not set)
m_procAttacker.Or(ProcFlags.DoneSpellMagicDmgClassNeg);
m_procVictim.Or(ProcFlags.TakenSpellMagicDmgClassNeg);
}
// Hellfire Effect - trigger as DOT
if (m_spellInfo.SpellFamilyName == SpellFamilyNames.Warlock && m_spellInfo.SpellFamilyFlags[0].HasAnyFlag(0x00000040u))
{
m_procAttacker = new ProcFlagsInit(ProcFlags.DonePeriodic);
m_procVictim = new ProcFlagsInit(ProcFlags.TakenPeriodic);
}
}
public void CleanupTargetList()
@@ -2885,10 +2866,27 @@ namespace Game.Spells
ProcFlagsInit procAttacker = m_procAttacker;
if (!procAttacker)
{
if (m_spellInfo.DmgClass == SpellDmgClass.Magic)
procAttacker = new ProcFlagsInit(IsPositive() ? ProcFlags.DoneSpellMagicDmgClassPos : ProcFlags.DoneSpellMagicDmgClassNeg);
if (m_spellInfo.HasAttribute(SpellAttr3.TreatAsPeriodic))
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulPeriodic);
else
procAttacker.Or(ProcFlags.DealHarmfulPeriodic);
}
else if (m_spellInfo.HasAttribute(SpellAttr0.Ability))
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulAbility);
else
procAttacker.Or(ProcFlags.DealHarmfulSpell);
}
else
procAttacker = new ProcFlagsInit(IsPositive() ? ProcFlags.DoneSpellNoneDmgClassPos : ProcFlags.DoneSpellNoneDmgClassNeg);
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulSpell);
else
procAttacker.Or(ProcFlags.DealHarmfulSpell);
}
}
procAttacker.Or(ProcFlags2.CastSuccessful);
@@ -3149,10 +3147,27 @@ namespace Game.Spells
ProcFlagsInit procAttacker = m_procAttacker;
if (!procAttacker)
{
if (m_spellInfo.DmgClass == SpellDmgClass.Magic)
procAttacker = new ProcFlagsInit(IsPositive() ? ProcFlags.DoneSpellMagicDmgClassPos : ProcFlags.DoneSpellMagicDmgClassNeg);
if (m_spellInfo.HasAttribute(SpellAttr3.TreatAsPeriodic))
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulPeriodic);
else
procAttacker.Or(ProcFlags.DealHarmfulPeriodic);
}
else if (m_spellInfo.HasAttribute(SpellAttr0.Ability))
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulAbility);
else
procAttacker.Or(ProcFlags.DealHarmfulAbility);
}
else
procAttacker = new ProcFlagsInit(IsPositive() ? ProcFlags.DoneSpellNoneDmgClassPos : ProcFlags.DoneSpellNoneDmgClassNeg);
{
if (IsPositive())
procAttacker.Or(ProcFlags.DealHelpfulSpell);
else
procAttacker.Or(ProcFlags.DealHarmfulSpell);
}
}
Unit.ProcSkillsAndAuras(m_originalCaster, null, procAttacker, new ProcFlagsInit(ProcFlags.None), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Finish, m_hitMask, this, null, null);
@@ -3294,6 +3309,8 @@ namespace Game.Spells
if (creatureCaster != null)
creatureCaster.ReleaseSpellFocus(this);
Unit.ProcSkillsAndAuras(unitCaster, null, new ProcFlagsInit(ProcFlags.CastEnded), new ProcFlagsInit(), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.None, ProcFlagsHit.None, this, null, null);
if (!ok)
return;
@@ -8225,28 +8242,46 @@ namespace Game.Spells
switch (spell.m_spellInfo.DmgClass)
{
case SpellDmgClass.Magic:
if (positive)
{
procAttacker.Or(ProcFlags.DoneSpellMagicDmgClassPos);
procVictim.Or(ProcFlags.TakenSpellMagicDmgClassPos);
}
else
{
procAttacker.Or(ProcFlags.DoneSpellMagicDmgClassNeg);
procVictim.Or(ProcFlags.TakenSpellMagicDmgClassNeg);
}
break;
case SpellDmgClass.None:
if (positive)
case SpellDmgClass.Magic:
if (spell.m_spellInfo.HasAttribute(SpellAttr3.TreatAsPeriodic))
{
procAttacker.Or(ProcFlags.DoneSpellNoneDmgClassPos);
procVictim.Or(ProcFlags.TakenSpellNoneDmgClassPos);
if (positive)
{
procAttacker.Or(ProcFlags.DealHelpfulPeriodic);
procVictim.Or(ProcFlags.TakeHelpfulPeriodic);
}
else
{
procAttacker.Or(ProcFlags.DealHarmfulPeriodic);
procVictim.Or(ProcFlags.TakeHarmfulPeriodic);
}
}
else if (spell.m_spellInfo.HasAttribute(SpellAttr0.Ability))
{
if (positive)
{
procAttacker.Or(ProcFlags.DealHelpfulAbility);
procVictim.Or(ProcFlags.TakeHelpfulAbility);
}
else
{
procAttacker.Or(ProcFlags.DealHarmfulAbility);
procVictim.Or(ProcFlags.TakeHarmfulAbility);
}
}
else
{
procAttacker.Or(ProcFlags.DoneSpellNoneDmgClassNeg);
procVictim.Or(ProcFlags.TakenSpellNoneDmgClassNeg);
if (positive)
{
procAttacker.Or(ProcFlags.DealHelpfulSpell);
procVictim.Or(ProcFlags.TakeHelpfulSpell);
}
else
{
procAttacker.Or(ProcFlags.DealHarmfulSpell);
procVictim.Or(ProcFlags.TakeHarmfulSpell);
}
}
break;
}
@@ -8299,7 +8334,7 @@ namespace Game.Spells
Unit.DealDamageMods(damageInfo.attacker, damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
hitMask |= Unit.CreateProcHitMask(damageInfo, MissCondition);
procVictim.Or(ProcFlags.TakenDamage);
procVictim.Or(ProcFlags.TakeAnyDamage);
spell.m_damage = (int)damageInfo.damage;
@@ -8931,7 +8966,7 @@ namespace Game.Spells
return true;
ProcFlags typeMaskActor = ProcFlags.None;
ProcFlags typeMaskActionTarget = ProcFlags.TakenSpellMagicDmgClassNeg | ProcFlags.TakenSpellNoneDmgClassNeg;
ProcFlags typeMaskActionTarget = ProcFlags.TakeHarmfulSpell | ProcFlags.TakeHarmfulAbility;
ProcFlagsSpellType spellTypeMask = ProcFlagsSpellType.Damage | ProcFlagsSpellType.NoDmgHeal;
ProcFlagsSpellPhase spellPhaseMask = ProcFlagsSpellPhase.None;
ProcFlagsHit hitMask = ProcFlagsHit.Reflect;
+4 -11
View File
@@ -2620,17 +2620,10 @@ namespace Game.Spells
|| (spell.GetState() == SpellState.Preparing && spell.GetCastTime() > 0.0f))
&& curSpellInfo.CanBeInterrupted(m_caster, unitTarget))
{
Unit unitCaster = GetUnitCasterForEffectHandlers();
if (unitCaster != null)
{
int duration = m_spellInfo.GetDuration();
duration = unitTarget.ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1u << (int)effectInfo.EffectIndex);
unitTarget.GetSpellHistory().LockSpellSchool(curSpellInfo.GetSchoolMask(), TimeSpan.FromMilliseconds(duration));
if (m_spellInfo.DmgClass == SpellDmgClass.Magic)
Unit.ProcSkillsAndAuras(unitCaster, unitTarget, new ProcFlagsInit(ProcFlags.DoneSpellMagicDmgClassNeg), new ProcFlagsInit(ProcFlags.TakenSpellMagicDmgClassNeg), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Hit, ProcFlagsHit.Interrupt, null, null, null);
else if (m_spellInfo.DmgClass == SpellDmgClass.Melee)
Unit.ProcSkillsAndAuras(unitCaster, unitTarget, new ProcFlagsInit(ProcFlags.DoneSpellMeleeDmgClass), new ProcFlagsInit(ProcFlags.TakenSpellMeleeDmgClass), ProcFlagsSpellType.MaskAll, ProcFlagsSpellPhase.Hit, ProcFlagsHit.Interrupt, null, null, null);
}
int duration = m_spellInfo.GetDuration();
duration = unitTarget.ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1u << (int)effectInfo.EffectIndex);
unitTarget.GetSpellHistory().LockSpellSchool(curSpellInfo.GetSchoolMask(), TimeSpan.FromMilliseconds(duration));
m_hitMask |= ProcFlagsHit.Interrupt;
SendSpellInterruptLog(unitTarget, curSpellInfo.Id);
unitTarget.InterruptSpell(i, false);
}
+1 -1
View File
@@ -484,7 +484,7 @@ namespace Game.Entities
}
// always trigger for these types
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.Killed | ProcFlags.Kill | ProcFlags.Death))
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.Heartbeat | ProcFlags.Kill | ProcFlags.Death))
return true;
// check school mask (if set) for other trigger types
+3 -3
View File
@@ -1498,7 +1498,7 @@ namespace Scripts.Spells.Items
void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
{
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneRangedAutoAttack | ProcFlags.DoneSpellRangedDmgClass))
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DealRangedAttack | ProcFlags.DealRangedAbility))
{
// in that case, do not cast heal spell
PreventDefaultAction();
@@ -3191,10 +3191,10 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActor();
Unit target = eventInfo.GetProcTarget();
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneSpellMagicDmgClassPos))
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DealHelpfulSpell))
caster.CastSpell(target, _healProcSpellId, new CastSpellExtraArgs(aurEff));
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DoneSpellMagicDmgClassNeg))
if (eventInfo.GetTypeMask().HasFlag(ProcFlags.DealHarmfulSpell))
caster.CastSpell(target, _damageProcSpellId, new CastSpellExtraArgs(aurEff));
}