Example #1
0
        public async Task <string> Attack([FromBody] AttackShipRequest value)
        {
            var shipsInRange = await this.ShipManager.ScanAsync(value.CommandCode);

            var defendingShip = await this.ShipManager.GetShipAsync(value.TransponderCode);

            if (!shipsInRange.Contains(defendingShip))
            {
                return("Attack failed. Ship out of range.");
            }
            await this.ShipManager.AttackShipAsync(value.CommandCode, value.TransponderCode);

            return("Attack Complete");
        }
Example #2
0
        public async Task <string> Attack([FromBody] AttackShipRequest value)
        {
            await this.ShipManager.AttackShipAsync(value.CommandCode, value.TransponderCode);

            return("Attack Complete");
        }