Example #1
0
        public static void Test_ShiftDoubleAction_BothPerformed()
        {
            var player = new Player(PlayerActionFactory.CreateDoubleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, null,
                PlayerActionType.MoveRed, PlayerActionType.Bravo,
                PlayerActionType.ChangeDeck, PlayerActionType.Charlie,
                PlayerActionType.BattleBots, PlayerActionType.Charlie,
                PlayerActionType.ChangeDeck, PlayerActionType.MoveBlue
            }), 0, PlayerColor.Blue);

            player.Actions.ElementAt(0).FirstActionSegment.SegmentStatus  = PlayerActionStatus.Performed;
            player.Actions.ElementAt(0).SecondActionSegment.SegmentStatus = PlayerActionStatus.Performed;
            player.Actions.ElementAt(1).FirstActionSegment.SegmentStatus  = PlayerActionStatus.Performed;
            player.Actions.ElementAt(1).SecondActionSegment.SegmentStatus = PlayerActionStatus.Performing;
            player.ShiftFromPlayerActions(2);
            var expectedActions = PlayerActionFactory.CreateDoubleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, null,
                PlayerActionType.MoveRed, PlayerActionType.Bravo,
                null, null,
                PlayerActionType.ChangeDeck, PlayerActionType.Charlie,
                PlayerActionType.BattleBots, PlayerActionType.Charlie
            }).ToList();

            expectedActions.ElementAt(0).FirstActionSegment.SegmentStatus  = PlayerActionStatus.Performed;
            expectedActions.ElementAt(0).SecondActionSegment.SegmentStatus = PlayerActionStatus.Performed;
            expectedActions.ElementAt(1).FirstActionSegment.SegmentStatus  = PlayerActionStatus.Performed;
            expectedActions.ElementAt(1).SecondActionSegment.SegmentStatus = PlayerActionStatus.Performing;
            AssertActionAreEqual(expectedActions.ToList(), player.Actions.ToList());
        }
        public Game ConvertToGame()
        {
            //TODO: For all 4 tracksTry using trackConfiguration instead of using TrackIndex and casting
            var externalTracksByZone = new Dictionary <ZoneLocation, TrackConfiguration>
            {
                { ZoneLocation.Red, (TrackConfiguration)RedTrack.TrackIndex },
                { ZoneLocation.White, (TrackConfiguration)WhiteTrack.TrackIndex },
                { ZoneLocation.Blue, (TrackConfiguration)BlueTrack.TrackIndex }
            };
            var internalTrack = (TrackConfiguration)InternalTrack.TrackIndex;

            var players = Players
                          .Select(playerModel => PlayerFactory.CreatePlayer(
                                      playerModel.Actions.Select(action => PlayerActionFactory.CreatePlayerAction(action.FirstAction, action.SecondAction, action.BonusAction?.FirstAction)),
                                      playerModel.Index,
                                      playerModel.PlayerColor,
                                      playerModel.PlayerSpecialization))
                          .ToList();
            var internalThreats      = CreateInternalThreats(InternalThreats);
            var redThreats           = CreateExternalThreats(RedThreats, ZoneLocation.Red);
            var whiteThreats         = CreateExternalThreats(WhiteThreats, ZoneLocation.White);
            var blueThreats          = CreateExternalThreats(BlueThreats, ZoneLocation.Blue);
            var externalThreats      = redThreats.Concat(whiteThreats).Concat(blueThreats).ToList();
            var allThreats           = redThreats.Cast <Threat>().Concat(whiteThreats).Concat(blueThreats).Concat(internalThreats).ToList();
            var bonusExternalThreats = allThreats
                                       .Where(threat => threat.NeedsBonusExternalThreat)
                                       .Select(threat => ((IThreatWithBonusThreat <ExternalThreat>)threat).BonusThreat);
            var bonusInternalThreats = allThreats
                                       .Where(threat => threat.NeedsBonusExternalThreat)
                                       .Select(threat => ((IThreatWithBonusThreat <ExternalThreat>)threat).BonusThreat);
            var bonusThreats = bonusExternalThreats.Cast <Threat>().Concat(bonusInternalThreats).ToList();
            var damageTokens = InitialDamageModels.ToLookup(model => model.ZoneLocation, model => model.DamageToken);

            return(new Game(players, internalThreats, externalThreats, bonusThreats, externalTracksByZone, internalTrack, damageTokens));
        }
