Exemplo n.º 1
0
        private void CheckAbility(GenericShip ship, Type tokenType)
        {
            if (HostShip.Charges < 3)
            {
                return;
            }

            if (ship.Owner.PlayerNo == HostShip.Owner.PlayerNo)
            {
                return;
            }

            if (tokenType != typeof(IonToken))
            {
                return;
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range < 4)
            {
                IonizedShip = ship;
                RegisterAbilityTrigger(TriggerTypes.OnTokenIsAssigned, AskDaceBonearmAbility);
            }
        }
Exemplo n.º 2
0
        private int GetFriednlyShipAiPriority(GenericShip ship)
        {
            int priority = ship.PilotInfo.Cost;

            DistanceInfo distInfo = new DistanceInfo(ship, LockedShip);

            if (distInfo.Range < 4)
            {
                priority += 100;
            }

            ShotInfo shotInfo = new ShotInfo(ship, LockedShip, ship.PrimaryWeapons);

            if (shotInfo.IsShotAvailable)
            {
                priority += 50;
            }

            if (!ship.Tokens.HasToken <BlueTargetLockToken>('*'))
            {
                priority += 100;
            }

            return(priority);
        }
Exemplo n.º 3
0
    public static void AcquireTargetLock(GenericShip thisShip, GenericShip targetShip, Action successCallback, Action failureCallback)
    {
        if (Letters.Count == 0)
        {
            InitializeTargetLockLetters();
        }

        DistanceInfo distanceInfo = new DistanceInfo(thisShip, targetShip);

        if (distanceInfo.Range >= thisShip.TargetLockMinRange && distanceInfo.Range <= thisShip.TargetLockMaxRange)
        {
            GenericToken existingBlueToken = thisShip.Tokens.GetToken(typeof(BlueTargetLockToken), '*');
            if (existingBlueToken != null)
            {
                thisShip.Tokens.RemoveToken(
                    existingBlueToken,
                    delegate { FinishAcquireTargetLock(thisShip, targetShip, successCallback); }
                    );
            }
            else
            {
                FinishAcquireTargetLock(thisShip, targetShip, successCallback);
            }
        }
        else
        {
            Messages.ShowErrorToHuman("Target is out of range of Target Lock");
            failureCallback();
        }
    }
Exemplo n.º 4
0
        private Cell FindFarthestEdgeCell(DistanceInfo distanceInfo, bool onlyLeftEdge = false)
        {
            var farthestCell         = (Cell)null;
            var farthestCellDistance = 0;

            var positionsToCheck = Enumerable.Range(0, RowCount).Select(x => (x, 0)); // left

            if (!onlyLeftEdge)
            {
                positionsToCheck = positionsToCheck.Concat(Enumerable.Range(0, ColumnCount).Select(x => (0, x))) // top
                                   .Concat(Enumerable.Range(0, ColumnCount).Select(x => (RowCount - 1, x)))      // bottom
                                   .Concat(Enumerable.Range(0, RowCount).Select(x => (x, ColumnCount - 1)));     // right
            }

            foreach (var(row, column) in positionsToCheck)
            {
                var cell = GetCell(row, column);
                if (distanceInfo.DistanceFromStartMap.TryGetValue(cell, out var distance))
                {
                    if (distance > farthestCellDistance)
                    {
                        farthestCell         = cell;
                        farthestCellDistance = distance;
                    }
                }
            }

            return(farthestCell);
        }
Exemplo n.º 5
0
        private void RegisterKlickAttackBonusPreventionAbility()
        {
            // No check for range - Grant Inquisitor's ability can be used

            if (HostShip.State.Charges == 0)
            {
                return;
            }

            if (!ActionsHolder.HasTargetLockOn(HostShip, Combat.Attacker))
            {
                return;
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, Combat.Attacker);

            if (distInfo.Range < 1 || distInfo.Range > 3)
            {
                return;
            }

            RegisterAbilityTrigger(TriggerTypes.OnAttackStart, delegate
            {
                AskToUseAbility(
                    HostShip.PilotInfo.PilotName,
                    UseIfRangeIsOne,
                    UseRangeOneBonusPreventionAbility,
                    descriptionLong: $"Do you want to spend 1 Charge to prevent the range 0-1 bonus?\n(Attack range is {Combat.ShotInfo.Range})",
                    imageHolder: HostShip
                    );
            });
        }
