Package csa.jportal.card

Examples of csa.jportal.card.CardList


    public int computeScore()
    {
        int ret =0;
        MatchPlayable p = vMatch.getPlayer(playerNo);
        CardList deck = p.getDeck();
        if (deck == null) return 0;
        int colorNeeded = deck.getColorCount();
        int colorsGot = lands.getColorCount();

        int colorsPerdec = (colorsGot *10 ) / colorNeeded;
        ret += colorsPerdec;
        ret += lands.size();
View Full Code Here


                if (AIHelper.hasHint(cardToPayFor, "EFFECT_ONE_CREATURE_DAMAGE"))
                {
                     if (!((AIHelper.hasHint(cardToPayFor, "EFFECT_ONE_PLAYER_DAMAGE")) || (AIHelper.hasHint(cardToPayFor, "EFFECT_OPPONENT_DAMAGE"))))
                     {
                        // seek creature
                        CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
                        if (opponentCreatures.size() == 0)
                        {
                            // whats this??
                            xCost = 0;
                        }
                        else
                        {
                            Card target = AIHelper.getDamageTarget(opponentCreatures, xCost, false, E.match, E.player);
                            xCost = target.getNowToughness();
                        }
                     }
                }


                // than x < E.player life No Suicide!
                if (AIHelper.hasHint(cardToPayFor, "EFFECT_PLAYER_DAMAGE"))
                {
                    int life = E.match.getLife(E.player);
                    if (life-1 < xCost) xCost = life-1;
                }
                allCost = xCost+baseCost;
            }
            E.aiPlayer.setIntData(keyHead+"_All", allCost);
        }

        // now all data is set so we can continue to pay
        // I take it that we ALLWAYS!!! have enough Lands to pay!
        // no checking is done here!
        CardList lands = E.match.getLand(E.player);
        CardList untappedLands = lands.getSubListTapState(false);

        E.D.addLog("EAI: Untapped lands: " + untappedLands ,debugLevel);
        Card toTap=null;
        if (E.aiPlayer.getIntData(keyHead+"_G")>0)
        {
            E.D.addLog("EAI: Payment 1 forest." ,debugLevel);
            CardList greens = untappedLands.getSubListBySubType("Forest");
            if (greens.size()!=0)
            {
                toTap = greens.getCard(0);
                int green = E.aiPlayer.getIntData(keyHead+"_G")-1;
                E.aiPlayer.setIntData(keyHead+"_G", green);
            }
        }
        if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_B")>0))
        {
            E.D.addLog("EAI: Payment 1 swamp." ,debugLevel);
            CardList blacks = untappedLands.getSubListBySubType("Swamp");
            if (blacks.size()!=0)
            {
                toTap = blacks.getCard(0);
                int black = E.aiPlayer.getIntData(keyHead+"_B")-1;
                E.aiPlayer.setIntData(keyHead+"_B", black);
              }
        }
        if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_U")>0))
        {
            E.D.addLog("EAI: Payment 1 islanE.D." ,debugLevel);
            CardList blues = untappedLands.getSubListBySubType("Island");
            if (blues.size()!=0)
            {
                toTap = blues.getCard(0);
                int blue = E.aiPlayer.getIntData(keyHead+"_U")-1;
                E.aiPlayer.setIntData(keyHead+"_U", blue);
              }
        }
        if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_W")>0))
        {
            E.D.addLog("EAI: Payment 1 plain." ,debugLevel);
            CardList whites = untappedLands.getSubListBySubType("Plains");
            if (whites.size()!=0)
            {
                toTap = whites.getCard(0);
                int white = E.aiPlayer.getIntData(keyHead+"_W")-1;
                E.aiPlayer.setIntData(keyHead+"_W", white);
              }
        }
        if ( (toTap==null) &&(E.aiPlayer.getIntData(keyHead+"_R")>0))
        {
            E.D.addLog("EAI: Payment 1 mountain." ,debugLevel);
            CardList reds = untappedLands.getSubListBySubType("Mountain");
            if (reds.size()!=0)
            {
                toTap = reds.getCard(0);
                int red = E.aiPlayer.getIntData(keyHead+"_R")-1;
                E.aiPlayer.setIntData(keyHead+"_R", red);
              }
        }
        // if still not one tapped, than all colored is done and we
