private static void DoShit(Unit hero, bool isTempest=false)
{
if (!hero.IsAlive)
return;
// setting variables
var handle = hero.Handle;
var items = isTempest ? hero.Inventory.Items.ToList() : null;
var travelBoots = isTempest?
items.FirstOrDefault(
x =>
(x.Name == "item_travel_boots" ||
x.Name == "item_travel_boots_2") && x.CanBeCasted() &&
Utils.SleepCheck("Tempest.Travels.Cd" + handle)) : null;
var autoPushItems =isTempest ?
items.Where(
x =>
AutoPushItems.Contains(x.Name) && x.CanBeCasted() &&
Utils.SleepCheck("Tempest.AutoPush.Cd" + handle + x.Name)) : null;
var myCreeps = Objects.LaneCreeps.GetCreeps().Where(x => x.Team == hero.Team).ToList();
var enemyCreeps = Objects.LaneCreeps.GetCreeps().Where(x => x.Team != hero.Team).ToList();
var creepWithEnemy =
myCreeps.FirstOrDefault(
x => x.MaximumHealth * 65 / 100 < x.Health && enemyCreeps.Any(y => y.Distance2D(x) <= 1000));
var isChannel = isTempest && hero.IsChanneling();
// code for using boots of travel
// note: chooses creep furthest away from unit to TP to
if (travelBoots != null && !enemyCreeps.Any(x => x.Distance2D(hero) <= 1000) && !isChannel && Menu.Item("AutoPush.Travels").GetValue<bool>())
{
var mod = hero.FindModifier("modifier_kill");
if (mod == null || mod.RemainingTime >= 10)
{
if (creepWithEnemy == null)
{
creepWithEnemy = myCreeps.OrderByDescending(x => x.Distance2D(hero)).FirstOrDefault();
}
if (creepWithEnemy != null)
{
travelBoots.UseAbility(creepWithEnemy);
Utils.Sleep(500, "Tempest.Travels.Cd" + handle);
return;
}
}
}
if (isChannel) return;
var nearestTower =
Objects.Towers.GetTowers()
.Where(x => x.Team == hero.GetEnemyTeam())
.OrderBy(y => y.Distance2D(hero))
.FirstOrDefault() ?? Objects.Fountains.GetEnemyFountain();
var fountain = Objects.Fountains.GetAllyFountain();
var curlane = GetCurrentLane(hero);
var clospoint = GetClosestPoint(curlane);
var useThisShit = clospoint.Distance2D(fountain) - 250 > hero.Distance2D(fountain);
// useThisShit will return true if unit is closer to the fountain than the clospoint
if (nearestTower != null)
{
var pos = (curlane == "mid" || !useThisShit) ? nearestTower.Position : clospoint;
// if unit is at mid or clospoint is closer than the unit to the fountain, push the nearest tower
// otherwise, push the closest point
// if unit is a tempest and is close to the tower, use shield and attack tower
if (nearestTower.Distance2D(hero) <= 900 && isTempest)
{
if (Utils.SleepCheck("Tempest.Attack.Tower.Cd" + handle))
{
var spell = hero.Spellbook.Spell2;
if (spell != null && IsAbilityEnable(spell.StoredName(), calcForPushing: true) &&
spell.CanBeCasted() && Utils.SleepCheck("shield" + handle))
// handle used to uniquely identify the current hero's cooldowns
{
spell.UseAbility(Prediction.InFront(hero, 100));
Utils.Sleep(1500, "shield" + handle);
}
else if (!hero.IsAttacking())
{
hero.Attack(nearestTower);
}
Utils.Sleep(1000, "Tempest.Attack.Tower.Cd" + handle);
}
}
// make the unit issue an attack command at the position pos
else if (Utils.SleepCheck("Tempest.Attack.Cd" + handle) && !hero.IsAttacking() && isTempest)
{
hero.Attack(pos);
Utils.Sleep(1000, "Tempest.Attack.Cd" + handle);
}
// smart attack for necrobook (unaggro under tower)
if (!isTempest && Utils.SleepCheck(hero.StoredName() + "attack"))
{
SmartAttack(hero, myCreeps, nearestTower, pos);
}
// if there are creeps in the vicinity, make tempest use mjollnir and necronomicon
if (enemyCreeps.Any(x => x.Distance2D(hero) <= 800) && isTempest)
{
var spell = hero.Spellbook.Spell3;
if (spell != null && IsAbilityEnable(spell.StoredName(), calcForPushing: true) &&
spell.CanBeCasted() && Utils.SleepCheck(spell.StoredName() + handle))
// handle used to uniquely identify the current hero's cooldowns
{
spell.UseAbility(enemyCreeps.First().Position);
Utils.Sleep(1500, spell.StoredName() + handle);
}
spell = hero.Spellbook.Spell2;
if (enemyCreeps.Count>=2 && spell != null && IsAbilityEnable(spell.StoredName(), calcForPushing: true) &&
spell.CanBeCasted() && Utils.SleepCheck(spell.StoredName() + handle))
// handle used to uniquely identify the current hero's cooldowns
{
spell.UseAbility(Prediction.InFront(hero, 100));
Utils.Sleep(1500, spell.StoredName() + handle);
}
foreach (var item in autoPushItems)
{
if (item.Name != "item_mjollnir")
{
item.UseAbility();
}
else
{
var necros =
Objects.Necronomicon.GetNecronomicons(hero)
.FirstOrDefault(x => x.Distance2D(hero) <= 500 && x.Name.Contains("warrior"));
if (necros != null) item.UseAbility(necros);
}
Utils.Sleep(350, "Tempest.AutoPush.Cd" + handle + item.Name);
}
}
}
}