Esempio n. 1
0
    public void SelectCard(CardGameObject cardGO, PlayerCombatObject player, System.Action <CardInHand> SelectCardCallback, System.Action RecalculateCardsPositionCallback)
    {
        // Player has selected a card from the hand.

        // Ignore if it is not player's turn.
        if (turn != TurnSelection.Players)
        {
            infoText.text = "It's not players' turn.";
            return;
        }

        // From here on, it's player's turn.

        // Ignore if the player is dead.
        if (player.IsDead)
        {
            infoText.text = "Player is knocked out.";
            return;
        }

        // Ignore if the player is disabled.
        if (!player.IsAbleToAct())
        {
            infoText.text = "Player cannot act.";
            return;
        }

        // Ignore if the player is disarmed and the card is attack.
        if (cardGO.card.data.type == CardPlayerScriptableObject.Type.Attack && !player.IsAbleToAttack())
        {
            infoText.text = "Player is disarmed.";
            return;
        }

        // Ignore if the player is silenced and the card is spell.
        if (cardGO.card.data.type == CardPlayerScriptableObject.Type.Spell && !player.IsAbleToCast())
        {
            infoText.text = "Player is silenced.";
            return;
        }

        // Ignore if the player does not have enough mana to play the card.
        if (cardGO.card.manaCost > player.Mana)
        {
            infoText.text = "Not enough mana.";
            return;
        }

        infoText.text       = "";
        stayUp              = true;
        currentCardOwner    = player;
        currentSelectedCard = cardGO;

        foreach (var c in coroutines)
        {
            StopCoroutine(c);
        }

        coroutines.Add(StartCoroutine(SelectTargets(cardGO, SelectCardCallback, RecalculateCardsPositionCallback)));
    }
Esempio n. 2
0
        public override void ExitState(StateController controller)
        {
            CardGameObject card     = controller.GetComponent <CardGameObject>();
            SpriteRenderer renderer = controller.GetComponent <SpriteRenderer>();

            renderer.sprite = card.GetCardData().Image;
        }
Esempio n. 3
0
    public void AddCardToHand(Card card, bool ethereal)
    {
        Canvas     canvas  = FindObjectOfType <Canvas>();
        CardInHand newCard = GameObject.Instantiate(cardPrefab, canvas.transform).GetComponent <CardInHand>();

        newCard.card   = card;
        newCard.active = true;

        newCard.gameObject.name         = "Card " + card.name;
        newCard.transform.localPosition = drawPile.localPosition;
        newCard.transform.SetParent(rectTransform);
        newCard.hand      = this;
        newCard.hoverable = true;
        CardGameObject cardGO = newCard.GetComponent <CardGameObject>();

        if (ethereal)
        {
            cardGO.ethereal = true;
        }

        cardGO.card = card;
        cardGO.cardButton.onClick.AddListener(delegate { FindObjectOfType <BattleManager>().SelectCard(cardGO, player); });

        cardsInHand.Add(newCard);

        newCard.GetComponent <CardInHand>().orderInHand = rectTransform.childCount;

        newCard.GetComponent <DisplayCard>().Display(cardGO);

        RecalculateCardsPosition();
    }
Esempio n. 4
0
    public void AddCardToHand(Card card)
    {
        Transform  playerUI = transform.parent;
        CardInHand newCard  = GameObject.Instantiate(cardPrefab, playerUI).GetComponent <CardInHand>();

        newCard.card   = card;
        newCard.active = true;

        newCard.gameObject.name         = "Card " + card.name + " " + (cardsInHand.Count + 1);
        newCard.transform.localScale    = Vector3.zero;
        newCard.transform.localPosition = drawPilePosition.localPosition;
        newCard.transform.SetParent(rectTransform);
        newCard.hand      = this;
        newCard.hoverable = true;
        CardGameObject cardGO = newCard.GetComponent <CardGameObject>();

        cardGO.card = card;
        cardGO.cardButton.onClick.AddListener(delegate { FindObjectOfType <InputManager>().ButtonInput_SelectCard(cardGO, player); });

        cardsInHand.Add(newCard);

        newCard.GetComponent <CardInHand>().orderInHand = rectTransform.childCount;

        newCard.GetComponent <DisplayCard>().Display(cardGO);

        RecalculateCardsPosition();
    }
