Exemple #1
0
    public void RunAction(Actor source, Actor target, Card card, BattleContext manager)
    {
        if (target is PlayerInstance)
        {
            PlayerInstance player = (PlayerInstance)target;

            ListenableList <ElementCardInstance> handheldList = player.HandheldSet;
            List <ElementCardInstance>           changeList   = new List <ElementCardInstance>();

            // if drop count greater than 0
            if (_count > 0)
            {
                for (int cnt = 0; cnt < _count; cnt++)
                {
                    changeList.Add(handheldList.Get(cnt));
                }

                //if drop count smaller than 0, drop all
            }
            else if (_count < 0)
            {
                changeList.AddRange(handheldList.GetAll());
            }

            //move card from handheld to graveard
            foreach (ElementCardInstance item in changeList)
            {
                handheldList.RemoveItem(item);
            }
            player.Graveyard.AddItems(changeList);
        }
    }
Exemple #2
0
    public void ComboCardPolymery()
    {
        ComboCardUIController.SetVisible(false);
        Debug.Log("play combo");

        BattleContext context = DataManager.Instance.BattleContext;

        if (null != context)
        {
            UltimateCardPlayEvent cardEvent = new UltimateCardPlayEvent();

            cardEvent.Card    = ComboCardUIController.GetCardInstance();
            cardEvent.Targets = null;

            bool isPlayable = false;
            ListenableList <ElementCardInstance> handHeldSet = context.Player.HandheldSet;
            int totalCnt = handHeldSet.GetCount();
            for (int i = 0; i < totalCnt; i++)
            {
                for (int j = 0; j < totalCnt; j++)
                {
                    if (cardEvent.Card.IsCardPlayable(handHeldSet.Get(i), handHeldSet.Get(j)))
                    {
                        isPlayable          = true;
                        cardEvent.LeftCard  = handHeldSet.Get(i);
                        cardEvent.RightCard = handHeldSet.Get(j);
                        EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent);
                        break;
                    }
                    else if (cardEvent.Card.IsCardPlayable(handHeldSet.Get(j), handHeldSet.Get(i)))
                    {
                        isPlayable          = true;
                        cardEvent.LeftCard  = handHeldSet.Get(j);
                        cardEvent.RightCard = handHeldSet.Get(i);
                        EventManager.TriggerEvent(BattleManager.PLAY_ULTIMATE_CARD, cardEvent);
                        break;
                    }
                }
            }

            Debug.Log("IsCombo Card Played: " + isPlayable.ToString());
        }
    }