Пример #1
0
        public void SetTurnStrategy(List <Card> hand, IEnumerable <Mingming> ownedParty, IEnumerable <Mingming> otherParty)
        {
            var canAttack = EnemyBehaviourHelper.CanAttack(ownedParty, otherParty, hand);

            CardPlays = new Queue <CardPlay>();

            if (canAttack)
            {
                UserMessage.Instance.CanSendMessage = false;

                var turnState = new TurnState(ownedParty, otherParty, hand);

                var maxScore = GetBestCardPlay(turnState, ref CardPlays, int.MinValue);

                UserMessage.Instance.CanSendMessage = true;
            }
        }
Пример #2
0
        public bool GetNextAttack()
        {
            bool hasAttack = EnemyBehaviourHelper.CanAttack(OwnedParty, OtherParty, Hand);

            if (hasAttack)
            {
                int minCardEnergy = Hand.Any() ? Hand.Min(x => x.EnergyCost) : int.MaxValue;
                Mingming source = GetRandomMingming(OwnedParty);
                Mingming target = GetRandomMingming(OtherParty);
                Card _card = GetCard(source);

                List<Mingming> availableMingmings = new List<Mingming>(OtherParty);
                while (!_card.IsValidAction(source, target))
                {
                    availableMingmings.Remove(target);
                    if (availableMingmings.Count == 0)
                    {
                        target = source;
                        break;
                    }

                    target = GetRandomMingming(availableMingmings);
                }

                if (_card.IsValidAction(source, target))
                {
                    UserMessage.Instance.CanSendMessage = true;

                    EventManager.Instance.OnSelectMingmingTrigger(source);
                    EventManager.Instance.OnSelectTargetTrigger(target, _card);

                    EventManager.Instance.OnSelectMingmingTrigger(source); //to deselect

                    //disable user message so not to get bombarded by failed attempts
                    UserMessage.Instance.CanSendMessage = false;
                }

                hasAttack = EnemyBehaviourHelper.CanAttack(OwnedParty, OtherParty, Hand);
            }

            return hasAttack;
        }