mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 07:29:02 -08:00
33 lines
959 B
C#
33 lines
959 B
C#
using SuperStarTrek.Objects;
|
|
using SuperStarTrek.Resources;
|
|
using SuperStarTrek.Space;
|
|
|
|
namespace SuperStarTrek.Systems.ComputerFunctions
|
|
{
|
|
internal class TorpedoDataCalculator : NavigationCalculator
|
|
{
|
|
private readonly Enterprise _enterprise;
|
|
|
|
public TorpedoDataCalculator(Enterprise enterprise, Output output)
|
|
: base("Photon torpedo data", output)
|
|
{
|
|
_enterprise = enterprise;
|
|
}
|
|
|
|
internal override void Execute(Quadrant quadrant)
|
|
{
|
|
if (!quadrant.HasKlingons)
|
|
{
|
|
Output.WriteLine(Strings.NoEnemyShips);
|
|
return;
|
|
}
|
|
|
|
Output.WriteLine("From Enterprise to Klingon battle cruiser".Pluralize(quadrant.KlingonCount));
|
|
|
|
foreach (var klingon in quadrant.Klingons)
|
|
{
|
|
WriteDirectionAndDistance(_enterprise.SectorCoordinates, klingon.Sector);
|
|
}
|
|
}
|
|
}
|
|
} |