예제 #1
0
 protected override void PerformXAction(int currentTurn)
 {
     if (attachedPlayer != null && !attachedPlayer.IsKnockedOut && attachedPlayer.CurrentStation.StationLocation.IsOnShip())
     {
         SittingDuck.DrainEnergy(attachedPlayer.CurrentStation.StationLocation, 1);
     }
 }
 internal InterceptorsOnShipComponent(
     SittingDuck sittingDuck,
     Interceptors interceptors)
 {
     Interceptors     = interceptors;
     this.sittingDuck = sittingDuck;
 }
 internal InterceptorsInSpaceComponent(
     SittingDuck sittingDuck,
     StationLocation stationLocation)
 {
     this.stationLocation = stationLocation;
     this.sittingDuck     = sittingDuck;
 }
예제 #4
0
 protected override void PerformZAction(int currentTurn)
 {
     foreach (var zone in EnumFactory.All <ZoneLocation>())
     {
         Attack(1 + SittingDuck.GetEnergyInReactor(zone));
     }
 }
예제 #5
0
        protected override void PerformYAction(int currentTurn)
        {
            var stationsWithMultiplePlayers = EnumFactory.All <StationLocation>()
                                              .Where(stationLocation => stationLocation.IsOnShip())
                                              .Where(stationLocation => SittingDuck.GetPlayerCount(stationLocation) > 1);

            SittingDuck.KnockOutPlayers(stationsWithMultiplePlayers);
        }
예제 #6
0
 protected override void PerformXAction(int currentTurn)
 {
     foreach (var adjacentLocation in AdjacentLocations())
     {
         DroneLocations.Add(adjacentLocation);
     }
     SittingDuck.SubscribeToMovingIn(DroneLocations, PoisonPlayer);
     SittingDuck.SubscribeToMovingOut(DroneLocations, PoisonPlayer);
 }
예제 #7
0
        protected override void PerformZAction(int currentTurn)
        {
            var removedRocketCount = SittingDuck.RemoveAllRockets();

            for (var i = 0; i < removedRocketCount; i++)
            {
                AttackSpecificZone(2, ZoneLocation.Red, ThreatDamageType.Standard);
            }
        }
