Example #1
0
    public static List <CardVisual> SortCardsByOwner(List <CardVisual> cardsToSort, OwnerConstraints ownerConstraints)
    {
        List <CardVisual> cards = new List <CardVisual>();

        for (int i = 0; i < cardsToSort.Count; i++)
        {
            switch (ownerConstraints)
            {
            case OwnerConstraints.Mine:
                if (cardsToSort[i].photonView.isMine)
                {
                    cards.Add(cardsToSort[i]);
                }
                break;

            case OwnerConstraints.Theirs:
                if (!cardsToSort[i].photonView.isMine)
                {
                    cards.Add(cardsToSort[i]);
                }
                break;

            default:
                cards.Add(cardsToSort[i]);

                break;
            }
        }

        return(cards);
    }
Example #2
0
    public static List <CardVisual> FindAllCardsInZone(DeckType zone, OwnerConstraints ownerConstraints)
    {
        List <CardVisual> cards = FindAllCardsInZone(zone);

        List <CardVisual> sortedCards = SortCardsByOwner(cards, ownerConstraints);

        return(sortedCards);
    }
Example #3
0
    public static List <CardVisual> FindAllCardsOfType(CardType type, DeckType zone, OwnerConstraints ownerConstraints)
    {
        List <CardVisual> cards = FindAllCardsOfType(type, zone);

        List <CardVisual> sortedcards = SortCardsByOwner(cards, ownerConstraints);

        return(sortedcards);
    }
Example #4
0
    public static int FindTotalSpellDamage(OwnerConstraints owner)
    {
        int result = 0;

        List <CardVisual> cards = FindAllCardsInZone(DeckType.Battlefield, owner);

        for (int i = 0; i < cards.Count; i++)
        {
            result += cards[i].CheckSpecialAttributes(SpecialAttribute.AttributeType.SpellDamage);
        }

        return(result);
    }
Example #5
0
    public static bool CardHasOwner(CardVisual card, OwnerConstraints ownerConstraints)
    {
        switch (ownerConstraints)
        {
        case OwnerConstraints.Mine:
            return(card.photonView.isMine);

        case OwnerConstraints.Theirs:
            return(!card.photonView.isMine);

        default:
            return(true);
        }
    }
Example #6
0
    public static List <CardVisual> FindCardsWithStatExtreme(CardStats stat, DeckType zone, bool high, OwnerConstraints owner)
    {
        List <CardVisual> results = new List <CardVisual>();

        //Debug.Log("Finding cards in" + zone.ToString());

        Dictionary <int, int> cardsByStat = StatCollector(stat, zone, owner);
        List <int>            sortedStats = cardsByStat.Values.ToList();

        //Debug.Log(sortedStats.Count + " is the number of stats found");

        //for (int i = 0; i < sortedStats.Count; i++) {
        //    Debug.Log(sortedStats[i].ToString() + " is the value of a stat on a soul");
        //}



        int targetStat;

        if (high)
        {
            targetStat = sortedStats.Max();
        }
        else
        {
            targetStat = sortedStats.Min();
        }

        foreach (KeyValuePair <int, int> entry in cardsByStat)
        {
            if (entry.Value == targetStat)
            {
                results.Add(FindCardByID(entry.Key));
            }
        }

        //foreach (CardVisual card in results) {
        //    Debug.Log(card.gameObject.name + " has the least " + stat.ToString());
        //}

        return(results);
    }
Example #7
0
    public static List <CardVisual> FindAllCardsInZone(DeckType zone, Keywords keyWord, OwnerConstraints ownerConstraints, CardType cardType)
    {
        List <CardVisual> cards = FindAllCardsInZone(zone, keyWord, ownerConstraints);

        List <CardVisual> sortedCards = FindAllCardsOfType(cards, cardType);

        return(sortedCards);
    }
Example #8
0
    public static List <CardVisual> FindAllCardsInZone(DeckType zone, Keywords keyWord, OwnerConstraints ownerConstraints)
    {
        List <CardVisual> cards = FindAllCardsInZone(zone);

        List <CardVisual> sortedCards1 = FindAllCardsWithKeyword(keyWord, cards);
        List <CardVisual> sortedCards2 = SortCardsByOwner(sortedCards1, ownerConstraints);

        return(sortedCards2);
    }
Example #9
0
    private static Dictionary <int, int> StatCollector(CardStats stat, DeckType zone, OwnerConstraints owner)
    {
        Dictionary <int, int> results = new Dictionary <int, int>();

        List <CardVisual> cardsToSearch = FindAllCardsInZone(zone, owner); //FindAllCardsOfType(CardType.Soul, zone, owner);

        //foreach(CardVisual card in cardsToSearch) {
        //    Debug.Log(card.gameObject.name + " is " + card.cardData.cardName);
        //}

        switch (stat)
        {
        case CardStats.Cost:

            for (int i = 0; i < cardsToSearch.Count; i++)
            {
                results.Add(cardsToSearch[i].photonView.viewID, cardsToSearch[i].essenceCost);
            }
            break;

        case CardStats.Attack:
            for (int i = 0; i < cardsToSearch.Count; i++)
            {
                if (cardsToSearch[i].primaryCardType != CardType.Soul)
                {
                    continue;
                }


                CreatureCardVisual soul = cardsToSearch[i] as CreatureCardVisual;

                results.Add(soul.photonView.viewID, soul.attack);
            }
            break;

        case CardStats.Size:
            for (int i = 0; i < cardsToSearch.Count; i++)
            {
                if (cardsToSearch[i].primaryCardType != CardType.Soul)
                {
                    continue;
                }

                CreatureCardVisual soul = cardsToSearch[i] as CreatureCardVisual;

                results.Add(soul.photonView.viewID, soul.size);
            }
            break;

        case CardStats.Health:
            for (int i = 0; i < cardsToSearch.Count; i++)
            {
                if (cardsToSearch[i].primaryCardType != CardType.Soul)
                {
                    continue;
                }

                CreatureCardVisual soul = cardsToSearch[i] as CreatureCardVisual;

                results.Add(soul.photonView.viewID, soul.health);
            }
            break;
        }

        return(results);
    }