Ejemplo n.º 1
0
        public void OnCombo(bool afterAttack = false, Obj_AI_Base afterAttackTarget = null)
        {
            // TODO: Smite usage

            // Unburrowed
            if (!player.IsBurrowed())
            {
                // Config values
                var useQ       = true;
                var useW       = true;
                var useE       = true;
                var useBurrowQ = true;



                // Validate spells we wanna use
                if ((useQ ? !Q.IsReady() : true) && (useW ? !W.IsReady() : true) && (useE ? !E.IsReady() : true))
                {
                    return;
                }

                // Get a low range target, since we don't have much range with our spells
                var target = ARAMTargetSelector.getBestTarget(useQ && Q.IsReady() ? Q.Range : E.Range);

                if (target != null)
                {
                    // General Q usage, we can safely spam that I guess
                    if (afterAttack && useQ && Q.IsReady())
                    {
                        Q.Cast(true);
                    }

                    // E usage, only cast on secure kill, full fury or our health is low
                    if (useE && E.IsReady() && (target.Health < E.GetDamage(target) || player.HasMaxFury() || player.IsLowHealth()))
                    {
                        E.Cast(target);
                    }
                }

                // Burrow usage
                if (target != null && useW && W.IsReady() && !player.HasQActive())
                {
                    if (target.CanBeKnockedUp())
                    {
                        W.Cast();
                    }
                    else if ((!useQ || !Q.IsReady()) && useBurrowQ && SpellManager.QBurrowed.IsReallyReady())
                    {
                        // Check if the player could make more attack attack damage than the Q damage, else cast W
                        if (Math.Floor(player.AttackSpeed()) * player.GetAutoAttackDamage(target) < SpellManager.QBurrowed.GetRealDamage(target))
                        {
                            W.Cast();
                        }
                    }
                }
            }
            // Burrowed
            else
            {
                // Disable auto attacks
                //DeathWalker.setAttack(false);

                // Config values
                var useQ       = true;
                var useW       = true;
                var useE       = true;
                var useNormalQ = true;
                var useNormalE = true;

                // General Q usage
                if (useQ && Q.IsReady())
                {
                    // Get a target at Q range
                    var target = ARAMTargetSelector.getBestTarget(Q.Range);

                    if (target != null)
                    {
                        Q.Cast(target);
                    }
                }

                // Gapclose with E, only for (almost) secured kills
                if (useE && E.IsReady())
                {
                    // Get targets that could be valid for our combo
                    var validRangeTargets = ObjectManager.Get <AIHeroClient>().Where(h => h.Distance(player, true) < Math.Pow(Q.Range + 150, 2) && h.Distance(player, true) > Math.Pow(Q.Range - 150, 2));

                    // Get a target that could die with our combo
                    var target = validRangeTargets.FirstOrDefault(t =>
                                                                  t.Health <
                                                                  W.GetRealDamage(t) +
                                                                  // Let's say 2 AAs without Q and 4 AAs with Q
                                                                  (SpellManager.QNormal.IsReallyReady(1000) ? SpellManager.QNormal.GetRealDamage(t) * 3 + player.GetAutoAttackDamage(t) : player.GetAutoAttackDamage(t) * 2) +
                                                                  (SpellManager.ENormal.IsReallyReady(1000) ? SpellManager.ENormal.GetRealDamage(t) : 0)
                                                                  );

                    if (target != null)
                    {
                        // Digg tunnel to target Kappa
                        E.Cast(target);
                    }
                    else
                    {
                        // Snipe Q targets, experimental, dunno if I'll leave this in here
                        if (useQ && Q.IsReallyReady(1000))
                        {
                            var snipeTarget = ARAMTargetSelector.getBestTarget(E.Range + Q.Range);
                            if (snipeTarget != null && snipeTarget.Health < Q.GetRealDamage(snipeTarget))
                            {
                                // Digg tunnel to the target direction
                                var prediction = E.GetPrediction(snipeTarget, false, float.MaxValue);
                                E.Cast(prediction.CastPosition);
                            }
                        }
                    }
                }

                // Check if we need to unburrow
                if (useW && ((useNormalQ ? SpellManager.QNormal.IsReallyReady(250) : true) || (useNormalE ? SpellManager.ENormal.IsReallyReady(250) : true)))
                {
                    // Get a target above the player that is within our spell range
                    var target = ARAMTargetSelector.getBestTarget(useNormalQ && SpellManager.QNormal.IsReallyReady(250) ? SpellManager.QNormal.Range : useNormalE ? SpellManager.ENormal.Range : Orbwalking.GetRealAutoAttackRange(player));
                    if (target != null)
                    {
                        // Unburrow
                        W.Cast();
                    }
                }
            }
        }