示例#1
0
        public Option(SabberStoneCore.Tasks.PlayerTasks.PlayerTask playerTask, int gameId)
        {
            gameId_ = gameId;
            print_  = playerTask.ToString();

            switch (playerTask)
            {
            case SabberStoneCore.Tasks.PlayerTasks.ChooseTask chooseTask:
                choice_ = chooseTask.Choices[0];
                type_   = Types.PlayerTaskType.Choose;
                return;

            case SabberStoneCore.Tasks.PlayerTasks.MinionAttackTask minionAttackTask:
                sourcePosition_ = getFriendlyPosition(minionAttackTask.Source);
                targetPosition_ = getEnemyPosition(minionAttackTask.Target);
                break;

            case SabberStoneCore.Tasks.PlayerTasks.HeroAttackTask heroAttackTask:
                targetPosition_ = getEnemyPosition(heroAttackTask.Target);
                break;

            case SabberStoneCore.Tasks.PlayerTasks.HeroPowerTask heroPowerTask:
                targetPosition_ = getPosition(heroPowerTask.Target, heroPowerTask.Controller.Id);
                break;

            case SabberStoneCore.Tasks.PlayerTasks.PlayCardTask playCardTask:
                subOption_      = playCardTask.ChooseOne;
                sourcePosition_ = playCardTask.Source.ZonePosition;         // SourcePosition: 0-based zone position in hand
                if (playCardTask.Source.Card.Type == CardType.MINION)
                {
                    targetPosition_ = playCardTask.ZonePosition + 1;        // Target Position:
                }
                // Minions: 1-based zone position in board
                else if (playCardTask.Source.Card.Type == CardType.SPELL)
                {
                    targetPosition_ = getPosition(playCardTask.Target, playCardTask.Controller.Id);
                }
                break;                                                      // Spells:  0    : Hero
                                                                            //          1-7  : Minions
                                                                            //          8    : Op Hero
                                                                            //          9-15 : Op Minions
            }
            type_ = (Types.PlayerTaskType)playerTask.PlayerTaskType;

            if (playerTask.HasSource)
            {
                sourceId_ = playerTask.Source.Id;
            }
            if (playerTask.HasTarget)
            {
                targetId_ = playerTask.Target.Id;
            }
        }
示例#2
0
        public Option(SabberStoneCore.Tasks.PlayerTasks.PlayerTask playerTask, int gameId)
        {
            gameId_ = gameId;
            print_  = playerTask.ToString();

            switch (playerTask)
            {
            case SabberStoneCore.Tasks.PlayerTasks.ChooseTask chooseTask:
                choice_ = chooseTask.Choices[0];
                type_   = Types.PlayerTaskType.Choose;
                return;

            case SabberStoneCore.Tasks.PlayerTasks.PlayCardTask playCardTask:
                subOption_      = playCardTask.ChooseOne;
                sourcePosition_ = playCardTask.Source.ZonePosition;
                if (playCardTask.Source.Card.Type == SabberStoneCore.Enums.CardType.MINION)
                {
                    targetPosition_ = playCardTask.ZonePosition + 1;
                }
                else if (playCardTask.Source.Card.Type == SabberStoneCore.Enums.CardType.SPELL)
                {
                    targetPosition_ = getPosition(playCardTask.Target, playCardTask.Controller.Id);
                }
                break;

            case SabberStoneCore.Tasks.PlayerTasks.MinionAttackTask minionAttackTask:
                sourcePosition_ = getFriendlyPosition(minionAttackTask.Source);
                targetPosition_ = getEnemyPosition(minionAttackTask.Target);
                break;

            case SabberStoneCore.Tasks.PlayerTasks.HeroAttackTask heroAttackTask:
                targetPosition_ = getEnemyPosition(heroAttackTask.Target);
                break;

            case SabberStoneCore.Tasks.PlayerTasks.HeroPowerTask heroPowerTask:
                targetPosition_ = getPosition(heroPowerTask.Target, heroPowerTask.Controller.Id);
                break;
            }

            type_ = (Types.PlayerTaskType)playerTask.PlayerTaskType;

            if (playerTask.HasSource)
            {
                sourceId_ = playerTask.Source.Id;
            }
            if (playerTask.HasTarget)
            {
                targetId_ = playerTask.Target.Id;
            }
        }