コード例 #1
0
ファイル: Spells.cs プロジェクト: iMaxopoly/KryAIO
        /// <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
ファイル: SpellPriorityForm.cs プロジェクト: say1981/Rawr
 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
ファイル: SpellPriorityForm.cs プロジェクト: tsebalj1/rawr
 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
ファイル: Spells.cs プロジェクト: iMaxopoly/KryAIO
        /// <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;
                }
            });
        }
コード例 #6
0
        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
ファイル: Spells.cs プロジェクト: iMaxopoly/KryAIO
        /// <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
ファイル: Spells.cs プロジェクト: iMaxopoly/KryAIO
        /// <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
     {
     }
 }