Example #1
0
 public static void LastHit()
 {
     if (!Utils.SleepCheck("Lasthit.Cast"))
     {
         return;
     }
     if (!Var.DisableAaKeyPressed)
     {
         Common.Autoattack(0);
         Var.DisableAaKeyPressed = true;
         Var.AutoAttackTypeDef   = false;
     }
     Var.CreeptargetH = KillableCreep(Var.Me, false, false, 2);
     if (MenuVar.UseSpell && Utils.SleepCheck("Lasthit.Cooldown"))
     {
         SpellCast();
     }
     if (Var.CreeptargetH != null && Var.CreeptargetH.IsValid &&
         Var.CreeptargetH.IsVisible && Var.CreeptargetH.IsAlive)
     {
         var time = Var.Me.IsRanged == false
             ? Var.HeroAPoint / 1000 + Var.Me.GetTurnTime(Var.CreeptargetH.Position)
             : Var.HeroAPoint / 1000 + Var.Me.GetTurnTime(Var.CreeptargetH.Position) +
                    Var.Me.Distance2D(Var.CreeptargetH) / MyHeroInfo.GetProjectileSpeed(Var.Me);
         var getDamage = GetDamageOnUnit(Var.Me, Var.CreeptargetH, 0);
         if (Var.CreeptargetH.Distance2D(Var.Me) <= MyHeroInfo.AttackRange())
         {
             if (Var.CreeptargetH.Health < getDamage ||
                 Var.CreeptargetH.Health < getDamage && Var.CreeptargetH.Team == Var.Me.Team &&
                 (MenuVar.Denie || MenuVar.Aoc))
             {
                 if (!Var.Me.IsAttacking())
                 {
                     Var.Me.Attack(Var.CreeptargetH);
                 }
             }
             else if (Var.CreeptargetH.Health < getDamage * 2 && Var.CreeptargetH.Health >= getDamage &&
                      Var.CreeptargetH.Team != Var.Me.Team && Utils.SleepCheck("Lasthit.Stop"))
             {
                 Var.Me.Hold();
                 Var.Me.Attack(Var.CreeptargetH);
                 Utils.Sleep((float)Var.HeroAPoint / 2 + Game.Ping, "Lasthit.Stop");
             }
         }
         else if (Var.Me.Distance2D(Var.CreeptargetH) >= MyHeroInfo.AttackRange() && Utils.SleepCheck("Lasthit.Walk"))
         {
             Var.Me.Move(Var.CreeptargetH.Position);
             Utils.Sleep(100 + Game.Ping, "Lasthit.Walk");
         }
     }
     else
     {
         Var.Target = MenuVar.Harass ? Var.Me.BestAATarget() : null;
         Orbwalking.Orbwalk(Var.Target, 500);
     }
 }
Example #2
0
        public static void Drawhpbar()
        {
            try
            {
                UpdateCreeps();
                if (Var.Creeps.Count == 0)
                {
                    return;
                }
                foreach (var creep in Var.Creeps)
                {
                    if ((MenuVar.Sapport && Var.Me.Team != creep.Team) ||
                        (!MenuVar.Sapport && Var.Me.Team == creep.Team))
                    {
                        continue;
                    }
                    var health    = creep.Health;
                    var maxHealth = creep.MaximumHealth;
                    if (health == maxHealth)
                    {
                        continue;
                    }
                    var damge  = (float)GetDamageOnUnitForDrawhpbar(creep, 0);
                    var hpperc = health / maxHealth;

                    var hbarpos = HUDInfo.GetHPbarPosition(creep);

                    Vector2 screenPos;
                    var     enemyPos = creep.Position + new Vector3(0, 0, creep.HealthBarOffset);
                    if (!Drawing.WorldToScreen(enemyPos, out screenPos))
                    {
                        continue;
                    }

                    var start = screenPos;

                    hbarpos.X = start.X - HUDInfo.GetHPBarSizeX(creep) / 2;
                    hbarpos.Y = start.Y;
                    var hpvarx   = hbarpos.X;
                    var a        = (float)Math.Floor(damge * HUDInfo.GetHPBarSizeX(creep) / creep.MaximumHealth);
                    var position = hbarpos + new Vector2(hpvarx * hpperc + 10, -12);
                    if (creep.ClassID == ClassID.CDOTA_BaseNPC_Tower)
                    {
                        hbarpos.Y = start.Y - HUDInfo.GetHpBarSizeY(creep) * 6;
                        position  = hbarpos + new Vector2(hpvarx * hpperc - 5, -1);
                    }
                    else if (creep.ClassID == ClassID.CDOTA_BaseNPC_Barracks)
                    {
                        hbarpos.X = start.X - HUDInfo.GetHPBarSizeX(creep);
                        hbarpos.Y = start.Y - HUDInfo.GetHpBarSizeY(creep) * 6;
                        position  = hbarpos + new Vector2(hpvarx * hpperc + 10, -1);
                    }
                    else if (creep.ClassID == ClassID.CDOTA_BaseNPC_Building)
                    {
                        hbarpos.X = start.X - HUDInfo.GetHPBarSizeX(creep) / 2;
                        hbarpos.Y = start.Y - HUDInfo.GetHpBarSizeY(creep);
                        position  = hbarpos + new Vector2(hpvarx * hpperc + 10, -1);
                    }

                    Drawing.DrawRect(
                        position,
                        new Vector2(a, HUDInfo.GetHpBarSizeY(creep) - 4),
                        creep.Health > damge
                            ? creep.Health > damge * 2 ? new Color(180, 205, 205, 40) : new Color(255, 0, 0, 60)
                            : new Color(127, 255, 0, 80));
                    Drawing.DrawRect(position, new Vector2(a, HUDInfo.GetHpBarSizeY(creep) - 4), Color.Black, true);

                    if (!MenuVar.Test)
                    {
                        continue;
                    }
                    var time = Var.Me.IsRanged == false
                        ? Var.HeroAPoint / 1000 + Var.Me.GetTurnTime(Var.CreeptargetH.Position)
                        : Var.HeroAPoint / 1000 + Var.Me.GetTurnTime(creep.Position) +
                               Var.Me.Distance2D(creep) / MyHeroInfo.GetProjectileSpeed(Var.Me);
                    var damgeprediction = Healthpredict(creep, time);
                    var b         = (float)Math.Round(damgeprediction * 1 * HUDInfo.GetHPBarSizeX(creep) / creep.MaximumHealth);
                    var position2 = position + new Vector2(a, 0);
                    Drawing.DrawRect(position2, new Vector2(b, HUDInfo.GetHpBarSizeY(creep) - 4), Color.YellowGreen);
                    Drawing.DrawRect(position2, new Vector2(b, HUDInfo.GetHpBarSizeY(creep) - 4), Color.Black, true);
                }
            }
            catch (Exception)
            {
                if (MenuVar.ShowErrors)
                {
                    Common.PrintError("Draw Hpbar Error");
                }
            }
        }