Esempio n. 5
0
    public void SelectCard(CardGameObject cardGO, Player player)
    {
        // Player has selected a card from the hand.

        // If it is not player's turn, do nothing.
        if (turn != TurnSelection.Players)
        {
            return;
        }

        // From here on, it's player's turn.

        // Ignore if the player does not have enough mana to play the card.
        if (cardGO.card.manaCost > player.mana)
        {
            return;
        }

        // Hide buttons for targetting.
        HideTargettingButtons();

        stayUp              = true;
        currentCardOwner    = player;
        currentSelectedCard = cardGO;

        foreach (var c in coroutines)
        {
            StopCoroutine(c);
        }

        player.hand.SelectCard(cardGO.GetComponent <CardInHand>());
        player.hand.RecalculateCardsPosition();
        coroutines.Add(StartCoroutine(SelectCardCoro(cardGO)));
    }
Esempio n. 6
0
    IEnumerator DealSolitaireCoroutine()
    {
        GameObject[,] playGrid = new GameObject[7, 7];
        GameObject lastAdded = null;

        for (int i = 0; i < bottomOrigin.Length; i++)
        {
            for (int j = bottomOrigin.Length - 1; j >= i; j--)
            {
                yield return(new WaitForSeconds(0.10f));

                Vector3     newPosition = new Vector3(bottomOrigin[j].position.x, (bottomOrigin[j].position.y - (YOffset * i)), -(ZOffset * i));
                PlayingCard cardData    = Deck.DealTopCard();
                lastAdded = CreateCardAtPosition(cardData, newPosition);
                lastAdded.GetComponent <StateController>().ChangeState(DealtFaceDownState);
                playGrid[i, j] = lastAdded;
                if (i == 0)
                {
                    lastAdded.transform.SetParent(bottomOrigin[j]);
                }
                else
                {
                    lastAdded.transform.SetParent(playGrid[i - 1, j].transform);
                }
            }
            CardGameObject lastAddedGameObject = lastAdded.GetComponent <CardGameObject>();
            lastAddedGameObject.TurnFaceUp();
            lastAddedGameObject.Activate();
        }
        DealFinished();
    }
    public void showCardInHand(Card card, int handSize)
    {
        CardGameObject cardInstance = getCardObject(card);

        cardInstance.card.actions = cardActionsService.getCardInHandActions(cardInstance);
        cardInstance.transform.SetParent(playerHand.transform, false);
        updatePlayerHandSpacing(handSize);
    }
    private CardGameObject getCardObject(Card card)
    {
        GameObject     cardInstance   = GameObject.Instantiate(cardPrefab, new Vector3(0, 0, 0), Quaternion.identity);
        CardGameObject cardGameObject = cardInstance.GetComponent <CardGameObject>();

        cardGameObject.initialize(cardInstance, card);
        return(cardGameObject);
    }
Esempio n. 9
0
        public override void ExitState(StateController controller)
        {
            CardGameObject card     = controller.GetComponent <CardGameObject>();
            SpriteRenderer renderer = controller.GetComponent <SpriteRenderer>();

            renderer.sprite = card.GetCardData().Image;
            controller.gameObject.AddComponent <SuitedDescendingDropReceiver>();
        }
Esempio n. 10
0
 public void DoDrop(CardGameObject cardGO)
 {
     cardGO.transform.position = this.transform.position + (Vector3.back * 10);
     cardGO.transform.SetParent(this.transform);
     if (cardGO.transform.childCount == 0 && cardGO.GetComponent <IDroppable>() == null)
     {
         cardGO.AddDropReceiver();
     }
 }
 public void DoDrop(CardGameObject cardGO)
 {
     cardGO.transform.position = this.transform.position - new Vector3(0, Solitaire.GameManager.YOffset, Solitaire.GameManager.ZOffset);
     cardGO.transform.SetParent(this.transform);
     if (cardGO.transform.childCount == 0 && cardGO.GetComponent <IDroppable>() == null)
     {
         cardGO.AddDropReceiver();
     }
 }
 public void showCardPile(List <Card> cards)
 {
     cardListScene.SetActive(true);
     foreach (Card card in cards)
     {
         CardGameObject listCard = getCardObject(card);
         listCard.transform.SetParent(cardListGrid.transform, false);
         listCard.card.actions = cardActionsService.getListCardActions(listCard);
     }
 }
Esempio n. 13
0
    public bool CheckDrop(CardGameObject sendingCard)
    {
        PlayingCard card = sendingCard.GetCardData();

        if (card.Value == 13 && transform.childCount == 0)
        {
            return(true);
        }
        return(false);
    }
