Ejemplo n.º 1
0
        public static StationLocation?OppositeStationLocation(this StationLocation stationLocation)
        {
            switch (stationLocation)
            {
            case StationLocation.UpperRed:
                return(StationLocation.LowerRed);

            case StationLocation.UpperWhite:
                return(StationLocation.LowerWhite);

            case StationLocation.UpperBlue:
                return(StationLocation.LowerBlue);

            case StationLocation.LowerRed:
                return(StationLocation.UpperRed);

            case StationLocation.LowerWhite:
                return(StationLocation.UpperWhite);

            case StationLocation.LowerBlue:
                return(StationLocation.UpperBlue);

            default:
                return(null);
            }
        }
Ejemplo n.º 2
0
 private void BasicHypernavigator()
 {
     if (StationLocation.IsLowerDeck())
     {
         SittingDuck.ThreatController.AddSingleTurnExternalThreatEffect(ThreatStatus.ReducedMovement);
     }
 }
Ejemplo n.º 3
0
 protected InternalThreat(ThreatType type, ThreatDifficulty difficulty, int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck) :
     base(type, difficulty, health, speed, timeAppears, sittingDuck)
 {
     CurrentStation = currentStation;
     sittingDuck.StationByLocation[currentStation].Threats.Add(this);
     ActionType = actionType;
 }
Ejemplo n.º 4
0
 public void TeleportPlayers(IEnumerable <Player> playersToTeleport, StationLocation newStationLocation)
 {
     foreach (var player in playersToTeleport)
     {
         player.CurrentStation = StationsByLocation[newStationLocation];
     }
 }
Ejemplo n.º 5
0
 protected Station(StationLocation stationLocation, ThreatController threatController)
 {
     Players = new List <Player>();
     IrreparableMalfunctions = new List <IrreparableMalfunction>();
     StationLocation         = stationLocation;
     ThreatController        = threatController;
 }