Example #3
0
        public static void Test_ShiftFromPlayerActions_MultipleTimesSameTurn()
        {
            var player = new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, PlayerActionType.Bravo, PlayerActionType.Charlie, PlayerActionType.ChangeDeck, PlayerActionType.HeroicA
            }), 0, PlayerColor.Blue);

            player.Actions.ElementAt(0).FirstActionSegment.SegmentStatus = PlayerActionStatus.Performed;
            player.Actions.ElementAt(1).FirstActionSegment.SegmentStatus = PlayerActionStatus.Performing;

            player.ShiftFromPlayerActions(2);
            player.ShiftFromPlayerActions(2);
            var expectedActions = PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha,
                PlayerActionType.Bravo,
                null,
                PlayerActionType.Charlie,
                PlayerActionType.ChangeDeck
            }).ToList();

            expectedActions[0].FirstActionSegment.SegmentStatus = PlayerActionStatus.Performed;
            expectedActions[1].FirstActionSegment.SegmentStatus = PlayerActionStatus.Performing;
            AssertActionAreEqual(expectedActions.ToList(), player.Actions.ToList());
        }
Example #4
0
        public static void RedSlimeTwoYCrossesXYY2Z_ProgenyACrossesY2Z_ProgenyBCrossesNoBreakpoints_TwoRedDamageTwoWhiteDamageHasDisabledBattleBots_Survived()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveBlue,
                    PlayerActionType.Charlie,
                    null,
                    PlayerActionType.ChangeDeck,
                    null,
                    null,
                    null,
                    null,
                    null,
                    PlayerActionType.BattleBots
                }), 0, PlayerColor.Red),
                new Player(PlayerActionFactory.CreateSingleActionList(ComputerMaintenanceActions), 1, PlayerColor.Green)
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track7;
            const int timeAppears = 4;

            const int  blueDamage         = 0;
            const int  whiteDamage        = 2;
            const int  redDamage          = 2;
            const bool isDefeated         = false;
            const bool isSurvived         = true;
            const bool battleBotsDisabled = true;

            SlimeBHelper(isDefeated, isSurvived, internalTrack, timeAppears, players, blueDamage, redDamage, whiteDamage, battleBotsDisabled);
        }
Example #5
0
        public static void RedSlimeNoYCrossesX_NoDamageHasDisabledBattleBots_Defeated()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateDoubleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveBlue, PlayerActionType.Charlie,
                    PlayerActionType.MoveRed, PlayerActionType.MoveRed,
                    PlayerActionType.ChangeDeck, null,
                    null, null,
                    PlayerActionType.BattleBots, null,
                    PlayerActionType.BattleBots, null
                }), 0, PlayerColor.Blue, PlayerSpecialization.EnergyTechnician),
                new Player(PlayerActionFactory.CreateSingleActionList(ComputerMaintenanceActions), 1, PlayerColor.Green)
            };


            const TrackConfiguration internalTrack = TrackConfiguration.Track1;
            const int timeAppears = 3;

            const int  blueDamage         = 0;
            const int  whiteDamage        = 0;
            const int  redDamage          = 0;
            const bool isDefeated         = true;
            const bool isSurvived         = false;
            const bool battleBotsDisabled = true;


            SlimeBHelper(isDefeated, isSurvived, internalTrack, timeAppears, players, blueDamage, redDamage, whiteDamage, battleBotsDisabled);
        }