Esempio n. 14
0
    public void SpawnCard(Card c)
    {
        GameObject     card           = Instantiate(cardType);
        CardGameObject cardGameObject = card.GetComponent <CardGameObject>();

        cardGameObject.Initialize(c.Id, System.Guid.NewGuid().ToString(), c.Name, c.Description, c.Costs);

        card.transform.SetParent(handArea.transform);

        createdCards.Add(cardGameObject.UUID, card);
    }
 public void showCardSelectUi(List <Card> cards)
 {
     destroyCardSelect();
     cardSelect.SetActive(true);
     foreach (Card card in cards)
     {
         CardGameObject selectableCard = getCardObject(card);
         selectableCard.card.actions = cardActionsService.getSelectableCardActions(selectableCard, this);
         selectableCard.transform.SetParent(cardSelect.transform, false);
     }
 }
Esempio n. 16
0
    public void DoDrop(CardGameObject cardGO)
    {
        currentValue++;
        cardGO.transform.position = this.transform.position + (Vector3.back * currentValue);
        cardGO.transform.SetParent(this.transform);
        SuitedDescendingDropReceiver sourceDrop = cardGO.GetComponent <SuitedDescendingDropReceiver>();

        if (sourceDrop != null)
        {
            Destroy(cardGO.GetComponent <SuitedDescendingDropReceiver>());
        }
    }
Esempio n. 17
0
    public CardActions getListCardActions(CardGameObject cardGameObject)
    {
        CardActions actions = new CardActions();

        copyOverActions(cardGameObject, actions);
        ScrollRect mainScroll = cardGameObject.transform.GetComponentInParent <ScrollRect>();

        actions.onScrollAction = (PointerEventData data) =>
        {
            mainScroll.OnScroll(data);
        };
        return(actions);
    }
Esempio n. 18
0
    public CardActions getSelectableCardActions(CardGameObject cardGameObject, CardUiManager cardUiManager)
    {
        CardActions actions = new CardActions();

        copyOverActions(cardGameObject, actions);
        actions.onClickAction = (Card card) =>
        {
            cardUiManager.destroyCardSelect();
            cardUiManager.cardSelect.SetActive(false);
            deckService.addCardToDeck(card);
        };
        return(actions);
    }
Esempio n. 19
0
    public void Display(CardGameObject card)
    {
        if (card != null && card.ethereal)
        {
            nameText.text = "ETHEREAL " + card.card.name;
        }
        else
        {
            nameText.text = card.card.name;
        }

        Dictionary <string, int> descriptionTags = new Dictionary <string, int>();
        var descriptionParts = card.card.description.Split(FileManager.SeparatorChar);

        if (card.card.description[0] == FileManager.SeparatorChar)
        {
            for (int i = 0; i < descriptionParts.Length; i += 2)
            {
                descriptionTags.Add(descriptionParts[i], i);
            }
        }
        else
        {
            for (int i = 1; i < descriptionParts.Length; i += 2)
            {
                descriptionTags.Add(descriptionParts[i], i);
            }
        }

        foreach (var step in card.card.stepValue)
        {
            if (descriptionTags.ContainsKey(step.descriptionTag.ToString()))
            {
                var actualValue = card.card.abilityStepsWithTargetingData[step.stepIndex].abilityStep.GetValueForIndex(step.valueIndex);

                descriptionParts[descriptionTags[step.descriptionTag.ToString()]] = actualValue;
            }
        }

        descText.text = "";
        foreach (var text in descriptionParts)
        {
            descText.text += text;
        }

        //descText.text = Utility.GetString(card.card.description, card.card., FileManager.SeparatorChar);
        manaCostText.text = card.card.manaCost.ToString();
        typeText.text     = card.card.data.type.ToString();
        image.sprite      = card.card.image;
        tooltip           = GenerateTooltip(card);
    }
