Пример #1
0
    public void CastOnTarget(string spell, SimpleTs.DamageType damageType, bool packet = true)
    {
        if (!Spells[spell].IsReady()) return;

        Obj_AI_Hero target = SimpleTs.GetTarget(Spells[spell].Range, damageType);
        if (target == null) return;

        if (target.IsValidTarget(Spells[spell].Range))
            Spells[spell].CastOnUnit(target, packet);
    }
Пример #2
0
    public void CastSkillshot(string spell, SimpleTs.DamageType damageType, HitChance hitChance = HitChance.VeryHigh, bool packet = true, bool aoe = false)
    {
        if (!Spells[spell].IsReady()) return;

        Obj_AI_Hero target = SimpleTs.GetTarget(Spells[spell].Range, damageType);
        if (target == null) return;

        if (target.IsValidTarget(Spells[spell].Range) && Spells[spell].GetPrediction(target).Hitchance >= hitChance)
            Spells[spell].Cast(target, packet, aoe);
    }
Пример #3
0
 /// <summary>
 ///     Casts a basic line skillshot towards target if hitchance is high
 /// </summary>
 /// <param name="spell"></param>
 /// <param name="damageType"></param>
 /// <returns> target </returns>
 public Obj_AI_Hero castLineSkillShot(Spell spell,
     SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
 {
     if (!spell.IsReady())
         return null;
     Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range, damageType);
     if (target == null)
         return null;
     if (!target.IsValidTarget(spell.Range) || spell.GetPrediction(target).Hitchance < HitChance.High)
         return null;
     spell.Cast(target, true);
     return target;
 }
Пример #4
0
 /// <summary>
 ///     Casts a basic circle skillshot towards target if hitchance is high
 /// </summary>
 /// <param name="spell"></param>
 /// <param name="damageType"></param>
 /// <param name="extrarange"></param>
 /// <returns></returns>
 public Obj_AI_Base castCircleSkillShot(Spell spell,
     SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical, float extrarange = 0)
 {
     if (!spell.IsReady())
         return null;
     Obj_AI_Hero target = SimpleTs.GetTarget(spell.Range + extrarange, damageType);
     if (target == null)
         return null;
     if (target.IsValidTarget(spell.Range + extrarange) &&
         spell.GetPrediction(target).Hitchance >= HitChance.High)
         spell.Cast(target, true);
     return target;
 }
Пример #5
0
		public void Cast_onMinion_nearEnemy(Spell spell, float range, SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical, MinionTypes minionTypes = MinionTypes.All, MinionTeam minionTeam = MinionTeam.All)
		{
			if(!spell.IsReady() || !ManaManagerAllowCast(spell))
				return;
			var target = SimpleTs.GetTarget(spell.Range + range, damageType);
			Obj_AI_Base[] nearstMinion = { null };
			var allminions = MinionManager.GetMinions(target.Position, range, minionTypes, minionTeam);
			foreach(var minion in allminions.Where(minion => minion.Distance(ObjectManager.Player) <= spell.Range && minion.Distance(target) <= range).Where(minion => nearstMinion[0] == null || nearstMinion[0].Distance(target) >= minion.Distance(target)))
				nearstMinion[0] = minion;

			if(nearstMinion[0] != null)
				spell.CastOnUnit(nearstMinion[0], Packets());
		}
