public static void createNewStation(Station newStation) { CurrentStations.Add(newStation); StationMapGrid[newStation.StationLocation].Visible = true; StationMapGrid[newStation.StationLocation].Text = newStation.Name; Homepage.ConsoleTextBox.Text = "Awesome! We named your new station: " + Homepage.namingTextBox.Text.Trim(); }
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 void OnPlayerActionsEnding(object sender, EventArgs args) { if (CurrentStations.All(station => StationsHitThisTurn.Contains(station))) { base.TakeDamage(2, null, false, null); } StationsHitThisTurn.Clear(); }
public override void PerformEndOfPlayerActions() { if (CurrentStations.All(station => StationsHitThisTurn.Contains(station))) { base.TakeDamage(1, null, false); } StationsHitThisTurn.Clear(); }
public override void TakeDamage(int damage, Player performingPlayer, bool isHeroic, StationLocation?stationLocation) { base.TakeDamage(damage, performingPlayer, isHeroic, stationLocation); if (stationLocation != null) { CurrentStations.Remove(stationLocation.Value); } }
private void MoveToNewStation(StationLocation?newStation) { if (CurrentStations.Count != 1) { throw new InvalidOperationException("Cannot move a threat that exists in more than 1 zone."); } if (!newStation.HasValue) { throw new InvalidOperationException("Moved wrongly."); } CurrentStations.Remove(CurrentStation); CurrentStations.Add(newStation.Value); }
public static string buildTrack(string state) { if (state == "startTrack") { selectedStationForSource = CurrentStations.Find(i => i.Name == Homepage.namingTextBox.Text.Trim()); if (string.IsNullOrEmpty(Homepage.namingTextBox.Text.Trim())) { Homepage.ConsoleTextBox.Text = "Sorry! You have to pick a Station"; return(state); } if (selectedStationForSource == null) { Homepage.ConsoleTextBox.Text = "We couldn't find a Station named " + Homepage.namingTextBox.Text.Trim(); return(state); } Homepage.ConsoleTextBox.Text = "Alright, we have set the start of the track to " + Homepage.namingTextBox.Text.Trim() + " now, where do you want it to end?"; Homepage.namingTextBox.Text = null; return("endTrack"); } if (state == "endTrack") { Homepage.ConsoleTextBox.Text = "we made it to endTrack"; if (string.IsNullOrEmpty(Homepage.namingTextBox.Text.Trim())) { Homepage.ConsoleTextBox.Text = "Sorry! You have to pick a Station"; return(state); } var selectedStationforDestination = CurrentStations.Find(i => i.Name == Homepage.namingTextBox.Text.Trim()); if (selectedStationforDestination == null) { Homepage.ConsoleTextBox.Text = "We couldn't find a Station named " + Homepage.namingTextBox.Text.Trim(); return(state); } Homepage.ConsoleTextBox.Text = "You picked Station " + selectedStationforDestination.Name; Homepage.namingTextBox.Text = null; if (selectedStationforDestination == selectedStationForSource) { Homepage.ConsoleTextBox.Text = "Sorry, you can't make a looped track. Transaction cancelled."; Bank.CurrentMoney += Bank.costOfTrack; Bank.updateMoneyBox(); return(null); } Homepage.ConsoleTextBox.Text = "Alright, we have set the track for you!"; CurrentTracks.Add(new Track(selectedStationForSource, selectedStationforDestination)); state = null; Train.updateTrainInfoBox(); Station.updateStationInfoBox(); } return(state); }
public virtual bool CanBeTargetedBy(StationLocation stationLocation, PlayerActionType playerActionType, Player performingPlayer) { return(IsDamageable && ActionType == playerActionType && CurrentStations.Contains(stationLocation)); }
public static string moveTrain(string state) { if (state == "MoveTrain") { if (string.IsNullOrEmpty(Homepage.namingTextBox.Text.Trim())) { Homepage.ConsoleTextBox.Text = "Sorry! You have to pick a Train"; return(state); } TrainForMove = CurrentTrains.Find(i => i.Name == Homepage.namingTextBox.Text.Trim()); if (TrainForMove == null) { Homepage.ConsoleTextBox.Text = "We couldn't find a train named " + Homepage.namingTextBox.Text.Trim(); return(null); } Homepage.namingTextBox.Text = null; Homepage.ConsoleTextBox.Text = "Alright, we found your Train! It is at station " + TrainForMove.TrainCurrentLocation.Name + " .Go ahead and add any packages or press 'Yes' to continue."; state = "PackageManagement"; foreach (Package i in TrainForMove.TrainCurrentLocation.PackagesWaiting) { Homepage.packageSelectionDropDown.Items.Add(i.PackageType + "-" + i.PackageValue + "," + i.PackageDestinationStation.Name); } return(state); } else if (state == "MoveTrainDestination") { if (string.IsNullOrEmpty(Homepage.namingTextBox.Text.Trim())) { Homepage.ConsoleTextBox.Text += "Sorry! You have to pick a Station"; return(state); } var selectedStationForMoving = CurrentStations.Find(i => i.Name == Homepage.namingTextBox.Text.Trim()); if (selectedStationForMoving == null) { Homepage.ConsoleTextBox.Text = "We couldn't find a Station named " + Homepage.namingTextBox.Text.Trim(); return(state); } var trackExists = CurrentTracks.Find(i => i.sourceStation == TrainForMove.TrainCurrentLocation && i.destinationStation == selectedStationForMoving); if (trackExists == null) { Homepage.ConsoleTextBox.Text = "Sorry, there is no track there. Transaction cancelled."; Homepage.namingTextBox.Text = null; return(null); } TrainForMove.TrainCurrentLocation = selectedStationForMoving; Homepage.ConsoleTextBox.Text = "You have moved!"; Homepage.namingTextBox.Text = null; Train.updateTrainInfoBox(); Station.updateStationInfoBox(); Homepage.packageSelectionDropDown.Items.Clear(); Homepage.packageSelectionDropDown.SelectedItem = null; foreach (Package i in TrainForMove.Holding) { if (i.PackageDestinationStation == TrainForMove.TrainCurrentLocation) { Bank.CurrentMoney += i.PackageValue; Homepage.ConsoleTextBox.Text = "Awesome! Packages have been successfully delivered!"; } } TrainForMove.Holding.RemoveAll(i => i.PackageDestinationStation == TrainForMove.TrainCurrentLocation); Bank.updateMoneyBox(); Train.updateTrainInfoBox(); Station.updateStationInfoBox(); state = null; } return(state); }