public static bool Cast(this Spells spell, Vector3 from, Vector3 rangecheckfrom, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow, bool UseExtendRadiusSSCirle = true) { if (spell.spellslot.IsReady()) { if (GetHiChance(from, ToTarget, spell) >= spell.MinHitChance && GetHiChance(from, ToTarget, spell) >= minhitchance) { Vector3 y = new Vector3(0, 0, 0); Vector3 pos = Predictions.GetPrediction(from, ToTarget, spell, true); if (rangecheckfrom.Distance(pos) <= spell.range && pos != y) { if (spell.collision == false) return Player.Spellbook.CastSpell(spell.spellslot, pos); else { List<Obj_AI_Base> list = Collisions.GetCollision(from, pos, spell); if (list.Count == 0) { Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, spell); return Player.Spellbook.CastSpell(spell.spellslot, pos1); } else return false; } } else if (UseExtendRadiusSSCirle == true && spell.skillshottype == SkillshotType.SkillshotCircle) { Spells x = new Spells(spell.spellslot, spell.skillshottype, spell.range + spell.radius - 20, spell.delay, 20, false, spell.speed); Vector3 y1 = new Vector3(0, 0, 0); Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, x, true); if (rangecheckfrom.Distance(pos1) <= x.range && pos1 != y1) { var pos2 = Player.Position.Extend(pos1, spell.range); return Player.Spellbook.CastSpell(spell.spellslot, pos2); } else return false; } else return false; } else return false; } else return false; }
private static void Game_OnGameLoad(EventArgs args) { if (Player.ChampionName != "Viktor") return; _q = new Spell(SpellSlot.Q); _w = new Spell(SpellSlot.W,700); _e = new Spell(SpellSlot.E); _r = new Spell(SpellSlot.R,700); _r.SetSkillshot(0.25f, 1,float.MaxValue,false,SkillshotType.SkillshotCircle); _w.SetSkillshot(0.25f, 325, float.MaxValue, false, SkillshotType.SkillshotCircle); E = new Spells(SpellSlot.E, SkillshotType.SkillshotLine, 520, (float)0.25, 40, false, 780, 500); //R = new Spells(SpellSlot.R, SkillshotType.SkillshotCircle, 700, 0.25f, 325 / 2, false); _menu = new Menu(Player.ChampionName, Player.ChampionName, true); Menu orbwalkerMenu = new Menu("Orbwalker", "Orbwalker"); _orbwalker = new Orbwalking.Orbwalker(orbwalkerMenu); _menu.AddSubMenu(orbwalkerMenu); Menu ts = _menu.AddSubMenu(new Menu("Target Selector", "Target Selector")); ; TargetSelector.AddToMenu(ts); Menu spellMenu = _menu.AddSubMenu(new Menu("Spells", "Spells")); Menu Harass = spellMenu.AddSubMenu(new Menu("Harass", "Harass")); Menu Combo = spellMenu.AddSubMenu(new Menu("Combo", "Combo")); Menu Focus = spellMenu.AddSubMenu(new Menu("Focus Selected", "Focus Selected")); Menu KS = spellMenu.AddSubMenu(new Menu("KillSteal", "KillSteal")); Harass.AddItem(new MenuItem("Use Q Harass", "Use Q Harass").SetValue(true)); Harass.AddItem(new MenuItem("Use E Harass", "Use E Harass").SetValue(true)); Combo.AddItem(new MenuItem("Use Q Combo", "Use Q Combo").SetValue(true)); Combo.AddItem(new MenuItem("Use E Combo", "Use E Combo").SetValue(true)); Combo.AddItem(new MenuItem("Use W Combo", "Use W Combo").SetValue(true)); Combo.AddItem(new MenuItem("Use R Burst Selected", "Use R Combo").SetValue(true)); Focus.AddItem(new MenuItem("force focus selected", "force focus selected").SetValue(false)); Focus.AddItem(new MenuItem("if selected in :", "if selected in :").SetValue(new Slider(1000, 1000, 1500))); KS.AddItem(new MenuItem("Use Q KillSteal", "Use Q KillSteal").SetValue(true)); KS.AddItem(new MenuItem("Use E KillSteal", "Use E KillSteal").SetValue(true)); KS.AddItem(new MenuItem("Use R KillSteal", "Use R KillSteal").SetValue(true)); spellMenu.AddItem(new MenuItem("Use R Follow", "Use R Follow").SetValue(true)); spellMenu.AddItem(new MenuItem("Use W GapCloser", "Use W anti gap").SetValue(true)); _menu.AddToMainMenu(); Game.OnUpdate += Game_OnGameUpdate; GameObject.OnCreate += Create; GameObject.OnDelete += Delete; AntiGapcloser.OnEnemyGapcloser += AntiGapcloser_OnEnemyGapcloser; Game.PrintChat("Welcome to ViktorWorld"); }
public static List<Obj_AI_Base> GetCollision(Vector3 from, Vector3 to, Spells spell) { var result = new List<Obj_AI_Base>(); var list = new List<CollisionableObjects>(); list.Add(CollisionableObjects.Minions); list.Add(CollisionableObjects.YasuoWall); float time = spell.delay + Game.Ping / 2 / 1000 + from.Distance(to) / spell.speed; foreach (var objectType in list) { switch (objectType) { case CollisionableObjects.Minions: foreach (var minion in ObjectManager.Get<Obj_AI_Minion>() .Where( minion => minion.IsValidTarget( Math.Min(spell.range + spell.radius + 100, 2000), true, from))) { //var chuot = Prediction.GetPrediction(minion, 100).CastPosition; //float y = minion.MoveSpeed * 100 / 1000; //bool moving = !(minion.Distance(chuot) < y); //var minionPrediction = moving == false ? minion.Position : minion.Position.Extend(chuot, time * minion.MoveSpeed); var minionPrediction = Prediction.GetPrediction(minion, time * 1000).UnitPosition; if ( minionPrediction.To2D() .Distance(from.To2D(), to.To2D(), true, true) <= Math.Pow((spell.radius * 2 + 15 + minion.BoundingRadius), 2) || minion.Position.To2D().Distance(from.To2D(), to.To2D(), true, true) <= Math.Pow((spell.radius * 2 + 15 + minion.BoundingRadius), 2)) { result.Add(minion); } } break; //case CollisionableObjects.Heroes: // foreach (var hero in // HeroManager.Enemies.FindAll( // hero => // hero.IsValidTarget( // Math.Min(input.Range + input.Radius + 100, 2000), true, input.RangeCheckFrom)) // ) // { // input.Unit = hero; // var prediction = Prediction.GetPrediction(input, false, false); // if ( // prediction.UnitPosition.To2D() // .Distance(input.From.To2D(), position.To2D(), true, true) <= // Math.Pow((input.Radius + 50 + hero.BoundingRadius), 2)) // { // result.Add(hero); // } // } // break; //case CollisionableObjects.Walls: // var step = position.Distance(input.From) / 20; // for (var i = 0; i < 20; i++) // { // var p = input.From.To2D().Extend(position.To2D(), step * i); // if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall)) // { // result.Add(ObjectManager.Player); // } // } // break; case CollisionableObjects.YasuoWall: if (Utils.TickCount - _wallCastT > 4000) { break; } GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>() .Where( gameObject => gameObject.IsValid && Regex.IsMatch( gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)) ) { wall = gameObject; } if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; if (wallStart.Intersection(wallEnd, to.To2D(), from.To2D()).Intersects) { var t = Utils.TickCount + (wallStart.Intersection(wallEnd, to.To2D(), from.To2D()) .Point.Distance(from) / spell.speed + spell.delay) * 1000; if (t < _wallCastT + 4000) { result.Add(ObjectManager.Player); } } break; } } return result.Distinct().ToList(); }
public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell) { Vector3 chuot = Prediction.GetPrediction(target, 1).CastPosition; float dis = from.Distance(target.Position); float rad = target.BoundingRadius + spell.radius - 50; double x = math.t(target.MoveSpeed, spell.speed, dis, spell.delay + Game.Ping / 2 / 1000, rad, from, target.Position, chuot); if (x != 0 && !target.IsDashing()) { return target.Position.Extend(chuot, (float)x * target.MoveSpeed - rad); } else return target.Position; }
//public Predictions (Obj_AI_Base dasher,Dash.DashItem args) //{ // Dasher = dasher; // Args = args; //} //public Obj_AI_Base Dasher { get; set; } //public Dash.DashItem Args { get; set; } //private static List<Predictions> Dashes; //static Predictions() //{ // CustomEvents.Unit.OnDash += OnDash; // foreach (var x in Dashes) // { // if (Utils.TickCount - Game.Ping/2 >= x.Args.EndTick) Dashes.Remove(x); // } //} //public static void OnDash(Obj_AI_Base sender, Dash.DashItem args) //{ // if (sender.IsEnemy) Dashes.Add(new Predictions(sender,args)); //} //public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell, bool DashPredict, bool Immobile) //{ // if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun) && Immobile == true && !target.IsDashing()) // { // float time = CastSpell.GetImmobileTime(target); // if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + from.Distance(target.Position) / spell.speed) // return target.Position; // else { return GetPrediction(from, target, spell); } // } // else // { // if (DashPredict == false) { return GetPrediction(from, target, spell); } // else if (!target.IsDashing()) { return GetPrediction(from, target, spell); } // else // { // Predictions x = null; // foreach (var y in Dashes) { if (y.Dasher.Name == target.Name)x = y; } // if (x == null) { return GetPrediction(from, target, spell); } // else // { // if (Utils.TickCount + Game.Ping / 2 + spell.delay * 1000 + (from.To2D().Distance(x.Args.EndPos) / spell.speed) * 1000 <= x.Args.EndTick) // { // Vector3 chuot = x.Args.EndPos.To3D(); // float dis = from.Distance(target.Position); // float rad = target.BoundingRadius + spell.radius - 20; // double z = math.t(x.Args.Speed, spell.speed, dis, spell.delay + Game.Ping / 2 / 1000, rad, from, target.Position, chuot); // if (z != 0) { return target.Position.Extend(chuot, (float)z * x.Args.Speed - rad); } // else return new Vector3(0, 0, 0); // } // else { return GetPrediction(from, target, spell); } // } // } // } //} public static Vector3 GetPrediction(Vector3 from, Obj_AI_Base target, Spells spell, bool Immobile) { if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun) && Immobile == true && !target.IsDashing()) { float time = CastSpell.GetImmobileTime(target); if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + from.Distance(target.Position) / spell.speed) return target.Position; else { return GetPrediction(from, target, spell); } } else { return GetPrediction(from, target, spell); } }
public static List<Obj_AI_Base> GetCollisions(Vector3 from, Vector3 to, Spells spell) { var result = new List<Obj_AI_Base>(); float t = spell.delay + Game.Ping / 2 / 1000 + from.Distance(to) / spell.speed; foreach (var obj in ObjectManager.Get<Obj_AI_Base>().Where(obj => obj.Type != GameObjectType.obj_AI_Turret && obj.Type != GameObjectType.obj_Building && obj.IsEnemy || obj.Team == GameObjectTeam.Neutral)) { if (obj.IsMoving) { var chuot = Prediction.GetPrediction(obj, 100).CastPosition; Vector3 obj2 = obj.Position.Extend(chuot, t * obj.MoveSpeed); var x = Geometry.Intersection(from.To2D(), to.To2D(), obj.Position.To2D(), obj2.To2D()); if (x.Intersects == true) result.Add(obj); else { Vector2 y; double d; math.FindDistanceToSegment(obj2.To2D(), from.To2D(), to.To2D(), out y, out d); if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D())) { if (d <= obj.BoundingRadius + spell.radius)result.Add(obj); } } } else { Vector2 y; double d; math.FindDistanceToSegment(obj.Position.To2D(), from.To2D(), to.To2D(), out y, out d); if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D())) { if (d <= obj.BoundingRadius + spell.radius)result.Add(obj); } } } GameObject wall = null; foreach (var gameObject in ObjectManager.Get<GameObject>() .Where( gameObject => gameObject.IsValid && Regex.IsMatch( gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase))) { if (Utils.TickCount - _wallCastT > 4000) { break; } wall = gameObject; if (wall == null) { break; } var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = (300 + 50 * Convert.ToInt32(level)); var wallDirection = (wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var x = Geometry.Intersection(wallStart, wallEnd, from.To2D(), to.To2D()); if (x.Intersects == true) result.Add(ObjectManager.Player); else { Vector2 y; double d; math.FindDistanceToSegment(wallStart, from.To2D(), to.To2D(), out y, out d); Vector2 y1; double d1; math.FindDistanceToSegment(wallEnd, from.To2D(), to.To2D(), out y1, out d1); if (from.To2D().Distance(y) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y) <= from.To2D().Distance(to.To2D())) { if (d <= spell.radius)result.Add(ObjectManager.Player); } if (from.To2D().Distance(y1) <= from.To2D().Distance(to.To2D()) && to.To2D().Distance(y1) <= from.To2D().Distance(to.To2D())) { if (d1 <= spell.radius)result.Add(ObjectManager.Player); } } } return result.Distinct().ToList(); }
public static Spells.HitChances GetHiChance(Vector3 From, Obj_AI_Base target, Spells spell) { if (target == null) return Spells.HitChances.Notarget; else { //Game.PrintChat("1"); if (target.HasBuffOfType(BuffType.Knockup) || target.HasBuffOfType(BuffType.Snare) || target.HasBuffOfType(BuffType.Stun)) { //Game.PrintChat("2"); float time = GetImmobileTime(target) - Utils.TickCount; if (time / 1000 + (spell.radius + target.BoundingRadius - 20) / target.MoveSpeed >= spell.delay + Game.Ping / 2 / 1000 + From.Distance(target.Position) / spell.speed) return Spells.HitChances.Immobile; else return Spells.HitChances.VeryLow; } else { //Game.PrintChat("3"); var predict = Prediction.GetPrediction(target, 100).CastPosition; float y = target.MoveSpeed * 100 / 1000; bool moving = !(target.Distance(predict) < y); var chuot = moving == false ? target.Position : target.Position.Extend(predict, y); if (chuot == target.Position) return Spells.HitChances.VeryLow; else { //Game.PrintChat("4"); var cosB = math.CosB(From, target.Position, chuot); var gocB = Math.Acos(cosB) * (180 / Math.PI); if (gocB <= 40) { return Spells.HitChances.VeryHigh; } else if (gocB <= 90) return Spells.HitChances.High; else if (gocB <= 165) return Spells.HitChances.Medium; else return Spells.HitChances.Low; } } } }
public static bool Cast(this Spells spell, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow) { return Cast(spell, Player.Position, ToTarget, minhitchance); }
public static bool Cast(this Spells spell, bool DragSpell, Vector3 from, Obj_AI_Base ToTarget, Spells.HitChances minhitchance = Spells.HitChances.VeryLow, bool UseExtendRadiusSSCirle = true) { if (spell.spellslot.IsReady()) { if (GetHiChance(from, ToTarget, spell) >= spell.MinHitChance && GetHiChance(from, ToTarget, spell) >= minhitchance) { Vector3 y = new Vector3(0, 0, 0); Vector3 pos = Predictions.GetPrediction(from, ToTarget, spell, true); if (Player.Distance(from) <= spell.range && from.Distance(pos) <= spell.extrarange && pos != y) { if (spell.collision == false) return Player.Spellbook.CastSpell(spell.spellslot, from, pos); else { List<Obj_AI_Base> list = Collisions.GetCollision(from, pos, spell); if (list.Count == 0) { Vector3 pos1 = Predictions.GetPrediction(from, ToTarget, spell); return Player.Spellbook.CastSpell(spell.spellslot, from, pos1); } else return false; } } else return false; } else return false; } else return false; }
private static void Game_OnGameLoad(EventArgs args) { if (Player.ChampionName != "Viktor") { return; } _q = new Spell(SpellSlot.Q); _e = new Spell(SpellSlot.E); _r = new Spell(SpellSlot.R); E = new Spells(SpellSlot.E, SkillshotType.SkillshotLine, 520, (float)0.25, 40, false, 780, 500); R = new Spells(SpellSlot.R, SkillshotType.SkillshotCircle, 700, 0.25f, 325 / 2, false); _menu = new Menu(Player.ChampionName, Player.ChampionName, true); Menu orbwalkerMenu = new Menu("Orbwalker", "Orbwalker"); _orbwalker = new Orbwalking.Orbwalker(orbwalkerMenu); _menu.AddSubMenu(orbwalkerMenu); Menu ts = _menu.AddSubMenu(new Menu("Target Selector", "Target Selector"));; TargetSelector.AddToMenu(ts); Menu spellMenu = _menu.AddSubMenu(new Menu("Spells", "Spells")); Menu Harass = spellMenu.AddSubMenu(new Menu("Harass", "Harass")); Menu Combo = spellMenu.AddSubMenu(new Menu("Combo", "Combo")); Menu Focus = spellMenu.AddSubMenu(new Menu("Focus Selected", "Focus Selected")); Menu KS = spellMenu.AddSubMenu(new Menu("KillSteal", "KillSteal")); Menu drawingg = spellMenu.AddSubMenu(new Menu("drawing", "drawing")); Harass.AddItem(new MenuItem("Use Q Harass", "Use Q Harass").SetValue(true)); Harass.AddItem(new MenuItem("Use E Harass", "Use E Harass").SetValue(true)); Combo.AddItem(new MenuItem("Use Q Combo", "Use Q Combo").SetValue(true)); Combo.AddItem(new MenuItem("Use E Combo", "Use E Combo").SetValue(true)); Combo.AddItem(new MenuItem("Use R Burst Selected", "Use R Burst Selected").SetValue(true)); Focus.AddItem(new MenuItem("force focus selected", "force focus selected").SetValue(false)); Focus.AddItem(new MenuItem("if selected in :", "if selected in :").SetValue(new Slider(1000, 1000, 1500))); KS.AddItem(new MenuItem("Use Q KillSteal", "Use Q KillSteal").SetValue(true)); KS.AddItem(new MenuItem("Use E KillSteal", "Use E KillSteal").SetValue(true)); KS.AddItem(new MenuItem("Use R KillSteal", "Use R KillSteal").SetValue(true)); spellMenu.AddItem(new MenuItem("Use R Follow", "Use R Follow").SetValue(true)); drawingg.AddItem(new MenuItem("apollo.viktor.draw.cd", "Draw on CD").SetValue(new Circle(false, Color.DarkRed))); MenuItem drawComboDamageMenu = new MenuItem("apollo.viktor.draw.ind.bool", "Draw Combo Damage", true).SetValue(true); MenuItem drawFill = new MenuItem("apollo.viktor.draw.ind.fill", "Draw Combo Damage Fill", true).SetValue(new Circle(true, Color.FromArgb(90, 255, 169, 4))); drawingg.AddItem(drawComboDamageMenu); drawingg.AddItem(drawFill); DamageIndicator.Enabled = drawComboDamageMenu.GetValue <bool>(); DamageIndicator.Fill = drawFill.GetValue <Circle>().Active; DamageIndicator.FillColor = drawFill.GetValue <Circle>().Color; drawComboDamageMenu.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { DamageIndicator.Enabled = eventArgs.GetNewValue <bool>(); }; drawFill.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { DamageIndicator.Fill = eventArgs.GetNewValue <Circle>().Active; DamageIndicator.FillColor = eventArgs.GetNewValue <Circle>().Color; }; _menu.AddToMainMenu(); Game.OnUpdate += Game_OnGameUpdate; GameObject.OnCreate += Create; GameObject.OnDelete += Delete; Game.PrintChat("Welcome to ViktorWorld"); }