Exemplo n.º 6
0
        private void CheckAbility(GenericShip ship, GenericToken token)
        {
            // To avoid infinite loop
            if (IsAbilityUsed)
            {
                return;
            }

            if (ship.Owner.PlayerNo == HostShip.Owner.PlayerNo)
            {
                return;
            }

            if (ActionsHolder.HasTargetLockOn(HostShip, ship))
            {
                return;
            }

            if (token.TokenColor != TokenColors.Red && token.TokenColor != TokenColors.Orange)
            {
                return;
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range == 1 || distInfo.Range == 2)
            {
                ShipWithAssignedToken = ship;
                RegisterAbilityTrigger(TriggerTypes.OnTokenIsAssigned, AskAcquireTargetLock);
            }
        }
Exemplo n.º 7
0
        private bool HasMoreEnemyShipsInRange(GenericShip ship)
        {
            int anotherFriendlyShipsInRange = 0;
            int enemyShipsInRange           = 0;

            foreach (GenericShip anotherShip in Roster.AllShips.Values)
            {
                if (anotherShip.ShipId == ship.ShipId)
                {
                    continue;
                }

                DistanceInfo distInfo = new DistanceInfo(ship, anotherShip);
                if (distInfo.Range <= 1)
                {
                    if (ship.Owner.PlayerNo == anotherShip.Owner.PlayerNo)
                    {
                        anotherFriendlyShipsInRange++;
                    }
                    else
                    {
                        enemyShipsInRange++;
                    }
                }
            }

            return(enemyShipsInRange > anotherFriendlyShipsInRange);
        }
Exemplo n.º 8
0
        private void CheckLimits()
        {
            if (SetupFilter == null)
            {
                return;
            }

            MovementTemplates.ReturnRangeRuler();

            GenericShip nearestEnemyShip = null;
            float       nearestDistance  = int.MaxValue;

            foreach (GenericShip anotherShip in Selection.ThisShip.Owner.EnemyShips.Values)
            {
                DistanceInfo distInfo = new DistanceInfo(Selection.ThisShip, anotherShip);
                if (distInfo.MinDistance.DistanceReal < nearestDistance)
                {
                    nearestDistance  = distInfo.MinDistance.DistanceReal;
                    nearestEnemyShip = anotherShip;
                }
            }

            DistanceInfo distInfoFinal = new DistanceInfo(Selection.ThisShip, nearestEnemyShip);

            if (distInfoFinal.Range < 4)
            {
                MovementTemplates.ShowRangeRuler(distInfoFinal.MinDistance);
            }
        }
Exemplo n.º 9
0
        private void CheckAbility()
        {
            if (!HasTokensToTransfter())
            {
                return;
            }

            if (Tools.IsAnotherFriendly(HostShip, Combat.Attacker))
            {
                DistanceInfo distInfo = new DistanceInfo(HostShip, Combat.Attacker);
                if (distInfo.Range >= 1 && distInfo.Range <= 2)
                {
                    ShipToTransferToken = Combat.Attacker;
                    RegisterAbilityTrigger(TriggerTypes.OnAttackStart, AskToTransfterToken);
                }
            }
            else if (Tools.IsAnotherFriendly(HostShip, Combat.Defender))
            {
                DistanceInfo distInfo = new DistanceInfo(HostShip, Combat.Defender);
                if (distInfo.Range >= 1 && distInfo.Range <= 2)
                {
                    ShipToTransferToken = Combat.Defender;
                    RegisterAbilityTrigger(TriggerTypes.OnAttackStart, AskToTransfterToken);
                }
            }
        }
Exemplo n.º 10
0
        private bool IsPossibleRedirectTarget(GenericShip ship)
        {
            bool result = false;

            if (ship.Owner.PlayerNo != HostShip.Owner.PlayerNo)
            {
                return(false);
            }

            if (ship.ShipId == HostShip.ShipId)
            {
                return(false);
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range > 1)
            {
                return(false);
            }

            result = CheckInArcRequirements(ship);

            return(result);
        }
