Example #1
0
    public override void PrintData()
    {
        base.PrintData();
        Debug.Log("Name: " + _name.Property + ", Power: " + _power.Property + ",draw count: " + _drawCount.Property + "Card Deck: " + CardDeck.GetCount() + ",Hand: " + _handheldSet.GetCount() + ",Graveyard: " + _graveyard.GetCount());

        if (CardDeck.GetCount() > 0)
        {
            Debug.Log("Card Deck");
            foreach (ElementCardInstance card in _cardDeck.GetAll())
            {
                card.PrintData();
            }
        }

        if (_graveyard.GetCount() > 0)
        {
            Debug.Log("Graveyard");
            foreach (ElementCardInstance card in _graveyard.GetAll())
            {
                card.PrintData();
            }
        }

        if (_handheldSet.GetCount() > 0)
        {
            Debug.Log("Hand card");
            foreach (ElementCardInstance card in _handheldSet.GetAll())
            {
                card.PrintData();
            }
        }
    }
Example #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());
        }
    }
Example #3
0
    // 敵人AI
    public override void StartTurn(BattleContext mgr)
    {
        base.StartTurn(mgr);

        if (this._postpone > 0)
        {
            this._postpone -= 1;
            return;
        }

        // get Card
        MonsterCardInstance card = null;

        // try to get card from queue
        if (_cardQueue.GetCount() > 0)
        {
            card = _cardQueue.Pop(1)[0];
        }
        else
        {
            // try to get card from strategy
            card = this._strategy.RunStrategy(this, mgr);

            //postpone card
            if (card.Postpone > 0)
            {
                _postpone += card.Postpone;
                _cardQueue.AddItem(card);
                return;
            }
        }

        if (null != card)
        {
            // run card
            if (card.IsAgainstEnemy)
            {
                List <Actor> enemy = new List <Actor>();
                enemy.Add(mgr.Player);

                if (card.IsAOE)
                {
                    card.Play(this, enemy, mgr);
                }
                else
                {
                    List <Actor> singleTarget = new List <Actor>();
                    singleTarget.Add(enemy[Random.Range(0, enemy.Count)]);
                    card.Play(this, singleTarget, mgr);
                }
            }
            else
            {
                if (card.IsAOE)
                {
                    List <Actor> partners = new List <Actor>();
                    foreach (Actor partner in mgr.EnemyList.GetAll())
                    {
                        partners.Add(partner);
                    }

                    card.Play(this, partners, mgr);
                }
                else
                {
                    List <Actor> singleTarget = new List <Actor>();
                    singleTarget.Add(this);
                    card.Play(this, singleTarget, mgr);
                }
            }
        }
    }
Example #4
0
 public int GetCount()
 {
     return(_list.GetCount());
 }
Example #5
0
    public ListenableList <ElementCardInstance> HightLightCardsList; //highligt card list

    public void PrintData()
    {
        Debug.Log("Turn Number: " + TurnNumber);
        Debug.Log("Actor count: " + ActorList.GetCount());
        Debug.Log("Enemy count: " + EnemyList.GetCount());
    }