Ejemplo n.º 6
0
        public int AddStationLocation(StationLocationDto requestDto)
        {
            try
            {
                var code = LastCodeStationLocation();

                var decriptCode     = EncoderAgent.EncryptString((int.Parse(code)).ToString());
                var stationLocation = new StationLocation
                {
                    FkStationId  = requestDto.StationId,
                    FkLocationId = requestDto.LocationId,
                    Code         = decriptCode,
                    Sno          = requestDto.Sno
                };

                _context.StationLocation.Add(stationLocation);
                _context.SaveChanges();
                return(stationLocation.PkStationLocationId);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Ejemplo n.º 7
0
 protected InternalThreat(ThreatType type, ThreatDifficulty difficulty, int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck)
     : base(type, difficulty, health, speed, timeAppears, sittingDuck)
 {
     CurrentStation = currentStation;
     sittingDuck.StationByLocation[currentStation].Threats.Add(this);
     ActionType = actionType;
 }
 internal InterceptorsInSpaceComponent(
     SittingDuck sittingDuck,
     StationLocation stationLocation)
 {
     this.stationLocation = stationLocation;
     this.sittingDuck     = sittingDuck;
 }
Ejemplo n.º 9
0
 public override bool CanBeTargetedBy(StationLocation stationLocation, PlayerActionType playerActionType, Player performingPlayer)
 {
     Check.ArgumentIsNotNull(performingPlayer, "performingPlayer");
     return(ActionType == playerActionType &&
            CurrentStations.Contains(performingPlayer.CurrentStation.StationLocation) &&
            performingPlayer != attachedPlayer);
 }
Ejemplo n.º 10
0
        private static IList <StationLocation> RedwardPath(StationLocation fromLocation, StationLocation toLocation)
        {
            var redwardLocation = fromLocation.RedwardStationLocation();

            if (redwardLocation == null)
            {
                return(null);
            }
            if (redwardLocation == toLocation)
            {
                return new List <StationLocation> {
                           toLocation
                }
            }
            ;
            var oppositeDeckPath = OppositeDeckPath(redwardLocation.Value, toLocation);

            if (oppositeDeckPath != null)
            {
                return new List <StationLocation> {
                           redwardLocation.Value, oppositeDeckPath.Single()
                }
            }
            ;
            var redwardPath = RedwardPath(redwardLocation.Value, toLocation);

            return(redwardPath == null ? null : new[] { redwardLocation.Value }.Concat(RedwardPath(redwardLocation.Value, toLocation)).ToList());
        }
Ejemplo n.º 11
0
        public static ZoneLocation ZoneLocation(this StationLocation stationLocation)
        {
            switch (stationLocation)
            {
            case StationLocation.UpperBlue:
            case StationLocation.LowerBlue:
                return(ShipComponents.ZoneLocation.Blue);

            case StationLocation.UpperWhite:
            case StationLocation.LowerWhite:
                return(ShipComponents.ZoneLocation.White);

            case StationLocation.UpperRed:
            case StationLocation.LowerRed:
                return(ShipComponents.ZoneLocation.Red);

            case StationLocation.Interceptor1:
            case StationLocation.Interceptor2:
            case StationLocation.Interceptor3:
                throw new InvalidOperationException("Cannot get zone location for interceptor station.");

            default:
                throw new InvalidOperationException("Invalid Station Location encountered.");
            }
        }
Ejemplo n.º 12
0
        public static void MoveHeroically(
            IDictionary <StationLocation, StandardStation> standardStationsByLocation,
            Player performingPlayer,
            StationLocation newStationLocation,
            int currentTurn)
        {
            Check.ArgumentIsNotNull(standardStationsByLocation, "standardStationsByLocation");
            Check.ArgumentIsNotNull(performingPlayer, "performingPlayer");
            var currentStationLocation = performingPlayer.CurrentStation.StationLocation;

            if (currentStationLocation == newStationLocation)
            {
                return;
            }
            var currentStation = standardStationsByLocation[currentStationLocation];
            var path           = Path(currentStationLocation, newStationLocation)
                                 .Select(stationLocation => standardStationsByLocation[stationLocation])
                                 .Select((station, index) => new { Station = station, Index = index })
                                 .ToList();
            var firstDestination = path.First();
            var movedOut         = MoveOut(performingPlayer, currentTurn, currentStation, firstDestination.Station.StationLocation);

            if (!movedOut)
            {
                return;
            }
            var finalDestination = path.First(
                pathLocation => pathLocation.Index >= path.Count - 1 ||
                !CanMoveOut(pathLocation.Station, path[pathLocation.Index + 1].Station.StationLocation));

            finalDestination.Station.MovePlayerIn(performingPlayer, currentTurn);
        }
Ejemplo n.º 13
0
 internal InterceptorStation(
     StationLocation stationLocation,
     ThreatController threatController,
     InterceptorsInSpaceComponent interceptorComponent) : base(stationLocation, threatController)
 {
     MovingIn            += UseBattleBots;
     InterceptorComponent = interceptorComponent;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            StationLocation stationLocation = db.StationLocations.Find(id);

            db.StationLocations.Remove(stationLocation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 15
0
 protected UpperStation(
     StationLocation stationLocation,
     ThreatController threatController,
     Gravolift gravolift,
     Doors bluewardDoors,
     Doors redwardDoors,
     SittingDuck sittingDuck) : base(stationLocation, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck)
 {
 }
Ejemplo n.º 16
0
 private void MoveToNewStation(StationLocation newStation)
 {
     if (CurrentStations.Count != 1)
     {
         throw new InvalidOperationException("Cannot move a threat that exists in more than 1 zone.");
     }
     sittingDuck.StationByLocation[CurrentStation].Threats.Remove(this);
     CurrentStation = newStation;
     sittingDuck.StationByLocation[CurrentStation].Threats.Add(this);
 }
 public ActionResult Edit([Bind(Include = "StationLocationID,StationType,StationName,StationLatitude,StationLongitude")] StationLocation stationLocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stationLocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stationLocation));
 }
Ejemplo n.º 18
0
        private void PerformAdvancedSpecialization(Player performingPlayer, int currentTurn)
        {
            switch (performingPlayer.Specialization)
            {
            case PlayerSpecialization.DataAnalyst:
                PerformCAction(performingPlayer, currentTurn, false, StationLocation == StationLocation.LowerWhite);
                break;

            case PlayerSpecialization.EnergyTechnician:
                PerformAdvancedEnergyTechnician();
                break;

            case PlayerSpecialization.Hypernavigator:
                if (currentTurn == SittingDuck.Game.NumberOfTurns - 1 || currentTurn == SittingDuck.Game.NumberOfTurns - 2)
                {
                    SittingDuck.Game.NumberOfTurns = currentTurn;
                }
                break;

            case PlayerSpecialization.Mechanic:
                PerformAdvancedMechanic(performingPlayer);
                break;

            case PlayerSpecialization.Medic:
                performingPlayer.SetPreventsKnockOut(true);
                break;

            case PlayerSpecialization.PulseGunner:
                PerformAAction(performingPlayer, false, StationLocation == StationLocation.LowerWhite);
                break;

            case PlayerSpecialization.Rocketeer:
                PerformCAction(performingPlayer, currentTurn, false, StationLocation == StationLocation.LowerBlue);
                break;

            case PlayerSpecialization.SpecialOps:
                //This spec does nothing when playing the card - determining the protection happens earlier, and the protection lasts until end of this players action
                break;

            case PlayerSpecialization.SquadLeader:
                PerformAdvancedSquadLeader(performingPlayer, currentTurn);
                break;

            case PlayerSpecialization.Teleporter:
                var newStationLocation = StationLocation.DiagonalStation();
                if (newStationLocation != null)
                {
                    performingPlayer.CurrentStation = SittingDuck.StandardStationsByLocation[newStationLocation.Value];
                }
                break;

            default:
                throw new InvalidOperationException("Missing specialization when attempting advanced specialization.");
            }
        }
        public IHttpActionResult GetStationLocation(int id)
        {
            StationLocation stationLocation = db.StationLocations.Find(id);

            if (stationLocation == null)
            {
                return(NotFound());
            }

            return(Ok(stationLocation));
        }
        public ActionResult Create([Bind(Include = "StationLocationID,StationType,StationName,StationLatitude,StationLongitude")] StationLocation stationLocation)
        {
            if (ModelState.IsValid)
            {
                db.StationLocations.Add(stationLocation);
                db.SaveChanges();
                TempData["Success"] = "Successfully Added.";
                return(RedirectToAction("Create"));
            }

            return(View(stationLocation));
        }
Ejemplo n.º 21
0
     private static IEnumerable <StationLocation> OppositeDeckPath(StationLocation fromLocation, StationLocation toLocation)
     {
         if (toLocation == fromLocation.OppositeStationLocation())
         {
             return new List <StationLocation> {
                        toLocation
             }
         }
         ;
         return(null);
     }
 }
Ejemplo n.º 22
0
 private void PerformAdvancedEnergyTechnician()
 {
     if (!StationLocation.IsUpperDeck())
     {
         return;
     }
     foreach (var zone in SittingDuck.Zones)
     {
         var isCurrentZone = (StationLocation.ZoneLocation() == zone.ZoneLocation);
         zone.UpperStation.AddBonusShield(isCurrentZone ? 2 : 1);
     }
 }
Ejemplo n.º 23
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;
 }
        // GET: StationLocations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StationLocation stationLocation = db.StationLocations.Find(id);

            if (stationLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(stationLocation));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 加入到车站记录点
        /// </summary>
        /// <param name="pStart"></param>
        /// <param name="pEnd"></param>
        private void addToStaLocation(Point pStart, Point pEnd, string stationCode, string stationName)
        {
            StationLocation stationLocation = new StationLocation();

            pStart.X = (int)((float)pStart.X * PathMatrix.widthScale);
            pStart.Y = (int)((float)pStart.Y * PathMatrix.heightScale);
            pEnd.X   = (int)((float)pEnd.X * PathMatrix.widthScale);
            pEnd.Y   = (int)((float)pEnd.Y * PathMatrix.heightScale);
            stationLocation.stationCode = stationCode;
            stationLocation.stationName = stationName;
            stationLocation.pStart      = pStart;
            stationLocation.pEnd        = pEnd;
            staLocation.Add(stationLocation);
        }
