private void CanPerformJam(ref bool result, GenericShip ship, ITargetLockable defender) { if (ship.Owner.PlayerNo != HostShip.Owner.PlayerNo) return; if (defender.GetRangeToShip(HostShip) < 2) { result = true; return; } }
private void CanPerformTargetLock(ref bool result, GenericShip ship, ITargetLockable defender) { if (ship.Owner.PlayerNo != HostShip.Owner.PlayerNo) { return; } foreach (GenericShip friendlyShip in HostShip.Owner.Ships.Values) { if (defender.GetRangeToShip(friendlyShip) < 4) { result = true; return; } } }
public bool TargetLockIsAllowed(GenericShip ship, ITargetLockable target) { bool result = true; int rangeBetween = target.GetRangeToShip(ship); if (rangeBetween > ship.TargetLockMaxRange || rangeBetween < ship.TargetLockMinRange) { result = false; } if (result != true) { OnCheckTargetLockIsAllowed?.Invoke(ref result, ship, target); } if (result == true) { OnCheckTargetLockIsDisallowed?.Invoke(ref result, ship, target); } return(result); }