public static bool CanStrike(this Hockeyist self, Unit unit) { var angle = self.GetAngleTo(unit); return((Math.Abs(angle) <= 0.5 * Current.Game.StickSector) && (self.GetDistanceTo(unit) <= Current.Game.StickLength)); }
public static bool IsHunter(this Hockeyist me) { var world = Get <World> .Current(); var teammate = world.MyTeam().First(x => x.Id != me.Id); return(world.Puck.OwnerHockeyistId == me.Id || me.GetDistanceTo(world.Puck) < teammate.GetDistanceTo(world.Puck)); }
private bool isOpponentClose() { for (int i = 0; i < 2; i++) { if (self.GetDistanceTo(opponentMinions[i]) < 4 * self.Radius) { return(true); } } return(false); }
public void Move(Hockeyist self, World world, Game game, Move move) { if (self.State == HockeyistState.Swinging) { move.Action = ActionType.Strike; return; } Init(self, world, game, move); if (PuckUnderOurControl) { if (ThisHasPuck) { if (InStrikeZone()) { if (Hypot(self.SpeedX, self.SpeedY) > 0.069) { move.SpeedUp = -1; } if (Math.Abs(TurnToNetFarCorner(self, move)) < STRIKE_ANGLE) { move.Action = ActionType.Swing; } } else { GoToNearestStrikeZone(); } } else { var nearestOpponent = GetNearestOpponent(); if (nearestOpponent != null) { if (self.GetDistanceTo(nearestOpponent) > game.StickLength) { move.SpeedUp = 1.0D; } else if (Math.Abs(self.GetAngleTo(nearestOpponent)) < 0.5D * game.StickSector) { move.Action = ActionType.Strike; } move.Turn = self.GetAngleTo(nearestOpponent); } } } else { move.SpeedUp = 1.0D; move.Turn = self.GetAngleTo(world.Puck); move.Action = ActionType.TakePuck; } }
public void Move(Hockeyist self, World world, Game game, Move move) { if (self.State == HockeyistState.Swinging) { move.Action = ActionType.Strike; return; } if (world.Puck.OwnerPlayerId == self.PlayerId) { if (world.Puck.OwnerHockeyistId == self.Id) { Player opponentPlayer = world.GetOpponentPlayer(); double netX = 0.5D * (opponentPlayer.NetBack + opponentPlayer.NetFront); double netY = 0.5D * (opponentPlayer.NetBottom + opponentPlayer.NetTop); netY += (self.Y < netY ? 0.5D : -0.5D) * game.GoalNetHeight; double angleToNet = self.GetAngleTo(netX, netY); move.Turn = angleToNet; if (Math.Abs(angleToNet) < STRIKE_ANGLE) { move.Action = ActionType.Swing; } } else { Hockeyist nearestOpponent = getNearestOpponent(self.X, self.Y, world); if (nearestOpponent != null) { if (self.GetDistanceTo(nearestOpponent) > game.StickLength) { move.SpeedUp = 1.0D; } else if (Math.Abs(self.GetAngleTo(nearestOpponent)) < 0.5D * game.StickSector) { move.Action = ActionType.Strike; } move.Turn = self.GetAngleTo(nearestOpponent); } } } else { move.SpeedUp = 1.0D; move.Turn = self.GetAngleTo(world.Puck); move.Action = ActionType.TakePuck; } }
public static bool CanStrike(Hockeyist ho, Unit to) { return(Math.Abs(ho.GetAngleTo(to)) <= Game.StickSector / 2 && ho.GetDistanceTo(to) <= Game.StickLength && ho.RemainingKnockdownTicks == 0); }