Example #6
0
        public static void RedSlimeTwoYCrossesXYY2_ProgenyACrossesY2_ProgenyBCrossesZ_TwoBlueDamageHasDisabledBattleBots_Survived()
        {
            var redPlayerActions = PlayerActionFactory.CreateDoubleActionList(new PlayerActionType?[]
            {
                PlayerActionType.MoveRed, PlayerActionType.ChangeDeck,
                PlayerActionType.Charlie, null,
                null, null,
                PlayerActionType.BattleBots, null,
                null, null,
                null, null,
                null, null,
                null, null,
                null, null,
                PlayerActionType.BattleBots, null
            }).ToList();

            redPlayerActions.Add(new PlayerAction(PlayerActionType.MoveBlue, PlayerActionType.BattleBots, PlayerActionType.AdvancedSpecialization));
            var players = new List <Player>
            {
                new Player(redPlayerActions, 0, PlayerColor.Red, PlayerSpecialization.SpecialOps),
                new Player(PlayerActionFactory.CreateSingleActionList(ComputerMaintenanceActions), 1, PlayerColor.Green)
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track7;
            const int timeAppears = 4;

            const int  blueDamage         = 2;
            const int  whiteDamage        = 0;
            const int  redDamage          = 0;
            const bool isDefeated         = false;
            const bool isSurvived         = true;
            const bool battleBotsDisabled = false;

            SlimeBHelper(isDefeated, isSurvived, internalTrack, timeAppears, players, blueDamage, redDamage, whiteDamage, battleBotsDisabled);
        }
Example #7
0
        private static IList <Player> ParsePlayers(IList <string> chunk)
        {
            if (chunk.Count == 1)
            {
                throw new InvalidOperationException("Need at least one player");
            }
            var players      = new List <Player>();
            var playerTokens = new Queue <string>(chunk.Skip(1));

            if (playerTokens.Count % 3 != 0)
            {
                throw new InvalidOperationException("Invalid players.");
            }
            while (playerTokens.Any())
            {
                var idToken = ParseToken(playerTokens.Dequeue());
                if (idToken == null || idToken.Item1 != "player-index")
                {
                    throw new InvalidOperationException("Error on player #" + players.Count + 1);
                }
                var index = TryParseInt(idToken.Item2);
                if (index == null)
                {
                    throw new InvalidOperationException("Error on player #" + players.Count + 1);
                }
                var actionsToken = ParseToken(playerTokens.Dequeue());
                if (actionsToken == null || actionsToken.Item1 != "actions")
                {
                    throw new InvalidOperationException("Error on player #" + players.Count + 1);
                }
                var actions = ParsePlayerActions(actionsToken.Item2);
                if (actions == null)
                {
                    throw new InvalidOperationException("Error on player #" + players.Count + 1);
                }
                var colorToken = ParseToken(playerTokens.Dequeue());
                if (colorToken == null || colorToken.Item1 != "player-color")
                {
                    throw new InvalidOperationException("Error on player # " + players.Count + 1);
                }
                var color = TryParseEnum <PlayerColor>(colorToken.Item2);
                if (color == null)
                {
                    throw new InvalidOperationException("Error on player # " + players.Count + 1);
                }
                var player = new Player(PlayerActionFactory.CreateSingleActionList(actions), index.Value, color.Value);
                players.Add(player);
                //TODO: Add specializations and teleport player/destination
            }
            return(players);
        }
Example #8
0
        public static void RedSlimeOneYCrossesXYZ_ProgenyACrossesZ_TwoRedDamageTwoWhiteDamageHasDisabledBattleBots_Survived()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateSingleActionList(ComputerMaintenanceActions), 0, PlayerColor.Green)
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track4;
            const int timeAppears = 3;

            const int  blueDamage         = 0;
            const int  whiteDamage        = 2;
            const int  redDamage          = 2;
            const bool isDefeated         = false;
            const bool isSurvived         = true;
            const bool battleBotsDisabled = true;

            SlimeBHelper(isDefeated, isSurvived, internalTrack, timeAppears, players, blueDamage, redDamage, whiteDamage, battleBotsDisabled);
        }
Example #9
0
        public static void Test_ShiftAfterPlayerActions_LastBlank()
        {
            var player = new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, PlayerActionType.Bravo, PlayerActionType.Charlie, PlayerActionType.ChangeDeck, null
            }), 0, PlayerColor.Blue);

            player.ShiftAfterPlayerActions(2);
            var expectedActions = PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha,
                PlayerActionType.Bravo,
                null,
                PlayerActionType.Charlie,
                PlayerActionType.ChangeDeck
            });

            AssertActionAreEqual(expectedActions.ToList(), player.Actions.ToList());
        }
Example #10
0
        public static void Test_ShiftAndRepeatPreviousActionAfterPlayerActions_NoBlanks()
        {
            var player = new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, PlayerActionType.Bravo, PlayerActionType.BattleBots, PlayerActionType.Charlie, PlayerActionType.ChangeDeck
            }), 0, PlayerColor.Blue);

            player.ShiftAndRepeatPreviousActionAfterPlayerActions(3);
            var expectedActions = PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha,
                PlayerActionType.Bravo,
                PlayerActionType.Bravo,
                PlayerActionType.BattleBots,
                PlayerActionType.Charlie
            });

            AssertActionAreEqual(expectedActions.ToList(), player.Actions.ToList());
        }
