示例#1
0
        /// <summary>
        /// Defines a set of Auras that are mutually exclusive
        /// </summary>
        public static uint AddAuraGroup(SpellLineId auraLine, SpellLineId auraLine2, params SpellId[] auras)
        {
            var uid  = GetNextAuraUID();
            var line = auraLine.GetLine();

            line.AuraUID = uid;
            foreach (var spell in line)
            {
                spell.AuraUID = uid;
            }
            line         = auraLine2.GetLine();
            line.AuraUID = uid;
            foreach (var spell in line)
            {
                spell.AuraUID = uid;
            }
            foreach (var id in auras)
            {
                var spell = SpellHandler.Get(id);
                if (spell == null)
                {
                    throw new ArgumentException("Invalid SpellId: " + id);
                }
                spell.AuraUID = uid;
            }
            return(uid);
        }
示例#2
0
        /// <summary>Defines a set of Auras that are mutually exclusive</summary>
        public static uint AddAuraGroup(SpellLineId auraLine, SpellLineId auraLine2, params SpellId[] auras)
        {
            uint      nextAuraUid = GetNextAuraUID();
            SpellLine line1       = auraLine.GetLine();

            line1.AuraUID = nextAuraUid;
            foreach (Spell spell in line1)
            {
                spell.AuraUID = nextAuraUid;
            }
            SpellLine line2 = auraLine2.GetLine();

            line2.AuraUID = nextAuraUid;
            foreach (Spell spell in line2)
            {
                spell.AuraUID = nextAuraUid;
            }
            foreach (SpellId aura in auras)
            {
                Spell spell = SpellHandler.Get(aura);
                if (spell == null)
                {
                    throw new ArgumentException("Invalid SpellId: " + aura);
                }
                spell.AuraUID = nextAuraUid;
            }

            return(nextAuraUid);
        }
示例#3
0
 public static SpellLine GetLine(this SpellLineId id)
 {
     if ((long)id < (long)SpellLines.ById.Length)
     {
         return(SpellLines.ById[(int)id]);
     }
     return((SpellLine)null);
 }
示例#4
0
        /// <summary>
        /// Apply the given action on all Spells with the given ids
        /// </summary>
        /// <param name="action"></param>
        public static void Apply(this SpellLineId id, Action <Spell> action)
        {
            var line = SpellLines.GetLine(id);

            if (line == null)
            {
                throw new Exception("Invalid SpellLineId: " + id);
            }
            Apply(action, line);
        }
        bool CheckBonus(Unit unit, SpellLineId line)
        {
            var bonus = unit.Auras[line];

            if (bonus == null || bonus.CasterReference != Cast.CasterReference)
            {
                return(false);
            }
            return(true);
        }
示例#6
0
        /// <summary>Returns the first visible Aura with the given SpellId</summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Contains(SpellLineId id)
        {
            SpellLine line = id.GetLine();

            if (line != null)
            {
                return(this[line] != null);
            }
            return(false);
        }
示例#7
0
        /// <summary>
        /// Removes and cancels the first Aura of the given SpellLine
        /// </summary>
        public bool Remove(SpellLineId spellLine)
        {
            var aura = this[spellLine];

            if (aura != null)
            {
                aura.Remove();
                return(true);
            }
            return(false);
        }
示例#8
0
        /// <summary>
        /// Removes and cancels the first Aura of the given SpellLine
        /// </summary>
        public bool Remove(SpellLineId spellLine)
        {
            Aura aura = this[spellLine];

            if (aura == null)
            {
                return(false);
            }
            aura.Remove(true);
            return(true);
        }
示例#9
0
        /// <summary>
        /// Apply the given action on all Spells with the given ids
        /// </summary>
        /// <param name="action"></param>
        public static void Apply(Action <Spell> action, SpellLineId id, params SpellId[] ids)
        {
            var line = SpellLines.GetLine(id);

            if (line == null)
            {
                throw new Exception("Invalid SpellLineId: " + id);
            }
            Apply(action, line);
            Apply(action, (IEnumerable <SpellId>)ids);
        }
示例#10
0
 /// <summary>
 /// Returns the first visible Aura with the given SpellId
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Aura this[SpellLineId id]
 {
     get
     {
         var line = SpellLines.GetLine(id);
         if (line != null)
         {
             return(this[line]);
         }
         return(null);
     }
 }
示例#11
0
        public void ClearCooldown(SpellLineId id, bool alsoClearCategory = true)
        {
            var line = id.GetLine();

            if (line != null)
            {
                foreach (var spell in line)
                {
                    ClearCooldown(spell, alsoClearCategory);
                }
            }
        }
