public override void SetUp() { base.SetUp(); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot1"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot2"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot3"))); }
public override void SetUp() { base.SetUp(); Battlefield = Get <IBattlefieldFactory>().Create(); BotAI = new TestBotAI(); BotWorkshop = Get <IBotWorkshop>(); Bot = BotWorkshop.Create(BotAI); IsExplodedEventRaised = false; Bot.Exploded += (sender, args) => IsExplodedEventRaised = true; }
public override void SetUp() { base.SetUp(); Bot.PositionTo(Battlefield, 0, 0); BotAI.TurnAction = TurnAction.Move.East(); Enemy = BotWorkshop.Create(TestBotAI.Idle); Enemy.PositionTo(Battlefield, 1, 0); Bot.ExecuteTurnAction(new List <IBattleBot> { Enemy }); }
public override void SetUp() { base.SetUp(); Battlefield = Get <IBattlefieldFactory>().Create(); BotWorkshop = Get <IBotWorkshop>(); TurnFactory = Get <ITurnFactory>(); Turn = TurnFactory.Create(1); Settings = Get <ISettings>(); AttackerBot = BotWorkshop.Create(TestBotAI.AttackFirstEnemy); IdleBot = BotWorkshop.Create(TestBotAI.Idle); }
public async Task OneBot() { var bot = BotWorkshop.Create(TestBotAI.Idle); BotFactory.Bots.Add(bot); await Round.StartAsync(); Round.Scores.Should().NotBeNull(); Round.Scores.Count().Should().Be(1); Round.Scores.First().BotName.Should().Be(bot.Name); }
public async Task FiveBots() { BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot1"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot2"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot3"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot4"))); BotFactory.Bots.Add(BotWorkshop.Create(TestBotAI.SeekAndDestroy("bot5"))); await Round.StartAsync(); Round.Scores.Should().NotBeNull(); Round.Scores.Count().Should().Be(5); }
public async Task TwoBots() { var attacker = BotWorkshop.Create(TestBotAI.SeekAndDestroy("attacker")); attacker.PositionTo(Round.Battlefield, 0, 0); var victim = BotWorkshop.Create(TestBotAI.Idle); victim.PositionTo(Round.Battlefield, 1, 0); BotFactory.Bots.Add(attacker); BotFactory.Bots.Add(victim); await Round.StartAsync(); Round.Scores.Should().NotBeNull(); Round.Scores.Count().Should().Be(2); Round.Scores.Single(s => s.BotName == attacker.Name).Kills.Should().Be(1); Round.Scores.Single(s => s.BotName == victim.Name).Deaths.Should().Be(1); }
public void ItIsPossibleToKill() { var attacker = BotWorkshop.Create(TestBotAI.SeekAndDestroy("attacker")); var victim = BotWorkshop.Create(TestBotAI.Idle); var bots = new List <IBattleBot> { attacker, victim }; attacker.PositionTo(Battlefield, 0, 0); victim.PositionTo(Battlefield, Battlefield.Width - 1, Battlefield.Height - 1); for (int i = 1; i <= Settings.MaxTurns; i++) { System.Console.WriteLine($"Attacker: {attacker.Position}"); System.Console.WriteLine($"Victim: {victim.Position}"); var turn = TurnFactory.Create(i); turn.Start(bots); System.Console.WriteLine(attacker.Action); } victim.HP.Should().Be(0); }