public void RequestBot(Team team, AiHero hero, Difficulty difficulty, IBotRule rule, int minPlayersOnTeam, int maxPlayersOnTeam) { BotRequest newRequest = new BotRequest(team, hero, difficulty, rule, minPlayersOnTeam, maxPlayersOnTeam); _botRequests.Requests.Add(newRequest); }
public void AddBot(AiHero hero, Difficulty difficulty, Team team) { if (_slots.Empty.Count(team) > 0) { _modifiedFlag.Flag(); _deltin.AddAi(hero, difficulty, team); } }
public void InitTooLargeMax() { Team team = Team.Blue; AiHero hero = AiHero.Ana; Difficulty difficulty = Difficulty.Medium; IBotRule rule = new BotRuleEqualTeams(); int min = 0; int max = 6; new BotRequest(team, hero, difficulty, rule, min, max); }
public void InitMinGreaterThanMax() { Team team = Team.Blue; AiHero hero = AiHero.Ana; Difficulty difficulty = Difficulty.Medium; IBotRule rule = new BotRuleEqualTeams(); int min = 4; int max = 3; new BotRequest(team, hero, difficulty, rule, min, max); }
public void TestWhenNoTeamSpecifiedThenRequestAddedForDifferentTeams() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Reaper; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleBothTeams(); sut.RequestBot(hero, difficulty, rule); Assert.AreNotEqual(requests.Requests[0].BotTeam, requests.Requests[1].BotTeam); }
public void TestWhenNoTeamSpecifiedThenRequestAddedToBothTeams() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Reaper; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleBothTeams(); sut.RequestBot(hero, difficulty, rule); Assert.AreEqual(requests.Requests.Count, 2); }
public void TestCorrectRuleInRequest() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Reaper; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleBothTeams(); sut.RequestBot(hero, difficulty, rule); Assert.AreEqual(requests.Requests[0].Rule, rule); Assert.AreEqual(requests.Requests[1].Rule, rule); }
public void TestIfSameReturnEqual() { Team team = Team.Blue; AiHero hero = AiHero.Ana; IBotRule rule = new BotRuleEqualTeams(); Difficulty difficulty = Difficulty.Medium; int min = 2; int max = 4; BotRequest sut1 = new BotRequest(team, hero, difficulty, rule, min, max); BotRequest sut2 = new BotRequest(team, hero, difficulty, rule, min, max); Assert.IsTrue(sut1.Equals(sut2)); }
public void TestRequestHasCorrectTeam() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Sombra; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleSmallerTeam(); Team team = Team.Blue; sut.RequestBot(team, hero, difficulty, rule); Assert.AreEqual(requests.Requests[0].BotTeam, Team.Blue); }
public void TestIfDifferentDifficultyNotReturnEqual() { Team team = Team.Blue; AiHero hero = AiHero.Ana; IBotRule rule = new BotRuleEqualTeams(); Difficulty difficulty1 = Difficulty.Medium; Difficulty difficulty2 = Difficulty.Hard; int min = 3; int max = 3; BotRequest sut1 = new BotRequest(team, hero, difficulty1, rule, min, max); BotRequest sut2 = new BotRequest(team, hero, difficulty2, rule, min, max); Assert.AreNotEqual(sut1, sut2); }
public void TestIfDifferentHeroNotReturnEqual() { Team team = Team.Blue; AiHero hero1 = AiHero.Ana; AiHero hero2 = AiHero.Bastion; IBotRule rule = new BotRuleEqualTeams(); Difficulty difficulty = Difficulty.Medium; int min = 0; int max = 3; BotRequest sut1 = new BotRequest(team, hero1, difficulty, rule, min, max); BotRequest sut2 = new BotRequest(team, hero2, difficulty, rule, min, max); Assert.AreNotEqual(sut1, sut2); }
public void TestMinAndMaxPlayersForRequest() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Sombra; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleSmallerTeam(); int minPlayers = 1; int maxPlayers = 4; sut.RequestBot(hero, difficulty, rule, minPlayers, maxPlayers); Assert.AreEqual(requests.Requests[0].MinPlayersOnTeam, minPlayers); Assert.AreEqual(requests.Requests[0].MaxPlayersOnTeam, maxPlayers); }
public void TestClearBotRequestsLeavesNoBotRequests() { BotRequests requests = new BotRequests(); BotRequester sut = new BotRequester(requests); AiHero hero = AiHero.Sombra; Difficulty difficulty = Difficulty.Hard; IBotRule rule = new BotRuleSmallerTeam(); sut.RequestBot(hero, difficulty, rule); AiHero hero2 = AiHero.Bastion; Difficulty difficulty2 = Difficulty.Easy; IBotRule rule2 = new BotRuleLargerTeam(); sut.RequestBot(hero2, difficulty2, rule2); sut.ClearBotRequests(); Assert.AreEqual(requests.Requests.Count, 0); }
internal BotRequest(Team team, AiHero hero, Difficulty difficulty, IBotRule rule, int minPlayersOnTeam, int maxPlayersOnTeam) { if (minPlayersOnTeam < 0 || minPlayersOnTeam > 5) { throw (new ArgumentOutOfRangeException(nameof(minPlayersOnTeam), "Must be in range 0 - 5 inclusive.")); } if (maxPlayersOnTeam < 0 || maxPlayersOnTeam > 5) { throw (new ArgumentOutOfRangeException(nameof(maxPlayersOnTeam), "Must be in range 0 - 5 inclusive.")); } if (minPlayersOnTeam > maxPlayersOnTeam) { throw (new ArgumentOutOfRangeException(nameof(minPlayersOnTeam), "Must not be greater than maxPlayers")); } BotTeam = team; Hero = hero; Difficulty = difficulty; Rule = rule; MinPlayersOnTeam = minPlayersOnTeam; MaxPlayersOnTeam = maxPlayersOnTeam; }
public void RequestBot(AiHero hero, Difficulty difficulty, IBotRule rule) { RequestBot(Team.Blue, hero, difficulty, rule); RequestBot(Team.Red, hero, difficulty, rule); }
public void RequestBot(AiHero hero, Difficulty difficulty, IBotRule rule, int minPlayersOnTeam, int maxPlayersOnTeam) { RequestBot(Team.Blue, hero, difficulty, rule, minPlayersOnTeam, maxPlayersOnTeam); RequestBot(Team.Red, hero, difficulty, rule, minPlayersOnTeam, maxPlayersOnTeam); }
public void AddAi(AiHero hero, Difficulty difficulty, Team team) { _ai.AddAI(hero.ToDeltin(), difficulty.ToDeltin(), team.ToBotTeam()); }
public void RequestBot(Team team, AiHero hero, Difficulty difficulty, IBotRule rule) { RequestBot(team, hero, difficulty, rule, _defaultMinPlayersOnTeam, _defaultMaxPlayersOnTeam); }
public void AddBot(AiHero hero, Difficulty difficulty, Team team) { AddedBotsCount++; }
public static Deltin.CustomGameAutomation.AIHero ToDeltin(this AiHero lindholmHero) { Deltin.CustomGameAutomation.AIHero deltinHero = (Deltin.CustomGameAutomation.AIHero)Enum.Parse(typeof(Deltin.CustomGameAutomation.AIHero), lindholmHero.ToString()); return(deltinHero); }