private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (isDodging) { if (lastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * Console.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["ClickOnlyOnce"].GetValue <bool>() == false || !(myHero.Path.Count() > 0 && lastPosInfo.position.Distance(myHero.Path.Last().To2D()) < 5)) //|| lastPosInfo.timestamp > lastEvadeOrderTime) { EvadeCommand.MoveTo(lastBestPosition); lastEvadeOrderTime = EvadeUtils.TickCount; } } } else //if not dodging { //Check if hero will walk into a skillshot var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .GetValue<Slider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .GetValue<Slider>().Value + 10; * * var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist); * * if (tPosInfo.posDangerLevel == 0) * { * lastPosInfo = tPosInfo; * return; * } * }*/ var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (//evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { //Block spell cast if flashing/blinking into spells /*if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash * { * args.Process = false; * return; * }*/ if (evadeSpell.evadeType == EvadeType.Dash) { //var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue<Slider>().Value; //var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].GetValue<Slider>().Value; var dashPos = args.StartPosition.To2D(); //real pos? if (args.Target != null) { dashPos = args.Target.Position.To2D(); } if (evadeSpell.fixedRange || dashPos.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } //Draw.RenderObjects.Add(new Draw.RenderCircle(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); //really? if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } if (args.Order == GameObjectOrder.MoveTo) { //movement block code goes in here if (isDodging && SpellDetector.spells.Count() > 0) { CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; //Block the command } else { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .GetValue<Slider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .GetValue<Slider>().Value + 10; * * var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist); * * if (tPosInfo.posDangerLevel == 0) * { * lastPosInfo = tPosInfo; * return; * } * }*/ lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; //Block the command if (EvadeUtils.TickCount - lastMovementBlockTime < 500 && lastMovementBlockPos.Distance(args.TargetPosition) < 100) { return; } lastMovementBlockPos = args.TargetPosition; lastMovementBlockTime = EvadeUtils.TickCount; var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } else { lastBlockedUserMoveTo.isProcessed = true; } } } else //need more logic { if (isDodging) { args.Process = false; //Block the command } else { if (args.Order == GameObjectOrder.AttackUnit) { var target = args.Target; if (target != null && target.IsValid <Obj_AI_Base>()) { var baseTarget = target as Obj_AI_Base; if (ObjectCache.myHeroCache.serverPos2D.Distance(baseTarget.ServerPosition.To2D()) > myHero.AttackRange + ObjectCache.myHeroCache.boundingRadius + baseTarget.BoundingRadius) { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { args.Process = false; //Block the command return; } } } } } } if (args.Process == true) { lastIssueOrderGameTime = Game.Time * 1000; lastIssueOrderTime = EvadeUtils.TickCount; lastIssueOrderArgs = args; if (args.Order == GameObjectOrder.MoveTo) { lastMoveToPosition = args.TargetPosition.To2D(); lastMoveToServerPos = myHero.ServerPosition.To2D(); } if (args.Order == GameObjectOrder.Stop) { lastStopPosition = myHero.ServerPosition.To2D(); } } }
public static bool ActivateEvadeSpell(Spell spell, bool checkSpell = false) { var sortedEvadeSpells = evadeSpells.OrderBy(s => s.dangerlevel); var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast <Slider>().CurrentValue; float spellActivationTime = ObjectCache.menuCache.cache["SpellActivationTime"].Cast <Slider>().CurrentValue + ObjectCache.gamePing + extraDelayBuffer; if (ObjectCache.menuCache.cache["CalculateWindupDelay"].Cast <CheckBox>().CurrentValue) { var extraWindupDelay = Evade.lastWindupTime - EvadeUtils.TickCount; if (extraWindupDelay > 0) { return(false); } } foreach (var evadeSpell in sortedEvadeSpells) { var processSpell = true; if (ObjectCache.menuCache.cache[evadeSpell.name + "UseEvadeSpell"].Cast <CheckBox>().CurrentValue == false || GetSpellDangerLevel(evadeSpell) > spell.GetSpellDangerLevel() || (evadeSpell.isItem == false && myHero.Spellbook.CanUseSpell(evadeSpell.spellKey) != SpellState.Ready) || (evadeSpell.isItem && !Items.CanUseItem((int)evadeSpell.itemID)) || (evadeSpell.checkSpellName && myHero.Spellbook.GetSpell(evadeSpell.spellKey).Name != evadeSpell.spellName)) { continue; //can't use spell right now } float evadeTime, spellHitTime; spell.CanHeroEvade(myHero, out evadeTime, out spellHitTime); float finalEvadeTime = (spellHitTime - evadeTime); if (checkSpell) { var mode = ObjectCache.menuCache.cache[evadeSpell.name + "EvadeSpellMode"] .Cast <ComboBox>().CurrentValue; if (mode == 0) { continue; } else if (mode == 1) { if (spellActivationTime < finalEvadeTime) { continue; } } } else { //if (ObjectCache.menuCache.cache[evadeSpell.name + "LastResort"].Cast<CheckBox>().CurrentValue) if (evadeSpell.spellDelay <= 50 && evadeSpell.evadeType != EvadeType.Dash) { var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, 0, 0); if (GetSpellDangerLevel(evadeSpell) > posInfo.posDangerLevel) { continue; } } } } if (evadeSpell.evadeType != EvadeType.Dash && spellHitTime > evadeSpell.spellDelay + 100 + Game.Ping + ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast <Slider>().CurrentValue) { processSpell = false; if (checkSpell == false) { continue; } } if (evadeSpell.isSpecial) { if (evadeSpell.useSpellFunc != null) { if (evadeSpell.useSpellFunc(evadeSpell, processSpell)) { return(true); } } continue; } else if (evadeSpell.evadeType == EvadeType.Blink) { if (evadeSpell.castType == CastType.Position) { var posInfo = EvadeHelper.GetBestPositionBlink(); if (posInfo != null) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, posInfo.position), processSpell); //DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); return(true); } } else if (evadeSpell.castType == CastType.Target) { var posInfo = EvadeHelper.GetBestPositionTargetedDash(evadeSpell); if (posInfo != null && posInfo.target != null && posInfo.posDangerLevel == 0) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, posInfo.target), processSpell); //DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); return(true); } } } else if (evadeSpell.evadeType == EvadeType.Dash) { if (evadeSpell.castType == CastType.Position) { var posInfo = EvadeHelper.GetBestPositionDash(evadeSpell); if (posInfo != null && CompareEvadeOption(posInfo, checkSpell)) { if (evadeSpell.isReversed) { var dir = (posInfo.position - ObjectCache.myHeroCache.serverPos2D).Normalized(); var range = ObjectCache.myHeroCache.serverPos2D.Distance(posInfo.position); var pos = ObjectCache.myHeroCache.serverPos2D - dir * range; posInfo.position = pos; } CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, posInfo.position), processSpell); //DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); return(true); } } else if (evadeSpell.castType == CastType.Target) { var posInfo = EvadeHelper.GetBestPositionTargetedDash(evadeSpell); if (posInfo != null && posInfo.target != null && posInfo.posDangerLevel == 0) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, posInfo.target), processSpell); //DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); return(true); } } } else if (evadeSpell.evadeType == EvadeType.WindWall) { if (spell.hasProjectile() || evadeSpell.spellName == "FioraW") //temp fix, don't have fiora :'( { var dir = (spell.startPos - ObjectCache.myHeroCache.serverPos2D).Normalized(); var pos = ObjectCache.myHeroCache.serverPos2D + dir * 100; CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, pos), processSpell); return(true); } } else if (evadeSpell.evadeType == EvadeType.SpellShield) { if (evadeSpell.isItem) { CastEvadeSpell(() => Items.UseItem((int)evadeSpell.itemID), processSpell); return(true); } else { if (evadeSpell.castType == CastType.Target) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, myHero), processSpell); return(true); } else if (evadeSpell.castType == CastType.Self) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell), processSpell); return(true); } } } else if (evadeSpell.evadeType == EvadeType.MovementSpeedBuff) { if (evadeSpell.isItem) { var posInfo = EvadeHelper.GetBestPosition(); if (posInfo != null) { CastEvadeSpell(() => Items.UseItem((int)evadeSpell.itemID), processSpell); EvadeCommand.MoveTo(posInfo.position); return(true); } } else { if (evadeSpell.castType == CastType.Target) { var posInfo = EvadeHelper.GetBestPosition(); if (posInfo != null) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, myHero), processSpell); EvadeCommand.MoveTo(posInfo.position); return(true); } } else if (evadeSpell.castType == CastType.Self) { var posInfo = EvadeHelper.GetBestPosition(); if (posInfo != null) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell), processSpell); EvadeCommand.MoveTo(posInfo.position); return(true); } } else if (evadeSpell.castType == CastType.Position) { var posInfo = EvadeHelper.GetBestPosition(); if (posInfo != null) { CastEvadeSpell(() => EvadeCommand.CastSpell(evadeSpell, posInfo.position), processSpell); EvadeCommand.MoveTo(posInfo.position); return(true); } } } } } return(false); }
//private void TestUnderTurret() //{ // if (Game.CursorPos.To2D().IsUnderTurret()) // { // Render.Circle.DrawCircle(Game.CursorPos, 50, Color.Red, 3); // } // else // { // Render.Circle.DrawCircle(Game.CursorPos, 50, Color.White, 3); // } //} private void Drawing_OnDraw(EventArgs args) { //PrintTimers(); //EvadeHelper.CheckMovePath(Game.CursorPos.To2D()); //TestUnderTurret(); /*if (EvadeHelper.CheckPathCollision(myHero, Game.CursorPos.To2D())) * { * var paths = myHero.GetPath(ObjectCache.myHeroCache.serverPos2DExtra.To3D(), Game.CursorPos); * foreach (var path in paths) * { * Render.Circle.DrawCircle(path, ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); * } * } * else * { * Render.Circle.DrawCircle(Game.CursorPos, ObjectCache.myHeroCache.boundingRadius, Color.White, 3); * }*/ foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; if (spell.spellType == SpellType.Line) { Vector2 spellPos = spell.currentSpellPosition; Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3); /*spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (60 / 1000); //move the spellPos by 50 miliseconds forwards * spellPos = spellPos + spell.direction * 200; //move the spellPos by 50 units forwards * * Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3);*/ } } if (testMenu.Get <CheckBox>("TestHeroPos").CurrentValue) { var path = myHero.Path; if (path.Length > 0) { var heroPos2 = EvadeHelper.GetRealHeroPos(ObjectCache.gamePing + 50);// path[path.Length - 1].To2D(); var heroPos1 = ObjectCache.myHeroCache.serverPos2D; Render.Circle.DrawCircle(new Vector3(heroPos2.X, heroPos2.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.White, 3); var heroPos = Drawing.WorldToScreen(ObjectManager.Player.Position); var dimension = Drawing.GetTextEntent("Evade: ON", 12); Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "" + (int)(heroPos2.Distance(heroPos1))); Render.Circle.DrawCircle(new Vector3(circleRenderPos.X, circleRenderPos.Y, myHero.ServerPosition.Z), 10, Color.Red, 3); } } if (testMenu.Get <CheckBox>("DrawHeroPos").CurrentValue) { Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), ObjectCache.myHeroCache.boundingRadius, Color.White, 3); } if (testMenu.Get <KeyBind>("TestMoveTo").CurrentValue) { //var keyBind = testMenu.Get<KeyBind>("TestMoveTo"); TODO: ?? //testMenu.Item("TestMoveTo").SetValue(new KeyBind(keyBind.Key, KeyBindType.Toggle, false)); /*lastRightMouseClickTime = EvadeUtils.TickCount; * myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos,false);*/ Player.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos); var dir = (Game.CursorPos - myHero.Position).Normalized(); //var pos2 = myHero.Position - dir * Game.CursorPos.Distance(myHero.Position); //var pos2 = myHero.Position.To2D() - dir.To2D() * 75; var pos2 = Game.CursorPos.To2D() - dir.To2D() * 75; //Console.WriteLine(myHero.BBox.Maximum.Distance(myHero.Position)); DelayAction.Add(20, () => Player.IssueOrder(GameObjectOrder.MoveTo, pos2.To3D(), false)); //myHero.IssueOrder(GameObjectOrder.MoveTo, pos2, false); } if (testMenu.Get <CheckBox>("TestPath").CurrentValue) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), ObjectCache.myHeroCache.boundingRadius, Color.Violet, 3); lastPoint = point2D; } } if (testMenu.Get <CheckBox>("TestPath").CurrentValue) { var tPath = myHero.GetPath(Game.CursorPos); Vector2 lastPoint = Vector2.Zero; foreach (Vector3 point in tPath) { var point2D = point.To2D(); //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), ObjectCache.myHeroCache.boundingRadius, Color.Violet, 3); lastPoint = point2D; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; Vector2 to = Game.CursorPos.To2D(); var dir = (to - myHero.Position.To2D()).Normalized(); Vector2 cPos1, cPos2; var cpa = MathUtilsCPA.CPAPointsEx(myHero.Position.To2D(), dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed, to, spell.endPos); var cpaTime = MathUtilsCPA.CPATime(myHero.Position.To2D(), dir * ObjectCache.myHeroCache.moveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed); //ConsolePrinter.Print("" + cpaTime); //Render.Circle.DrawCircle(cPos1.To3D(), ObjectCache.myHeroCache.boundingRadius, Color.Red, 3); if (cpa < ObjectCache.myHeroCache.boundingRadius + spell.radius) { } } } if (testMenu.Get <CheckBox>("ShowBuffs").CurrentValue) { var target = myHero; foreach (var hero in HeroManager.Enemies) { target = hero; } var buffs = target.Buffs; //ConsolePrinter.Print(myHero.ChampionName); //if(myHero.IsDead) // ConsolePrinter.Print("dead"); if (!target.IsTargetable) { ConsolePrinter.Print("invul" + EvadeUtils.TickCount); } int height = 20; foreach (var buff in buffs) { if (buff.IsValid()) { Drawing.DrawText(10, height, Color.White, buff.Name); height += 20; ConsolePrinter.Print(buff.Name); } } } if (testMenu.Get <CheckBox>("TestTracker").CurrentValue) { foreach (KeyValuePair <int, ObjectTrackerInfo> entry in ObjectTracker.objTracker) { var info = entry.Value; Vector3 endPos2; if (info.usePosition == false) { endPos2 = info.obj.Position; } else { endPos2 = info.position; } Render.Circle.DrawCircle(new Vector3(endPos2.X, endPos2.Y, myHero.Position.Z), 50, Color.Green, 3); } /*foreach (var obj in ObjectManager.Get<Obj_AI_Minion>()) * { * ConsolePrinter.Print("minion: " + obj.Name); * if (obj.Name == "Ekko") * { * var pos = obj.Position; * Render.Circle.DrawCircle(pos, 100, Color.Green, 3); * } * }*/ } if (testMenu.Get <CheckBox>("ShowMissileInfo").CurrentValue) { if (testMissile != null) { //Render.Circle.DrawCircle(testMissile.Position, testMissile.BoundingRadius, Color.White, 3); } } if (testMenu.Get <CheckBox>("TestWall").CurrentValue) { /*foreach (var posInfo in sortedBestPos) * { * var posOnScreen = Drawing.WorldToScreen(posInfo.position.To3D()); * //Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * * * if (!posInfo.rejectPosition) * { * Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * } * * Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance); * * if (posInfo.posDangerCount <= 0) * { * var pos = posInfo.position; * Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3); * } * }*/ int posChecked = 0; int maxPosToCheck = 50; int posRadius = 50; int radiusIndex = 0; Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D; List <PositionInfo> posTable = new List <PositionInfo>(); while (posChecked < maxPosToCheck) { radiusIndex++; int curRadius = radiusIndex * (2 * posRadius); int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius)); for (int i = 1; i < curCircleChecks; i++) { posChecked++; var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians))); if (EvadeHelper.CheckPathCollision(myHero, pos)) { Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3); } } } } }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.myHeroCache.UpdateInfo(); if (ObjectCache.menuCache.cache["DodgeSkillShots"].GetValue <KeyBind>().Active == false) { lastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (ObjectCache.myHeroCache.serverPos2D.CheckDangerousPos(0) || ObjectCache.myHeroCache.serverPos2DExtra.CheckDangerousPos(0)) { if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var posInfo = EvadeHelper.GetBestPosition(); var calculationTimer = EvadeUtils.TickCount; var caculationTime = EvadeUtils.TickCount - calculationTimer; //computing time /*if (numCalculationTime > 0) * { * sumCalculationTime += caculationTime; * avgCalculationTime = sumCalculationTime / numCalculationTime; * } * numCalculationTime += 1;*/ //Console.WriteLine("CalculationTime: " + caculationTime); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) * { * return; * }*/ if (posInfo != null) { lastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.myHeroCache.serverPos2DPing.Distance(lastPosInfo.position) / myHero.MoveSpeed; lastPosInfo.endTime = EvadeUtils.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); DodgeSkillShots(); //walking CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } //Console.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Any()) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Blink) { var dir = (args.StartPosition.To2D() - myHero.ServerPosition.To2D()).Normalized(); var end = myHero.ServerPosition.To2D() + dir * myHero.ServerPosition.To2D().Distance(Game.CursorPos.To2D()); if (evadeSpell.fixedRange || end.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { end = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(end, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerCount < 1) { if (lastPosInfo != null) { lastPosInfo = posInfo; } if (lastPosInfo == null) { lastPosInfo = posInfo; } if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 250) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.To2D(); if (args.Target != null) { dashPos = args.Target.Position.To2D(); } if (evadeSpell.fixedRange || dashPos.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; } else { if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); return; } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { IsDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * GameData.MyHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (IsDodging) { ConsoleDebug.WriteLineColor("Dodging Skill Shots by Ka", ConsoleColor.Green); if (LastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * ConsoleDebug.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ Vector2 lastBestPosition = LastPosInfo.Position; if (!ConfigValue.ClickOnlyOnce.GetBool() || !(GameData.MyHero.Path.Length > 0 && LastPosInfo.Position.Distance(GameData.MyHero.Path.Last().To2D()) < 5)) //|| lastPosInfo.timestamp > lastEvadeOrderTime) { EvadeCommand.MoveTo(lastBestPosition); LastEvadeOrderTime = EvadeUtils.TickCount; } } } else //if not dodging { //Check if hero will walk into a skillshot var path = GameData.MyHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (() Properties.Properties.Data["AllowCrossing"].Cast<CheckBox>().CurrentValue) * { * var extraDelayBuffer = () Properties.Properties.Data["ExtraPingBuffer"] + 30; + var extraDist = () Properties.Properties.Data["ExtraCPADistance"] + 10; + + var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.moveSpeed, extraDelayBuffer + Game.Ping, extraDist); + + if (tPosInfo.posDangerLevel == 0) + { + lastPosInfo = tPosInfo; + return; + } + }*/ var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.Position); } return; } } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (args.Order == GameObjectOrder.HoldPosition) { var path = myHero.Path; var heroPoint = myHero.ServerPosition.To2D(); if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); var walkDir = (movePos - heroPoint).Normalized(); //circleRenderPos = EvadeHelper.GetRealHeroPos(); //heroPoint;// +walkDir * myHero.MoveSpeed * (((float)Game.Ping) / 1000); } } /* * if (args.Order == GameObjectOrder.MoveTo) * { * if (testingCollision) * { * if (args.TargetPosition.To2D().Distance(testCollisionPos) < 3) * { * //var path = myHero.GetPath(); * //circleRenderPos * * args.Process = false; * } * } * }*/ if (args.Order == GameObjectOrder.MoveTo) { Vector2 heroPos = myHero.ServerPosition.To2D(); Vector2 pos = args.TargetPosition.To2D(); float speed = myHero.MoveSpeed; startWalkPos = heroPos; startWalkTime = Evade.GetTickCount(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; var spellPos = SpellDetector.GetCurrentSpellPosition(spell); var walkDir = (pos - heroPos).Normalized(); float spellTime = (Evade.GetTickCount() - spell.startTime) - spell.info.spellDelay; spellPos = spell.startPos + spell.direction * spell.info.projectileSpeed * (spellTime / 1000); //Game.PrintChat("aaaa" + spellTime); bool isCollision = false; float movingCollisionTime = MathUtils.GetCollisionTime(heroPos, spellPos, walkDir * (speed - 25), spell.direction * (spell.info.projectileSpeed - 200), myHero.BoundingRadius, EvadeHelper.GetSpellRadius(spell), out isCollision); if (isCollision) { //Game.PrintChat("aaaa" + spellPos.Distance(spell.endPos) / spell.info.projectileSpeed); if (true)//spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > movingCollisionTime) { Game.PrintChat("movingCollisionTime: " + movingCollisionTime); //circleRenderPos = heroPos + walkDir * speed * movingCollisionTime; } } } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, PlayerIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } //DebugIssueOrders(args); if (args.Order == GameObjectOrder.MoveTo) { //movement block code goes in here if (IsDodging && SpellDetector.Spells.Count > 0) { ConsoleDebug.WriteLineColor("Issue Order detected while spells exist", ConsoleColor.Yellow); CheckHeroInDanger(); LastBlockedUserMoveTo = new EvadeCommand { Order = EvadeOrderCommand.MoveTo, TargetPosition = args.TargetPosition.To2D(), Timestamp = EvadeUtils.TickCount, IsProcessed = false, }; args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Movement Command", ConsoleColor.Red); } else { var movePos = args.TargetPosition.To2D(); var extraDelay = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { ConsoleDebug.WriteLineColor("Move Path is colliding with spell", ConsoleColor.Yellow); /*if (() Properties.Properties.Data["AllowCrossing"].Cast<CheckBox>().CurrentValue) * { * var extraDelayBuffer = () Properties.Properties.Data["ExtraPingBuffer"] + 30; + var extraDist = () Properties.Properties.Data["ExtraCPADistance"] + 10; + + var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.moveSpeed, extraDelayBuffer + Game.Ping, extraDist); + + if (tPosInfo.posDangerLevel == 0) + { + lastPosInfo = tPosInfo; + return; + } + }*/ LastBlockedUserMoveTo = new EvadeCommand { Order = EvadeOrderCommand.MoveTo, TargetPosition = args.TargetPosition.To2D(), Timestamp = EvadeUtils.TickCount, IsProcessed = false, }; args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Movement Command", ConsoleColor.Red); if (EvadeUtils.TickCount - LastMovementBlockTime < 500 && LastMovementBlockPos.Distance(args.TargetPosition) < 100) { return; } LastMovementBlockPos = args.TargetPosition; LastMovementBlockTime = EvadeUtils.TickCount; var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.Position); } return; } else { LastBlockedUserMoveTo.IsProcessed = true; } } } else //need more logic { if (IsDodging) { args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked IssueOrder(" + args.Order + ") Command", ConsoleColor.Red); } else { if (args.Order == GameObjectOrder.AttackUnit) { var target = args.Target; if (target != null && target.GetType() == typeof(Obj_AI_Base)) { var baseTarget = (Obj_AI_Base)target; if (baseTarget.IsValid()) { if (GameData.HeroInfo.ServerPos2D.Distance(baseTarget.ServerPosition.To2D()) > GameData.MyHero.AttackRange + GameData.HeroInfo.BoundingRadius + baseTarget.BoundingRadius) { var movePos = args.TargetPosition.To2D(); var extraDelay = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Attack Unit Command", ConsoleColor.Red); return; } } } } } } } if (args.Process == true) { LastIssueOrderGameTime = Game.Time * 1000; LastIssueOrderTime = EvadeUtils.TickCount; LastIssueOrderArgs = args; if (args.Order == GameObjectOrder.MoveTo) { LastMoveToPosition = args.TargetPosition.To2D(); LastMoveToServerPos = GameData.MyHero.ServerPosition.To2D(); } if (args.Order == GameObjectOrder.Stop) { LastStopPosition = GameData.MyHero.ServerPosition.To2D(); } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.ChanneledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = GameData.HeroInfo.serverPos2D; LastStopEvadeTime = EvadeUtils.TickCount + Game.Ping + 100; } if (EvadeSpell.LastSpellEvadeCommand != null && EvadeSpell.LastSpellEvadeCommand.Timestamp + Game.Ping + 150 > EvadeUtils.TickCount) { args.Process = false; } LastSpellCast = args.Slot; LastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = GameData.MyHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (IsDodging && SpellDetector.Spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.WindupSpells) { SpellData spellData = entry.Value; if (spellData.SpellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.EvadeSpells) { if (evadeSpell.IsItem == false && evadeSpell.SpellKey == args.Slot) { if (evadeSpell.EvadeType == EvadeType.Blink || evadeSpell.EvadeType == EvadeType.Dash) { //Block spell cast if flashing/blinking into spells if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash { args.Process = false; return; } if (evadeSpell.EvadeType == EvadeType.Dash) { var extraDelayBuffer = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); var extraDist = Config.Properties.GetInt(ConfigValue.ExtraCpaDistance); var dashPos = Game.CursorPos.To2D(); //real pos? if (evadeSpell.FixedRange) { var dir = (dashPos - GameData.MyHero.ServerPosition.To2D()).Normalized(); dashPos = GameData.MyHero.ServerPosition.To2D() + dir * evadeSpell.Range; } //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.Speed, extraDelayBuffer + Game.Ping, extraDist); if (posInfo.PosDangerLevel > 0) { args.Process = false; return; } } LastPosInfo = PositionInfo.SetAllUndodgeable(); //really? if (IsDodging || EvadeUtils.TickCount < LastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto LastStopEvadeTime = EvadeUtils.TickCount + Game.Ping + 100; } } return; } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (isDodging) { if (lastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * Console.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["RecalculatePosition"].GetValue <bool>())//recheck path { var dodgeInterval = ObjectCache.menuCache.cache["DodgeInterval"].GetValue <Slider>().Value; if (lastPosInfo != null && !lastPosInfo.recalculatedPath && dodgeInterval <= EvadeUtils.TickCount - lastPosInfo.timestamp) { var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (movePos.Distance(lastPosInfo.position) < 5) //more strict checking { var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, 0, 0, false); if (posInfo.isSamePosInfo(lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { lastPosInfo.recalculatedPath = true; } } } } } } EvadeCommand.MoveTo(lastBestPosition); if (Game.Time * 1000 - lastIssueOrderTime < 1) { DelayAction.Add(0, () => EvadeCommand.MoveTo(lastBestPosition)); } } } else //if not dodging { //return; //Check if hero will walk into a skillshot var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); if (Game.Time * 1000 - lastIssueOrderTime < 1) { DelayAction.Add(0, () => EvadeCommand.MoveTo(posInfo.position)); } } return; } } } }
private void Drawing_OnDraw(EventArgs args) { if (menu.SubMenu("Draw").Item("DrawSkillShots").GetValue <bool>() == false) { return; } if (menu.SubMenu("Draw").Item("DrawEvadePosition").GetValue <bool>()) { if (Evade.lastPosInfo != null) { var pos = Evade.lastPosInfo.position; Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), 65, Color.Red, 10); } } DrawEvadeStatus(); foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells) { Spell spell = entry.Value; var dangerStr = EvadeHelper.GetSpellDangerString(spell); var spellDrawingConfig = Evade.menu.SubMenu("Draw").SubMenu("DangerLevelDrawings") .SubMenu(dangerStr + "Drawing").Item(dangerStr + "Color").GetValue <Circle>(); var spellDrawingWidth = Evade.menu.SubMenu("Draw").SubMenu("DangerLevelDrawings") .SubMenu(dangerStr + "Drawing").Item(dangerStr + "Width").GetValue <Slider>().Value; if (Evade.menu.SubMenu("Spells").SubMenu(spell.info.charName + spell.info.spellName + "Settings") .Item(spell.info.spellName + "DrawSpell").GetValue <bool>() && spellDrawingConfig.Active) { if (spell.info.spellType == SpellType.Line) { Vector2 spellPos = SpellDetector.GetCurrentSpellPosition(spell); DrawLineRectangle(spellPos, spell.endPos, (int)EvadeHelper.GetSpellRadius(spell), spellDrawingWidth, spellDrawingConfig.Color); if (menu.SubMenu("Draw").Item("DrawSpellPos").GetValue <bool>()) { /*if (true) * { * var spellPos2 = spell.startPos + spell.direction * spell.info.projectileSpeed * (Evade.GetTickCount() - spell.startTime - spell.info.spellDelay) / 1000 + spell.direction * spell.info.projectileSpeed * ((float)Game.Ping / 1000); * Render.Circle.DrawCircle(new Vector3(spellPos2.X, spellPos2.Y, myHero.Position.Z), (int)EvadeHelper.GetSpellRadius(spell), Color.Red, 8); * }*/ Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), (int)EvadeHelper.GetSpellRadius(spell), spellDrawingConfig.Color, spellDrawingWidth); } } else if (spell.info.spellType == SpellType.Circular) { Render.Circle.DrawCircle(new Vector3(spell.endPos.X, spell.endPos.Y, myHero.Position.Z), (int)EvadeHelper.GetSpellRadius(spell), spellDrawingConfig.Color, spellDrawingWidth); } else if (spell.info.spellType == SpellType.Cone) { } } } }
public static void UseEvadeSpell() { if (!Situation.ShouldUseEvadeSpell()) { return; } //int posDangerlevel = EvadeHelper.CheckPosDangerLevel(myHero.ServerPosition.To2D(), 0); if (Evade.GetTickCount() - lastSpellEvadeCommand.timestamp < 1000) { return; } foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (ShouldActivateEvadeSpell(spell)) { 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 } if (evadeSpell.evadeType == EvadeType.Blink) { if (evadeSpell.castType == CastType.Position) { var posInfo = EvadeHelper.GetBestPositionBlink(); if (posInfo != null) { EvadeCommand.CastSpell(evadeSpell, posInfo.position); //Utility.DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); } } else if (evadeSpell.castType == CastType.Target) { var posInfo = EvadeHelper.GetBestPositionTargetedDash(evadeSpell); if (posInfo != null) { EvadeCommand.CastSpell(evadeSpell, posInfo.position); //Utility.DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); } } } else if (evadeSpell.evadeType == EvadeType.Dash) { if (evadeSpell.castType == CastType.Position) { var posInfo = EvadeHelper.GetBestPositionDash(evadeSpell); if (posInfo != null) { if (evadeSpell.isReversed) { var dir = (posInfo.position - myHero.ServerPosition.To2D()).Normalized(); var range = myHero.ServerPosition.To2D().Distance(posInfo.position); var pos = myHero.ServerPosition.To2D() - dir * range; posInfo.position = pos; } EvadeCommand.CastSpell(evadeSpell, posInfo.position); //Utility.DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); } } else if (evadeSpell.castType == CastType.Target) { var posInfo = EvadeHelper.GetBestPositionTargetedDash(evadeSpell); if (posInfo != null) { EvadeCommand.CastSpell(evadeSpell, posInfo.position); //Utility.DelayAction.Add(50, () => myHero.IssueOrder(GameObjectOrder.MoveTo, posInfo.position.To3D())); } } } else if (evadeSpell.evadeType == EvadeType.SpellShield) { if (evadeSpell.isItem) { Items.UseItem((int)evadeSpell.itemID); } else { EvadeCommand.CastSpell(evadeSpell); } } return; } } } }