예제 #1
0
        /// <summary>
        /// Adds a set of spells to this Effect's AffectMask, which is used to determine whether
        /// a certain Spell and this effect have some kind of influence on one another (for procs, talent modifiers etc).
        /// Usually the mask also contains any spell that is triggered by the original spell.
        ///
        /// If you get a warning that the wrong set is affected, use AddAffectingSpells instead.
        /// </summary>
        public void AddToAffectMask(params SpellLineId[] abilities)
        {
            uint[] mask = new uint[3];
            if (abilities.Length != 1)
            {
                foreach (SpellLineId ability in abilities)
                {
                    Spell firstRank = ability.GetLine().FirstRank;
                    for (int index = 0; index < 3; ++index)
                    {
                        mask[index] |= firstRank.SpellClassMask[index];
                    }
                }
            }
            else
            {
                abilities[0].GetLine().FirstRank.SpellClassMask.CopyTo(mask, 0);
            }

            HashSet <SpellLine> affectedSpellLines = SpellHandler.GetAffectedSpellLines(Spell.ClassId, mask);

            if (affectedSpellLines.Count != abilities.Length)
            {
                LogManager.GetCurrentClassLogger().Warn(
                    "[SPELL Inconsistency for {0}] Invalid affect mask affects a different set than the one intended: {1} (intended: {2}) - You might want to use AddAffectingSpells instead!",
                    Spell, affectedSpellLines.ToString(", "),
                    abilities.ToString(", "));
            }
            for (int index = 0; index < 3; ++index)
            {
                AffectMask[index] |= mask[index];
            }
        }
예제 #2
0
        /// <summary>
        /// Adds a set of spells to this Effect's AffectMask, which is used to determine whether
        /// a certain Spell and this effect have some kind of influence on one another (for procs, talent modifiers etc).
        /// Usually the mask also contains any spell that is triggered by the original spell.
        ///
        /// If you get a warning that the wrong set is affected, use AddAffectingSpells instead.
        /// </summary>
        public void AddToAffectMask(params SpellLineId[] abilities)
        {
            var newMask = new uint[SpellConstants.SpellClassMaskSize];

            // build new mask from abilities
            if (abilities.Length != 1)
            {
                foreach (var ability in abilities)
                {
                    var spell = SpellLines.GetLine(ability).FirstRank;
                    for (int i = 0; i < SpellConstants.SpellClassMaskSize; i++)
                    {
                        newMask[i] |= spell.SpellClassMask[i];
                    }
                }
            }
            else
            {
                SpellLines.GetLine(abilities[0]).FirstRank.SpellClassMask.CopyTo(newMask, 0);
            }

            // verification
            var affectedLines = SpellHandler.GetAffectedSpellLines(Spell.ClassId, newMask);

            if (affectedLines.Count != abilities.Length)
            {
                LogManager.GetCurrentClassLogger().Warn("[SPELL Inconsistency for {0}] " +
                                                        "Invalid affect mask affects a different set than the one intended: {1} (intended: {2}) - " +
                                                        "You might want to use AddAffectingSpells instead!",
                                                        Spell, affectedLines.ToString(", "), abilities.ToString(", "));
            }

            for (int i = 0; i < SpellConstants.SpellClassMaskSize; i++)
            {
                AffectMask[i] |= newMask[i];
            }
        }