예제 #1
0
        private bool validateCardsToPlayInQuest(List <BattleCard>[] questChunks)
        {
            int lastBattlePoints = 0;

            foreach (List <BattleCard> questChunk in questChunks)
            {
                BattleArea compareArea = new BattleArea();
                foreach (BattleCard card in questChunk)
                {
                    compareArea.Add(card);
                }

                if (compareArea.BattlePoints() - 10 < lastBattlePoints)
                {
                    return(false);
                }
                lastBattlePoints = compareArea.BattlePoints();
            }

            return(true);
        }
예제 #2
0
        private bool validateCardsToSponsorQuest(List <AdventureCard>[] stages)
        {
            int lastBattlePoints = 0;

            foreach (List <AdventureCard> stage in stages)
            {
                BattleArea        compareArea = new BattleArea();
                List <BattleCard> nonTests    = new List <BattleCard>();
                bool StageIsTest = false;
                //filter test cards
                foreach (AdventureCard card in stage)
                {
                    if (!(card is TestCard))
                    {
                        nonTests.Add((BattleCard)card);
                    }
                    else
                    {
                        StageIsTest = true;
                        break;
                    }
                }
                if (!StageIsTest)
                {
                    foreach (BattleCard card in nonTests)
                    {
                        compareArea.Add(card);
                    }

                    if (compareArea.BattlePoints() <= lastBattlePoints)
                    {
                        return(false);
                    }
                    lastBattlePoints = compareArea.BattlePoints();
                }
            }

            return(true);
        }
예제 #3
0
        // assuming battleCards is sorted, starting from weakest
        private List <BattleCard>[] bestCardsToPlayInQuest(QuestCard questCard, Hand hand)
        {
            List <BattleCard>[] stages = new List <BattleCard> [questCard.StageCount];

            List <Amour>      amours  = new List <Amour>(hand.GetDistinctCards <Amour>());
            List <AllyCard>   allies  = new List <AllyCard>(hand.GetCards <AllyCard>());
            List <WeaponCard> weapons = new List <WeaponCard>(hand.GetCards <WeaponCard>());

            allies.Sort((x, y) => x.BattlePoints.CompareTo(y.BattlePoints));
            weapons.Sort((x, y) => x.BattlePoints.CompareTo(y.BattlePoints));

            for (int i = 0; i < questCard.StageCount; i++)
            {
                stages[i] = new List <BattleCard>();
            }

            BattleArea lastCards = new BattleArea();
            BattleArea currCards;

            for (int i = 0; i < questCard.StageCount; i++)
            {
                currCards = new BattleArea();

                BattleArea weaponArea = new BattleArea();
                weapons.ForEach(x => weaponArea.Add(x));
                List <WeaponCard> playableWeapons = weaponArea.GetDistinctCards <WeaponCard>();

                while (currCards.BattlePoints() < lastCards.BattlePoints() + 10 && amours.Count + allies.Count + playableWeapons.Count > 0)
                {
                    if (i == 0 && amours.Count > 0)
                    {
                        Amour nextAmour = amours[0];
                        stages[i].Add(nextAmour);
                        currCards.Add(nextAmour);
                        amours.Remove(nextAmour);
                        continue;
                    }

                    // Add ally.
                    else if (allies.Count > 0)
                    {
                        AllyCard nextAlly = allies[0];
                        stages[i].Add(nextAlly);
                        currCards.Add(nextAlly);
                        allies.Remove(nextAlly);
                        continue;
                    }

                    // Add wepon
                    else if (playableWeapons.Count > 0)
                    {
                        WeaponCard nextWeapon = playableWeapons[0];
                        stages[i].Add(nextWeapon);
                        currCards.Add(nextWeapon);
                        playableWeapons.Remove(nextWeapon);
                        weapons.Remove(nextWeapon);
                        continue;
                    }
                }

                lastCards = currCards;
            }

            return(stages);
        }