Examples of CardList


Examples of csa.jportal.card.CardList

        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.createCardOpponentHand(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);
View Full Code Here

Examples of csa.jportal.card.CardList

        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.createCreaturePlayerLibrary(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);
View Full Code Here

Examples of csa.jportal.card.CardList

        //#import "scripts\Allround\AIHelperScript.java"

        Card card = c.E.mInitiatorCard;
        //#import "scripts\Allround\SorceryComboCast.java"

        CardList playerLand = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createLandPlayerLand(E.player, E.opponent));
        playerLand = AIHelper.removeRS(playerLand, c, E.match, E.player);
        CardList opponentLand = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createLandOpponentLand(E.player, E.opponent));
        opponentLand = AIHelper.removeRS(opponentLand, c, E.match, E.player);
        CardList playerCreature = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCreaturePlayerCreature(E.player, E.opponent));
        playerCreature = AIHelper.removeRS(playerCreature, c, E.match, E.player);
        CardList opponentCreature = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCreatureOpponentCreature(E.player, E.opponent));
        opponentCreature = AIHelper.removeRS(opponentCreature, c, E.match, E.player);

        playerLand = AIHelper.adjustListWithCardNeeds(playerLand, card);
        opponentLand = AIHelper.adjustListWithCardNeeds(opponentLand, card);
        playerCreature = AIHelper.adjustListWithCardNeeds(playerCreature, card);
        opponentCreature = AIHelper.adjustListWithCardNeeds(opponentCreature, card);

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

        if ((opponentCreature.size()==0) && (opponentLand.size()==0))
        {
            E.D.addLog("EAI: I didn´t find any suitable card, I´ll take maybe!",debugLevel);
            c.setCancled(true);
            c.setMaybeTaken(true);
            c.setCardResult(null);
            c.setSuccessfull(true);
            // c.E.ev.iRet.bRet=false;
            return;
        }

        if (opponentCreature.size()>=playerCreature.size())
        {
            if (opponentCreature.size()>0)
            {
                chosen = AIHelper.getMostDamaging(opponentCreature);
            }
            if (chosen==null)
            {
View Full Code Here

Examples of csa.jportal.card.CardList

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

        Card target=null;

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

        myCreatures = AIHelper.adjustListWithCardNeeds(myCreatures, card);
        boolean myself = true;
        CardList targetList=null;

        if (AIHelper.isDamageCard(card))
        {
            if (myCreatures.size()>0) targetList = myCreatures;
            if (targetList==null)
            {
                c.E.mTargetCardTo = null;
                c.setCardResult(null);
                c.setCancled(true);
                c.setMaybeTaken(true);
                c.setSuccessfull(false);
                E.D.addLog("EAI: No creature!",debugLevel);
                return;
            }

            if (AIHelper.hasBoolHint(card, "EFFECT_ONE_CREATURE_DAMAGE"))
            {
                int damageAmount = c.callerEv.amount;
                // above is probably right, if trouble try this, changed: 7.4.2010 int damageAmount = c.E.ev.amount;
                if (damageAmount == 0)
                {
                    hint = hints.getHintbyVarname("DAMAGE_AMOUNT");
                    if (hint != null)
                    {
                        damageAmount = hint.getInteger();
                        E.D.addLog("EAI: Hint.DAMAGE_AMOUNT: " + damageAmount,debugLevel);
                    }
                }
                target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
                AIHelper.addToRS(target, c, E.match, E.player);

                c.E.mTargetCardTo = target;
                c.setCardResult(target);
                c.setSuccessfull(true);
                E.D.addLog("EAI: Successfull end!" ,debugLevel);
                return;
            }

            target = AIHelper.getKillTarget(targetList, myself,E.match, E.player);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
            c.setSuccessfull(true);
            E.D.addLog("EAI: Successfull end!",debugLevel);
            return;
        }
        else if (AIHelper.isBufCard(card))
        {
            myCreatures = myCreatures.getSubListBooleanState(Card.CARD_SICKNESS, false);
            if ((targetList==null) && (myCreatures.size()>0)) targetList=myCreatures;
            if (targetList==null)
            {
                c.E.mTargetCardTo = null;
                c.setCardResult(null);
                c.setCancled(true);
                c.setMaybeTaken(true);
                c.setSuccessfull(false);
                E.D.addLog("EAI: No creature!",debugLevel);
                return;
            }
             target = AIHelper.getAttackerBufTarget(targetList, myself,E.match, E.player);
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
            c.setSuccessfull(true);
            E.D.addLog("EAI: Successfull end!",debugLevel);
            return;
        }
        else if (AIHelper.isReplayCard(card))
        {
            boolean healerMode=false;
            if ((myCreatures.size() > 0) && (AIHelper.hasHealer(myCreatures)))
            {
                targetList=myCreatures;
                target = AIHelper.getHealerTarget(targetList,E.match, E.player);
          }
            else if (myCreatures.size()>0)
            {
                targetList=myCreatures;
                target = AIHelper.getHarmlessTarget(targetList);
            }
            AIHelper.addToRS(target, c, E.match, E.player);
            c.E.mTargetCardTo = target;
            c.setCardResult(target);
            c.setSuccessfull(true);
            E.D.addLog("EAI: Successfull end!",debugLevel);
            return;
        }
        else
        {
          E.D.addLog("EAI: No Supported Hint found - don´t know what to do, taking strongest... give more hints!!!!",debugLevel);
          // e.g. Goblin War Cry-> EFFECT_OPPONENT_CREATURE_ONLY_ONE_BLOCK

          CardList powerlist = myCreatures.removeWithAbility("NoBlock, Flying");
          if (powerlist.size() == 0)
            powerlist = myCreatures.removeWithAbility("Flying");
          if (powerlist.size() == 0)
            powerlist = myCreatures.removeWithAbility("NoBlock");
          if (powerlist.size() == 0)
            powerlist = myCreatures.copyList();

          powerlist  = powerlist.sortListByPower();
          // for now take the strongest...
            if (powerlist.size() == 0)
            {
                c.E.mTargetCardTo = null;
                c.setCardResult(null);
                c.setCancled(true);
                c.setMaybeTaken(true);
                c.setSuccessfull(false);
                E.D.addLog("EAI: No creature!",debugLevel);
                return;
            }
            c.E.mTargetCardTo = powerlist.getCard(powerlist.size()-1);
            AIHelper.addToRS(c.E.mTargetCardTo, c, E.match, E.player);
            c.setCardResult(c.E.mTargetCardTo);
            c.setSuccessfull(true);
            E.D.addLog("EAI: Successfull end! " +c.E.mTargetCardTo,debugLevel);
            return;
View Full Code Here

Examples of csa.jportal.card.CardList

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

        // target E.player would be set as:
        // c.E.mTargetPlayer = E.player;
        CardList ocreatures = E.match.getBattlefield(E.opponent);
        ocreatures = AIHelper.removeRS(ocreatures, c, E.match, E.player);

        Card cc = AIHelper.getSingleCreatureToDie(c.E.mInitiatorCard, ocreatures, E.match, E.player);
        if (cc!=null)
           AIHelper.addToRS(cc, c, E.match, E.player);
View Full Code Here

Examples of csa.jportal.card.CardList

    public Card dropOneExcessCard()
    {
        int debugLevel = 3;
        E.D.addLog("EAI: Remove excess cards!",debugLevel);

        CardList playerList = AIHelper.getPossibleCardList(E.player, E.match, CardAsking.createCardPlayerHand(E.player, E.opponent));
        E.D.addLog("EAI: Player:!" + E.player, debugLevel);
        Card chosen;

        if (playerList.size() == 0)
        {
            E.D.addLog("EAI: No card found! ",debugLevel);
            return null;
        }
View Full Code Here

Examples of csa.jportal.card.CardList

        initEnvironment();
       
        E.D.addLog("EAI: Enter take Muligan?",E.debugLevel);

        int landCount=0;
        CardList hand = E.match.getHand(E.player);
        E.D.addLog("EAI: Cards in hand: "+hand.size(), E.debugLevel);
        E.D.addLog("EAI: Cards in hand: "+hand, E.debugLevel);

        for (int i=0; i<hand.size(); i++)
        {
            Card card = hand.getCard(i);
            if (card.isLand()) landCount++;
        }
        E.D.addLog("EAI: Lands (count) in hand: "+landCount, E.debugLevel);

        if (landCount==0)
        {
            E.D.addLog("EAI: No lands -> I take a mulligan", E.debugLevel);
            E.L.addLog(E.player+" takes mulligan!");
            E.D.addLog("EAI: End take Muligan?", E.debugLevel);
            return true;
        }
        if (landCount==hand.size())
        {
            E.D.addLog("EAI: Hand full of lands -> I take a mulligan", E.debugLevel);
            E.L.addLog(E.player+" takes mulligan!");
            E.D.addLog("EAI: End take Muligan?", E.debugLevel);
            return true;
View Full Code Here

Examples of csa.jportal.card.CardList

        String dattackerKey="DECLARE_ATTACKER_"+baseKey;
        //#import "scripts\Allround\AIHelperScript.java"
        E.D.addLog("EAI:script include Loaded",E.debugLevel);

        int state = aiPlayer.getIntData(dattackerKey+"STATE");
        CardList attackerList = (CardList) aiPlayer.getObjectData(dattackerKey+"ATTACKER_LIST");
        CardList tapperList = (CardList) aiPlayer.getObjectData(dattackerKey+"TAPPER_LIST");

        // init declaration
        E.D.addLog("EAI: state check init, State: " + state ,E.debugLevel);

        if (state == 0)
        {
            E.D.addLog("EAI: state 0 enter",E.debugLevel);
            state++;
            aiPlayer.setIntData(dattackerKey+"STATE", state);
            aiPlayer.setIntData(dattackerKey, 0); // loop
            int intelligence  = aiPlayer.mStrategie.getIntelligence();

            CardList myCreatures = E.match.getBattlefield(E.player);
            myCreatures = myCreatures.getSubListTapState(false);
            myCreatures = myCreatures.getSubListBooleanState(Card.CARD_SICKNESS, false);

            tapperList = AIHelper.onlyWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_ATTACK");
            tapperList = AIHelper.adjustListWithCardNeeds(tapperList, true, "ATTACK_TAP" , E.match, E.player);
            aiPlayer.setObjectData(dattackerKey+"TAPPER_LIST", tapperList);

            //to ignore! CAN_BE_TAPPED_INSTEAD_ATTACK
            myCreatures = E.match.getBattlefield(E.player);
            myCreatures = myCreatures.getSubListBooleanState(Card.CARD_SICKNESS, false);
            myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_ATTACK");
            myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_BLOCK");

            E.D.addLog("EAI: myCreatures: " +myCreatures,E.debugLevel);
            if (AIHelper.isBufActive(myCreatures))
            {
                // allways attack if creatures are buffed
                E.D.addLog("EAI: Buf active - all attacking!",E.debugLevel);
                attackerList = myCreatures;
            }
            else
            {
                attackerList = AIHelper.getAttackerList(myCreatures, E.player, E.match);
            }

            if (intelligence > 6)
            {
                attackerList = AIHelper.adjustShouldAttack(attackerList, myCreatures);
            }

            aiPlayer.setObjectData(dattackerKey+"ATTACKER_LIST", attackerList);

            E.D.addLog("EAI: AttackerList evaluated: "+attackerList,E.debugLevel);
            // init
           E.D.addLog("EAI: state 0 ends",E.debugLevel);
        }

        // can someone be tapped instead?
        if (state == 1)
        {
            E.D.addLog("EAI: state 1 enter",E.debugLevel);
            int loop = aiPlayer.getIntData(dattackerKey);

            // ensure during some past actions tapper list is still valid
            // Diaochan, Artful Beauty might have something destroyed

            for (int i=loop; i< tapperList.size(); i++)
            {
                Card card = tapperList.getCard(loop);
                if (!E.match.getBattlefield(E.player).isInList(card))
                  tapperList.removeCard(card);
            }


            while ((loop < tapperList.size()) && (state == 1))
            {
                loop = aiPlayer.getIntData(dattackerKey);
                boolean tappingDone = false;
                if (tapperList.size() != 0)
                {
                    E.D.addLog("EAI: tapper found enter: " +tapperList.size(),E.debugLevel);
                    E.D.addLog("EAI: tapper loop: " + loop,E.debugLevel);


                    Card card = tapperList.getCard(loop);
                    E.D.addLog("EAI: current tapper: " + card,E.debugLevel);

                    boolean sense = AIHelper.tapHintMakesSenseNow(E.player, E.match, card);

                    if ((!card.isTapped()) && (sense))
                    {
                        E.D.addLog("EAI: tapping in attacking possible: "+card,E.debugLevel);
                        boolean doTap=true;
                        //-> only when attacking occurs!
                        if (AIHelper.hasHint(card, "PLAYER_CREATURE_NEED"))
                        {
                            doTap = attackerList.size()>0;
                        }
                        if (AIHelper.hasHint(card, "OPPONENT_CREATURE_NEED"))
                        {
                            CardList oCreatures = E.match.getBattlefield(E.opponent);
                            oCreatures = oCreatures.getSubListTapState(false);
                            doTap = oCreatures.size()>0;
                            if (doTap)
                            {
                                state=-1; // rest attack list!
                                aiPlayer.setIntData(dattackerKey+"STATE", state);
                            }
                        }
                        if (AIHelper.hasHint(card, "OPPONENT_TAPPED_CREATURE_NEED"))
                        {
                            CardList oCreatures = E.match.getBattlefield(E.opponent);
                            oCreatures = oCreatures.getSubListTapState(true);
                            doTap = oCreatures.size()>0;
                            if (doTap)
                            {
                                state=-1; // rest attack list!
                                aiPlayer.setIntData(dattackerKey+"STATE", state);
                            }
View Full Code Here

Examples of csa.jportal.card.CardList

        int round = E.match.getRound();
        String dblockerKey="DECLARE_BLOCKER_"+baseKey;
        //#import "scripts\Allround\AIHelperScript.java"


        CardList blockerList = (CardList) aiPlayer.getObjectData(dblockerKey+"BLOCKER_LIST");
        CardList tapperList = (CardList) aiPlayer.getObjectData(dblockerKey+"TAPPER_LIST");

        if (tapperList == null)
        {
          // first time
            CardList myCreatures = E.match.getBattlefield(E.player);
            myCreatures = myCreatures.getSubListTapState(false);

            tapperList = AIHelper.onlyWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_BLOCK");
            tapperList = AIHelper.adjustListWithCardNeeds(tapperList, true, "ATTACK_TAP" , E.match, E.player); // attack on purpose - that is the key, dont need an extra for blocking
            aiPlayer.setObjectData(dblockerKey+"TAPPER_LIST", tapperList);

            myCreatures = E.match.getBattlefield(E.player);
            myCreatures = myCreatures.getSubListTapState(false);
            myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_BLOCK");
            aiPlayer.setObjectData(dblockerKey+"BLOCKER_LIST", myCreatures);
            blockerList = myCreatures;
        }

        int state = aiPlayer.getIntData(dblockerKey+"STATE");
        CombatFormation blockerFormation;
        if (state == 0)
        {
            int loop = aiPlayer.getIntData(dblockerKey+"TLOOP");

            E.D.addLog("EAI: state 0 enter, tapper size = "+ tapperList.size()+", loop = "+ loop,debugLevel);
            while ((loop < tapperList.size()) && (state == 0))
            {
              loop = aiPlayer.getIntData(dblockerKey+"TLOOP");
              boolean tappingDone = false;
              if (tapperList.size() != 0)
              {
                  E.D.addLog("EAI: tapper found enter: " +tapperList.size(),debugLevel);
                  E.D.addLog("EAI: tapper loop: " + loop,debugLevel);


                  Card card = tapperList.getCard(loop);
                  E.D.addLog("EAI: current tapper: " + card,debugLevel);

                  boolean sense = AIHelper.tapHintMakesSenseNow(E.player, E.match, card);

                  if ((!card.isTapped()) && (sense))
                  {
                      E.D.addLog("EAI: tapping in blocking possible: "+card,debugLevel);
                      boolean doTap=true;

                      if (AIHelper.hasHint(card, "OPPONENT_ATTACKER_NEED"))
                      {
                          doTap = E.match.getAttackerList().size()>0;
                      }
                      if (doTap)
                      {
                          E.D.addLog("EAI: tapping!: "+card,debugLevel);
                          E.match.playAbility(E.player, card);
                          tappingDone = true;
                      }
                      else
                      {
                          E.D.addLog("EAI: not tapping!: "+card,debugLevel);
                      }
                  }
              }
              loop++;
              if (loop >= tapperList.size())
              {
                  loop = 0;
                  aiPlayer.setIntData(dblockerKey+"TLOOP", 0);
                  state++;
                  aiPlayer.setIntData(dblockerKey+"STATE", state);
                  if ((tapperList.size() > 0) && (tappingDone))
                  {
                      E.D.addLog("EAI: Todo one tap - than come back to block " + loop,debugLevel);
                      return false;
                  }
              }
              if (loop != 0)
              {
                  E.D.addLog("EAI: Todo one tap - than come back to tap more " + loop,debugLevel);
                  aiPlayer.setIntData(dblockerKey+"TLOOP", loop);
                  if (tappingDone)
                  {
                        E.D.addLog("EAI: Tapping was done! " ,debugLevel);
                        return false;
                  }
              }

            }

            E.D.addLog("EAI: state 0 ends (state = "+state+")",debugLevel);
            state = 1;
            aiPlayer.setIntData(dblockerKey+"STATE", state);
        }

        // init declaration
        if (state == 1)
        {
            state++;
            aiPlayer.setIntData(dblockerKey+"STATE", state);

                int mood  = aiPlayer.mStrategie.getMood();
                int intelligence  = aiPlayer.mStrategie.getIntelligence();
                int majorMood = mood/3;
                if (majorMood>2) majorMood = 2;
                int minorMood = mood - (majorMood*3);

                if (majorMood==0)
                {
                    // defense
                    blockerFormation = AIHelper.getDefensiveBlocker(
                        blockerList,
                        E.match.getAttackerList(),
                        E.match.getLand(E.player),
                        E.match.getLand(E.opponent) , minorMood, intelligence);
                }
                else if (majorMood==1)
                {
                    // equal
                    blockerFormation = AIHelper.getMediumBlocker(
                        blockerList,
                        E.match.getAttackerList(),
                        E.match.getLand(E.player),
                        E.match.getLand(E.opponent) , minorMood, intelligence);
                }
                else // 2
                {
                    // offense
                    blockerFormation = AIHelper.getAgressiveBlocker(
                        blockerList,
                        E.match.getAttackerList(),
                        E.match.getLand(E.player),
                        E.match.getLand(E.opponent) , minorMood, intelligence);
                }

            aiPlayer.setObjectData(dblockerKey+"BlockerFormation", blockerFormation);
            E.D.addLog("EAI: Block formation:  "+blockerFormation ,debugLevel);
        }

        // blocker declaration
        if (state == 2)
        {
            blockerFormation = (CombatFormation) aiPlayer.getObjectData(dblockerKey+"BlockerFormation");
            int loopAttacker = aiPlayer.getIntData(dblockerKey+"ATTACKER_LOOP");
            int loopBlocker = aiPlayer.getIntData(dblockerKey+"BLOCKER_LOOP");

            while (loopAttacker < blockerFormation.getFormation().size())
            {
                E.D.addLog("EAI: entering loop, A counter = "+loopAttacker+" from "+(blockerFormation.getFormation().size()+1) ,debugLevel);
                E.D.addLog("EAI: B counter = "+loopBlocker+" from "+(blockerFormation.getFormation().elementAt(loopAttacker).blocker.size()+1) ,debugLevel);

                SingleFight sFight = blockerFormation.getFormation().elementAt(loopAttacker);
                E.D.addLog("EAI: SingleFight: "+sFight ,debugLevel);
                CardList blockers = sFight.blocker;
                Card attacker = sFight.attacker;

                while (loopBlocker < blockers.size())
                {
                    Card blocker = blockers.getCard(loopBlocker);
                    if (sFight.isBlockerUsed(blocker))
                    {
                        E.D.addLog("EAI: Blocker used: "+blocker ,debugLevel);
                        String blockerKey="TMP_KEY_"+round+"_attacker_blocker"+blocker.getUniqueID();
                        // tell answer script what blocker to use
                        aiPlayer.setObjectData(blockerKey, attacker);
                        E.match.declareBlocker(E.player, blocker);

                        loopBlocker++;
                        if (loopBlocker == blockers.size())
                        {
                            E.D.addLog("EAI: Going to next attacker..." ,debugLevel);
                            loopAttacker++;
                            loopBlocker=0;
                        }
View Full Code Here

Examples of csa.jportal.card.CardList

    public boolean untapCards()
    {
        initEnvironment();
//// UNTAP ALL START
        CardList lands = E.match.getLand(E.player);
        CardList creatures = E.match.getBattlefield(E.player);
        Vector ls = lands.getCards();
        for (int i = 0; i < ls.size(); i++)
        {
            Card card = (Card) ls.elementAt(i);
            if (card.isTapped())
            {
                E.match.untapCard(E.player,  card);
                E.D.addLog("EAI: untapping land"+card,4);
            }
        }
        Vector cs = creatures.getCards();
        for (int i = 0; i < cs.size(); i++)
        {
            Card card = (Card) cs.elementAt(i);
            if (card.isTapped())
            {
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.