Examples of CardList


Examples of csa.jportal.card.CardList

     *

     */
    public static Card getHarmlessTarget(CardList list)
    {
        CardList orderedList = list.sortListByManaCost();
        return orderedList.getCard(0);
    }
View Full Code Here

Examples of csa.jportal.card.CardList

     */
    public static Card getMostTough(CardList list)
    {
        if (list==null) return null;
        if (list.size()==0) return null;
        CardList orderedList = list.sortListByToughness();
        return orderedList.getCard(orderedList.size()-1);
    }
View Full Code Here

Examples of csa.jportal.card.CardList

     */
    public static Card getMostExpensive(CardList list)
    {
        if (list==null) return null;
        if (list.size()==0) return null;
        CardList orderedList = list.sortListByManaCost();
        return orderedList.getCard(orderedList.size()-1);
    }
View Full Code Here

Examples of csa.jportal.card.CardList

     */
    public static Card getLeastExpensive(CardList list)
    {
        if (list==null) return null;
        if (list.size()==0) return null;
        CardList orderedList = list.sortListByManaCost();
        return orderedList.getCard(0);
    }
View Full Code Here

Examples of csa.jportal.card.CardList

        return AIHelper.getToughnessSum(creatureList);
    }

    public static CardList onlyWithHint(CardList creatureList, String key, HintBundle bundle)
    {
        CardList ret = new CardList();
        for (int i=0; i < creatureList.size();i++)
        {
            Card card = creatureList.getCard(i);
            if (hasHint(card, key, bundle))
                ret.addCard(card);
        }
        return ret;
    }
View Full Code Here

Examples of csa.jportal.card.CardList

        return ret;
    }

    public static CardList removeWithHint(CardList list, String key, HintBundle bundle)
    {
        CardList ret = new CardList();
        for (int i=0; i < list.size();i++)
        {
            Card card = list.getCard(i);
            if (!hasHint(card, key, bundle))
                ret.addCard(card);
        }
        return ret;
    }
View Full Code Here

Examples of csa.jportal.card.CardList

    }

    Card shouldPlayLand()
    {
        boolean skip = false;
        CardList hand = E.match.getHand(E.player);
        CardList handLands = hand.getSubListByType("Land");
        if (handLands.size() == 0) return null;

        int intelligence  = E.aiPlayer.mStrategie.getIntelligence();
        int landPlayMood = E.match.getLand(E.player).size()+3;

        if (landPlayMood>10)
        {
            int prob = 12 - (landPlayMood);
            if (prob < 0) prob = 0;
            int randy =  csa.Global.getRand().nextInt(10);

            if (randy>=prob )
            {
                // todo check if enough lands of EVERY usefull color are present (2? at least?)
                int manaBlack = E.match.getLand(E.player).getSubListBySubType("Swamp").size();
                int manaRed = E.match.getLand(E.player).getSubListBySubType("Mountain").size();
                int manaWhite = E.match.getLand(E.player).getSubListBySubType("Plains").size();
                int manaBlue = E.match.getLand(E.player).getSubListBySubType("Island").size();
                int manaGreen = E.match.getLand(E.player).getSubListBySubType("Forest").size();

                if ((manaBlack < 3) && (handLands.getSubListBySubType("Swamp").size()>0) ) skip = true;
                if ((manaRed < 3) && (handLands.getSubListBySubType("Mountain").size()>0) ) skip = true;
                if ((manaWhite < 3) && (handLands.getSubListBySubType("Plains").size()>0) ) skip = true;
                if ((manaBlue < 3) && (handLands.getSubListBySubType("Island").size()>0) ) skip = true;
                if ((manaGreen < 3) && (handLands.getSubListBySubType("Forest").size()>0) ) skip = true;


              if (enoughLands(E.match.getLand(E.player).size(), hand ))
                skip = true;
            }
        }
        if (skip) return null;

        String color = getColorOfLessFrequence(E.match.getLand(E.player), handLands);
        CardList handlands = handLands.getSubListByColor(color);
        Card aLand;

        if (handlands.size() == 1)
            aLand = handlands.getCard(0);
        else
            aLand = handLands.getCard(csa.Global.getRand().nextInt(handLands.size()));

        return aLand;
    }