Exemplo n.º 11
0
            private bool AnotherTargetsPresent()
            {
                bool result = false;

                foreach (var ship in OriginalDefender.Owner.Ships.Values)
                {
                    if (ship.ShipId == OriginalDefender.ShipId)
                    {
                        continue;
                    }

                    DistanceInfo distInfo = new DistanceInfo(ship, OriginalDefender);
                    if (distInfo.Range > 1)
                    {
                        continue;
                    }

                    ShotInfo shotInfo = new ShotInfo(HostShip, ship, HostUpgrade as IShipWeapon);
                    if (shotInfo.IsShotAvailable)
                    {
                        return(true);
                    }
                }

                return(result);
            }
Exemplo n.º 12
0
        public bool TargetLockIsAllowed(GenericShip ship, GenericShip target)
        {
            bool result = true;

            DistanceInfo distanceInfo = new DistanceInfo(ship, target);

            if (distanceInfo.Range > ship.TargetLockMaxRange || distanceInfo.Range < ship.TargetLockMinRange)
            {
                result = false;
            }

            if (result != true)
            {
                if (OnCheckTargetLockIsAllowed != null)
                {
                    OnCheckTargetLockIsAllowed(ref result, ship, target);
                }
            }
            if (result == true)
            {
                if (OnCheckTargetLockIsDisallowed != null)
                {
                    OnCheckTargetLockIsDisallowed(ref result, ship, target);
                }
            }

            return(result);
        }
