private void CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (lastPosInfo != null && lastPosInfo.dodgeableSpells.Contains(spell.spellID)) { if (myHero.ServerPosition.To2D().InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { playerInDanger = true; break; } if (ObjectCache.menuCache.cache["EnableEvadeDistance"].GetValue <bool>() && EvadeUtils.TickCount < lastPosInfo.endTime) { playerInDanger = true; break; } } } if (isDodging && !playerInDanger) { lastDodgingEndTime = EvadeUtils.TickCount; } if (isDodging == false && !Situation.ShouldDodge()) { return; } isDodging = playerInDanger; }
public static bool PreferEvadeSpell() { if (!Situation.ShouldUseEvadeSpell()) { return(false); } foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (!ObjectCache.myHeroCache.serverPos2D.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { continue; } if (ActivateEvadeSpell(spell, true)) { return(true); } } return(false); }
private void CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.Spells) { Spell spell = entry.Value; if (LastPosInfo != null) //&& lastPosInfo.dodgeableSpells.Contains(spell.spellID)) { if (GameData.MyHero.ServerPosition.To2D().InSkillShot(spell, GameData.HeroInfo.BoundingRadius)) { playerInDanger = true; break; } if (ConfigValue.EnableEvadeDistance.GetBool() && EvadeUtils.TickCount < LastPosInfo.EndTime) { playerInDanger = true; break; } } } if (IsDodging && !playerInDanger) { LastDodgingEndTime = EvadeUtils.TickCount; } if (IsDodging == false && !Situation.ShouldDodge()) { return; } IsDodging = playerInDanger; }
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 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 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, 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 Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) /////LOI DOAN NAY { 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 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; } 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) { 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"].Cast <Slider>().CurrentValue; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast <Slider>().CurrentValue; var dashPos = Game.CursorPos.To2D(); //real pos? if (evadeSpell.fixedRange) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, extraDelayBuffer + ObjectCache.gamePing, 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 + ObjectCache.gamePing + 100; } } 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, 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; } }
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)) { 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; 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.Dash) { if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.LSTo2D(); //real pos? if (args.Target != null) { dashPos = args.Target.Position.LSTo2D(); } if (evadeSpell.fixedRange || dashPos.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.LSTo2D()).LSNormalized(); dashPos = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } 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; } 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 (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) { lastPosInfo = PositionInfo.SetAllUndodgeable(); if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { /*if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //need testing * { * args.Process = false; * return; * }*/ if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
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; } } } }