/// <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); }
/// <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); }
public static SpellLine GetLine(this SpellLineId id) { if ((long)id < (long)SpellLines.ById.Length) { return(SpellLines.ById[(int)id]); } return((SpellLine)null); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); } }
public void ClearCooldown(SpellLineId id, bool alsoClearCategory = true) { var line = id.GetLine(); if (line != null) { foreach (var spell in line) { ClearCooldown(spell, alsoClearCategory); } } }
public Aura this[SpellLineId id, bool positive] { get { SpellLine line = id.GetLine(); if (line != null) { return(this[line, positive]); } return(null); } }
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>}" }); }
/// <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); } }
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); } }
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); } } }
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); }); }
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); }); }
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); }
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); } } }
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); } } } }
public void AddToEffectMask(SpellLineId ability) { var spell = SpellLines.GetLine(ability).FirstRank; for (int i = 0; i < AffectMask.Length; i++) { AffectMask[i] |= spell.SpellClassMask[i]; } }
/// <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); }
public static SpellLine GetLine(SpellLineId id) { return ById[(int)id]; }
bool CheckBonus(Unit unit, SpellLineId line) { var bonus = unit.Auras[line]; if (bonus == null || bonus.CasterReference != Cast.CasterReference) { return false; } return true; }
public Aura this[SpellLineId id, bool positive] { get { var line = SpellLines.GetLine(id); if (line != null) { return this[line, positive]; } return null; } }
/// <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; } }
/// <summary> /// Gets the highest rank of the line that this SpellCollection contains /// </summary> public Spell GetHighestRankOf(SpellLineId lineId) { return(this.GetHighestRankOf(lineId.GetLine())); }
/// <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; }
public static SpellLine GetLine(this SpellLineId id) { return((uint)id >= ById.Length ? null : ById[(int)id]); }