View Full Code Here

        String baseKey=E.match.getPlayerBaseKey(E.player);
        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;

        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCardPlayerHand(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);

        playerList.removeCard(card);
        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);
        Card chosen;

        if (E.player == c.E.mInitiatorPlayer)
           E.D.addLog("EAI: Asked from self!",debugLevel);
        else
           E.D.addLog("EAI: Asked from Opponent!",debugLevel);

        if (playerList.size() == 0)
        {
            E.D.addLog("EAI: No card found! ",debugLevel);
            c.setMaybeTaken(true);
            c.setCardResult(null);
            c.setSuccessfull(true);
//// c.E.ev.iRet.bRet=false;
            return;
        }

        String[] h={"EFFECT_OPPONENT_CREATURE_TO_GRAVE", "EFFECT_ONE_CREATURE_TO_GRAVE", "EFFECT_OPPONENT_HAND_TO_GRAVE","EFFECT_PLAYER_HAND_TO_GRAVE"};
        if (AIHelper.hasBoolHints(card, h))
        {
            chosen = AIHelper.getLeastUseableHandCard(playerList, E.match, E.player);
            E.D.addLog("EAI: Chosen card to discard: "+chosen ,debugLevel);
            AIHelper.addToRS(chosen, c, E.match, E.player);

            c.E.mTargetCardTo = chosen;
            c.setCardResult(chosen);
            c.setSuccessfull(true);
//// c.E.ev.iRet.bRet=true;
        }
        else
        {
            boolean maybe=false;
            String[] h2={"EFFECT_OPPONENT_HAND_LIBRARY_SWITCH", "EFFECT_PLAYER_HAND_LIBRARY_SWITCH"};
            if (AIHelper.hasBoolHints(card, h2))
            {
                CardList notUseable = AIHelper.getUnUseableHandCard(playerList, E.match, E.player);
                if (notUseable.size() == 0)
                {
                    E.D.addLog("EAI: MayBe taken!!" ,debugLevel);
                    c.setMaybeTaken(true);
                    c.setCardResult(null);
                    c.setSuccessfull(true);
                    // c.E.ev.iRet.bRet=false;
                    return;
                }
                chosen = notUseable.getCard(0);
                AIHelper.addToRS(chosen, c, E.match, E.player);
                E.D.addLog("EAI: Chosen card: "+chosen ,debugLevel);
                c.E.mTargetCardTo = chosen;
                c.setCardResult(chosen);
                c.setSuccessfull(true);
View Full Code Here

            c.setCardResult(st);
            c.setSuccessfull(true);
            return;
        }

        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createUntappedCreaturePlayer(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);
        CardList opponentList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createUntappedCreatureOpponent(E.player, E.opponent));
        opponentList = AIHelper.removeRS(opponentList, c, E.match, E.player);

        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);
        opponentList = AIHelper.adjustListWithCardNeeds(opponentList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);

        Card target=null;
        if (opponentList.size()>0)
        {
            target = AIHelper.getMostDamaging(opponentList);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
View Full Code Here

            c.setCardResult(st);
            c.setSuccessfull(true);
            return;
        }

        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createTappedCreaturePlayer(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);
        CardList opponentList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createTappedCreatureOpponent(E.player, E.opponent));
        opponentList = AIHelper.removeRS(opponentList, c, E.match, E.player);

        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);
        opponentList = AIHelper.adjustListWithCardNeeds(opponentList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);

        Card target=null;
        if (opponentList.size()>0)
        {
            target = AIHelper.getMostDamaging(opponentList);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
View Full Code Here

        AIPlayer aiPlayer = E.player.getAIPlayer();
        String baseKey=E.match.getPlayerBaseKey(E.player);
        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;
        CardList opponentList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createAttackingCreatureOpponentCreature(E.player, E.opponent));
        opponentList = AIHelper.removeRS(opponentList, c, E.match, E.player);
        opponentList = AIHelper.adjustListWithCardNeeds(opponentList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);

        E.D.addLog("EAI: Asked from myself!",debugLevel);
        Card target=null;
        if (opponentList.size()>0)
        {
            target = AIHelper.getMostDamaging(opponentList);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
View Full Code Here

        //if (E.player == c.E.mInitiatorPlayer)
        {
          E.D.addLog("EAI: Asked from myself!",debugLevel);

            CardList targetList=null;
            Card target=null;
            CardList myCreatures = E.match.getBattlefield(E.player);
            myCreatures = AIHelper.removeRS(myCreatures, c, E.match, E.player);
            myCreatures=AIHelper.adjustListWithCardNeeds(myCreatures, card);

            CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
            opponentCreatures = AIHelper.removeRS(opponentCreatures, c, E.match, E.player);
            opponentCreatures=AIHelper.adjustListWithCardNeeds(opponentCreatures, card);

            CardList stack = E.match.getStackCardList();
            boolean myself = true;

            if (AIHelper.isDamageCard(card))
            {
                if (opponentCreatures.size()>0)
                {
                    targetList=opponentCreatures;

                    myself = false;
                }
                E.D.addLog("EAI: opponentCreatures.size():"+opponentCreatures.size(),debugLevel);
                E.D.addLog("EAI: myCreatures.size():"+myCreatures.size(),debugLevel);
                E.D.addLog("EAI: c.mIsMust:"+c.mIsMust,debugLevel);
                if ((targetList==null) && (myCreatures.size()>0))
                {
                  if (c.mIsMust)
                  {
                    targetList=myCreatures;
                  }
                }
                if ((targetList==null) && (stack.size()>0))
                {
                  if (c.mIsMust)
                      if (stack.getCard(0).isCreature())
                          targetList=stack;
                }
                if (targetList==null)
                {
                    c.E.mTargetCardTo = null;
View Full Code Here

        AIPlayer aiPlayer = E.player.getAIPlayer();
        String baseKey=E.match.getPlayerBaseKey(E.player);
        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;
        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCreaturePlayerGraveyard(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);
        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);

        Card target=null;

        if (playerList.size()>0)
        {

            if (AIHelper.hasHint(card, "EFFECT_PLAYER_CREATURE_FROM_GRAVE_TO_PLAY"))
            {
                // allround takes most expensive
                CardList pl = playerList.sortListByManaCost();
                target = pl.getCard(pl.size()-1);
            }
            else if (AIHelper.hasHint(card, "EFFECT_PLAYER_CREATURE_FROM_GRAVE_TO_LIBRARY"))
            {
                // allround takes most expensive, but still playable card...
                CardList pl = AIHelper.onlyEnoughManaGeneral(playerList, E.match.getLand(E.player));
                pl = pl.sortListByManaCost();
                target = pl.getCard(pl.size()-1);
            }

            // if still nothing, than cheapest
            if (target == null)
            {
                CardList pl = playerList.sortListByManaCost();
                target = pl.getCard(0);
            }

            E.D.addLog("EAI: I take the card: "+target,debugLevel);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
View Full Code Here

        AIPlayer aiPlayer = E.player.getAIPlayer();
        String baseKey=E.match.getPlayerBaseKey(E.player);
        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;
        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCreaturePlayerHand(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);
        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);
        int intelligence  = aiPlayer.mStrategie.getIntelligence();

        playerList.removeCard(card);
        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);
        Card chosen;

        if (E.player == c.E.mInitiatorPlayer) E.D.addLog("EAI: Asked from self!",debugLevel);
        else E.D.addLog("EAI: Asked from Opponent!",debugLevel);

        if (playerList.size() == 0)
        {
            c.setCardResult(null);
            c.setCancled(true);
            c.setSuccessfull(true);
            // c.E.ev.iRet.bRet=true;
            return;
        }

        String[] h={"EFFECT_OPPONENT_CREATURE_TO_GRAVE", "EFFECT_ONE_CREATURE_TO_GRAVE", "EFFECT_OPPONENT_HAND_TO_GRAVE","EFFECT_PLAYER_HAND_TO_GRAVE", "EFFECT_PLAYER_HAND_CREATURE_TO_GRAVE"};
        if (AIHelper.hasBoolHints(card, h))
        {
          chosen = AIHelper.getLeastUseableHandCard(playerList,E.match, E.player);
            if (chosen != null)
            {
              E.D.addLog("EAI: Chosen card to discard: "+chosen ,debugLevel);
              AIHelper.addToRS(chosen, c, E.match, E.player);
              c.E.mTargetCardTo = chosen;
              c.setCardResult(chosen);
              c.setSuccessfull(true);
              // c.E.ev.iRet.bRet=true;
            }
            c.setCardResult(null);
            c.setCancled(true);
            c.setSuccessfull(true);
            // c.E.ev.iRet.bRet=true;
            return;
        }
        else
        {
          boolean maybe=false;
          String[] h2={"EFFECT_OPPONENT_HAND_LIBRARY_SWITCH", "EFFECT_PLAYER_HAND_LIBRARY_SWITCH"};
          if (AIHelper.hasBoolHints(card, h2))
          {
            CardList notUseable = AIHelper.getUnUseableHandCard(playerList,E.match, E.player);
            if (notUseable.size() == 0)
            {
                  E.D.addLog("EAI: MayBe taken!!" ,debugLevel);
                  c.setMaybeTaken(true);
                  c.setCardResult(null);
                  c.setSuccessfull(true);
                  // c.E.ev.iRet.bRet=false;
                  return;
            }
            chosen = notUseable.getCard(0);
            AIHelper.addToRS(chosen, c, E.match, E.player);
            E.D.addLog("EAI: Chosen card: "+chosen ,debugLevel);
            c.E.mTargetCardTo = chosen;
            c.setCardResult(chosen);
            c.setSuccessfull(true);
View Full Code Here

        AIPlayer aiPlayer = E.player.getAIPlayer();
        String baseKey=E.match.getPlayerBaseKey(E.player);
        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;
        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createLandPlayerHand(E.player, E.opponent));
        playerList = AIHelper.removeRS(playerList, c, E.match, E.player);
        playerList = AIHelper.adjustListWithCardNeeds(playerList, card);

        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        E.D.addLog("EAI: Initiator E.player:!" + c.E.mInitiatorPlayer,debugLevel);
        Card chosen;

        if (playerList.size() == 0)
        {
            E.D.addLog("EAI: MayBe taken!!" ,debugLevel);
            c.setMaybeTaken(true);
            c.setCardResult(null);
            c.setSuccessfull(true);
            // c.E.ev.iRet.bRet=false;
            return;
        }
        chosen = playerList.getCard(0);
        AIHelper.addToRS(chosen, c, E.match, E.player);
        E.D.addLog("EAI: Chosen card: "+chosen ,debugLevel);
        c.E.mTargetCardTo = chosen;
        c.setCardResult(chosen);
        c.setSuccessfull(true);
View Full Code Here

TOP

Related Classes of csa.jportal.card.CardList

Copyright © 2018 www.massapicom. 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.