示例#1
0
        public decimal CalculateValue(RawOutcome outcome)
        {
            var result = 0m;

            if (outcome.Initiative >= 1)
            {
                result += FirstInitiativeValue;
            }
            if (outcome.Initiative >= 2)
            {
                result += SecondInitiativeValue;
            }
            if (outcome.Initiative >= 3)
            {
                result += ThirdInitiativeValue;
            }
            if (outcome.Initiative >= 4)
            {
                result += FourthInitiativeValue;
            }
            if (outcome.Initiative >= 5)
            {
                result += FifthInitiativeValue;
            }
            return(result);
        }
        public decimal CalculateValue(RawOutcome outcome)
        {
            if (outcome.Tokens.All(x => x.Type != RawTokenType.Damage))
            {
                return(0);
            }
            var result = outcome.Tokens.Where(x => x.Type == RawTokenType.Damage).Sum(x => x.Quantity) * DamageValue;

            result -= FirstDamagePenalty;
            if (outcome.Tokens.Where(x => x.Type == RawTokenType.Damage).Sum(x => x.Quantity) >= 2)
            {
                result -= SecondDamagePenalty;
            }
            var highestToken = outcome.Tokens.Where(x => x.Type == RawTokenType.Damage).OrderByDescending(x => x.Quantity).First();

            if (highestToken.Quantity >= 2)
            {
                result -= AtLeastTwoDamageTokenOneTimePenalty;
            }
            if (highestToken.Quantity >= 3)
            {
                result -= AtLeastThreeDamageHighestTokenOneTimePenalty;
            }
            return(result);
        }
示例#3
0
        public decimal CalculateValue(RawOutcome outcome)
        {
            var multiplier = 1m;
            var result     = 0m;

            outcome.Tokens.Where(x => x.Type == RawTokenType.Surge).OrderBy(x => x.Quantity).ForEach(x =>
            {
                var tokenValue = SurgeTokenValue;
                if (x.Quantity >= 2)
                {
                    tokenValue += AtLeastTwoSurgeOnTokenBonus;
                }
                if (x.Quantity >= 3)
                {
                    tokenValue += AtLeastThreeSurgeOnTokenBonus;
                }
                if (x.Quantity >= 4)
                {
                    tokenValue += EachQuantityPastThreeOnTokenBonus * (x.Quantity - 3);
                }
                result     += tokenValue * multiplier;
                multiplier -= multiplier * (PerTokenDiminishingPercentageMultiplier / 100);
            });
            return(result);
        }
示例#4
0
        public decimal CalculateValue(RawOutcome outcome)
        {
            var blocks = outcome.Tokens.Where(x => x.Type == RawTokenType.Block).OrderBy(x => x.Quantity).ToList();

            if (!blocks.Any())
            {
                return(0);
            }
            var percentage = 1m;

            if (outcome.Tokens.Any(x => x.Type == RawTokenType.Charge))
            {
                percentage -= percentage * (PercentageDropForChargeDisynergy / 100);
            }
            blocks.Skip(1).Where(x => x.Quantity == 1).ForEach(x => percentage -= percentage * (PercentageOneBlockDrop / 100));
            blocks.Skip(1).Where(x => x.Quantity == 2).ForEach(x => percentage -= percentage * (PercentageTwoBlockDrop / 100));
            blocks.Skip(1).Where(x => x.Quantity == 3).ForEach(x => percentage -= percentage * (PercentageThreeBlockDrop / 100));
            blocks.Skip(1).Where(x => x.Quantity >= 4).ForEach(x => percentage -= percentage * (PercentageFourBlockDrop / 100));
            var result = 0m;

            blocks.Where(x => x.Quantity == 1).ForEach(x => result += OneBlockValue);
            blocks.Where(x => x.Quantity == 2).ForEach(x => result += TwoBlockValue);
            blocks.Where(x => x.Quantity == 3).ForEach(x => result += ThreeBlockValue);
            blocks.Where(x => x.Quantity >= 4).ForEach(x => result += FourOrGreaterBlockValue);
            return(result * percentage);
        }
示例#5
0
        public decimal CalculateValue(RawOutcome outcome)
        {
            var result = outcome.Tokens.Where(x => x.Type == RawTokenType.Charge).Sum(x => x.Quantity * ChargeValue);

            if (outcome.Tokens.All(x => x.Type != RawTokenType.Damage))
            {
                result += NoNormalDamageBonus;
            }
            return(result);
        }
示例#6
0
        public decimal CalculateValue(RawOutcome outcome)
        {
            var multiplier = 1m;
            var result     = 0m;

            outcome.Tokens.Where(x => x.Type == RawTokenType.OpenDouble).ForEach(x =>
            {
                result     += OpenDoubleValue * multiplier;
                multiplier -= multiplier * (DiminishingPercentageMultiplier / 100);
            });
            return(result);
        }
        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());
        }
示例#8
0
 public RawOutcomeCalculation(List <IEvaluator> evaluators, RawOutcome outcome)
 {
     _evaluators = evaluators;
     _outcome    = outcome;
 }
 public decimal CalculateValue(RawOutcome outcome)
 {
     return(_onEvaluate(outcome));
 }
示例#10
0
 public SimpleApplication(List <Token> tokens, RawOutcome outcome)
 {
     _tokens  = tokens;
     _outcome = outcome;
 }
 public TacticsApplication(RawOutcome outcome, int tactics)
 {
     _outcome = outcome;
     _tactics = tactics;
 }
示例#12
0
 public DoubleApplication(RawOutcome outcome, int doubles)
 {
     _outcome = outcome;
     _doubles = doubles;
 }
 public WingsApplication(List <Token> tokens, RawOutcome outcome)
 {
     _tokens  = tokens;
     _outcome = outcome;
 }
 public decimal CalculateValue(RawOutcome outcome)
 {
     return(outcome.Tokens.Where(x => x.WasTactics).Sum(x => UsedTacticsValue));
 }