Ejemplo n.º 1
0
        protected override void HandleEvent(AnalyserActivationEvent @event)
        {
            if (PlayerScoreMatcherGroup.TryGetMatchingEntity(@event.PlayerEntityId, out var playerTuple))
            {
                var avWorkstationInfected = _malwareMatcherGroup.MatchingEntities.Any(mw => mw.Component2.Value == @event.LocationEntityId);
                switch (@event.ActivationResult)
                {
                case AnalyserActivationEvent.AnalyserActivationResult.Error:
                    // TODO: log
                    break;

                case AnalyserActivationEvent.AnalyserActivationResult.NoSamplePresent:
                case AnalyserActivationEvent.AnalyserActivationResult.OutputContainerFull:
                    playerTuple.Component2.ResourceManagement -= 1;
                    break;

                case AnalyserActivationEvent.AnalyserActivationResult.AnalysisComplete:
                    playerTuple.Component2.ResourceManagement += 1;
                    // one extra if the workstation is infected
                    playerTuple.Component2.Systematicity += 1 + (avWorkstationInfected ? 1 : 0);
                    break;
                }
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.ActivationResult));
            }
        }
        protected override void HandleEvent(CaptureActivationEvent @event)
        {
            var onAvWorkstation = _antivirusWorkstationMatcherGroup.MatchingEntityKeys.Contains(@event.SubsystemEntityId);

            var systematicityModifier = 0;
            var actionModifier        = 0;

            switch (@event.ActivationResult)
            {
            case CaptureActivationEvent.CaptureActivationResult.NoVirusPresent:
                systematicityModifier -= 1;
                break;

            case CaptureActivationEvent.CaptureActivationResult.GenomeAlreadyCaptured:
                break;

            case CaptureActivationEvent.CaptureActivationResult.SimpleGenomeCaptured:
                systematicityModifier += onAvWorkstation
                                                ? 2
                                                : 1;
                break;

            case CaptureActivationEvent.CaptureActivationResult.ComplexGenomeCaptured:
                systematicityModifier += onAvWorkstation
                                                ? 3
                                                : 2;
                break;
            }
            if (PlayerScoreMatcherGroup.TryGetMatchingEntity(@event.PlayerEntityId, out var playerTuple))
            {
                playerTuple.Component2.Systematicity += systematicityModifier;
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.ActivationResult));
            }
        }
        protected override void HandleEvent(MalwarePropogationEvent @event)
        {
            var resourceManagementModifier = 0;
            var systematicityModifier      = 0;

            switch (@event.Result)
            {
            case MalwarePropogationEvent.MalwarePropogationResult.Error:
                // TODO: log
                return;

            case MalwarePropogationEvent.MalwarePropogationResult.InfectionSpread:
                resourceManagementModifier = -1;
                systematicityModifier      = -1;
                break;

            case MalwarePropogationEvent.MalwarePropogationResult.InfectionMutated:
                resourceManagementModifier = -1;
                systematicityModifier      = -2;
                break;

            default:
                return;
            }

            foreach (var playerTuple in PlayerScoreMatcherGroup.MatchingEntities)
            {
                playerTuple.Component2.ResourceManagement += resourceManagementModifier;
                playerTuple.Component2.Systematicity      += systematicityModifier;
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.Result));
            }
        }
        protected override void HandleEvent(TransferActivationEvent @event)
        {
            if (PlayerScoreMatcherGroup.TryGetMatchingEntity(@event.PlayerEntityId, out var playerTuple))
            {
                switch (@event.ActivationResult)
                {
                case TransferActivationEvent.TransferActivationResult.NoItemsPresent:
                    break;

                case TransferActivationEvent.TransferActivationResult.PulledItem:
                case TransferActivationEvent.TransferActivationResult.PushedItem:
                case TransferActivationEvent.TransferActivationResult.SwappedItems:
                    playerTuple.Component2.ResourceManagement += 1;
                    break;
                }
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.ActivationResult));
            }
        }
Ejemplo n.º 5
0
        protected override void HandleEvent(AntivirusActivationEvent @event)
        {
            var onAvWorkstation = _antivirusWorkstationMatcherGroup.MatchingEntityKeys.Contains(@event.SubsystemEntityId);

            var resourceManagementModifier = 0;
            var systematicityModifier      = 0;
            var actionModifier             = 0;

            switch (@event.ActivationResult)
            {
            case AntivirusActivationEvent.AntivirusActivationResult.Error:
                // TODO: log
                break;

            case AntivirusActivationEvent.AntivirusActivationResult.NoVirusPresent:
            case AntivirusActivationEvent.AntivirusActivationResult.IncorrectGenome:
                resourceManagementModifier -= 1;
                systematicityModifier      -= 1;
                break;

            case AntivirusActivationEvent.AntivirusActivationResult.SoloExtermination:
                resourceManagementModifier += 1;
                systematicityModifier      += onAvWorkstation
                                                ? 2
                                                : 1;
                break;

            case AntivirusActivationEvent.AntivirusActivationResult.CoopExtermination:
                resourceManagementModifier += 2;
                systematicityModifier      += onAvWorkstation
                                                ? 3
                                                : 2;
                break;
            }
            if (PlayerScoreMatcherGroup.TryGetMatchingEntity(@event.PlayerEntityId, out var playerTuple))
            {
                playerTuple.Component2.ResourceManagement += resourceManagementModifier;
                playerTuple.Component2.Systematicity      += systematicityModifier;
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.ActivationResult));
            }
        }
        protected override void HandleEvent(ScannerActivationEvent @event)
        {
            if (PlayerScoreMatcherGroup.TryGetMatchingEntity(@event.PlayerEntityId, out var playerTuple))
            {
                var useOnAntivirusWorkstation = _antivirusWorkstationMatcherGroup.MatchingEntityKeys.Contains(@event.SubsystemEntityId);
                switch (@event.ActivationResult)
                {
                case ScannerActivationEvent.ScannerActivationResult.VirusAlreadyVisisble:
                    playerTuple.Component2.Systematicity -= 1;
                    break;

                case ScannerActivationEvent.ScannerActivationResult.NoVirusPresent:
                    break;

                case ScannerActivationEvent.ScannerActivationResult.VirusRevealed:
                    playerTuple.Component2.Systematicity += 1 + (useOnAntivirusWorkstation ? 1 : 0);
                    break;
                }
                playerTuple.Component2.ActionCompleted(ActivationEventScoring.GetMultiplier(@event.ActivationResult));
            }
        }