Example #11
0
        public static void Test_ShiftAndRepeatPreviousActionAfterPlayerActions_MultipleTimesConsecutiveTurns()
        {
            var player = new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha, PlayerActionType.Bravo, PlayerActionType.Charlie, PlayerActionType.ChangeDeck, PlayerActionType.HeroicA
            }), 0, PlayerColor.Blue);

            player.ShiftAndRepeatPreviousActionAfterPlayerActions(3);
            player.ShiftAndRepeatPreviousActionAfterPlayerActions(4);
            var expectedActions = PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
            {
                PlayerActionType.Alpha,
                PlayerActionType.Bravo,
                PlayerActionType.Bravo,
                PlayerActionType.Bravo,
                PlayerActionType.Charlie
            });

            AssertActionAreEqual(expectedActions.ToList(), player.Actions.ToList());
        }
        public static void EzraCampaign1Mission3()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveBlue, null, PlayerActionType.BasicSpecialization,
                    PlayerActionType.Alpha, PlayerActionType.Alpha, PlayerActionType.MoveRed, null,
                    PlayerActionType.ChangeDeck, null, null, null, PlayerActionType.Charlie
                }), 0, PlayerColor.Blue, PlayerSpecialization.EnergyTechnician),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null, PlayerActionType.MoveBlue, PlayerActionType.ChangeDeck,
                    PlayerActionType.Alpha, PlayerActionType.Alpha, PlayerActionType.MoveRed, PlayerActionType.MoveRed,
                    PlayerActionType.Alpha, PlayerActionType.MoveBlue, null, null, PlayerActionType.Charlie
                }), 1, PlayerColor.Green, PlayerSpecialization.PulseGunner),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null, null, PlayerActionType.AdvancedSpecialization,
                    PlayerActionType.MoveRed, PlayerActionType.BasicSpecialization, null, PlayerActionType.Alpha,
                    PlayerActionType.Alpha, PlayerActionType.MoveBlue, PlayerActionType.ChangeDeck, null, PlayerActionType.Charlie
                }), 2, PlayerColor.Purple, PlayerSpecialization.Mechanic),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.Charlie, null, PlayerActionType.Alpha,
                    PlayerActionType.BasicSpecialization, PlayerActionType.Alpha, PlayerActionType.Alpha, PlayerActionType.Alpha,
                    PlayerActionType.Charlie, PlayerActionType.ChangeDeck, null, null, PlayerActionType.AdvancedSpecialization
                }), 3, PlayerColor.Red, PlayerSpecialization.DataAnalyst)
            };

            var externalTracksByZone = new Dictionary <ZoneLocation, TrackConfiguration>
            {
                { ZoneLocation.Blue, TrackConfiguration.Track6 },
                { ZoneLocation.Red, TrackConfiguration.Track2 },
                { ZoneLocation.White, TrackConfiguration.Track5 },
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track3;

            var spacecraftCarrier = new SpacecraftCarrier();

            spacecraftCarrier.SetInitialPlacement(4, ZoneLocation.Blue);
            var manOfWar = new ManOfWar();

            manOfWar.SetInitialPlacement(5, ZoneLocation.White);
            var frigate = new Frigate();

            frigate.SetInitialPlacement(7, ZoneLocation.Red);
            var externalThreats = new ExternalThreat[] { spacecraftCarrier, manOfWar, frigate };

            var centralLaserJam = new CentralLaserJam();

            centralLaserJam.SetInitialPlacement(3);
            var internalThreats = new InternalThreat[] { centralLaserJam };

            var bonusThreats = new Threat[0];

            var game = new Game(players, internalThreats, externalThreats, bonusThreats, externalTracksByZone, internalTrack, null);

            game.StartGame();
            for (var currentTurn = 0; currentTurn < game.NumberOfTurns + 1; currentTurn++)
            {
                game.PerformTurn();
            }
            Assert.AreEqual(GameStatus.Won, game.GameStatus);
            Assert.AreEqual(0, game.SittingDuck.BlueZone.TotalDamage);
            Assert.AreEqual(0, game.SittingDuck.RedZone.TotalDamage);
            Assert.AreEqual(0, game.SittingDuck.WhiteZone.TotalDamage);
            Assert.AreEqual(4, game.ThreatController.DefeatedThreats.Count());
            Assert.AreEqual(0, game.ThreatController.SurvivedThreats.Count());
            Assert.AreEqual(28 + 1 + 9, game.TotalPoints);
            Assert.AreEqual(0, players.Count(player => player.IsKnockedOut));
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(0).CurrentDamageTokens.Count);
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(1).CurrentDamageTokens.Count);
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(2).CurrentDamageTokens.Count);
        }
        public static void EzraCampaign1Mission2()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null, PlayerActionType.MoveBlue, PlayerActionType.BasicSpecialization,
                    null, PlayerActionType.AdvancedSpecialization, PlayerActionType.ChangeDeck, PlayerActionType.Alpha,
                    PlayerActionType.Alpha, null, null, null, null
                }), 0, PlayerColor.Blue, PlayerSpecialization.EnergyTechnician),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveRed, PlayerActionType.BasicSpecialization, null,
                    null, PlayerActionType.Alpha, PlayerActionType.Alpha, PlayerActionType.MoveBlue,
                    PlayerActionType.BasicSpecialization, null, null, null, null
                }), 1, PlayerColor.Green, PlayerSpecialization.PulseGunner),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveRed, PlayerActionType.ChangeDeck, PlayerActionType.Bravo,
                    PlayerActionType.Alpha, PlayerActionType.Alpha, PlayerActionType.Alpha, null,
                    null, null, null, null, null
                }), 2, PlayerColor.Purple),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.Charlie, null, null,
                    PlayerActionType.BasicSpecialization, PlayerActionType.MoveBlue, PlayerActionType.Alpha, PlayerActionType.Alpha,
                    PlayerActionType.MoveRed, PlayerActionType.BasicSpecialization, null, null, null
                }), 3, PlayerColor.Red, PlayerSpecialization.DataAnalyst)
            };

            var externalTracksByZone = new Dictionary <ZoneLocation, TrackConfiguration>
            {
                { ZoneLocation.Blue, TrackConfiguration.Track1 },
                { ZoneLocation.Red, TrackConfiguration.Track2 },
                { ZoneLocation.White, TrackConfiguration.Track7 },
            };
            const TrackConfiguration internalTrack = TrackConfiguration.Track4;

            var dimensionSpider = new DimensionSpider();

            dimensionSpider.SetInitialPlacement(6, ZoneLocation.Blue);
            var cryoshieldFrigate = new CryoshieldFrigate();

            cryoshieldFrigate.SetInitialPlacement(4, ZoneLocation.Red);
            var energyCloud = new EnergyCloud();

            energyCloud.SetInitialPlacement(1, ZoneLocation.Red);
            var externalThreats = new ExternalThreat[] { dimensionSpider, cryoshieldFrigate, energyCloud };

            var battleBotUprising = new BattleBotUprising();

            battleBotUprising.SetInitialPlacement(5);
            var internalThreats = new InternalThreat[] { battleBotUprising };

            var bonusThreats = new Threat[0];

            var game = new Game(players, internalThreats, externalThreats, bonusThreats, externalTracksByZone, internalTrack, null);

            game.StartGame();
            for (var currentTurn = 0; currentTurn < game.NumberOfTurns + 1; currentTurn++)
            {
                game.PerformTurn();
            }
            Assert.AreEqual(GameStatus.Won, game.GameStatus);
            Assert.AreEqual(0, game.SittingDuck.BlueZone.TotalDamage);
            Assert.AreEqual(0, game.SittingDuck.RedZone.TotalDamage);
            Assert.AreEqual(0, game.SittingDuck.WhiteZone.TotalDamage);
            Assert.AreEqual(3, game.ThreatController.DefeatedThreats.Count());
            Assert.AreEqual(1, game.ThreatController.SurvivedThreats.Count());
            Assert.AreEqual(20 + 4 + 2, game.TotalPoints);
            Assert.AreEqual(2, players.Count(player => player.IsKnockedOut));
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(0).CurrentDamageTokens.Count);
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(1).CurrentDamageTokens.Count);
            Assert.AreEqual(0, game.SittingDuck.Zones.ElementAt(2).CurrentDamageTokens.Count);
        }
        private static IList <Player> GetPlayers()
        {
            var players = new List <Player>
            {
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null,
                    PlayerActionType.ChangeDeck,
                    PlayerActionType.Bravo,
                    PlayerActionType.ChangeDeck,
                    PlayerActionType.Alpha,
                    PlayerActionType.Alpha,
                    PlayerActionType.Alpha,
                    PlayerActionType.Alpha,
                    PlayerActionType.Alpha,
                    PlayerActionType.Alpha
                }), 0, PlayerColor.Blue),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.MoveRed,
                    PlayerActionType.ChangeDeck,
                    PlayerActionType.Charlie,
                    PlayerActionType.ChangeDeck,
                    null,
                    PlayerActionType.Charlie,
                    PlayerActionType.BattleBots,
                    PlayerActionType.Charlie,
                    PlayerActionType.BattleBots,
                    PlayerActionType.Alpha
                }), 1, PlayerColor.Green),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null,
                    PlayerActionType.Charlie,
                    null,
                    null,
                    PlayerActionType.Charlie,
                    PlayerActionType.ChangeDeck,
                    PlayerActionType.Charlie
                }), 2, PlayerColor.Purple),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.ChangeDeck,
                    null,
                    null,
                    null,
                    null,
                    null,
                    PlayerActionType.Charlie
                }), 3, PlayerColor.Red),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    null,
                    PlayerActionType.ChangeDeck,
                    null,
                    null,
                    null,
                    null,
                    PlayerActionType.Charlie
                }), 4, PlayerColor.Yellow),
                new Player(PlayerActionFactory.CreateSingleActionList(new PlayerActionType?[]
                {
                    PlayerActionType.TeleportBlueLower,
                    PlayerActionType.TeleportRedUpper,
                    PlayerActionType.TeleportWhiteLower,
                    PlayerActionType.TeleportWhiteUpper
                }), 5, PlayerColor.Blue)
            };

            return(players);
        }
