示例#1
0
        /// <summary>
        /// Casts the spell w.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="priority">The priority.</param>
        private void CastSpellW(Obj_AI_Base target, SpellPriority priority)
        {
            SpellCastLocker.RunWithLock((int)WSpell.Slot, () =>
            {
                if (!WSpell.Ready || !IsValidTargetLocked(target, WSpell.Range))
                {
                    return;
                }

                var localHeroMana = 100 * LocalHero.Mana / LocalHero.MaxMana;

                var targetPrediction = WSpell.GetPrediction(target);
                switch (priority)
                {
                case SpellPriority.Harass:
                    if (localHeroMana > 55 && targetPrediction.HitChance >= HitChance.Medium)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    else if (localHeroMana > 30 && localHeroMana <= 55 &&
                             targetPrediction.HitChance >= HitChance.High)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    else if (localHeroMana <= 30 && targetPrediction.HitChance >= HitChance.VeryHigh)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                case SpellPriority.Farm:
                    if (localHeroMana > 30 && targetPrediction.HitChance >= HitChance.Low)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                case SpellPriority.Combo:
                    if (targetPrediction.HitChance >= HitChance.Medium)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                case SpellPriority.Force:
                    if (targetPrediction.HitChance >= HitChance.Low)
                    {
                        WSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                default:
                    Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error,
                               EventType.OnGameOnUpdateEvent);
                    break;
                }
            });
        }
示例#2
0
 private static void LoadSpellPriority(XElement elem, ref SpellPriority pri)
 {
     try
     {
         pri = (SpellPriority)Enum.Parse(typeof(SpellPriority), elem.Value);
     }
     catch
     {
     }
 }
示例#3
0
 private void bSave_Click(object sender, EventArgs e)
 {
     SpellPriority.Clear();
     MirrowList.Items.Clear();
     foreach (Object o in lsSpellPriority.Items)
     {
         SpellPriority.Add(o.ToString());
         MirrowList.Items.Add(o);
     }
 }
示例#4
0
 private void bSave_Click(object sender, EventArgs e)
 {
     SpellPriority.Clear();
     MirrowList.Items.Clear();
     foreach (Object o in lsSpellPriority.Items)
     {
         SpellPriority.Add(o.ToString());
         MirrowList.Items.Add(o);
     }
     character.OnCalculationsInvalidated();
     Hide();
 }
示例#5
0
        /// <summary>
        /// Casts the spell w.
        /// </summary>
        /// <param name="castPosition">The cast position.</param>
        /// <param name="priority">The priority.</param>
        private void CastSpellW(Vector2 castPosition, SpellPriority priority)
        {
            SpellCastLocker.RunWithLock((int)WSpell.Slot, () =>
            {
                if (!WSpell.Ready)
                {
                    return;
                }

                var localHeroMana = 100 * LocalHero.Mana / LocalHero.MaxMana;

                switch (priority)
                {
                case SpellPriority.Harass:
                    if (localHeroMana > 55)
                    {
                        WSpell.Cast(castPosition);
                    }
                    else if (localHeroMana > 30 && localHeroMana <= 55)
                    {
                        WSpell.Cast(castPosition);
                    }
                    else if (localHeroMana <= 30)
                    {
                        WSpell.Cast(castPosition);
                    }
                    break;

                case SpellPriority.Farm:
                    if (localHeroMana > 30)
                    {
                        WSpell.Cast(castPosition);
                    }
                    break;

                case SpellPriority.Combo:
                case SpellPriority.Force:
                    WSpell.Cast(castPosition);
                    break;

                default:
                    Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error,
                               EventType.OnGameOnUpdateEvent);
                    break;
                }
            });
        }
        public CharacterCalculationsWarlock(Character character, Stats stats) : this()
        {
            Character  = character;
            TotalStats = stats;

            if (Character.CalculationOptions == null)
            {
                Character.CalculationOptions = new CalculationOptionsWarlock();
            }

            Options = (CalculationOptionsWarlock)Character.CalculationOptions;
            if (Options.SpellPriority.Count > 0)
            {
                _warlockAbilities.Clear();

                foreach (String name in Options.SpellPriority)
                {
                    Abilities += "\r\n- " + name;

                    Spell spell = SpellFactory.CreateSpell(name, stats, character, Options);
                    if (spell == null)
                    {
                        continue;                   //i.e. skip over the following lines if null
                    }
                    SpellPriority.Add(spell);       //used by "DPS Sources" comparison calcs
                    _warlockAbilities.Enqueue(spell);

                    //wire up the event handlers
                    #region backdraft notifications
                    if (character.WarlockTalents.Backdraft > 0)
                    {
                        if (spell.SpellTree == SpellTree.Destruction)
                        {
                            Backdraft.AuraUpdate += spell.BackdraftAuraHandler;
                            spell.SpellCast      += Backdraft.SpellCastHandler;
                        }
                    }
                    #endregion
                }
            }
        }
示例#7
0
        /// <summary>
        /// Casts the spell q.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="priority">The priority.</param>
        private void CastSpellQ(AttackableUnit target, SpellPriority priority)
        {
            SpellCastLocker.RunWithLock((int)QSpell.Slot, () =>
            {
                if (!QSpell.Ready || !IsValidTargetLocked(target, LocalHeroTrueRange))
                {
                    return;
                }

                var localHeroMana = 100 * LocalHero.Mana / LocalHero.MaxMana;

                switch (priority)
                {
                case SpellPriority.Harass:
                    if (localHeroMana > 70)
                    {
                        QSpell.Cast();
                    }
                    break;

                case SpellPriority.Farm:
                    if (localHeroMana > 80)
                    {
                        QSpell.Cast();
                    }
                    break;

                case SpellPriority.Combo:
                case SpellPriority.Force:
                    QSpell.Cast();
                    break;

                default:
                    Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error,
                               EventType.OnGameOnUpdateEvent);
                    break;
                }
            });
        }
示例#8
0
        /// <summary>
        /// Casts the spell r.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="priority">The priority.</param>
        private void CastSpellR(Obj_AI_Base target, SpellPriority priority)
        {
            SpellCastLocker.RunWithLock((int)RSpell.Slot, () =>
            {
                if (!RSpell.Ready)
                {
                    return;
                }

                var targetPrediction = RSpell.GetPrediction(target);
                switch (priority)
                {
                case SpellPriority.Harass:
                    break;

                case SpellPriority.Combo:
                    if (targetPrediction.HitChance >= HitChance.High)
                    {
                        RSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                case SpellPriority.Force:
                    if (targetPrediction.HitChance >= HitChance.Low)
                    {
                        RSpell.Cast(targetPrediction.CastPosition);
                    }
                    break;

                case SpellPriority.Farm:
                    break;

                default:
                    Logger.Log($"Caught ArgumentOutOfRangeException: {nameof(priority)}, {priority}", LogType.Error,
                               EventType.OnGameOnUpdateEvent);
                    break;
                }
            });
        }
示例#9
0
 private static void LoadSpellPriority(XElement elem, ref SpellPriority pri)
 {
     try
     {
         pri = (SpellPriority)Enum.Parse( typeof(SpellPriority), elem.Value);
     }
     catch
     {
     }
 }