View Full Code Here

Examples of csa.jportal.card.CardList

        mOfferCard = null;
        jComboBoxCard.setSelectedIndex(-1);
        if (jComboBoxPlayerSet.getSelectedIndex() == -1) return;

        CardSet mCardset = new CardSet((String) jComboBoxPlayerSet.getSelectedItem());
        CardList list = new CardList (mCardset.getCards());
        list = list.onlyInHeap(mHeap);


        if ( ((String)jComboBoxPlayerColor.getSelectedItem()).indexOf("W") != -1) list = list.getSubListByColor("W");
        if ( ((String)jComboBoxPlayerColor.getSelectedItem()).indexOf("R") != -1) list = list.getSubListByColor("R");
        if ( ((String)jComboBoxPlayerColor.getSelectedItem()).indexOf("G") != -1) list = list.getSubListByColor("G");
        if ( ((String)jComboBoxPlayerColor.getSelectedItem()).indexOf("B") != -1) list = list.getSubListByColor("B");
        if ( ((String)jComboBoxPlayerColor.getSelectedItem()).indexOf("U") != -1) list = list.getSubListByColor("U");

        jComboBoxCard.removeAllItems();
        Vector<Card> cards = list.getCards();
        Collections.sort(cards, new Comparator<Card>()
        {
           public final int compare(Card s1, Card s2)
           {
              return (s1.getName().compareTo(s2.getName()));
View Full Code Here

Examples of csa.jportal.card.CardList

        {
            int setCount = mPlayer.getData().getKnownSets().size();
            int setRare = Global.getRand().nextInt(setCount);
            String setName = mPlayer.getData().getKnownSets().elementAt(setRare);
            CardSet set = CardSet.getSet(setName);
            CardList list = new CardList(set.getCards());
            list = list.getSubListByRarity("R");
            int rareSize = list.size();
            int listRare = Global.getRand().nextInt(rareSize);
            Card rare = list.getCard(listRare);

            Vector <String> specialOffers = mPlayer.getData().getSpecialOfferItem();
            Vector <Integer> specialOfferPrice = mPlayer.getData().getSpecialOfferItemPrice();
             specialOffers = new Vector <String>();
             specialOfferPrice = new Vector <Integer>();
View Full Code Here

Examples of csa.jportal.card.CardList

    boolean hasRed = false;
   
    CardList buildHeapList()
    {
        CardHeap heap = new CardHeap("AllInHeap", true);
        CardList list = heap.getCardList();
       
        // hard heap reduction
        if (!jCheckBoxPortal.isSelected())
            list = list.removeSet("Portal");
        if (!jCheckBoxII.isSelected())
            list = list.removeSet("Portal Second Age");
        if (!jCheckBoxIII.isSelected())
            list = list.removeSet("Portal Three Kingdoms");
        if (!jCheckBox1999.isSelected())
            list = list.removeSet("Starter 1999");
        if (!jCheckBox2000.isSelected())
            list = list.removeSet("Starter 2000");
        list = list.removeSet("Fifth Edition");


        hasWhite = false;
        hasGreen = false;
        hasBlue = false;
        hasBlack = false;
        hasRed = false;
       
        if (jCheckBoxRandom1.isSelected())
        {
            // 2 colors random
            CardList copy = list.copyList();
            String color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
        }
       
        if (jCheckBoxRandom2.isSelected())
        {
            // 2 colors random
            CardList copy = list.copyList();
            String color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
        }
        else if (jCheckBoxRandom3.isSelected())
        {
            // 3 colors random
            CardList copy = list.copyList();
            String color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
        }
        else if (jCheckBoxRandom4.isSelected())
        {
            // 4 colors random
            CardList copy = list.copyList();
            String color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
            copy = copy.removeColors(color);
            color = getRandomColor(copy);
            if (color.length()==0) return new CardList();
            if (color.equals("W")) hasWhite=true;
            if (color.equals("R")) hasRed=true;
            if (color.equals("B")) hasBlack=true;
            if (color.equals("U")) hasBlue=true;
            if (color.equals("G")) hasGreen=true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.