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; * * Game.PrintChat("" + (int)(GetTickCount()-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (menu.SubMenu("MiscSettings").Item("RecalculatePosition").GetValue <bool>())//recheck path { 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, myHero.MoveSpeed, 0, 0, false); if (EvadeHelper.isSamePosInfo(posInfo, lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = EvadeHelper.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); //using spells) } } } } } EvadeCommand.MoveTo(lastBestPosition); } } 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)) { var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } 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["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_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 = GetTickCount(), isProcessed = false, }; args.Process = false; //Block the command } else { var movePos = args.TargetPosition.To2D(); var extraDelay = Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraPingBuffer").GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { args.Process = false; //Block the command if (GetTickCount() - lastMovementBlockTime < 250 && lastMovementBlockPos.Distance(args.TargetPosition) < 100) { return; } lastMovementBlockPos = args.TargetPosition; lastMovementBlockTime = GetTickCount(); var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } else //need more logic { if (isDodging) { args.Process = false; //Block the command } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, PlayerIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } if (args.Order == GameObjectOrder.MoveTo) { if (isDodging && SpellDetector.spells.Any()) { CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; } 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(); } } }
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, 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 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 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)) { 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) { lastIssueOrderTime = Game.Time * 1000; } }