private void GiveBall(Match match, Team team) { //give the ball to a random attacker on the selected team var index = _randomHandler.NextInt(team.Attackers.Count); match.PlayerWithBall = team.Attackers[index]; match.AttackingTeam = team; }
public Team CreateTeam(string name, int averageStrength) { return(new Team { Name = name, Attackers = new List <FootballPlayer> { new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) } }, Defenders = new List <FootballPlayer> { new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) } }, MidFielders = new List <FootballPlayer> { new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) }, new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) } }, Keeper = new FootballPlayer { BallControl = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Passing = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalKeeping = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), Tackles = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), GoalScoring = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance), SprintSpeed = averageStrength + _randomHandler.NextInt(TeamConstants.TeamStatVariance) } }); }