コード例 #1
0
        private void CreateCombatExecute()
        {
            Combat       combat   = null;
            RandomFactor isRandom = (IsRandom) ? RandomFactor.Random : RandomFactor.NonRandom;

            List <CardDrawed> leftCards = new List <CardDrawed>();

            for (int i = 0; i < 4; i++)
            {
                CardInstance instance = InMemoryManager.GetFakeCardInstance(CreationLeftCards[i].CardBaseId, CreationLeftLevels[i].Value);
                //CardInstance instance = new CardInstance(CreationLeftCards[i], 0, CreationLeftLevels[i].Value);
                leftCards.Add(new CardDrawed(instance));
            }
            Hand leftHand = new Hand(leftCards);

            List <CardDrawed> rightCards = new List <CardDrawed>();

            for (int i = 0; i < 4; i++)
            {
                CardInstance instance = InMemoryManager.GetFakeCardInstance(CreationRightCards[i].CardBaseId, CreationRightLevels[i].Value);
                //CardInstance instance = new CardInstance(CreationRightCards[i], 0, CreationRightLevels[i].Value);
                rightCards.Add(new CardDrawed(instance));
            }
            Hand rightHand = new Hand(rightCards);

            switch (GameMode)
            {
            case GameMode.Tourney:
                combat = CombatFactory.GetTourneyCombat(leftHand, rightHand, HasInitiative, isRandom);
                break;

            case GameMode.Classic:
                combat = CombatFactory.GetClassicCombat(leftHand, rightHand, HasInitiative, isRandom);
                break;

            case GameMode.Solo:
                combat = CombatFactory.GetSoloCombat(leftHand, rightHand, HasInitiative, isRandom);
                break;

            case GameMode.LeaderWars:
                throw new NotImplementedException();

            //break;
            case GameMode.ELO:
                combat = CombatFactory.GetEloCombat(leftHand, rightHand, HasInitiative);
                break;

            case GameMode.Survivor:
                throw new NotImplementedException();

            //break;
            case GameMode.Duel:
                combat = CombatFactory.GetDuelCombat(leftHand, rightHand, HasInitiative, isRandom);
                break;

            case GameMode.Custom:
                throw new NotImplementedException();
                //break;
            }

            ((CombatCalculatorCombatModeViewModel)ViewModelLocator.Locator["CombatCalculatorCombatMode"]).Combat = combat;
        }