Esempio n. 20
0
    private void Update()
    {
        if (gameState.GetGameState() == GameState.processing)
        {
            isSubmitFinish = false;
        }
        if (gameState.GetGameState() != GameState.Wait)//wait상태일때만 입력받음
        {
            return;
        }
        if (isSubmitFinish)
        {
            return;
        }
        Touch touch = new Touch();

        if (Input.touchCount > 0)
        {
            touch = Input.GetTouch(0);
            Ray          ray = Camera.main.ScreenPointToRay(touch.position);
            RaycastHit2D hit = Physics2D.GetRayIntersection(ray, Mathf.Infinity, LayerMask.GetMask("Card")); //입력좌표에 카드있나 감지
            if (hit && !isCardSelected)                                                                      //있으면
            {
                isCardSelected     = true;
                cardObject         = hit.collider.gameObject.GetComponentInParent <CardGameObject>();
                cardTransform      = hit.collider.gameObject.transform.parent;
                cardReturnPosition = cardTransform.position;
            }
            if (isCardSelected)                                                                   //카드가 잡혀있고 마우스가 계속 눌려있다면
            {
                cardTransform.position = (Vector2)Camera.main.ScreenToWorldPoint(touch.position); //마우스 따라 이동
            }
            if (touch.phase == TouchPhase.Ended && isCardSelected)
            {
                if (touch.position.y > submitZoneYPixel)
                {
                    player.SubmitCard(cardObject);//제출
                    isCardSelected = false;
                    isSubmitFinish = true;
                }
                else
                {
                    isCardSelected         = false;
                    cardTransform.position = cardReturnPosition;//원래자리로 백
                }
            }
        }
    }
Esempio n. 21
0
    public void Display(CardGameObject card)
    {
        if (card != null && card.ethereal)
        {
            nameText.text = "ETHEREAL " + card.card.name;
        }
        else
        {
            nameText.text = card.card.name;
        }

        descText.text     = Utility.GetString(card.card.description, card.card.values);
        manaCostText.text = card.card.manaCost.ToString();
        typeText.text     = card.card.type.ToString();
        image.sprite      = card.card.picture;
    }
Esempio n. 22
0
    UISlot.TooltipData GenerateTooltip(CardGameObject card)
    {
        UISlot.TooltipData tooltip = new UISlot.TooltipData();

        if (card.card.tooltip.Trim() == "")
        {
            tooltip.show = false;
            return(tooltip);
        }

        tooltip.title   = card.card.name;
        tooltip.content = card.card.tooltip;
        tooltip.show    = true;

        return(tooltip);
    }