示例#12
0
 public Aura this[SpellLineId id, bool positive]
 {
     get
     {
         SpellLine line = id.GetLine();
         if (line != null)
         {
             return(this[line, positive]);
         }
         return(null);
     }
 }
示例#13
0
        private static void FixRegrowthAndRejuvenation(SpellLineId line)
        {
            line.Apply(spell =>
            {
                // apply the AuraState, so swiftmend can be used (AuraState probably going to be replaced with an invisible Aura in later versions)
                spell.AddAuraEffect(() => new AddTargetAuraStateHandler(AuraStateMask.RejuvenationOrRegrowth));

                var effect = spell.GetEffect(AuraType.PeriodicHeal);

                // TODO: Implement <mult> from "${$m1*5*$<mult>}"
            });
        }
示例#14
0
 /// <summary>Returns the first visible Aura with the given SpellId</summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Aura this[SpellLineId id]
 {
     get
     {
         SpellLine line = id.GetLine();
         if (line != null)
         {
             return(this[line]);
         }
         return((Aura)null);
     }
 }
示例#15
0
        public void ClearCooldown(SpellLineId id, bool alsoClearCategory = true)
        {
            SpellLine line = id.GetLine();

            if (line == null)
            {
                return;
            }
            foreach (Spell cooldownSpell in line)
            {
                this.ClearCooldown(cooldownSpell, alsoClearCategory);
            }
        }
示例#16
0
		public SpellLine(SpellLineId id, params Spell[] spells)
		{
			LineId = id;
			AuraUID =  (uint)id;
			Spells = new List<Spell>();
			if (spells.Length > 0)
			{
				m_firstSpell = spells[0];

				for (var i = 0; i < spells.Length; i++)
				{
					var spell = spells[i];
					AddSpell(spell);
				}
			}
		}
示例#17
0
        public static void MakeRuneConversionProc(SpellLineId line, SpellLineId trigger1, SpellLineId trigger2, RuneType to, params RuneType[] from)
        {
            line.Apply(spell =>
            {
                spell.ProcTriggerFlags = ProcTriggerFlags.DoneHarmfulMagicSpell | ProcTriggerFlags.DoneMeleeSpell;

                var effect = spell.GetEffect(AuraType.Dummy2);
                // should not have an amplitude
                // (although it's probably the timeout for when the death rune is converted back to its original but it's not mentioned in the tooltip)
                effect.Amplitude = 0;

                effect.ClearAffectMask();
                effect.AddAffectingSpells(trigger1, trigger2);
                effect.IsProc = true;
                effect.AuraEffectHandlerCreator = () => new ProcRuneConversionHandler(to, from);
            });
        }
示例#18
0
		public static void MakeRuneConversionProc(SpellLineId line, SpellLineId trigger1, SpellLineId trigger2, RuneType to, params RuneType[] from)
		{
			line.Apply(spell =>
			{
				spell.ProcTriggerFlags = ProcTriggerFlags.SpellCast;

				var effect = spell.GetEffect(AuraType.Dummy2);
				// should not have an amplitude 
				// (although it's probably the timeout for when the death rune is converted back to its original but it's not mentioned in the tooltip)
				effect.Amplitude = 0;

				effect.ClearAffectMask();
				effect.AddAffectingSpells(trigger1, trigger2);
				effect.IsProc = true;
				effect.AuraEffectHandlerCreator = () => new ProcRuneConversionHandler(to, from);
			});
		}
示例#19
0
        private static void FixPassiveDiseaseTalent(SpellLineId passiveSpell, SpellId effectId)
        {
            //  the debuff needs to use the disease talent to apply damage
            SpellEffect passiveEffect = null;

            passiveSpell.Apply(spell =>
            {
                passiveEffect = spell.GetEffect(AuraType.Dummy);
                passiveEffect.APValueFactor      = 0.055f * 1.15f;
                passiveEffect.RealPointsPerLevel = 0;
            });

            SpellHandler.Apply(spell =>
            {
                var dmgEffect = spell.GetEffect(AuraType.PeriodicDamage);
                dmgEffect.EffectValueOverrideEffect = passiveEffect;                            // calculate damage based on the passive spell
            }, effectId);
        }
示例#20
0
 public SpellLine(SpellLineId id, params Spell[] spells)
 {
     LineId  = id;
     AuraUID = (uint)id;
     Spells  = new List <Spell>();
     if (spells.Length <= 0)
     {
         return;
     }
     m_firstSpell = spells[0];
     for (int index = 0; index < spells.Length; ++index)
     {
         Spell spell = spells[index];
         if (spell != null)
         {
             AddSpell(spell);
         }
     }
 }
