private void CheckHeroInDanger()
        {
            bool playerInDanger = false;

            foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells)
            {
                Spell spell = entry.Value;

                if (lastPosInfo != null && lastPosInfo.dodgeableSpells.Contains(spell.spellID) &&
                    EvadeHelper.InSkillShot(spell, myHero.ServerPosition.To2D(), myHero.BoundingRadius))
                {
                    playerInDanger = true;
                    break;
                }
            }

            if (isDodging && !playerInDanger)
            {
                lastDodgingEndTime = GetTickCount();
            }

            if (isDodging == false && !Situation.ShouldDodge())
            {
                return;
            }

            isDodging = playerInDanger;
        }
예제 #2
0
        public static bool PreferEvadeSpell()
        {
            if (!Situation.ShouldUseEvadeSpell())
            {
                return(false);
            }

            var   extraDelayBuffer = Evade.menu.Item("ExtraPingBuffer").GetValue <Slider>().Value;
            float fastEvadeTime    = Evade.menu.Item("SpellActivationTime").GetValue <Slider>().Value + Game.Ping + extraDelayBuffer;

            foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells)
            {
                Spell spell = entry.Value;

                if (!EvadeHelper.InSkillShot(spell, myHero.ServerPosition.To2D(), myHero.BoundingRadius))
                {
                    continue;
                }

                float rEvadeTime, rSpellHitTime = 0;
                spell.CanHeroEvade(myHero, out rEvadeTime, out rSpellHitTime);

                float finalEvadeTime = (rSpellHitTime - rEvadeTime);

                if (finalEvadeTime < fastEvadeTime)
                {
                    foreach (var evadeSpell in evadeSpells)
                    {
                        if (Evade.menu.SubMenu("EvadeSpells").SubMenu(evadeSpell.charName + evadeSpell.name + "EvadeSpellSettings")
                            .Item(evadeSpell.name + "UseEvadeSpell").GetValue <bool>() == false ||
                            GetSpellDangerLevel(evadeSpell) > spell.GetSpellDangerLevel() ||
                            (evadeSpell.isItem == false && !(myHero.Spellbook.CanUseSpell(evadeSpell.spellKey) == SpellState.Ready)) ||
                            (evadeSpell.isItem == true && !(Items.CanUseItem((int)evadeSpell.itemID))) ||
                            (evadeSpell.checkSpellName == true && myHero.Spellbook.GetSpell(evadeSpell.spellKey).Name != evadeSpell.spellName))
                        {
                            continue; //can't use spell right now
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #3
0
        public static bool CheckSpellCollision(this Spell spell)
        {
            if (spell.info.collisionObjects.Count() < 1)
            {
                return(false);
            }

            List <Obj_AI_Base> collisionCandidates = new List <Obj_AI_Base>();
            var spellPos       = spell.GetCurrentSpellPosition();
            var distanceToHero = spellPos.Distance(Evade.myHero.ServerPosition.To2D());

            if (spell.info.collisionObjects.Contains(CollisionObjectType.EnemyChampions))
            {
                foreach (var hero in HeroManager.Allies.Where(h => h.Distance(spellPos) < distanceToHero && !h.IsDead))
                {
                    collisionCandidates.Add(hero);
                }
            }

            if (spell.info.collisionObjects.Contains(CollisionObjectType.EnemyMinions))
            {
                foreach (var minion in ObjectManager.Get <Obj_AI_Minion>()
                         .Where(h => h.Team == Evade.myHero.Team && h.Distance(spellPos) < distanceToHero && !h.IsDead))
                {
                    collisionCandidates.Add(minion);
                }
            }

            var sortedCandidates = collisionCandidates.OrderBy(h => h.Distance(spellPos));

            foreach (var candidate in sortedCandidates)
            {
                if (EvadeHelper.InSkillShot(spell, candidate.ServerPosition.To2D(), candidate.BoundingRadius))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #4
0
        private static bool ShouldActivateEvadeSpell(Spell spell)
        {
            if (Evade.lastPosInfo == null)
            {
                return(false);
            }

            if (Evade.lastPosInfo.undodgeableSpells.Contains(spell.spellID) &&
                EvadeHelper.InSkillShot(spell, myHero.ServerPosition.To2D(), myHero.BoundingRadius))
            {
                return(true);
            }

            /*float activationTime = Evade.menu.SubMenu("MiscSettings").SubMenu("EvadeSpellMisc").Item("EvadeSpellActivationTime")
             *  .GetValue<Slider>().Value + Game.Ping;
             *
             * if (spell.spellHitTime != float.MinValue && activationTime > spell.spellHitTime - spell.evadeTime)
             * {
             *  return true;
             * }*/

            return(false);
        }