Пример #6
0
		public void Cast_onEnemy(Spell spell, SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
		{
			if(!spell.IsReady() || !ManaManagerAllowCast(spell))
				return;
			var target = SimpleTs.GetTarget(spell.Range, damageType);
			if(target.IsValidTarget(spell.Range))
				spell.CastOnUnit(target, Packets());
		}
Пример #7
0
        public void Cast_BasicCircleSkillshot_Enemy(Spell spell, SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical, float extrarange = 0)
		{
			if(!spell.IsReady() || !ManaManagerAllowCast(spell))
				return;
            var target = SimpleTs.GetTarget(spell.Range + extrarange, damageType);
			if(target == null)
				return;
            if (target.IsValidTarget(spell.Range + extrarange) && spell.GetPrediction(target).Hitchance >= HitChance.High)
				spell.Cast(target, Packets());
		}
Пример #8
0
		public void Cast_BasicLineSkillshot_Enemy(Spell spell, Vector3 sourcePosition, SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
		{
			if(!spell.IsReady() || !ManaManagerAllowCast(spell))
				return;
			spell.UpdateSourcePosition(sourcePosition, sourcePosition);
            foreach (var hero in Program.Helper.EnemyTeam
				.Where(hero => (hero.Distance(sourcePosition) < spell.Range) && hero.IsValidTarget()).Where(hero => spell.GetPrediction(hero).Hitchance >= HitChance.High))
			{
				spell.Cast(hero, Packets());
				return;
			}
		}
Пример #9
0
		public Obj_AI_Hero Cast_BasicLineSkillshot_Enemy(Spell spell, SimpleTs.DamageType damageType = SimpleTs.DamageType.Physical)
		{
			if(!spell.IsReady() || !ManaManagerAllowCast(spell))
				return null;
			var target = SimpleTs.GetTarget(spell.Range, damageType);
			if(target == null)
				return null;
			if (!target.IsValidTarget(spell.Range) || spell.GetPrediction(target).Hitchance < HitChance.High)
				return null;
			spell.Cast(target, Packets());
			return target;
		}
Пример #10
0
 public Obj_AI_Hero Cast_BasicSkillshot_Enemy(Spell spell, SimpleTs.DamageType prio = SimpleTs.DamageType.True, float extrarange = 0)
 {
     if(!spell.IsReady())
         return null;
     var target = SimpleTs.GetTarget(spell.Range + extrarange, prio);
     if(target == null)
         return null;
     if(!target.IsValidTarget(spell.Range + extrarange) || spell.GetPrediction(target).Hitchance < HitChance.Medium)
         return null;
     spell.UpdateSourcePosition();
     spell.Cast(target, UsePackets());
     return target;
 }
Пример #11
0
        //Credits to Lexxes gave me this function to use
        public static bool Spell_Cast_LineSkillshot(string MainMenu, string Menu, Spell Spell, SimpleTs.DamageType DmgType, string Objekt = "Enemy", bool Condition = true, bool Lasthit = false, DamageLib.StageType Stage = DamageLib.StageType.Default)
        {
            
                if (Objekt == "Enemy")
                {
                    var Target = SimpleTs.GetTarget(Spell.Range, DmgType);
                    if (Target != null)
                    {
                        if (Target.IsValidTarget(Spell.Range) && Spell.IsReady())
                        {
                            if (Spell.GetPrediction(Target).HitChance >= Prediction.HitChance.HighHitchance)
                            {
                                Spell.Cast(Target, true);
                                
                                return true;
                            }
                        }
                    }
                }
                if (Objekt == "Minion")
                {
                    var allMinions = MinionManager.GetMinions(ObjectManager.Player.ServerPosition, Spell.Range, MinionTypes.All, MinionTeam.NotAlly);
                    foreach (var Target in allMinions)
                    {
                        if (Target != null)
                        {
                            var spelltype = DamageLib.SpellType.AD;

                            if (Spell.Slot.ToString() == "Q")
                                spelltype = DamageLib.SpellType.Q;
                            if (Spell.Slot.ToString() == "W")
                                spelltype = DamageLib.SpellType.W;
                            if (Spell.Slot.ToString() == "E")
                                spelltype = DamageLib.SpellType.E;
                            if (Spell.Slot.ToString() == "R")
                                spelltype = DamageLib.SpellType.R;

                            if (Target.IsValidTarget(Spell.Range) && Spell.IsReady())
                            {
                                if ((Lasthit && (DamageLib.getDmg(Target, spelltype, Stage) > Target.Health) || (DamageLib.getDmg(Target, spelltype, Stage) + 100 < Target.Health) && !Lasthit))
                                {
                                    Spell.Cast(Target.Position, true);
                                    return true;
                                }
                            }
                        }
                    }
                }
                if (Objekt == "KS")
                {

                }

            
            return true;
        }
Пример #12
0
            public Obj_AI_Base GetTarget()
            {
                Obj_AI_Base result = null;
                var         r      = float.MaxValue;

                if ((ActiveMode == OrbwalkingMode.Mixed || ActiveMode == OrbwalkingMode.LaneClear) &&
                    !_config.Item("PriorizeFarm").GetValue <bool>())
                {
                    var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical);
                    if (target != null)
                    {
                        return(target);
                    }
                }

                /*Killable Minion*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed ||
                    ActiveMode == OrbwalkingMode.LastHit)
                {
                    foreach (var minion in
                             ObjectManager.Get <Obj_AI_Minion>()
                             .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion) && minion.Health < 2 * (ObjectManager.Player.BaseAttackDamage + ObjectManager.Player.FlatPhysicalDamageMod)))
                    {
                        var t          = (int)(Player.AttackCastDelay * 1000) - 100 + Game.Ping / 2 + 1000 * (int)Player.Distance(minion) / (int)GetMyProjectileSpeed();
                        var predHealth = HealthPrediction.GetHealthPrediction(minion, t, FarmDelay);

                        if (minion.Team != GameObjectTeam.Neutral && MinionManager.IsMinion(minion))
                        {
                            if (predHealth <= 0)
                            {
                                FireOnNonKillableMinion(minion);
                            }

                            if (predHealth > 0 && predHealth <= Player.GetAutoAttackDamage(minion, true))
                            {
                                return(minion);
                            }
                        }
                    }
                }

                //Forced target
                if (_forcedTarget != null && _forcedTarget.IsValidTarget() && InAutoAttackRange(_forcedTarget))
                {
                    return(_forcedTarget);
                }

                /*Champions*/
                if (ActiveMode != OrbwalkingMode.LastHit)
                {
                    var target = SimpleTs.GetTarget(-1, SimpleTs.DamageType.Physical);
                    if (target != null)
                    {
                        return(target);
                    }
                }

                /*Jungle minions*/
                if (ActiveMode == OrbwalkingMode.LaneClear || ActiveMode == OrbwalkingMode.Mixed)
                {
                    foreach (var mob in
                             ObjectManager.Get <Obj_AI_Minion>()
                             .Where(
                                 mob =>
                                 mob.IsValidTarget() && InAutoAttackRange(mob) && mob.Team == GameObjectTeam.Neutral)
                             .Where(mob => mob.MaxHealth >= r || Math.Abs(r - float.MaxValue) < float.Epsilon))
                    {
                        result = mob;
                        r      = mob.MaxHealth;
                    }
                }

                if (result != null)
                {
                    return(result);
                }

                /*Lane Clear minions*/
                r = float.MaxValue;
                if (ActiveMode == OrbwalkingMode.LaneClear)
                {
                    if (!ShouldWait())
                    {
                        if (_prevMinion != null && _prevMinion.IsValidTarget() && InAutoAttackRange(_prevMinion))
                        {
                            var predHealth = HealthPrediction.LaneClearHealthPrediction(
                                _prevMinion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay);
                            if (predHealth >= 2 * Player.GetAutoAttackDamage(_prevMinion, false) ||
                                Math.Abs(predHealth - _prevMinion.Health) < float.Epsilon)
                            {
                                return(_prevMinion);
                            }
                        }

                        foreach (var minion in
                                 ObjectManager.Get <Obj_AI_Minion>()
                                 .Where(minion => minion.IsValidTarget() && InAutoAttackRange(minion)))
                        {
                            var predHealth = HealthPrediction.LaneClearHealthPrediction(
                                minion, (int)((Player.AttackDelay * 1000) * LaneClearWaitTimeMod), FarmDelay);
                            if (predHealth >= 2 * Player.GetAutoAttackDamage(minion, false) ||
                                Math.Abs(predHealth - minion.Health) < float.Epsilon)
                            {
                                if (minion.Health >= r || Math.Abs(r - float.MaxValue) < float.Epsilon)
                                {
                                    result      = minion;
                                    r           = minion.Health;
                                    _prevMinion = minion;
                                }
                            }
                        }
                    }
                }

                /*turrets*/
                if (ActiveMode == OrbwalkingMode.LaneClear)
                {
                    foreach (var turret in
                             ObjectManager.Get <Obj_AI_Turret>().Where(t => t.IsValidTarget() && InAutoAttackRange(t)))
                    {
                        return(turret);
                    }
                }

                return(result);
            }