Package csa.jportal.card

Examples of csa.jportal.card.Card


    void buildLeafForCommunication()
    {
        // for now -> only Mana Payment
        ManaPayment mana = pendingCommunication.manaExpected;
        Card card = pendingCommunication.E.mInitiatorCard;
        if (mana.paymentType == ManaPayment.MP_TRIGGER_ACTIVATE_CARD)
        {
            // only spontanous Mana supported as yet
            EAIAction ret;
            ManaCollection cost = ManaCollection.getCost(mana);
View Full Code Here


    public void setList(CardList list)
    {
        Vector<Card> cards = list.getCards();
        for (int i = 0; i < cards.size(); i++)
        {
            Card card = cards.elementAt(i);
            CardSim sim = new CardSim(card);
            mCards.addElement(sim);
        }
    }
View Full Code Here

    public void setList(CardList list, int p)
    {
        Vector<Card> cards = list.getCards();
        for (int i = 0; i < cards.size(); i++)
        {
            Card card = cards.elementAt(i);
            CardSim sim = new CardSim(card, p);
            mCards.addElement(sim);
        }
    }
View Full Code Here

    public boolean hasRealCards()
    {
        boolean ret = false;
        for (int j = 0; j < mCards.size(); j++)
        {
            Card card = mCards.elementAt(j).getCard();
            if (!card.isDummy())
            {
                return true;
            }
        }
        return ret;
View Full Code Here

                {
                    Map.Entry entry2 = (Map.Entry) it2.next();
                    String uid = (String) entry2.getKey();
                    CardTrigger trigger = (CardTrigger) entry2.getValue();

                    Card sourceCard = trigger.initiatorCard;

                    AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(sourceCard);

                    AIEnhancedHint hint = hints.getHint(HintAll.HINT_SITUATION_CARD_PLAYED, HintAll.TY_ATTACK_DENIAL);
                    if (hint != null)
View Full Code Here

                System.out.println(target+"CARD: " + target.getCard()+", " +target.getCard().getUniqueID());
                System.out.println("Last Autosave: " + Match.lastAutoSaveName);
                Configuration.getConfiguration().getDebugEntity().addLog("VMatch Card Missmatch! Last Autosave: " + Match.lastAutoSaveName);
                // try to rescue!
                initLibrary();
                Card c = target.getCard();
                target.setSCard(allCards.get(c.getUniqueID()));
                tCard = target.getSCard();
                if (tCard == null)
                {
                    // ERROR!!!!
                }
View Full Code Here

        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)
        {
View Full Code Here

            // 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);
                            }
                        }

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

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

        // attackin init
        if (state == 2)
        {
        E.D.addLog("EAI: state 2 enter",E.debugLevel);
            state++;
            aiPlayer.setIntData(dattackerKey+"STATE", state);
            aiPlayer.setIntData(dattackerKey, 0);
        E.D.addLog("EAI: state 2 ends",E.debugLevel);
        }

        // attacker declaration
        if (state == 3)
        {
            E.D.addLog("EAI: state 3 enter",E.debugLevel);
            int loop = aiPlayer.getIntData(dattackerKey);
            if (loop != attackerList.size())
            {
                E.D.addLog("EAI: entering loop, counter = "+loop+" from "+attackerList.size() ,E.debugLevel);

                Card card = attackerList.getCard(loop);
                E.D.addLog("EAI: attack with "+card,E.debugLevel);
                E.match.declareAttacker(E.player, card);

                loop++;
                aiPlayer.setIntData(dattackerKey, loop);
View Full Code Here

              {
                  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++;
View Full Code Here

        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())
            {
                E.match.untapCard(E.player,  card);
                E.D.addLog("EAI: untapping creature"+card,4);
            }
        }
View Full Code Here

TOP

Related Classes of csa.jportal.card.Card

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.