Beispiel #1
0
            private void AssignInitialBlockers(Card attacker, IEnumerable <Card> blockers, int defendersLife)
            {
                _canAllInitialBlockersBeKilled = true;
                var attackerAbilities = attacker.GetCombatAbilities();

                var attackerEvaluationParameters = new AttackerEvaluationParameters(attacker,
                                                                                    attackerAbilities.PowerIncrease, attackerAbilities.ToughnessIncrease);

                foreach (var blocker in blockers)
                {
                    var blockerAbilities = blocker.GetCombatAbilities();

                    _blockers.Add(blocker);

                    attackerEvaluationParameters.AddBlocker(blocker, blockerAbilities.PowerIncrease,
                                                            blockerAbilities.ToughnessIncrease);

                    var canBlockerBeDealtLeathalCombatDamage =
                        QuickCombat.CanBlockerBeDealtLeathalCombatDamage(new BlockerEvaluationParameters
                    {
                        Attacker                  = attacker,
                        Blocker                   = blocker,
                        BlockerPowerIncrease      = blockerAbilities.PowerIncrease,
                        BlockerToughnessIncrease  = blockerAbilities.ToughnessIncrease,
                        AttackerPowerIncrease     = attackerAbilities.PowerIncrease,
                        AttackerToughnessIncrease = attackerAbilities.ToughnessIncrease
                    });

                    var blockerScore = canBlockerBeDealtLeathalCombatDamage && !blockerAbilities.CanRegenerate
            ? blocker.Score
            : 0;

                    var lifelossScore = ScoreCalculator.CalculateLifelossScore(
                        defendersLife,
                        attacker.CalculateCombatDamageAmount(singleDamageStep: false));

                    var trampleScore = ScoreCalculator.CalculateLifelossScore(
                        defendersLife, QuickCombat.CalculateTrampleDamage(Attacker, blocker));

                    Gain = lifelossScore - blockerScore - trampleScore;
                    _canAllInitialBlockersBeKilled = _canAllInitialBlockersBeKilled && canBlockerBeDealtLeathalCombatDamage;
                }

                IsAttackerKilled = QuickCombat.CanAttackerBeDealtLeathalDamage(attackerEvaluationParameters);

                var attackerScore = IsAttackerKilled && !attackerAbilities.CanRegenerate
          ? attacker.Score
          : 0;

                Gain += attackerScore;
            }