/// <summary> /// Whether there are enough runes in this set to satisfy the given cost requirements /// </summary> public bool HasEnoughRunes(Spell spell) { RuneCostEntry runeCostEntry = spell.RuneCostEntry; if (runeCostEntry == null || !runeCostEntry.CostsRunes || this.Owner.Auras.GetModifiedInt(SpellModifierType.PowerCost, spell, 1) != 1) { return(true); } for (RuneType runeType = RuneType.Blood; runeType < (RuneType)runeCostEntry.CostPerType.Length; ++runeType) { int num = runeCostEntry.CostPerType[(int)runeType]; if (num > 0) { for (int index = 0; index < 6; ++index) { if ((this.ActiveRunes[index] == runeType || this.ActiveRunes[index] == RuneType.Death) && (double)this.Cooldowns[index] <= 0.0) { --num; } } if (num > 0) { return(false); } } } return(true); }
/// <summary> /// Method is internal because we don't have a packet yet to signal the client spontaneous cooldown updates /// </summary> internal void ConsumeRunes(Spell spell) { RuneCostEntry runeCostEntry = spell.RuneCostEntry; if (runeCostEntry == null || !runeCostEntry.CostsRunes || this.Owner.Auras.GetModifiedInt(SpellModifierType.PowerCost, spell, 1) != 1) { return; } for (RuneType runeType = RuneType.Blood; runeType < (RuneType)runeCostEntry.CostPerType.Length; ++runeType) { int num = runeCostEntry.CostPerType[(int)runeType]; if (num > 0) { for (uint index = 0; index < 6U; ++index) { if (this.ActiveRunes[index] == runeType && (double)this.Cooldowns[index] <= 0.0) { this.StartCooldown(index); --num; if (num == 0) { return; } } } for (uint index = 0; index < 6U; ++index) { if (this.ActiveRunes[index] == RuneType.Death && (double)this.Cooldowns[index] <= 0.0) { this.ConvertToDefault(index); this.StartCooldown(index); --num; if (num == 0) { return; } } } } } }
public void FinalizeDataHolder() { try { //Id SpellId = (SpellId)Id; PowerType = PowerType.Mana; Durations = new DurationEntry() { Min = Duration, Max = Duration }; Range = new SimpleRange(0, MaxRange); ProjectileSpeed = 1; RequiredToolIds = new uint[2]; Reagents = ItemStackDescription.EmptyArray; RequiredItemClass = ItemClass.None; RequiredItemSubClassMask = ItemSubClassMask.None; if (Id == 2228 || Id == 2231 || Id == 2234 || Id == 2237 || Id == 2240 || Id == 2243 || Id == 2246 || Id == 2249 || Id == 2252) { SoulGuardProffLevel = 1; } if (Id == 2229 || Id == 2232 || Id == 2235 || Id == 2238 || Id == 2241 || Id == 2244 || Id == 2247 || Id == 2250 || Id == 2253) { SoulGuardProffLevel = 2; } if (Id == 2230 || Id == 2233 || Id == 2236 || Id == 2239 || Id == 2242 || Id == 2245 || Id == 2248 || Id == 2251 || Id == 2254) { SoulGuardProffLevel = 3; } RequiredItemInventorySlotMask = InventorySlotTypeMask.None; var effects = new List <SpellEffect>(3); // 71 - 127+ #region read effects var effect = new SpellEffect(this, EffectIndex.Zero) { EffectType = Effect0_EffectType, DiceSides = 0, RealPointsPerLevel = 0, BasePoints = 0, Mechanic = Effect0_Mehanic, ImplicitTargetA = Effect0_ImplicitTargetA, ImplicitTargetB = Effect0_ImplicitTargetB, Radius = Effect0_Radius, AuraType = Effect0_AuraType, Amplitude = Effect0_Amplitude, ProcValue = Effect0_ProcValue, ChainTargets = 0, MiscValue = Effect0_MiscValue, MiscValueB = Effect0_MiscValueB, MiscValueC = Effect0_MiscValueC, TriggerSpellId = SpellId.None, PointsPerComboPoint = 0 }; effect.AffectMask[0] = 0; effect.AffectMask[1] = 0; effect.AffectMask[2] = 0; // Fix: This is a default AoE effect, thus doesn't have a fact at destination if (effect.ImplicitTargetA == ImplicitSpellTargetType.AllEnemiesAroundCaster && effect.ImplicitTargetB == ImplicitSpellTargetType.AllEnemiesInArea) { effect.ImplicitTargetB = ImplicitSpellTargetType.None; } effects.Add(effect); effect = new SpellEffect(this, EffectIndex.One) { EffectType = Effect1_EffectType, DiceSides = 0, RealPointsPerLevel = 0, BasePoints = 0, Mechanic = Effect1_Mehanic, ImplicitTargetA = Effect1_ImplicitTargetA, ImplicitTargetB = Effect1_ImplicitTargetB, Radius = Effect1_Radius, AuraType = Effect1_AuraType, Amplitude = Effect1_Amplitude, ProcValue = Effect1_ProcValue, ChainTargets = 0, MiscValue = Effect1_MiscValue, MiscValueB = Effect1_MiscValueB, MiscValueC = Effect1_MiscValueC, TriggerSpellId = SpellId.None, PointsPerComboPoint = 0 }; effect.AffectMask[0] = 0; effect.AffectMask[1] = 0; effect.AffectMask[2] = 0; // Fix: This is a default AoE effect, thus doesn't have a fact at destination if (effect.ImplicitTargetA == ImplicitSpellTargetType.AllEnemiesAroundCaster && effect.ImplicitTargetB == ImplicitSpellTargetType.AllEnemiesInArea) { effect.ImplicitTargetB = ImplicitSpellTargetType.None; } effects.Add(effect); #endregion Effects = effects.ToArray(); PowerCostPercentage = 0; // 127+- SpellClassSet = SpellClassSet.Generic; // 131+ MaxTargets = 100; // 135+ PreventionType = DamageType == DamageType.Magic ? SpellPreventionType.Magic : SpellPreventionType.Melee; //DamageMultipliers RequiredToolCategories = new ToolCategory[2]; // 145-146+ for (int i = 0; i < RequiredToolCategories.Length; i++) { RequiredToolCategories[i] = ToolCategory.None; } RuneCostEntry = new RuneCostEntry(); if (CooldownTime > 5000) { CooldownTime -= 1000; } else if (CooldownTime > 0) { CooldownTime -= 500; } if (Name.Contains("Party")) { Effect0_ImplicitTargetA = ImplicitSpellTargetType.AllParty; Effect1_ImplicitTargetA = ImplicitSpellTargetType.AllParty; } SpellHandler.AddSpell(this); } catch (Exception ex) { LogUtil.WarnException("Error when finalizing data holder of spell {0}. {1}", Name, ex); } }