From e3f53762481ce3720ceb92d75c35ac73ef8c8b4c Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Sun, 21 Mar 2021 13:12:44 +1100 Subject: [PATCH] Refuel Enterprise at starbase --- 84 Super Star Trek/csharp/Objects/Enterprise.cs | 2 ++ 84 Super Star Trek/csharp/Systems/PhotonTubes.cs | 2 ++ 84 Super Star Trek/csharp/Systems/ShieldControl.cs | 2 ++ 84 Super Star Trek/csharp/Systems/WarpEngines.cs | 7 +++++++ 4 files changed, 13 insertions(+) diff --git a/84 Super Star Trek/csharp/Objects/Enterprise.cs b/84 Super Star Trek/csharp/Objects/Enterprise.cs index 1608b94b..e48c5f76 100644 --- a/84 Super Star Trek/csharp/Objects/Enterprise.cs +++ b/84 Super Star Trek/csharp/Objects/Enterprise.cs @@ -75,6 +75,8 @@ namespace SuperStarTrek.Objects return _commandExecutors[command].ExecuteCommand(_quadrant); } + public void Refuel() => TotalEnergy = _maxEnergy; + internal bool Recognises(string command) { throw new NotImplementedException(); diff --git a/84 Super Star Trek/csharp/Systems/PhotonTubes.cs b/84 Super Star Trek/csharp/Systems/PhotonTubes.cs index 656c65be..a807d16c 100644 --- a/84 Super Star Trek/csharp/Systems/PhotonTubes.cs +++ b/84 Super Star Trek/csharp/Systems/PhotonTubes.cs @@ -60,5 +60,7 @@ namespace SuperStarTrek.Systems return quadrant.KlingonsFireOnEnterprise(); } + + internal void ReplenishTorpedoes() => TorpedoCount = _tubeCount; } } diff --git a/84 Super Star Trek/csharp/Systems/ShieldControl.cs b/84 Super Star Trek/csharp/Systems/ShieldControl.cs index 6ceefcf4..5af343f1 100644 --- a/84 Super Star Trek/csharp/Systems/ShieldControl.cs +++ b/84 Super Star Trek/csharp/Systems/ShieldControl.cs @@ -51,5 +51,7 @@ namespace SuperStarTrek.Systems } internal void AbsorbHit(int hitStrength) => ShieldEnergy -= hitStrength; + + internal void DropShields() => ShieldEnergy = 0; } } diff --git a/84 Super Star Trek/csharp/Systems/WarpEngines.cs b/84 Super Star Trek/csharp/Systems/WarpEngines.cs index 8e24b750..0dcf396c 100644 --- a/84 Super Star Trek/csharp/Systems/WarpEngines.cs +++ b/84 Super Star Trek/csharp/Systems/WarpEngines.cs @@ -32,6 +32,13 @@ namespace SuperStarTrek.Systems _enterprise.VaryConditionOfRandomSystem(); var timeElapsed = _enterprise.Move(course, warpFactor, distanceToMove); + if (_enterprise.IsDocked) + { + _enterprise.ShieldControl.DropShields(); + _enterprise.Refuel(); + _enterprise.PhotonTubes.ReplenishTorpedoes(); + } + return CommandResult.Elapsed(timeElapsed); }