diff --git a/84 Super Star Trek/csharp/Objects/Enterprise.cs b/84 Super Star Trek/csharp/Objects/Enterprise.cs index 004ce893..bb177369 100644 --- a/84 Super Star Trek/csharp/Objects/Enterprise.cs +++ b/84 Super Star Trek/csharp/Objects/Enterprise.cs @@ -87,6 +87,11 @@ namespace SuperStarTrek.Objects public override string ToString() => "<*>"; + internal void UseEnergy(float amountUsed) + { + TotalEnergy -= amountUsed; + } + internal CommandResult TakeHit(Coordinates sector, int hitStrength) { _output.WriteLine($"{hitStrength} unit hit on Enterprise from sector {sector}"); diff --git a/84 Super Star Trek/csharp/Systems/PhaserControl.cs b/84 Super Star Trek/csharp/Systems/PhaserControl.cs index 5aa7cf8b..18566294 100644 --- a/84 Super Star Trek/csharp/Systems/PhaserControl.cs +++ b/84 Super Star Trek/csharp/Systems/PhaserControl.cs @@ -42,6 +42,8 @@ namespace SuperStarTrek.Systems var phaserStrength = GetPhaserStrength(); if (phaserStrength < 0) { return CommandResult.Ok; } + _enterprise.UseEnergy(phaserStrength); + var perEnemyStrength = GetPerTargetPhaserStrength(phaserStrength, quadrant.KlingonCount); foreach (var klingon in quadrant.Klingons.ToList())