Ejemplo n.º 1
0
 /// <summary>
 /// Add Spells which, when casted by others on the owner of this Aura, can cause it to trigger it's procs
 /// Don't add damage spells (they will generate a Proc event anyway).
 /// </summary>
 public void AddTargetProcSpells(params Spell[] spells)
 {
     if (TargetProcSpells == null)
     {
         TargetProcSpells = new HashSet <Spell>();
     }
     foreach (var spell in spells)
     {
         spell.GeneratesProcEventOnCast = true;
     }
     TargetProcSpells.AddRange(spells);
     //ProcTriggerFlags = ProcTriggerFlags.SpellCast;
 }
Ejemplo n.º 2
0
        public bool CanProcBeTriggeredBy(Unit owner, IUnitAction action, bool active)
        {
            //if (CheckCasterConstraints(owner) != SpellFailedReason.Ok)
            //{
            //    return false;
            //}

            if (action.Spell != null)
            {
                if (active)
                {
                    // owner == attacker
                    if (CasterProcSpells != null)
                    {
                        return(CasterProcSpells.Contains(action.Spell));
                    }
                }
                else if (TargetProcSpells != null)
                {
                    // owner == victim
                    return(TargetProcSpells.Contains(action.Spell));
                }
                if (action.Spell == this)
                {
                    // Proc spell can't trigger itself
                    return(false);
                }
            }

            if (RequiredItemClass != ItemClass.None)
            {
                // check for weapon
                if (!(action is DamageAction))
                {
                    return(false);
                }

                var aAction = (DamageAction)action;
                if (aAction.Weapon == null || !(aAction.Weapon is Item))
                {
                    return(false);
                }

                var weapon = ((Item)aAction.Weapon).Template;

                return(weapon.Class == RequiredItemClass &&
                       (RequiredItemSubClassMask == 0 || weapon.SubClassMask.HasAnyFlag(RequiredItemSubClassMask)));
            }
            return(true);
        }