mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-28 05:33:48 -08:00
Fix phaser energy use
This commit is contained in:
@@ -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}");
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user