public void RechargeShields() { Shields = MaxShields; Crew.First(c => c.Type == CrewType.Science && c.State == CrewState.Available).State = CrewState.Returning; string message = $"{SoundFx.RechargeShields}Our science crew recharged the shields back to full power. We now have {Shields} shields. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
public void ProcessBoardingShipMission(DefaultEvent e) { // the tactical crew used to complete the boarding ship mission goes to infirmary var tactical = Crew.First(c => c.Type == CrewType.Tactical && c.MissionName == e.Message); tactical.State = CrewState.Infirmary; tactical.MissionName = string.Empty; }
public void FireStasisBeam(Threat threat) { threat.IsDisabled = true; Crew.First(c => c.Type == CrewType.Science && c.State == CrewState.Available).State = CrewState.Returning; string message = $"{SoundFx.StasisBeam}Our science crew fired the stasis beam and disabled {threat.Name} until the next round. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
public void RemoveThreatFromScanner() { Crew.First(c => c.Type == CrewType.Threat && c.State == CrewState.Locked).State = CrewState.Returning; Crew.First(c => c.Type == CrewType.Medical && c.State == CrewState.Available).State = CrewState.Returning; string message = $"{SoundFx.ThreatRemoved}Medical crew was used to remove a threat die from our scanners. The number of locked threats on our scanners is {ScannerCount}. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
public void TransformCrew(CrewType sourceType, CrewType targetType) { // first use a commander die Crew.First(c => c.Type == CrewType.Commander && c.State == CrewState.Available).State = CrewState.Returning; Crew.First(c => c.Type == sourceType && c.State == CrewState.Available).Type = targetType; string message = $"You used a commander to transform one {sourceType.ToString()} crew member to {targetType.ToString()}. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
public void RepairShip() { int repairValue = ExtraRepair ? 2 : 1; ExtraRepair = true; Hull += repairValue; Hull = Math.Min(Hull, MaxHull); Crew.First(c => c.Type == CrewType.Engineering && c.State == CrewState.Available).State = CrewState.Returning; string message = $"Engineering crew repaired {repairValue} damage and we now have {Hull} out of {MaxHull} hull. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
public void RollCrewDice() { Crew.ForEach(c => c.Roll()); // check if scanners have 3 threats and notify ThreatManager to draw a new threat while (Crew.Count(c => c.State == CrewState.Locked) >= ScannerSize) { for (int i = 0; i < ScannerSize; i++) { Crew.First(c => c.State == CrewState.Locked).State = CrewState.Returning; } _eventManager.Trigger("ScannerDrawThreatCard"); } }
public void HealCrew() { int infirmaryCount = InfirmaryCrewCount; string plural = infirmaryCount > 1 ? "s" : ""; foreach (var item in Crew) { // if crew is in infirmary, put it in the returning state, otherwise keep the state that it is in if it wasn't in infirmary item.State = item.State == CrewState.Infirmary ? CrewState.Returning : item.State; } Crew.First(c => c.Type == CrewType.Medical && c.State == CrewState.Available).State = CrewState.Returning; string message = $"{SoundFx.HealCrew}Our medical crew healed {infirmaryCount} crew member{plural} that will be available next round. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
private void ProcessBoostMorale() { string message = ""; if (ScannerCount < 1) { message = "Boost morale activated, but our scanneres were already empty. "; } else { Crew.First(c => c.State == CrewState.Locked).State = CrewState.Returning; message = "Boost morale was activated and one threat was removed from our scanners! "; } _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }
private void ProcessDistracted(bool isComplete = false) { // processes the distracted event // when is complete is true, it means that we should return the distracted unit string message = ""; if (isComplete) { var distractedCrew = Crew.FirstOrDefault(c => c.State == CrewState.Distracted); if (distractedCrew == null) { // sometimes there might be an special scenario where you can't distract a crew member message = "The distracted threat was discarded. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); return; } distractedCrew.State = CrewState.Returning; message = "A distracted crew member will be available on the next round. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); return; } // distract a crew mebmer, look in returning crew first CrewDie crew = null; if (ReturningCrewCount > 0) { crew = Crew.First(c => c.State == CrewState.Returning); } else if (AvailableCrewCount > 0) { crew = Crew.First(c => c.State == CrewState.Available); } else { message = "We have no returning or available crew to distract. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); return; } crew.State = CrewState.Distracted; message = "One crew member is distracted and cannot be used until you send two medical crew on a mission to deal with the distracted threat, or the threat die rolls a three or a four. "; _eventManager.Trigger("AppendMessage", new DefaultEvent(message)); }