示例#21
0
		public SpellLine(SpellLineId id, params Spell[] spells)
		{
			LineId = id;
			AuraUID = (uint)id;
			Spells = new List<Spell>();
			if (spells.Length > 0)
			{
				m_firstSpell = spells[0];

				for (var i = 0; i < spells.Length; i++)
				{
					var spell = spells[i];
					if (spell != null)
					{
						AddSpell(spell);
					}
				}
			}
		}
示例#22
0
		public void AddToEffectMask(SpellLineId ability)
		{
			var spell = SpellLines.GetLine(ability).FirstRank;
			for (int i = 0; i < AffectMask.Length; i++)
			{
				AffectMask[i] |= spell.SpellClassMask[i];
			}
		}
示例#23
0
		/// <summary>
		/// Apply the given action on all Spells with the given ids
		/// </summary>
		/// <param name="action"></param>
		public static void Apply(Action<Spell> action, SpellLineId id, SpellLineId id2, params SpellId[] ids)
		{
			var line = SpellLines.GetLine(id);
			if (line == null)
			{
				throw new Exception("Invalid SpellLineId: " + id);
			}
			var line2 = SpellLines.GetLine(id2);
			if (line2 == null)
			{
				throw new Exception("Invalid SpellLineId: " + id2);
			}
			Apply(action, line);
			Apply(action, line2);
			Apply(action, (IEnumerable<SpellId>)ids);
		}
示例#24
0
		public static SpellLine GetLine(SpellLineId id)
		{
			return ById[(int)id];
		}
示例#25
0
		private static void FixPassiveDiseaseTalent(SpellLineId passiveSpell, SpellId effectId)
		{
			//  the debuff needs to use the disease talent to apply damage
			SpellEffect passiveEffect = null;
			passiveSpell.Apply(spell =>
			{
				passiveEffect = spell.GetEffect(AuraType.Dummy);
				passiveEffect.APValueFactor = 0.055f * 1.15f;
				passiveEffect.RealPointsPerLevel = 0;
			});

			SpellHandler.Apply(spell =>
			{
				var dmgEffect = spell.GetEffect(AuraType.PeriodicDamage);
				dmgEffect.EffectValueOverrideEffect = passiveEffect;		// calculate damage based on the passive spell
			}, effectId);
		}
示例#26
0
		bool CheckBonus(Unit unit, SpellLineId line)
		{
			var bonus = unit.Auras[line];
			if (bonus == null || bonus.CasterReference != Cast.CasterReference)
			{
				return false;
			}
			return true;
		}
示例#27
0
		private static void FixRegrowthAndRejuvenation(SpellLineId line)
		{
			line.Apply(spell =>
			{
				// apply the AuraState, so swiftmend can be used (AuraState probably going to be replaced with an invisible Aura in later versions)
				spell.AddAuraEffect(() => new AddTargetAuraStateHandler(AuraStateMask.RejuvenationOrRegrowth));

				var effect = spell.GetEffect(AuraType.PeriodicHeal);

				// TODO: Implement <mult> from "${$m1*5*$<mult>}"
			});
		}
示例#28
0
		public Aura this[SpellLineId id, bool positive]
		{
			get
			{
				var line = SpellLines.GetLine(id);
				if (line != null)
				{
					return this[line, positive];
				}
				return null;
			}
		}
示例#29
0
		/// <summary>
		/// Returns the first visible Aura with the given SpellId
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		public Aura this[SpellLineId id]
		{
			get
			{
				var line = SpellLines.GetLine(id);
				if (line != null)
				{
					return this[line];
				}
				return null;
			}
		}
示例#30
0
 /// <summary>
 /// Gets the highest rank of the line that this SpellCollection contains
 /// </summary>
 public Spell GetHighestRankOf(SpellLineId lineId)
 {
     return(this.GetHighestRankOf(lineId.GetLine()));
 }
示例#31
0
		/// <summary>
		/// Defines a set of Auras that are mutually exclusive
		/// </summary>
		public static uint AddAuraGroup(SpellLineId auraLine, SpellLineId auraLine2, params SpellId[] auras)
		{
			var uid = GetNextAuraUID();
			var line = SpellLines.GetLine(auraLine);
			line.AuraUID = uid;
			foreach (var spell in line)
			{
				spell.AuraUID = uid;
			}
			line = SpellLines.GetLine(auraLine2);
			line.AuraUID = uid;
			foreach (var spell in line)
			{
				spell.AuraUID = uid;
			}
			foreach (var id in auras)
			{
				var spell = SpellHandler.Get(id);
				if (spell == null)
				{
					throw new ArgumentException("Invalid SpellId: " + id);
				}
				spell.AuraUID = uid;
			}
			return uid;
		}
示例#32
0
 public static SpellLine GetLine(this SpellLineId id)
 {
     return((uint)id >= ById.Length ? null : ById[(int)id]);
 }