Exemplo n.º 13
0
        protected virtual bool IsAvailable()
        {
            if (Combat.AttackStep != CombatStep.Attack)
            {
                return(false);
            }
            if (Combat.Attacker.Owner != HostShip.Owner)
            {
                return(false);
            }

            DistanceInfo positionInfo = new DistanceInfo(HostShip, Combat.Attacker);

            if (positionInfo.Range > 2)
            {
                return(false);
            }

            if (Combat.Defender.SectorsInfo.IsShipInSector(HostShip, ArcType.Left) || Combat.Defender.SectorsInfo.IsShipInSector(HostShip, ArcType.Right))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 14
0
        private void CheckAbility()
        {
            if (Combat.Defender.Owner.PlayerNo != HostShip.Owner.PlayerNo)
            {
                return;
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, Combat.Defender);

            if (distInfo.Range > 3)
            {
                return;
            }

            BombsAndMinesInRangeCount = 0;
            foreach (var bombHolder in BombsManager.GetBombsOnBoard().Where(n => n.Value.HostShip.Owner.PlayerNo == HostShip.Owner.PlayerNo))
            {
                //January 2020 errata: This ability now only works with bombs
                if (bombHolder.Value.UpgradeInfo.SubType != UpgradeSubType.Bomb)
                {
                    break;
                }

                if (BombsManager.IsShipInRange(Combat.Defender, bombHolder.Key, 1))
                {
                    BombsAndMinesInRangeCount++;
                    break;
                }
            }

            if (BombsAndMinesInRangeCount > 0)
            {
                RegisterAbilityTrigger(TriggerTypes.OnDefenseStart, AskToAddExtraDice);
            }
        }
Exemplo n.º 15
0
        private bool IsPossibleRedirectTarget(GenericShip ship)
        {
            bool result = false;

            if (ship.ShipId == HostShip.ShipId)
            {
                return(false);
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range > 1)
            {
                return(false);
            }

            foreach (GenericArc arc in Combat.Attacker.ArcsInfo.Arcs)
            {
                ShotInfoArc shotInfoArcDefender = new ShotInfoArc(Combat.Attacker, HostShip, arc);
                if (shotInfoArcDefender.InArc && shotInfoArcDefender.IsShotAvailable)
                {
                    ShotInfoArc shotInfoArcRedirect = new ShotInfoArc(Combat.Attacker, ship, arc);
                    if (shotInfoArcRedirect.InArc && shotInfoArcDefender.IsShotAvailable)
                    {
                        return(true);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 16
0
        private static void ProcessHeavyGeometryCalculations(GenericShip ship, out float minDistanceToEnemyShip, out float minDistanceToNearestEnemyInShotRange, out float minAngle, out int enemiesInShotRange)
        {
            minDistanceToEnemyShip = float.MaxValue;
            minDistanceToNearestEnemyInShotRange = 0;
            minAngle           = float.MaxValue;
            enemiesInShotRange = 0;
            foreach (GenericShip enemyShip in ship.Owner.EnemyShips.Values)
            {
                DistanceInfo distInfo = new DistanceInfo(ship, enemyShip);
                if (distInfo.MinDistance.DistanceReal < minDistanceToEnemyShip)
                {
                    minDistanceToEnemyShip = distInfo.MinDistance.DistanceReal;
                }

                ShotInfo shotInfo = new ShotInfo(ship, enemyShip, ship.PrimaryWeapons.First());
                if (shotInfo.IsShotAvailable)
                {
                    enemiesInShotRange++;

                    if (minDistanceToNearestEnemyInShotRange < shotInfo.DistanceReal)
                    {
                        minDistanceToNearestEnemyInShotRange = shotInfo.DistanceReal;
                    }
                }

                Vector3 forward     = ship.GetFrontFacing();
                Vector3 toEnemyShip = enemyShip.GetCenter() - ship.GetCenter();
                float   angle       = Mathf.Abs(Vector3.SignedAngle(forward, toEnemyShip, Vector3.down));
                if (angle < minAngle)
                {
                    minAngle = angle;
                }
            }
        }
Exemplo n.º 17
0
        public static SKImage RenderWithSkia(this CircularMaze maze,
                                             RenderOptions renderOptions,
                                             DistanceInfo distanceInfo,
                                             ShortestPathInfo shortestPathInfo)
        {
            if (maze == null)
            {
                throw new ArgumentNullException(nameof(maze));
            }

            renderOptions = renderOptions ?? new RenderOptions();

            var imageWidth  = (GetRadiusAtRing(maze.RingCount) * 2) + (Margin * 2);
            var imageCenter = imageWidth / 2;

            var imageInfo = new SKImageInfo(imageWidth, imageWidth, SKColorType.Rgba8888, SKAlphaType.Premul);

            using (var surface = SKSurface.Create(imageInfo))
            {
                surface.Canvas.Clear(SKColors.Black);

                var whitePaint = new SKPaint {
                    Color = SKColors.White, StrokeWidth = CellLineWidth, Style = SKPaintStyle.Stroke
                };

                var renderedWalls = new HashSet <CellWall>();
                foreach (var cell in maze.AllCells)
                {
                    DrawRenderOptions(renderOptions, distanceInfo, cell, imageCenter, surface, shortestPathInfo, maze);
                    DrawWalls(maze, cell, renderedWalls, surface, imageCenter, whitePaint);
                }

                return(surface.Snapshot());
            }
        }
Exemplo n.º 18
0
    private void CheckInfo()
    {
        if (isCheckingNow)
        {
            return;
        }
        isCheckingNow = true;
        DistanceInfo di = GetDistances(currentGame, map.position.y, map.position.x);
        SPoint       p  = di.points[curreintPointIndex];

        max_len = di.points.Count;
        //result.text = string.Format("Point {0}", curreintPointIndex + 1);
        compassDiff = (float)p.f_az - 90;
        float d = 1500 - (float)p.distance;

        if (d < 0)
        {
            d = 0;
        }
        var isFinish = p.distance < 50f;

        markerUser.texture = TextureSelection(d / 1500, isFinish);
        if (isFinish)
        {
            if ((curreintPointIndex == 0 & !resultMiniGame.First) | (curreintPointIndex == 1 & !resultMiniGame.Second) | (curreintPointIndex == 2 & !resultMiniGame.Third) | (curreintPointIndex == 3 && !resultMiniGame.Fourth))
            {
                Check();
            }
        }
        isCheckingNow = false;
    }
Exemplo n.º 19
0
    public static int GetRangeAndShow(GenericShip thisShip, GenericShip anotherShip)
    {
        DistanceInfo distanceInfo = new DistanceInfo(thisShip, anotherShip);

        MovementTemplates.ShowRangeRuler(distanceInfo.MinDistance);

        string messageText = "Range to target: " + RangeInfoToText(distanceInfo) +
                             "\nRange in Front sector: " + ArcRangeInfoToText(thisShip.SectorsInfo.GetSectorInfo(anotherShip, ArcType.Front)) +
                             "\nRange in Bullseye sector: " + ArcRangeInfoToText(thisShip.SectorsInfo.GetSectorInfo(anotherShip, ArcType.Bullseye));

        List <ArcType> mentionedFacings = new List <ArcType>()
        {
            ArcType.None, ArcType.Front
        };

        foreach (GenericArc arc in thisShip.ArcsInfo.Arcs)
        {
            ArcType arcType = ArcToSector(arc);

            if (!mentionedFacings.Contains(arcType))
            {
                messageText += "\nRange in " + arc.Facing.ToString() + " sector: " + ArcRangeInfoToText(thisShip.SectorsInfo.GetSectorInfo(anotherShip, arcType));
                mentionedFacings.Add(arcType);
            }
        }

        Messages.ShowInfo(messageText);

        return(distanceInfo.Range);
    }
Exemplo n.º 20
0
        private void DealDamage(object sender, EventArgs e)
        {
            List <GenericShip> sufferedShips = new List <GenericShip>();

            foreach (var ship in Roster.AllShips.Values)
            {
                if (ship.ShipId == HostShip.ShipId)
                {
                    continue;
                }

                DistanceInfo distInfo = new DistanceInfo(HostShip, ship);
                if (distInfo.Range < 1)
                {
                    sufferedShips.Add(ship);
                }
            }

            if (sufferedShips.Any())
            {
                Messages.ShowInfo(HostName + " deals 1 Crit to " + sufferedShips.Count + " ships");
                DealDamageToShips(sufferedShips, 1, true, Triggers.FinishTrigger);
            }
            else
            {
                Triggers.FinishTrigger();
            }
        }
Exemplo n.º 21
0
        private bool IsDiceModificationAvailable()
        {
            if (HostShip.State.Charges == 0)
            {
                return(false);
            }

            GenericShip currentShip = (Combat.AttackStep == CombatStep.Attack) ? Combat.Attacker : Combat.Defender;

            if (currentShip.Owner.PlayerNo != HostShip.Owner.PlayerNo)
            {
                return(false);
            }

            if (currentShip.State.Initiative >= HostShip.State.Initiative)
            {
                return(false);
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, currentShip);

            if (distInfo.Range < 1 || distInfo.Range > 2)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 22
0
        private void CheckAbility(GenericShip ship)
        {
            if (ship.Owner.PlayerNo == HostShip.Owner.PlayerNo)
            {
                return;
            }
            if (HostShip.State.Force == 0)
            {
                return;
            }
            //skip if crew is owned by the AI, because it is hard to calculate correct priority of red action
            if (HostShip.Owner.PlayerType == Players.PlayerType.Ai)
            {
                return;
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range > 2)
            {
                return;
            }

            RegisterAbilityTrigger(TriggerTypes.OnManeuverIsRevealed, AskToUseCrewAbility);
        }
Exemplo n.º 23
0
        private bool IsDiceModificationAvailable()
        {
            if (Combat.AttackStep != CombatStep.Attack)
            {
                return(false);
            }

            if (Combat.Attacker.ShipId == HostShip.ShipId)
            {
                return(false);
            }

            if (Combat.Attacker.Owner.PlayerNo != HostShip.Owner.PlayerNo)
            {
                return(false);
            }

            DistanceInfo distInfo = new DistanceInfo(HostShip, Combat.Defender);

            if (distInfo.Range > 1)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 24
0
 private bool FilterTargets(GenericShip ship)
 {
     //Filter other friendly ships range 1
     DistanceInfo distanceInfo = new DistanceInfo(HostShip, ship);
     return ship.Owner.PlayerNo == HostShip.Owner.PlayerNo &&
             ship != HostShip &&
             InRange(distanceInfo);
 }
Exemplo n.º 25
0
        private bool FilterTargets(GenericShip ship)
        {
            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            return(distInfo.Range <= 3 &&
                   ship.Owner.PlayerNo == HostShip.Owner.PlayerNo &&
                   ship.SectorsInfo.IsShipInSector(LastMovedShip, ArcType.Bullseye));
        }
Exemplo n.º 26
0
        public InsertCopyCommand(IList <Literal> literals, int copyLength = InsertCopyLengths.MinCopyLength, DistanceInfo copyDistance = DistanceInfo.EndsAfterLiterals)
        {
            InsertCopyLengths.CheckBounds(literals.Count, copyLength);

            this.Literals     = literals.ToArray();
            this.CopyLength   = copyLength;
            this.CopyDistance = copyDistance;
        }
Exemplo n.º 27
0
        private void RegisterValenRudorAbility(GenericShip ship)
        {
            var distanceInfo = new DistanceInfo(HostShip, Combat.Defender);

            if (distanceInfo.Range <= 1 && Combat.Defender.Owner == HostShip.Owner)
            {
                RegisterAbilityTrigger(TriggerTypes.OnAttackFinish, PerformFreeAction);
            }
        }
Exemplo n.º 28
0
        public static async Task <DistanceInfo> ExecuteLuisQuery(IConfiguration configuration, ILogger logger, ITurnContext turnContext, CancellationToken cancellationToken)
        {
            DistanceInfo output = new DistanceInfo();

            try
            {
                // Create the LUIS settings from configuration.
                var luisApplication = new LuisApplication(
                    configuration["LuisAppId"],
                    configuration["LuisAPIKey"],
                    "https://" + configuration["LuisAPIHostName"]
                    );

                var recognizer = new LuisRecognizer(luisApplication);

                // The actual call to LUIS
                var recognizerResult = await recognizer.RecognizeAsync(turnContext, cancellationToken);

                var(intent, score) = recognizerResult.GetTopScoringIntent();
                if (intent == "Mileage_Status")
                {
                    // We need to get the result from the LUIS JSON which at every level returns an array.
                    var timex        = recognizerResult.Entities["datetime"]?.FirstOrDefault()?["timex"]?.FirstOrDefault()?.ToString().Split('T')[0];
                    var distanceUnit = recognizerResult.Entities["distance_unit"]?.FirstOrDefault()?.ToString();

                    var request  = WebRequest.Create("https://getstravamileage20190721115651.azurewebsites.net/api/GetStravaMileage?timex=" + timex);
                    var response = request.GetResponse();

                    // Get the stream containing content returned by the server.
                    // The using block ensures the stream is automatically closed.
                    using (Stream dataStream = response.GetResponseStream())
                    {
                        // Open the stream using a StreamReader for easy access.
                        StreamReader reader = new StreamReader(dataStream);
                        // Read the content.

                        var responseFromServer = reader.ReadToEnd();
                        // Display the content.
                        Console.WriteLine(responseFromServer);

                        output.Distance = Math.Round(double.Parse((responseFromServer.Trim())) / 1000, 0);
                        if (distanceUnit.ToUpper().Contains("MILE"))
                        {
                            output.Unit      = DistanceUnit.MILES;
                            output.Distance /= 1.6;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                logger.LogWarning($"LUIS Exception: {e.Message} Check your LUIS configuration.");
            }

            return(output);
        }
Exemplo n.º 29
0
        public void LoadMaze(IMaze maze, MazeStats mazeStats)
        {
            _currentMaze          = maze;
            _currentStats         = mazeStats;
            _mazeDistanceInfo     = CellDistanceSolver.GetPassableDistancesFromCell(_currentMaze.StartingCell);
            _mazeShortestPathInfo = ShortestPathSolver.Solve(_currentMaze.FinishingCell, _mazeDistanceInfo);

            UpdateMazeRendering();
            ResetMazePositionAndScaling();
        }
Exemplo n.º 30
0
        private void TryRestoreCharge(GenericShip ship, bool flag)
        {
            DistanceInfo distInfo = new DistanceInfo(HostShip, ship);

            if (distInfo.Range < 4 && HostUpgrade.State.Charges < HostUpgrade.State.MaxCharges)
            {
                Messages.ShowInfo("Treacherous: Charge is restored");
                HostUpgrade.State.RestoreCharge();
            }
        }
Exemplo n.º 31
0
 private void ShowOrHidePastPerformances(DistanceInfo di, bool show)
 {
     foreach (DataGridViewRow row in _grid.Rows)
     {
         var pp = row.Tag as BrisPastPerformance;
         if (null != pp && di.Distance == pp.DistanceInYards && di.Surface == pp.Surface.Trim().ToUpper())
         {
             row.Visible = show;
         }
     }
 }