コード例 #1
0
        public void NoWings_UnaffectedOutcome()
        {
            var results = new WingsApplication(_tokens, _outcome).Get();

            Assert.Single(results);
            Assert.True(_outcome.Tokens.Matches(results[0].Outcome.Tokens));
            Assert.Empty(results[0].Tokens);
        }
コード例 #2
0
        public void OneWings_OneOpenWings()
        {
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Wings
            });

            var results = new WingsApplication(_tokens, _outcome).Get();

            Assert.Single(results);
            Assert.Empty(results[0].Tokens);
            Assert.Single(results[0].Outcome.Tokens);
            Assert.Equal(RawTokenType.OpenWings, results[0].Outcome.Tokens[0].Type);
        }
コード例 #3
0
        private CalculatedOutcome CalculateBestOutcome(List <Token> tokens)
        {
            var outcome = new RawOutcome {
                Initiative = new InitiativeCalculation(tokens).Get()
            };
            var wingOutcomes = new WingsApplication(tokens, outcome).Get();
            var outcomes     = wingOutcomes.SelectMany(x =>
            {
                var simpleOutcome   = new SimpleApplication(x.Tokens, x.Outcome).Get();
                var doubledOutcomes = new DoubleApplication(simpleOutcome,
                                                            x.Tokens.Count(token => token.FaceUp.Type == TokenSideType.Double)).Get();
                var tacticsOutcomes = doubledOutcomes.SelectMany(doubledOutcome => new TacticsApplication(doubledOutcome,
                                                                                                          x.Tokens.Count(token => token.FaceUp.Type == TokenSideType.Tactics)).Get()).ToList();
                return(tacticsOutcomes);
            }).ToList();
            var calculatedOutcomes = outcomes.Select(x => new RawOutcomeCalculation(_evaluators, x).Get());

            return(calculatedOutcomes.OrderByDescending(x => x.Value).First());
        }
コード例 #4
0
        public void OneWingsAndOneOtherNonWings_WithAndWithoutWings()
        {
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Wings
            });
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Damage, FaceDown = TokenSideType.Block
            });

            var results = new WingsApplication(_tokens, _outcome).Get();

            Assert.Equal(2, results.Count);
            Assert.Contains(results, result => result.Outcome.Tokens.Any(x => x.Type == RawTokenType.OpenWings) &&
                            result.Tokens[0].FaceUp.Type == TokenSideType.Damage &&
                            result.Tokens.Count == 1);
            Assert.Contains(results, result => !result.Outcome.Tokens.Any() &&
                            result.Tokens[0].FaceUp.Type == TokenSideType.Block &&
                            result.Tokens.Count == 1);
        }
コード例 #5
0
        public void TwoWingsWithOneOtherToken_AllResultsProduced()
        {
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Wings, FaceDown = TokenSideType.Damage
            });
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Wings, FaceDown = TokenSideType.Block
            });
            _tokens.Add(new Token {
                FaceUp = TokenSideType.Surge, FaceDown = TokenSideType.Wings
            });

            var results = new WingsApplication(_tokens, _outcome).Get();

            Assert.Equal(7, results.Count);
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 2 &&
                            result.Outcome.Tokens.All(x => x.Type == RawTokenType.OpenWings) &&
                            result.Tokens.Count == 1 &&
                            result.Tokens[0].FaceUp.Type == TokenSideType.Surge);
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 2 &&
                            result.Outcome.Tokens.All(x => x.Type == RawTokenType.OpenWings) &&
                            result.Tokens.Count == 0);
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 0 &&
                            result.Tokens.Count == 2 &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Surge) &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Damage));
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 0 &&
                            result.Tokens.Count == 2 &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Surge) &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Block));
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 0 &&
                            result.Tokens.Count == 1 &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Damage));
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 0 &&
                            result.Tokens.Count == 1 &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Block));
            Assert.Contains(results, result => result.Outcome.Tokens.Count == 0 &&
                            result.Tokens.Count == 1 &&
                            result.Tokens.Any(x => x.FaceUp.Type == TokenSideType.Surge));
        }