コード例 #1
0
ファイル: Defense.cs プロジェクト: isxGames/StealthBot
        private void ProcessState()
        {
            var methodName = "ProcessPulseState";

            LogTrace(methodName);

            //If I'm at a safespot and flee reason was DowntimeNear, save and exit
            if (FleeReason == FleeReasons.DowntimeNear && _safespots.IsSafe())
            {
                LogMessage(methodName, LogSeverityTypes.Standard, methodName, "Downtime near and we're at a safespot. Exiting...");
                DowntimeExitAndRelaunch();
                return;
            }

            //If I'm in station just return, nothing to process
            if (_meCache.InStation)
            {
                return;
            }

            //If I need to flee, do so.
            if (!IsFleeing)
            {
                return;
            }

            if (!_meCache.ToEntity.IsWarpScrambled)
            {
                Flee();
            }
        }
コード例 #2
0
        protected override void ProcessPulseState()
        {
            var methodName = "ProcessPulseState";

            LogTrace(methodName);

            //Switch the state and handle it
            switch (_rattingState)
            {
            case RattingStates.Idle:
                //Do nothing during idle.
                break;

            case RattingStates.Defend:
                //Again do nothing; we're fleeing or hiding.
                ClearEntities();
                break;

            case RattingStates.Rearm:
                //Add later
                break;

            case RattingStates.KillRats:
                KillRats();
                break;

            case RattingStates.ChangeBelts:
                ChangeBelt();
                break;

            case RattingStates.Error:
                if (_safespots.IsSafe())
                {
                    return;
                }

                var safespot = _safespots.GetSafeSpot();
                _movement.QueueDestination(safespot);
                break;
            }
        }
コード例 #3
0
        protected override void ProcessPulseState()
        {
            var methodName = "ProcessPulseState";

            LogTrace(methodName);

            LogMessage(methodName, LogSeverityTypes.Debug, "State: {0}",
                       _boostOrcaState);
            switch (_boostOrcaState)
            {
            case BoostOrcaStates.Idle:
                _boostOrcaState = BoostOrcaStates.GetInPosition;
                goto case BoostOrcaStates.GetInPosition;

            case BoostOrcaStates.GetInPosition:
                var boostLocationBookmark = _bookMarkCache.FirstBookMarkMatching(_miningConfiguration.BoostOrcaBoostLocationLabel, true);
                if (boostLocationBookmark == null)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Error: Could not find a bookmark matching the boost orca location label of \"{0}\" in this system.",
                               _miningConfiguration.BoostOrcaBoostLocationLabel);
                    _boostOrcaState = BoostOrcaStates.Error;
                    return;
                }

                if (_meCache.InStation)
                {
                    LogMessage(methodName, LogSeverityTypes.Debug, "Undocking.");
                    _movement.QueueDestination(
                        new Destination(DestinationTypes.Undock));
                    return;
                }

                //Now I need to get to a safespot in space. Preferrably a tower but I can't know what type it is.
                //If I'm out of warp range, warp to it
                if (!_bookmarks.IsAtBookmark(boostLocationBookmark))
                {
                    _movement.QueueDestination(
                        new Destination(DestinationTypes.BookMark, boostLocationBookmark.Id));
                    LogMessage(methodName, LogSeverityTypes.Standard, "Moving to boost location bookmark \"{0}\".",
                               boostLocationBookmark.Label);
                }
                else
                {
                    _boostOrcaState = BoostOrcaStates.WaitInPosition;
                    goto case BoostOrcaStates.WaitInPosition;
                }
                break;

            case BoostOrcaStates.WaitInPosition:
                //Just chill here and boost for the fleet. Turn on ganglinks as needed.
                if (_ship.GangLinkModules.Count > 0 &&
                    !_ship.GangLinkModules[0].IsActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Activating ganglink modules.");
                    _ship.ActivateModuleList(_ship.GangLinkModules, true);
                }
                if (_ship.DamageControlModules.Count > 0 &&
                    !_ship.DamageControlModules[0].IsActive)
                {
                    LogMessage(methodName, LogSeverityTypes.Standard, "Activating damage control module.");
                    _ship.ActivateModuleList(_ship.DamageControlModules, false);
                }
                break;

            case BoostOrcaStates.Error:
                //Make sure I'm at a safespot; preferrably in space, station if required.
                if (!_safespots.IsSafe())
                {
                    var destination = _safespots.GetSafeSpot();
                    _movement.QueueDestination(destination);
                }

                IsEnabled = false;
                break;
            }
        }