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); } }
private void BasicHypernavigator() { if (StationLocation.IsLowerDeck()) { SittingDuck.ThreatController.AddSingleTurnExternalThreatEffect(ThreatStatus.ReducedMovement); } }
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; }
public void TeleportPlayers(IEnumerable <Player> playersToTeleport, StationLocation newStationLocation) { foreach (var player in playersToTeleport) { player.CurrentStation = StationsByLocation[newStationLocation]; } }
protected Station(StationLocation stationLocation, ThreatController threatController) { Players = new List <Player>(); IrreparableMalfunctions = new List <IrreparableMalfunction>(); StationLocation = stationLocation; ThreatController = threatController; }
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; } }
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; }
public override bool CanBeTargetedBy(StationLocation stationLocation, PlayerActionType playerActionType, Player performingPlayer) { Check.ArgumentIsNotNull(performingPlayer, "performingPlayer"); return(ActionType == playerActionType && CurrentStations.Contains(performingPlayer.CurrentStation.StationLocation) && performingPlayer != attachedPlayer); }
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()); }
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."); } }
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); }
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")); }
protected UpperStation( StationLocation stationLocation, ThreatController threatController, Gravolift gravolift, Doors bluewardDoors, Doors redwardDoors, SittingDuck sittingDuck) : base(stationLocation, threatController, gravolift, bluewardDoors, redwardDoors, sittingDuck) { }
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)); }
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)); }
private static IEnumerable <StationLocation> OppositeDeckPath(StationLocation fromLocation, StationLocation toLocation) { if (toLocation == fromLocation.OppositeStationLocation()) { return new List <StationLocation> { toLocation } } ; return(null); } }
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); } }
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)); }
/// <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); }
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); } }
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); }
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"); }
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); } }
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); } }
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"); }
protected Skirmishers(int timeAppears, StationLocation station, ISittingDuck sittingDuck) : base(1, 3, timeAppears, station, PlayerAction.BattleBots, sittingDuck) { }
//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) { }
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) { }
protected Commandos(int timeAppears, StationLocation currentStation, ISittingDuck sittingDuck) : base(2, 2, timeAppears, currentStation, PlayerAction.BattleBots, sittingDuck) { }
public int GetPlayerCount(StationLocation station) { return StationByLocation[station].Players.Count; }
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) { }