예제 #8
0
 protected UpperStation(
     StationLocation stationLocation,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(stationLocation, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
 }
예제 #9
0
        protected override void PerformYAction(int currentTurn)
        {
            var energyDrained = SittingDuck.DrainReactors(new [] { CurrentZone }, 1);

            if (energyDrained == 0)
            {
                Attack(1);
            }
        }
예제 #10
0
        protected override void PerformYAction(int currentTurn)
        {
            var drainedCapsule = SittingDuck.DestroyFuelCapsule();

            if (drainedCapsule)
            {
                AttackAllZones(1);
            }
        }
예제 #11
0
        static void Main()
        {
            var players     = GetPlayers();
            var sittingDuck = new SittingDuck();

            sittingDuck.SetPlayers(players);
            var externalTracks = new []
            {
                new ExternalTrack(TrackConfiguration.Track1, sittingDuck.BlueZone),
                new ExternalTrack(TrackConfiguration.Track2, sittingDuck.RedZone),
                new ExternalTrack(TrackConfiguration.Track3, sittingDuck.WhiteZone)
            };
            var internalTrack = new InternalTrack(TrackConfiguration.Track4);

            var externalThreats = new ExternalThreat[]
            {
                new Destroyer(3, ZoneLocation.Blue, sittingDuck),
                new Fighter(4, ZoneLocation.Red, sittingDuck),
                new Fighter(5, ZoneLocation.White, sittingDuck)
            };
            var internalThreats = new InternalThreat[]
            {
                new SkirmishersA(3, sittingDuck),
                new Fissure(2, sittingDuck)
                //new Alien(1, sittingDuck)
            };
            var game        = new Game(sittingDuck, externalThreats, externalTracks, internalThreats, internalTrack, players);
            var currentTurn = 0;

            try
            {
                for (currentTurn = 0; currentTurn < Game.NumberOfTurns; currentTurn++)
                {
                    game.PerformTurn();
                }
            }
            catch (LoseException loseException)
            {
                Console.WriteLine("Killed on turn {0} by: {1}", currentTurn, loseException.Threat);
            }
            Console.WriteLine("Damage Taken:\r\nBlue: {0}\r\nRed: {1}\r\nWhite: {2}",
                              sittingDuck.BlueZone.TotalDamage,
                              sittingDuck.RedZone.TotalDamage,
                              sittingDuck.WhiteZone.TotalDamage);
            Console.WriteLine("Threats killed: {0}. Threats survived: {1}",
                              game.defeatedThreats.Count,
                              game.survivedThreats.Count);
            Console.WriteLine("Total points: {0}", game.TotalPoints);
            foreach (var zone in sittingDuck.Zones)
            {
                foreach (var token in zone.AllDamageTokensTaken)
                {
                    Console.WriteLine("{0} damage token taken in zone {1}. Still damaged: {2}", token, zone.ZoneLocation, zone.CurrentDamageTokens.Contains(token));
                }
            }
        }
예제 #12
0
        protected override void PerformYAction(int currentTurn)
        {
            var otherPlayersInStation = SittingDuck.GetPlayersInStation(attachedPlayer.CurrentStation.StationLocation)
                                        .Except(new [] { attachedPlayer });

            foreach (var player in otherPlayersInStation)
            {
                player.KnockOut();
            }
        }
예제 #13
0
 internal LowerWhiteStation(
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.LowerWhite, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     CentralReactor = new CentralReactor();
     AlphaComponent = new PulseCannon(CentralReactor);
     VisualConfirmationComponent = new VisualConfirmationComponent();
 }
예제 #14
0
 internal UpperWhiteStation(
     CentralReactor whiteReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperWhite, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent    = new CentralHeavyLaserCannon(whiteReactor, ZoneLocation.White);
     Shield            = new CentralShield(whiteReactor);
     ComputerComponent = new ComputerComponent();
 }
예제 #15
0
 internal UpperBlueStation(
     SideReactor redReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperBlue, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent      = new SideHeavyLaserCannon(redReactor, ZoneLocation.Blue);
     Shield              = new SideShield(redReactor);
     BattleBotsComponent = new BattleBotsComponent();
 }
예제 #16
0
        protected override void PerformYAction(int currentTurn)
        {
            var upperRedPlayers  = SittingDuck.GetPlayersInStation(StationLocation.UpperRed);
            var lowerRedPlayers  = SittingDuck.GetPlayersInStation(StationLocation.LowerRed);
            var upperBluePlayers = SittingDuck.GetPlayersInStation(StationLocation.UpperBlue);
            var lowerBluePlayers = SittingDuck.GetPlayersInStation(StationLocation.LowerBlue);

            SittingDuck.TeleportPlayers(upperRedPlayers, StationLocation.UpperBlue);
            SittingDuck.TeleportPlayers(lowerRedPlayers, StationLocation.LowerBlue);
            SittingDuck.TeleportPlayers(upperBluePlayers, StationLocation.UpperRed);
            SittingDuck.TeleportPlayers(lowerBluePlayers, StationLocation.LowerRed);
        }
예제 #17
0
 protected StandardStation(
     StationLocation stationLocation,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(stationLocation, threatController)
 {
     Gravolift     = gravolift;
     BluewardDoors = bluewardDoors;
     RedwardDoors  = redwardDoors;
     SittingDuck   = sittingDuck;
 }
예제 #18
0
 internal UpperRedStation(
     SideReactor redReactor,
     Interceptors interceptors,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.UpperRed, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     AlphaComponent       = new SideHeavyLaserCannon(redReactor, ZoneLocation.Red);
     Shield               = new SideShield(redReactor);
     InterceptorComponent = new InterceptorsOnShipComponent(sittingDuck, interceptors);
 }
예제 #19
0
 internal LowerRedStation(
     CentralReactor whiteReactor,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(StationLocation.LowerRed, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
     BatteryPack         = new BatteryPack();
     AlphaComponent      = new SideLightLaserCannon(BatteryPack, ZoneLocation.Red);
     BattleBotsComponent = new BattleBotsComponent();
     SideReactor         = new SideReactor(whiteReactor);
 }
예제 #20
0
        private void InfectPlayers()
        {
            if (infectedPlayers == null)
            {
                infectedPlayers = new InfectedPlayers(this);
                infectedPlayers.Initialize(SittingDuck, ThreatController, EventMaster);
                ThreatController.AddInternalThreat(infectedPlayers, TimeAppears, Position);
            }
            var playersInCurrentStation = SittingDuck.GetPlayersInStation(CurrentStation);

            foreach (var player in playersInCurrentStation)
            {
                infectedPlayers.InfectPlayer(player);
            }
        }
예제 #21
0
        public override void TakeDamage(int damage, Player performingPlayer, bool isHeroic, StationLocation?stationLocation)
        {
            var remainingDamageWillDestroyThreat = RemainingHealth <= damage;
            var energyDrained = 0;

            if (remainingDamageWillDestroyThreat)
            {
                energyDrained = SittingDuck.DrainReactors(new [] { CurrentZone }, 1);
            }
            var cannotTakeDamage = remainingDamageWillDestroyThreat && energyDrained == 0;

            if (!cannotTakeDamage)
            {
                base.TakeDamage(damage, performingPlayer, isHeroic, stationLocation);
            }
        }
예제 #22
0
        protected override void PerformYAction(int currentTurn)
        {
            switch (numberOfYsCrossed)
            {
            case 0:
                SittingDuck.AddZoneDebuff(new[] { ZoneLocation.Red }, ZoneDebuff.DisruptedOptics, this);
                break;

            case 1:
                SittingDuck.AddZoneDebuff(new[] { ZoneLocation.Blue }, ZoneDebuff.DisruptedOptics, this);
                break;

            default:
                throw new InvalidOperationException("Invalid number of Y's crossed.");
            }
            numberOfYsCrossed++;
        }
예제 #23
0
        private void TeleportPlayersToOppositeDecks()
        {
            var playersByStation = EnumFactory.All <StationLocation>()
                                   .Where(stationLocation => stationLocation.IsOnShip())
                                   .Select(stationLocation => new
            {
                Players         = SittingDuck.GetPlayersInStation(stationLocation).ToList(),
                StationLocation = stationLocation
            })
                                   .ToList();

            foreach (var playerList in playersByStation)
            {
                SittingDuck.TeleportPlayers(
                    playerList.Players,
                    playerList.StationLocation.OppositeStationLocation().GetValueOrDefault());
            }
        }
예제 #24
0
        protected override void OnReachingEndOfTrack()
        {
            base.OnReachingEndOfTrack();
            var malfunctionTypes = new[]
            {
                PlayerActionType.Alpha,
                PlayerActionType.Bravo,
                PlayerActionType.Charlie
            };

            if (ActionType != null && malfunctionTypes.Contains(ActionType.Value))
            {
                SittingDuck.AddIrreparableMalfunctionToStations(
                    CurrentStations,
                    new IrreparableMalfunction {
                    ActionType = ActionType.Value
                });
            }
        }
 protected override void PerformYAction(int currentTurn)
 {
     SittingDuck.DrainReactors(EnumFactory.All <ZoneLocation>(), 1);
 }
 protected override void PerformXAction(int currentTurn)
 {
     SittingDuck.DrainReactors(new [] { ZoneLocation.White }, 2);
 }
예제 #27
0
 protected override void OnHealthReducedToZero()
 {
     base.OnHealthReducedToZero();
     SittingDuck.RemoveZoneDebuffForSource(EnumFactory.All <ZoneLocation>(), this);
 }
예제 #28
0
 protected override void PerformYAction(int currentTurn)
 {
     SittingDuck.RemoveZoneDebuffForSource(EnumFactory.All <ZoneLocation>(), this);
     SittingDuck.AddZoneDebuff(EnumFactory.All <ZoneLocation>(), ZoneDebuff.ReversedShields, this);
 }
예제 #29
0
 protected override void PerformXAction(int currentTurn)
 {
     SittingDuck.AddZoneDebuff(EnumFactory.All <ZoneLocation>(), ZoneDebuff.IneffectiveShields, this);
 }
예제 #30
0
 private bool IsAnyPlayerPresent()
 {
     return(SittingDuck.GetPlayerCount(CurrentStation) != 0);
 }