Ejemplo n.º 26
0
 private void PerformBasicSquadLeader(Player performingPlayer)
 {
     if (performingPlayer.BattleBots == null)
     {
         return;
     }
     if (performingPlayer.BattleBots.IsDisabled)
     {
         performingPlayer.BattleBots.IsDisabled = false;
     }
     else
     {
         SittingDuck.ZonesByLocation[StationLocation.ZoneLocation()].RepairFirstDamage(performingPlayer);
     }
 }
Ejemplo n.º 27
0
        public void SpreadFrom(StationLocation spreadFromStation, int position)
        {
            var spreadToStation = GetStationToSpreadTo(spreadFromStation);

            if (spreadToStation == null ||
                ThreatController.DamageableInternalThreats.Any(threat => threat is BaseSlime && threat.CurrentStation == spreadToStation))
            {
                return;
            }
            var newProgeny = CreateProgeny(spreadToStation.Value);

            Progeny.Add(newProgeny);
            newProgeny.Initialize(SittingDuck, ThreatController, EventMaster);
            ThreatController.AddInternalThreat(newProgeny, TimeAppears, position);
        }
Ejemplo n.º 28
0
 private static bool CanMoveOut(StandardStation fromStation, StationLocation toStationLocation)
 {
     if (toStationLocation == fromStation.StationLocation.OppositeStationLocation())
     {
         return(StandardStation.CanMoveOutTowardsOppositeDeck());
     }
     if (toStationLocation == fromStation.StationLocation.RedwardStationLocation())
     {
         return(fromStation.CanMoveOutTowardsRed());
     }
     if (toStationLocation == fromStation.StationLocation.BluewardStationLocation())
     {
         return(fromStation.CanMoveOutTowardsBlue());
     }
     throw new InvalidOperationException("Could not determine if player could heroically move out of current station");
 }
