public void OnDraw() { if (!menuManager.IsEnabled) { return; } if (!target.Locked) { target.NewTarget(TargetSelector.ClosestToMouse(hero, 600)); } if (!target.IsValid() || hero.Distance2D(target.GetPosition()) > 1400 && !target.Locked || !hero.IsAlive) { if (targetParticle != null) { targetParticle.Dispose(); targetParticle = null; } return; } if (targetParticle == null) { targetParticle = new ParticleEffect( @"particles\ui_mouseactions\range_finder_tower_aoe.vpcf", target.GetPosition(true)); } targetParticle.SetControlPoint(2, heroPosition = hero.Position); targetParticle.SetControlPoint(6, new Vector3(1, 0, 0)); targetParticle.SetControlPoint(7, target.GetPosition(true)); }
public Tree GetChaseTree( Hero hero, Target target, TimberChain timberChain, float maxDistanceToEnemy, float minDistanceToHero) { var castRange = timberChain.GetCastRange(); var targetPosition = target.GetPosition(); var targetDistance = target.GetDistance(hero.Position); var ignoreMaxDistance = targetDistance > castRange + 200; var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000; var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList(); return (trees.Where( x => (ignoreMaxDistance || x.Distance2D( TimberPrediction.PredictedXYZ( target, timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed)) <= maxDistanceToEnemy || (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600)) && x.Distance2D(hero) >= minDistanceToHero) .FirstOrDefault( z => trees.Where(x => !x.Equals(z)) .All( x => x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25)))); }
public Tree GetChaseTree( Vector3 hero, Target target, TimberChain timberChain, float maxDistanceToEnemy, float minDistanceToHero) { var castRange = timberChain.GetCastRange(); var targetPosition = target.GetPosition(); var targetDistance = target.GetDistance(hero); var ignoreMaxDistance = targetDistance > castRange + 200; var trees = GetAvailableTrees(hero, targetPosition, castRange).ToList(); return (trees.Where( x => (ignoreMaxDistance || x.Distance2D( TimberPrediction.PredictedXYZ( target, timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed)) <= maxDistanceToEnemy || (Math.Abs( target.Hero.FindAngleR() - Utils.DegreeToRadian(target.Hero.FindAngleForTurnTime(x.Position))) < 0.3 && x.Distance2D(targetPosition) < targetDistance)) && x.Distance2D(hero) >= minDistanceToHero) .FirstOrDefault( z => trees.Where(x => !x.Equals(z)) .All(x => !IsPointOnLine(x.Position, hero, z.Position, forceRadius: 25)))); }
public void OnDraw() { if (!menuManager.IsEnabled) { return; } if (!target.Locked) { target.NewTarget(TargetSelector.ClosestToMouse(hero, 600)); } if (!target.IsValid() || hero.Distance2D(target.GetPosition()) > 1400 && !target.Locked || !hero.IsAlive) { if (targetParticle != null) { targetParticle.Dispose(); targetParticle = null; } return; } //if (debug == null) //{ // debug = new ParticleEffect( // @"materials\ensage_ui\particles\drag_selected_ring_mod.vpcf", // target.GetPosition()); // debug.SetControlPoint(1, new Vector3(0, 255, 0)); // debug.SetControlPoint(2, new Vector3(50, 255, 0)); //} //debug.SetControlPoint(0, TimberPrediction.PredictedXYZ(target, 700)); if (targetParticle == null) { targetParticle = new ParticleEffect( @"particles\ui_mouseactions\range_finder_tower_aoe.vpcf", target.GetPosition(true)); } targetParticle.SetControlPoint(2, hero.Position); targetParticle.SetControlPoint(6, new Vector3(1, 0, 0)); targetParticle.SetControlPoint(7, target.GetPosition(true)); }
public static Vector3 PredictedXYZ(Hero hero, Target target, float delay) { if (IsIdle(target.Hero)) { return(target.Position); } if (target.IsVsisible && target.FindAngle(hero.Position) < 0.5f) { delay /= 2; } var targetSpeed = new Vector3(); if (!LastRotRDictionary.ContainsKey(target.Handle)) { LastRotRDictionary.Add(target.Handle, target.RotationRad); } var straightTime = StraightTime(target.Hero); if (straightTime > 180) { LastRotRDictionary[target.Handle] = target.RotationRad; } LastRotRDictionary[target.Handle] = target.RotationRad; if ((target.ClassId == ClassId.CDOTA_Unit_Hero_StormSpirit || target.ClassId == ClassId.CDOTA_Unit_Hero_Rubick) && target.HasModifier("modifier_storm_spirit_ball_lightning")) { var ballLightning = target.FindSpell("storm_spirit_ball_lightning", true); var firstOrDefault = ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed"); if (firstOrDefault != null) { var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1); var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000f); targetSpeed = newpredict; } } else { targetSpeed = target.Vector3FromPolarAngle() * (target.MovementSpeed / 1000f); } var v = target.GetPosition() + targetSpeed * delay; return(new Vector3(v.X, v.Y, 0)); }
public Vector3 GetBlinkPosition( Target target, Vector3 hero, float distance, float radius, bool whirlingDeathCanBeCasted) { var tree = allTrees.OrderBy(x => x.Distance2D(target.Position)) .FirstOrDefault( x => x.Distance2D(target.Position) <= radius * 1.9 && x.Distance2D(hero) <= distance && NavMesh.GetCellFlags(x.Position).HasFlag(NavMeshCellFlags.Tree)); return(tree != null && whirlingDeathCanBeCasted ? new Vector3( (target.Position.X + tree.Position.X) / 2, (target.Position.Y + tree.Position.Y) / 2, target.Position.Z) : target.GetPosition()); }
public Vector3 GetBlinkPosition( Target target, Vector3 hero, float distance, float radius, bool whirlingDeathCanBeCasted) { var tree = allTrees.OrderBy(x => x.Distance2D(target.Position)) .FirstOrDefault( x => x.Distance2D(target.Position) <= radius * 1.9 && x.Distance2D(hero) <= distance && NavMesh.GetCellFlags(x.Position).HasFlag(NavMeshCellFlags.Tree)); return tree != null && whirlingDeathCanBeCasted ? new Vector3( (target.Position.X + tree.Position.X) / 2, (target.Position.Y + tree.Position.Y) / 2, target.Position.Z) : target.GetPosition(); }
public static Vector3 PredictedXYZ(Target target, float delay) { if (IsIdle(target.Hero)) { return(target.Position); } var targetSpeed = new Vector3(); if (!lastRotRDictionary.ContainsKey(target.Handle)) { lastRotRDictionary.Add(target.Handle, target.RotationRad); } var straightTime = StraightTime(target.Hero); if (straightTime > 180) { lastRotRDictionary[target.Handle] = target.RotationRad; } if (straightTime < 10 || IsTurning(target.Hero, 0.18)) { var rotDiff = lastRotRDictionary[target.Handle] - target.RotationRad; var a = 10 * straightTime * Math.Pow(rotDiff, 2); if (a >= 0 && a <= 1300) { a = 1300 + a; } else if (a <= 0 && a >= -1300) { a = 1300 - a; } targetSpeed = (Vector3) VectorExtensions.FromPolarAngle((lastRotRDictionary[target.Handle] + target.RotationRad * 2) / 2) * target.MovementSpeed / (float)Math.Abs(a); } else if (straightTime < 180) { var rotDiff = lastRotRDictionary[target.Handle] - target.RotationRad; var a = straightTime * Math.Pow(rotDiff, 2); if (a >= 0 && a <= 1000) { a = 1000 + a; } else if (a <= 0 && a >= -1000) { a = 1000 - a; } targetSpeed = (Vector3) (VectorExtensions.FromPolarAngle((lastRotRDictionary[target.Handle] + target.RotationRad) / 2) * target.MovementSpeed / (float)Math.Abs(a)); } else { lastRotRDictionary[target.Handle] = target.RotationRad; if ((target.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit || target.ClassID == ClassID.CDOTA_Unit_Hero_Rubick) && target.HasModifier("modifier_storm_spirit_ball_lightning")) { var ballLightning = target.FindSpell("storm_spirit_ball_lightning", true); var firstOrDefault = ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed"); if (firstOrDefault != null) { var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1); var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000); targetSpeed = newpredict; } } else { targetSpeed = (Vector3)(VectorExtensions.FromPolarAngle(target.RotationRad) * target.MovementSpeed / 1000); } } var v = target.GetPosition() + targetSpeed * delay; return(new Vector3(v.X, v.Y, 0)); }
public static Vector3 PredictedXYZ(Target target, float delay) { if (IsIdle(target.Hero)) { return target.Position; } var targetSpeed = new Vector3(); if (!LastRotRDictionary.ContainsKey(target.Handle)) { LastRotRDictionary.Add(target.Handle, target.RotationRad); } var straightTime = StraightTime(target.Hero); if (straightTime > 180) { LastRotRDictionary[target.Handle] = target.RotationRad; } LastRotRDictionary[target.Handle] = target.RotationRad; if ((target.ClassID == ClassID.CDOTA_Unit_Hero_StormSpirit || target.ClassID == ClassID.CDOTA_Unit_Hero_Rubick) && target.HasModifier("modifier_storm_spirit_ball_lightning")) { var ballLightning = target.FindSpell("storm_spirit_ball_lightning", true); var firstOrDefault = ballLightning.AbilitySpecialData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed"); if (firstOrDefault != null) { var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1); var newpredict = target.Vector3FromPolarAngle() * (ballSpeed / 1000f); targetSpeed = newpredict; } } else { targetSpeed = target.Vector3FromPolarAngle() * (target.MovementSpeed / 1000f); } var v = target.GetPosition() + targetSpeed * delay; return new Vector3(v.X, v.Y, 0); }
public Tree GetChaseTree( Hero hero, Target target, TimberChain timberChain, float maxDistanceToEnemy, float minDistanceToHero) { var castRange = timberChain.GetCastRange(); var targetPosition = target.GetPosition(); var targetDistance = target.GetDistance(hero.Position); var ignoreMaxDistance = targetDistance > castRange + 200; var delay = Game.RawGameTime + timberChain.CastPoint + Game.Ping / 1000; var trees = GetAvailableTrees(hero, targetPosition, castRange, delay, timberChain.Speed).ToList(); return trees.Where( x => (ignoreMaxDistance || x.Distance2D( TimberPrediction.PredictedXYZ( target, timberChain.CastPoint + x.Distance2D(targetPosition) / timberChain.Speed)) <= maxDistanceToEnemy || (target.Hero.GetTurnTime(x.Position) <= 0 && x.Distance2D(targetPosition) < 600)) && x.Distance2D(hero) >= minDistanceToHero) .FirstOrDefault( z => trees.Where(x => !x.Equals(z)) .All( x => x.Distance2D(hero) > 150 && !IsPointOnLine(x.Position, hero.Position, z.Position, 25))); }