public void ExecuteMoveOrderTest(Player.Orders order, int end_x, int end_y) { //Arrange Team firsteTeam = new Team() { TeamName = "The greeks" }; Team secondTeam = new Team() { TeamName = "Olsen banden" }; Match thisMatch = new Match() { HomeTeam = firsteTeam, AwayTeam = secondTeam }; Player alfred = new Player() { Name = "Alfred", Position = new Coordinate(1, 1), PlayerOrder = order, Team = firsteTeam }; firsteTeam.PlayersOnTeam.Add(alfred); firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(2, 1), Team = firsteTeam }); firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(1, 1), Team = firsteTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(1, 1), Team = secondTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(1, 1), Team = secondTeam }); Player player = new Player(); //act player.ExecuteOrders(thisMatch); //Assert Assert.Equal(end_x, alfred.Position.X); Assert.Equal(end_y, alfred.Position.Y); }
public void compairePlayerPostionTest2Coordinate() { //Arrange Team firsteTeam = new Team() { TeamName = "The greeks" }; Team secondTeam = new Team() { TeamName = "Olsen banden" }; Match thisMatch = new Match() { HomeTeam = firsteTeam, AwayTeam = secondTeam }; firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(5, 5), Team = firsteTeam }); firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(3, 2), Team = firsteTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(5, 5), Team = secondTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(3, 2), Team = secondTeam }); //Act List<Coordinate> result = thisMatch.CompairePlayersCoordinates(thisMatch); //Assert Assert.Equal(new Coordinate(5, 5), result[0]); Assert.Equal(new Coordinate(3, 2), result[1]); Assert.Equal(2, result.Count); }
public Match SetupMatch() { Team homeTeam = new Team() { TeamName = "The greeks" }; Team awayTeam = new Team() { TeamName = "Olsen banden" }; Ball ball = new Ball() {}; Match thisMatch = new Match() { HomeTeam = homeTeam, AwayTeam = awayTeam, MatchBall = ball }; homeTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(1, 1), Team = homeTeam }); homeTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(1, 3), Team = homeTeam }); homeTeam.PlayersOnTeam.Add(new Player() {ShirtNumber = 3, Name = "Gamma", Position = new Coordinate(1,3), Team = homeTeam}); awayTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(1, 5), Team = awayTeam }); awayTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(1, 5), Team = awayTeam }); awayTeam.PlayersOnTeam.Add(new Player() {ShirtNumber = 13, Name = "Kjeld", Position = new Coordinate(1,3), Team = awayTeam}); Console.WriteLine("--PRESENTING THE HOME TEAM: {0}", homeTeam.TeamName); foreach (Player player in homeTeam.PlayersOnTeam) { Console.WriteLine("For {0} first player is #{1} {2}", homeTeam.TeamName, player.ShirtNumber, player.Name); } Console.WriteLine("--PRESENTING THE AWAY TEAM: {0}", awayTeam.TeamName); foreach(Player player in awayTeam.PlayersOnTeam) { Console.WriteLine("For {0} first player is #{1} {2}", awayTeam.TeamName, player.ShirtNumber, player.Name); } thisMatch.MatchBall.PlayerWithBall = homeTeam.PlayersOnTeam[0]; Console.WriteLine("{0} startes with the ball", homeTeam.PlayersOnTeam[0]); return thisMatch; }
public void rollForEngagementTest() { //Arrange Team firsteTeam = new Team() { TeamName = "The greeks" }; Team secondTeam = new Team() { TeamName = "Olsen banden" }; Ball ball = new Ball(); Match thisMatch = new Match() { HomeTeam = firsteTeam, AwayTeam = secondTeam, MatchBall = ball }; firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(2, 1), Team = firsteTeam }); firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(1, 1), Team = firsteTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(1, 1), Team = secondTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(1, 1), Team = secondTeam }); //Act Rolls roll = new Rolls(); roll.RollForEngagement(new Coordinate(1, 1), thisMatch); //Assert }
public void GetPlayersAtCoordinateTest() { //Arrange Team firsteTeam = new Team() { TeamName = "The greeks" }; Team secondTeam = new Team() { TeamName = "Olsen banden" }; Match thisMatch = new Match() { HomeTeam = firsteTeam, AwayTeam = secondTeam }; firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 1, Name = "Alpha", Position = new Coordinate(2, 1), Team = firsteTeam }); firsteTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 2, Name = "Beta", Position = new Coordinate(1, 1), Team = firsteTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 10, Name = "Egon", Position = new Coordinate(1, 1), Team = secondTeam }); secondTeam.PlayersOnTeam.Add(new Player() { ShirtNumber = 11, Name = "Benny", Position = new Coordinate(1, 1), Team = secondTeam }); //Act var playersToFind = thisMatch.GetPlayersAtCoordinate(new Coordinate(1, 1), thisMatch); //Assert Assert.NotEmpty(playersToFind); Assert.Equal(3, playersToFind.Count); Assert.Equal("Beta", playersToFind[0].Name); Assert.Equal("The greeks", playersToFind[0].Team.TeamName); Assert.Equal("Egon", playersToFind[1].Name); Assert.Equal("Olsen banden", playersToFind[1].Team.TeamName); Assert.Equal("Benny", playersToFind[2].Name); Assert.Equal("Olsen banden", playersToFind[2].Team.TeamName); }
public void effectOfEngagementTest(Rolls.ResultOfEngagement engagementResult, string loserTeam) { //Arrange Team firsteTeam = new Team() { TeamName = "The greeks" }; Team secondTeam = new Team() { TeamName = "Olsen banden" }; //Setup players at an engagement Rolls roll = new Rolls(); List<Player> homeTeamPlayersAtCoordinate = new List<Player>(); List<Player> awayTeamPlayersAtCoordinate = new List<Player>(); homeTeamPlayersAtCoordinate.Add(new Player() { Name="Aplha", State = Player.PlayerState.Up, Team = firsteTeam}); homeTeamPlayersAtCoordinate.Add(new Player() { Name="Beta", State = Player.PlayerState.Up, Team = firsteTeam}); awayTeamPlayersAtCoordinate.Add(new Player() { Name = "Ringo", State = Player.PlayerState.Up, Team = secondTeam}); awayTeamPlayersAtCoordinate.Add(new Player() { Name = "John", State = Player.PlayerState.Up, Team = secondTeam}); //Act var result = roll.EffectOfEngangement(engagementResult, homeTeamPlayersAtCoordinate, awayTeamPlayersAtCoordinate); //Assert Assert.Equal(Player.PlayerState.Down, result.State); Assert.Equal(loserTeam, result.Team.TeamName); }
public void OnLoad() { hero = ObjectManager.LocalHero; heroTeam = hero.Team; jungleCamps = new JungleCamps(heroTeam); Camp.DisplayOverlay = menu.IsEnabled; Camp.Debug = Controllable.Debug = menu.IsDebugEnabled; controllableUnits.Add(new Controllable(hero, true)); sleeper = new Sleeper(); }
public JungleCamps(Team heroTeam) { if (heroTeam == Team.Radiant) { GetCamps.Add( new Camp { OverlayPosition = new Vector3(-1411, -4284, 256), CampPosition = new Vector3(-1812, -4302, 128), StackPosition = new Vector3(-1805, -2930, 256), WaitPosition = new Vector3(-1829, -3834, 256), Id = 1, StackTime = 56, Team = Team.Radiant, Ancients = false, Name = "Medium Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 1, MaxTimeAdjustment = 1 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-100, -3424, 384), CampPosition = new Vector3(-563, -3314, 256), StackPosition = new Vector3(-726, -4275, 384), WaitPosition = new Vector3(-859, -3217, 256), Id = 2, StackTime = 54, Team = Team.Radiant, Ancients = false, Name = "Hard Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(135, -4793, 384), CampPosition = new Vector3(431, -4637, 384), StackPosition = new Vector3(751, -3479, 384), WaitPosition = new Vector3(719, -4391, 384), Id = 3, StackTime = 55, Team = Team.Radiant, Ancients = false, Name = "Medium Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(5152, -4384, 256), CampPosition = new Vector3(4679, -4293, 256), StackPosition = new Vector3(3064, -3733, 256), WaitPosition = new Vector3(4514, -4114, 256), Id = 4, StackTime = 54, Team = Team.Radiant, Ancients = false, Name = "Bot Hard Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 2, MaxTimeAdjustment = 2 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(3168, -4320, 256), CampPosition = new Vector3(3030, -4555, 256), StackPosition = new Vector3(4499, -5096, 384), WaitPosition = new Vector3(3432, -4656, 256), Id = 5, StackTime = 54, Team = Team.Radiant, Ancients = false, Name = "Easy Camp", }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-3000, 300, 384), CampPosition = new Vector3(-2858, -126, 384), StackPosition = new Vector3(-3472, -1566, 384), WaitPosition = new Vector3(-2649, -140, 384), Id = 6, StackTime = 53, Team = Team.Radiant, Ancients = true, Name = "Top Ancients Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 1, MaxTimeAdjustment = 1 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-5121, -239, 256), CampPosition = new Vector3(-4710, -287, 256), StackPosition = new Vector3(-4658, 1403, 384), WaitPosition = new Vector3(-4573, -111, 256), Id = 7, StackTime = 55, Team = Team.Radiant, Ancients = false, Name = "Secret Hard Camp", }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-3324, 736, 256), CampPosition = new Vector3(-3824, 766, 256), StackPosition = new Vector3(-4896, 736, 256), WaitPosition = new Vector3(-4049, 620, 256), Id = 8, StackTime = 54, Team = Team.Radiant, Ancients = false, Name = "Secret Medium Camp", }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(567, -1908, 384), CampPosition = new Vector3(259, -2014, 384), StackPosition = new Vector3(945, -3544, 384), WaitPosition = new Vector3(528, -2283, 384), Id = 9, StackTime = 54, Team = Team.Radiant, Ancients = true, Name = "Bot Ancients Camp", }); } else if (heroTeam == Team.Dire) { GetCamps.Add( new Camp { OverlayPosition = new Vector3(1700, 3400, 384), CampPosition = new Vector3(1174, 3453, 384), StackPosition = new Vector3(449, 4752, 384), WaitPosition = new Vector3(960, 3688, 384), Id = 10, StackTime = 53, Team = Team.Dire, Ancients = false, Name = "Medium Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-352, 3070, 256), CampPosition = new Vector3(-270, 3424, 256), StackPosition = new Vector3(-395, 4616, 384), WaitPosition = new Vector3(-551, 3556, 256), Id = 11, StackTime = 54, Team = Team.Dire, Ancients = false, Name = "Hard Camp", StackCountTimeAdjustment = 2, TimeAdjustment = 1, MaxTimeAdjustment = 3 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-1184, 2208, 384), CampPosition = new Vector3(-716, 2378, 384), StackPosition = new Vector3(982, 2251, 384), WaitPosition = new Vector3(-419, 2473, 384), Id = 12, StackTime = 53, Team = Team.Dire, Ancients = true, Name = "Top Ancients Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 1, MaxTimeAdjustment = 1 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-2512, 4900, 384), CampPosition = new Vector3(-2919, 4955, 384), StackPosition = new Vector3(-1923, 6042, 384), WaitPosition = new Vector3(-3023, 5180, 384), Id = 13, StackTime = 53, Team = Team.Dire, Ancients = false, Name = "Easy Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-4100, 3300, 256), CampPosition = new Vector3(-4331, 3706, 256), StackPosition = new Vector3(-2894, 3515, 256), WaitPosition = new Vector3(-4174, 3893, 256), Id = 14, StackTime = 55, Team = Team.Dire, Ancients = false, Name = "Top Hard Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 1, MaxTimeAdjustment = 2 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(4200, -400, 256), CampPosition = new Vector3(3732, -631, 256), StackPosition = new Vector3(2221, -1013, 256), WaitPosition = new Vector3(3446, -697, 256), Id = 15, StackTime = 53, Team = Team.Dire, Ancients = false, Name = "Secret Medium Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(4696, 1120, 384), CampPosition = new Vector3(4273, 791, 384), StackPosition = new Vector3(4552, -305, 384), WaitPosition = new Vector3(4001, 745, 384), Id = 16, StackTime = 55, Team = Team.Dire, Ancients = false, Name = "Secret Hard Camp" }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(-1864, 4300, 384), CampPosition = new Vector3(-1735, 4024, 256), StackPosition = new Vector3(-961, 5011, 384), WaitPosition = new Vector3(-1526, 3855, 256), Id = 17, StackTime = 55, Team = Team.Dire, Ancients = false, Name = "Medium Camp", StackCountTimeAdjustment = 2, TimeAdjustment = 1, MaxTimeAdjustment = 2 }); GetCamps.Add( new Camp { OverlayPosition = new Vector3(2527, 478, 384), CampPosition = new Vector3(2685, 110, 384), StackPosition = new Vector3(4425, 11, 384), WaitPosition = new Vector3(3039, 106, 384), Id = 18, StackTime = 54, Team = Team.Dire, Ancients = true, Name = "Bot Ancients Camp", StackCountTimeAdjustment = 3, TimeAdjustment = 1, MaxTimeAdjustment = 1 }); } }
public void GiveOrders(Team teamToGiveOrders, List<Orders> hand) { //Give players orders //foreach players in match to give them orders foreach (Player player in teamToGiveOrders.PlayersOnTeam) { if (player.State == PlayerState.Up) { Console.WriteLine("{0} spiller for {1} med nummer {2}", player.Name, player.Team.TeamName, player.ShirtNumber); Console.WriteLine("Give order to {0}", player.Name); Console.WriteLine("#### YOUR HAND ####"); Console.WriteLine("You have the following Orders on your Hand:"); //Write the orders the player has for (int index = 0; index < hand.Count; index++) { var card = hand[index]; Console.Write("#" + index); Console.WriteLine(" " + card); } Console.WriteLine("Play an order from your hand or select a move"); Console.WriteLine("Hit arrowkey for direction to move or space to protect for {0}: ", player.Name); var playerOrder = new Orders(); ConsoleKeyInfo keyInfo = Console.ReadKey(); switch (keyInfo.Key) { case ConsoleKey.UpArrow: playerOrder = Orders.MoveUp; break; case ConsoleKey.DownArrow: playerOrder = Orders.MoveDown; break; case ConsoleKey.LeftArrow: playerOrder = Orders.MoveLeft; break; case ConsoleKey.RightArrow: playerOrder = Orders.MoveRigth; break; case ConsoleKey.Spacebar: playerOrder = Orders.Protect; break; case ConsoleKey.D0: playerOrder = Orders.DobbelMove; break; } //Assign player Order player.PlayerOrder = playerOrder; Console.WriteLine(player.Name + " has the order " + player.PlayerOrder); } if (player.State == PlayerState.Down) { player.State = PlayerState.Up; player.PlayerOrder = Orders.NoOrder; Console.WriteLine("{0} was down and is now up, can take no order this turn"); } Console.WriteLine("----------------------------"); } }