Пример #1
0
    //Set Magnus' valid state based on current battle round
    public void ValidateCard(GameObject card)
    {
        if (card != null)
        {
            Magnus cardScript = card.GetComponent <Magnus>();

            if (isPlayerTurn)
            {
                //All cards are invalid if an invalid card was played during player turn
                if (playedInvalid)
                {
                    cardScript.SetValid(false);
                }
                //def only magnus invalid
                else if (cardScript.GetIsDef() && !cardScript.GetIsAtk())
                {
                    cardScript.SetValid(false);
                }
                //atk combo too high
                else if (cardScript.GetAtkCombo() > currCombo)
                {
                    cardScript.SetValid(false);
                }
                //heal magnus invalid after attacking or attack magnus after healing
                else if ((cardScript.GetIsHeal() && playedAttack) || (cardScript.GetIsAtk() && playedHeal))
                {
                    cardScript.SetValid(false);
                }
                else
                {
                    cardScript.SetValid(true);
                }
            }
            else
            {
                //atk only magnus invalid
                //heal magnus invalid
                if (!cardScript.GetIsDef())
                {
                    cardScript.SetValid(false);
                }
                //def combo too high
                else if (cardScript.GetDefCombo() > currCombo)
                {
                    cardScript.SetValid(false);
                }
                else
                {
                    cardScript.SetValid(true);
                }
            }
        }
    }
Пример #2
0
    private void SetDescription(GameObject card)
    {
        if (card != null)
        {
            Magnus cardScript  = card.GetComponent <Magnus>();
            string magnusName  = cardScript.GetName().Replace("_", " ");
            string elementStat = cardScript.GetElementStat().ToString();
            string totalStat   = (cardScript.GetNeutralStat() + cardScript.GetElementStat()).ToString();
            string element     = cardScript.GetElement().ToString();

            string effect = "ATK/DEF ";
            if (cardScript.GetIsHeal())
            {
                effect = "Heals " + totalStat + " HP";
            }
            else
            {
                if (element == "Neutral")
                {
                    effect += totalStat;
                }
                else
                {
                    effect += totalStat + " (" + element + " " + elementStat + ")";
                }
            }

            bottomBar.GetChild(1).GetComponent <Text>().text = magnusName;
            bottomBar.GetChild(2).GetComponent <Text>().text = effect;
        }
        else
        {
            bottomBar.GetChild(1).GetComponent <Text>().text = "";
            bottomBar.GetChild(2).GetComponent <Text>().text = "";
        }
    }