Ejemplo n.º 29
0
        public static StationLocation?SpacewardLocation(this StationLocation stationLocation)
        {
            switch (stationLocation)
            {
            case StationLocation.UpperRed:
                return(StationLocation.Interceptor1);

            case StationLocation.Interceptor1:
                return(StationLocation.Interceptor2);

            case StationLocation.Interceptor2:
                return(StationLocation.Interceptor3);

            default:
                return(null);
            }
        }
Ejemplo n.º 30
0
        public static int?DistanceFromShip(this StationLocation stationLocation)
        {
            switch (stationLocation)
            {
            case StationLocation.Interceptor3:
                return(3);

            case StationLocation.Interceptor2:
                return(2);

            case StationLocation.Interceptor1:
                return(1);

            default:
                return(null);
            }
        }
Ejemplo n.º 31
0
 private static bool MoveOut(
     Player performingPlayer,
     int currentTurn,
     StandardStation fromStation,
     StationLocation toStationLocation)
 {
     if (toStationLocation == fromStation.StationLocation.OppositeStationLocation())
     {
         return(fromStation.PerformMoveOutTowardsOppositeDeck(performingPlayer, currentTurn, true));
     }
     if (toStationLocation == fromStation.StationLocation.RedwardStationLocation())
     {
         return(fromStation.PerformMoveOutTowardsRed(performingPlayer, currentTurn));
     }
     if (toStationLocation == fromStation.StationLocation.BluewardStationLocation())
     {
         return(fromStation.PerformMoveOutTowardsBlue(performingPlayer, currentTurn));
     }
     throw new InvalidOperationException("Could not find a path to heroically move out of current station");
 }
Ejemplo n.º 32
0
 protected Skirmishers(int timeAppears, StationLocation station, ISittingDuck sittingDuck)
     : base(1, 3, timeAppears, station, PlayerAction.BattleBots, sittingDuck)
 {
 }
Ejemplo n.º 33
0
 //TODO: Implement this
 //TODO: Make SlimeProgeny
 public Slime(int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck)
     : base(health, speed, timeAppears, currentStation, actionType, sittingDuck)
 {
 }
 protected MinorInternalThreat(ThreatDifficulty difficulty, int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck)
     : base(ThreatType.MinorExternal, difficulty, health, speed, timeAppears, currentStation, actionType, sittingDuck)
 {
 }
Ejemplo n.º 35
0
 private void MoveToNewStation(StationLocation newStation)
 {
     if (CurrentStations.Count != 1)
         throw new InvalidOperationException("Cannot move a threat that exists in more than 1 zone.");
     sittingDuck.StationByLocation[CurrentStation].Threats.Remove(this);
     CurrentStation = newStation;
     sittingDuck.StationByLocation[CurrentStation].Threats.Add(this);
 }
 protected MinorYellowInternalThreat(int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck)
     : base(ThreatDifficulty.Yellow, health, speed, timeAppears, currentStation, actionType, sittingDuck)
 {
 }
Ejemplo n.º 37
0
 protected Commandos(int timeAppears, StationLocation currentStation, ISittingDuck sittingDuck)
     : base(2, 2, timeAppears, currentStation, PlayerAction.BattleBots, sittingDuck)
 {
 }
Ejemplo n.º 38
0
 public int GetPlayerCount(StationLocation station)
 {
     return StationByLocation[station].Players.Count;
 }
Ejemplo n.º 39
0
 protected HackedShields(int timeAppears, StationLocation station, ISittingDuck sittingDuck)
     : base(3, 2, timeAppears, station, PlayerAction.B, sittingDuck)
 {
 }
 protected SeriousWhiteInternalThreat(int health, int speed, int timeAppears, StationLocation currentStation, PlayerAction actionType, ISittingDuck sittingDuck)
     : base(ThreatDifficulty.White, health, speed, timeAppears, currentStation, actionType, sittingDuck)
 {
 }