Esempio n. 23
0
 public bool CheckDrop(CardGameObject sendingCard)
 {
     if (sendingCard.transform.childCount == 0)
     {
         PlayingCard card = sendingCard.GetCardData();
         if (card.Value == 1 && PileSuit == char.MinValue)
         {
             PileSuit = card.Suit;
         }
         if (PileSuit == card.Suit && card.Value == currentValue + 1)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 24
0
    public void SubmitCard(CardGameObject cardGameObject)
    {
        sm.PlayHitAudio();
        Card card = cardGameObject.GetCard();

        pv.RPC("RPC_SubmitCard", RpcTarget.MasterClient, card, GetActorNumber());                                            //제출
        pv.RPC("RPC_AnounceCard", RpcTarget.Others, card, GetActorNumber());                                                 //다른애들에게 뒷면 표시되게 알림
        onProcessingCardObject = Instantiate(cardObjectPrefab, new Vector2(0, 0), Quaternion.identity);
        onProcessingCardObject.GetComponent <CardGameObject>().SetCard(new Card(card.GetCardType(), card.GetValue(), true)); //중앙에 카드생성
        Destroy(cardGameObject.gameObject);
        for (int i = 0; i < cards.Length; i++)
        {
            if (card == cards[i])
            {
                cardEmptyIndex = i;
                cards[i]       = null;
                currentHand--;
            }
        }
    }
Esempio n. 25
0
    public void ButtonInput_SelectCard(CardGameObject cardGO, PlayerCombatObject player)
    {
        // Player has selected a card from the hand.

        // Let's first unselect all player's cards.
        foreach (var p in battleManager.players)
        {
            p.hand.UnselectCard();
            p.hand.RecalculateCardsPosition();
        }

        // Ignore if the player does not have control over the card.
        if (!playersToManage.Contains(player))
        {
            //return;
        }

        // Pass the info to Battle Manager.
        battleManager.SelectCard(cardGO, player, player.hand.SelectCard, player.hand.RecalculateCardsPosition);
    }
Esempio n. 26
0
    private void CreateCardObjects(List <PlayingCard> tuple)
    {
        Transform      parentObject     = this.transform;
        CardGameObject newestCardObject = null;

        for (int i = 0; i < tuple.Count; i++)
        {
            //if (newestCardObject != null)
            //    newestCardObject.enabled = false;

            Vector3    newPosition = this.transform.position + baseOffset + new Vector3(xOffset * i, 0, -(zOffset * i));
            GameObject newCard     = Solitaire.GameManager.CreateCardAtPosition(tuple[i], newPosition);
            newCard.transform.SetParent(parentObject);
            parentObject     = newCard.transform;
            newestCardObject = newCard.GetComponent <CardGameObject>();
            newestCardObject.TurnFaceUp();
            dealtCards.Add(newCard);
        }
        newestCardObject.Activate();
    }
    public bool CheckDrop(CardGameObject sendingCard)
    {
        PlayingCard card = sendingCard.GetCardData();
        PlayingCard CardData = this.GetComponent <CardGameObject>().GetCardData();
        bool        thisRed = false, thatRed = false;

        if (CardData.Suit == 'D' || CardData.Suit == 'H')
        {
            thisRed = true;
        }
        if (card.Suit == 'D' || card.Suit == 'H')
        {
            thatRed = true;
        }
        if (thisRed != thatRed)
        {
            if (CardData.Value - 1 == card.Value)
            {
                Destroy(this);
                return(true);
            }
        }
        return(false);
    }
Esempio n. 28
0
 private void copyOverActions(CardGameObject cardGameObject, CardActions cardActions)
 {
     cardActions.getDescriptionAction = cardGameObject.card.actions.getDescriptionAction;
     cardActions.onCardDrawnAction    = cardGameObject.card.actions.onCardDrawnAction;
     cardActions.onCardPlayedAction   = cardGameObject.card.actions.onCardPlayedAction;
 }
Esempio n. 29
0
    public CardActions getCardInHandActions(CardGameObject cardGameObject)
    {
        CardActions actions = new CardActions();

        copyOverActions(cardGameObject, actions);
        Card       card            = cardGameObject.card;
        CardData   data            = card.data;
        Transform  transform       = cardGameObject.transform;
        bool       isDragging      = false;
        bool       isHovering      = false;
        Vector3    startPosition   = new Vector3(0, 0);
        GameObject backgroundImage = cardGameObject.transform.Find("cardBackground").gameObject;

        int yPositionForCardPlay = -250;

        actions.onDragStartAction = () =>
        {
            card.data.targetedEnemy = null;
            if (startPosition == null)
            {
                startPosition = cardGameObject.transform.position;
            }
            if (!(deckService.isCardPlayable(cardGameObject.card) && playerService.isCardPlayable(cardGameObject.card)))
            {
                backgroundImage.GetComponent <Image>().color = ColorUtils.cardUnplayable;
                return;
            }
            isDragging = true;
        };
        actions.onDragEndAction = () =>
        {
            isDragging = false;
            EnemyGameObject target = card.data.targetedEnemy;
            if (data.playerCardData.needsTarget && transform.position.y >= yPositionForCardPlay && target != null)
            {
                cardService.onCardPlayed(card);
                target.onNotTargeted();
                card.data.targetedEnemy = null;
                GameObject.Destroy(cardGameObject.gameObject);
            }
            else if (!data.playerCardData.needsTarget && transform.position.y >= yPositionForCardPlay)
            {
                cardService.onCardPlayed(card);
                GameObject.Destroy(cardGameObject.gameObject);
            }
            else
            {
                if (target != null)
                {
                    target.onNotTargeted();
                    card.data.targetedEnemy = null;
                }
                backgroundImage.GetComponent <Image>().color = ColorUtils.none;
                if (transform.position != startPosition)
                {
                    transform.localScale -= new Vector3(0.4f, 0.4f, 0);
                    transform.position    = startPosition;
                }
            }
        };
        actions.onUpdateAction = () =>
        {
            if (!isDragging || data.isEnemycard)
            {
                return;
            }

            EnemyGameObject target = card.data.targetedEnemy;
            if (transform.position.y >= yPositionForCardPlay && (!data.playerCardData.needsTarget || data.playerCardData.needsTarget && target != null))
            {
                backgroundImage.GetComponent <Image>().color = ColorUtils.cardPlayedGreen;
                if (target != null)
                {
                    target.onTargeted();
                }
            }
            else
            {
                backgroundImage.GetComponent <Image>().color = ColorUtils.white;
                if (target != null)
                {
                    target.onNotTargeted();
                }
            }
            RectTransform playerHandTransform = transform.parent.GetComponent <RectTransform>();
            transform.localPosition = new Vector2(Input.mousePosition.x - Screen.width / 2, Input.mousePosition.y - playerHandTransform.rect.height / 2);
        };
        actions.onTriggerEnter2DAction = (Collider2D other) =>
        {
            if (data.playerCardData.needsTarget)
            {
                EnemyGameObject curr = other.transform.gameObject.GetComponent <EnemyGameObject>();
                if (curr != null)
                {
                    card.data.targetedEnemy = curr;
                    curr.onTargeted();
                }
            }
        };
        actions.onTriggerExit2DAction = (Collider2D other) =>
        {
            EnemyGameObject target = card.data.targetedEnemy;
            if (target != null)
            {
                target.onNotTargeted();
            }
            card.data.targetedEnemy = null;
        };
        actions.onHoverEnter = () =>
        {
            if (isHovering)
            {
                return;
            }
            startPosition         = transform.position;
            transform.position   += new Vector3(0, 140, 0);
            transform.localScale += new Vector3(0.4f, 0.4f, 0);
            cardGameObject.GetComponent <Canvas>().overrideSorting  = true;
            cardGameObject.GetComponent <Canvas>().sortingOrder     = 10;
            cardGameObject.GetComponent <Canvas>().sortingLayerName = "UI";
            isHovering = true;
        };
        actions.onHoverExit = () =>
        {
            if (transform.position != startPosition)
            {
                transform.position   -= new Vector3(0, 140, 0);
                transform.localScale -= new Vector3(0.4f, 0.4f, 0);
            }
            cardGameObject.GetComponent <Canvas>().overrideSorting = false;
            isHovering = false;
        };
        return(actions);
    }
Esempio n. 30
0
    IEnumerator SelectTargets(CardGameObject cardGO, System.Action <CardInHand> SelectCardCallback, System.Action RecalculateCardsPositionCallback)
    {
        PlayerCombatObject       playerOnTurn = currentCardOwner;
        HealthEntityCombatObject caster       = playerOnTurn;

        stepNumber = 0;

        targetsPerAbilityStep = new List <List <HealthEntityCombatObject> >();

        AbilityStepsWithTargetingData_Player[] abilities = cardGO.card.abilityStepsWithTargetingData;

        // Let's cycle through all ability steps in order to determine targets.
        foreach (var abilityStepWithTargetingData in abilities)
        {
            chosenTargets = new List <HealthEntityCombatObject>();
            targetFound   = false;

            TargetData targetData = GetValidTargets(caster, abilityStepWithTargetingData.targetingData);
            if (targetData.multipleSpecificMode)
            {
                multipleSpecificMode     = true;
                numberOfSpecificTargets  = targetData.multipleSpecificNumber;
                multipleSpecificModeList = new List <HealthEntityCombatObject>();
            }
            else
            {
                multipleSpecificMode = false;
            }

            if (targetData.previousStepTargets > -1)
            {
                targetFound = true;
                foreach (var entity in targetsPerAbilityStep[targetData.previousStepTargets])
                {
                    chosenTargets.Add(entity);
                }
            }
            else if (targetData.targetDecided)
            {
                targetFound = true;
                foreach (var e in targetData.entities)
                {
                    chosenTargets.Add(e);
                }
            }
            else
            {
                if (targetData.entities.Count == 1 && targetData.entities[0] is PlayerCombatObject)
                {
                    targetFound = true;
                    chosenTargets.Add(targetData.entities[0]);
                }
                else
                {
                    SelectCardCallback(cardGO.GetComponent <CardInHand>());
                    RecalculateCardsPositionCallback();
                    infoText.text = abilityStepWithTargetingData.targetingData.textForChoosing;
                    ShowTargetingButton(targetData.entities);
                }
            }

            while (targetFound == false)
            {
                yield return(null);
            }

            stepNumber++;
            targetsPerAbilityStep.Add(chosenTargets);
        }

        // We have all chosen targets.
        // We now have to check whether any of those are multiple hits.

        for (int i = 0; i < targetsPerAbilityStep.Count; i++)
        {
            TargetingData_Base targetingData = cardGO.card.abilityStepsWithTargetingData[i].targetingData;

            if (targetingData.targetAlignment == TargetingData_Base.TargetAlignment.Hostile)
            {
                if (targetingData.targets == TargetingData_Base.Target.Multiple)
                {
                    EnemyCombatObject        chosenTarget  = (EnemyCombatObject)targetsPerAbilityStep[i][0];
                    List <EnemyCombatObject> nearbyEnemies = GetNearbyEnemies(chosenTarget, targetingData.numberOfTargets);
                    foreach (var e in nearbyEnemies)
                    {
                        targetsPerAbilityStep[i].Add(e);
                    }
                }
            }
        }

        // Now we have full lists of all targets for each attribute.
        // Let's do the card trick.

        DoCardTrick();

        yield return(null);
    }