private void Init() { Start = new SmartDecision { Condition = () => Current.Hockeyist.State == HockeyistState.Swinging } .Yes(new ScriptAction { Action = () => Current.Move.Action = ActionType.CancelStrike } ) .No(new TakePuck()); }
private void Init() { Start = new SmartDecision { Condition = () => Current.Hockeyist.State == HockeyistState.Swinging } .Yes(new ScriptAction { Action = () => Current.Move.Action = ActionType.CancelStrike } ) .No( new SmartDecision { Condition = () => !PlayerHelper.IsFreezeTime(), NoNode = new TakePuck(), YesNode = new SmartDecision { Condition = () => { var minDistance = Current.World.Width; foreach (var hock in Current.World.Hockeyists) { if (!hock.IsTeammate && hock.Type != HockeyistType.Goalie) { var nd = Current.World.Puck.GetDistanceTo(hock); if (minDistance > nd) { minDistance = nd; } } } return((!Current.World.Puck.IsMyPlayerOwner() && (Current.World.Puck.GetSpeedModule() < 9.0D) && minDistance > Current.Hockeyist.GetDistanceTo(Current.World.Puck) / 2.0D) && (Current.Hockeyist.GetDistanceTo(Current.World.GetMyPlayer().NetFront, PlayerHelper.GetMyYCenterNetCoordinate()) < Current.World.Width / 3.5D)); }, NoNode = new CoverNet(), YesNode = new TakePuck() } }); }
private void Init() { Start = new SmartDecision { Condition = () => Current.World.Puck.OwnerHockeyistId == Current.Hockeyist.Id, YesNode = new SmartDecision { Condition = () => { var opponent = Current.World.GetOpponentPlayer(); return(Current.Hockeyist.GetDistanceTo(opponent.NetFront, PlayerHelper.GetPlayerYCenterNetCoordinate(opponent)) <= Current.World.Width / 2.8D); }, YesNode = new SmartDecision { Condition = () => { var opponent = Current.World.GetOpponentPlayer(); return((Current.Hockeyist.State != HockeyistState.Swinging) && Math.Abs(Current.Hockeyist.X - opponent.NetFront) < Math.Abs((opponent.NetFront - opponent.NetBack) * 4.3D)); //TODO: write out to specific const }, YesNode = new TakeShotPossition(), //new SmartDecision { // Condition = () => { // var minDistance = 200.0D; // foreach (var hock in Current.World.Hockeyists) // { // if (!hock.IsTeammate && hock.Type != HockeyistType.Goalie) // { // var nd = Current.World.Puck.GetDistanceTo(hock); // if (minDistance > nd) // minDistance = nd; // } // } // return minDistance < Current.Hockeyist.Radius + 0.5D + Current.Game.StickLength; // }, // YesNode = new TakePass(), // NoNode = new TakeShotPossition() //}, NoNode = new Strike() }, NoNode = new SmartDecision { Condition = () => Current.Hockeyist.State == HockeyistState.Swinging, YesNode = GameStates.CancelStrikeAction, NoNode = new SmartDecision { Condition = () => { var opponent = Current.World.GetOpponentPlayer(); var futureY = Current.Hockeyist.Y + 4.0D * Current.Hockeyist.SpeedY; return(opponent.NetBottom > futureY && futureY > opponent.NetTop); }, YesNode = new GoToSide(), NoNode = new MoveToNet() } } }, NoNode = new Cover() }; }