Example #15
0
        public static void Main()
        {
            //IO
            IReader reader = new ConsoleReader();
            IWriter writer = new ConsoleWriter(Constants.ConsoleHeight, Constants.ConsoleWidth);

            //player
            IPlayer player = new Player("Pesho")
            {
                Inventory = new List <IItem>
                {
                    new Axe(1, "Cepeni4kata", 99, Rarity.Common),
                    new Hammer(2, "Za dinozavrite", 15, Rarity.Epic),
                    new Sword(3, "Me4a na Ahil", 15, Rarity.Epic),
                    new Booklet(4, "Priklu4eniq", 15, Rarity.Epic),
                    new Sneaker(5, "Adidas", 15, Rarity.Epic),
                    new Sneaker(6, "Nike", 15, Rarity.Epic),
                    new Sneaker(7, "Reebok", 15, Rarity.Epic),
                    new Sneaker(8, "Puma", 15, Rarity.Epic),
                    new Sneaker(9, "Guma", 15, Rarity.Epic)
                }
            };

            //MANAGERS AND UTILITIES
            IRandomNumberGenerator   randomNumberGenerator = new RandomNumberGenerator();
            ICustomEventHandler      handler                 = new CustomEventHandler(writer);
            IPlayerManager           playerManager           = new PlayerManager(player);
            ITownsManager            townsManager            = new TownsManager();
            IRandomEncountersManager randomEncountersManager =
                new RandomEncountersManager(playerManager, reader, writer);
            IPlayerActionFactory playerActionFactory =
                new PlayerActionFactory(townsManager, playerManager, reader, writer);

            //SOFIA
            IMap  sofiaMap = new Map(player, writer);
            ITown sofia    = new Town("Sofia", sofiaMap, writer);

            sofia.AddBuilding(new Banicharnitsa(1, "Banicharnica", "Topli zakuski", 10, 50, playerManager));
            sofia.AddBuilding(new PoliceOffice(townsManager, playerManager, randomNumberGenerator, 1, "Police Station",
                                               "Just a police station", 30, 15, handler));
            IBuilding mall = new MallShop(playerManager, 1, "Mall of Sofia", null, 30, 50)
            {
                Inventory = new List <IItem>
                {
                    new Primer(10, "Primer", 55, Rarity.Epic),
                    new Overshoe(11, "Obushta", 60, Rarity.Epic)
                }
            };

            sofia.AddBuilding(mall);
            foreach (var building in Initializer.InitializeBuildings())
            {
                sofia.AddBuilding(building);
            }
            townsManager.AddTown(sofia);
            townsManager.SetCurrentTown(sofia);

            //MONTANA
            IMap  montanaMap = new Map(player, writer);
            ITown montana    = new Town("Montana", montanaMap, writer);

            montana.AddBuilding(new BasicBuilding(10, 10, 3));
            townsManager.AddTown(montana);

            //ENGINE
            IEngine engine = new Engine(playerManager, townsManager, reader, writer, playerActionFactory,
                                        randomEncountersManager, randomNumberGenerator);

            engine.Run();
        }