Package csa.jportal.ai.enhancedAI.enhancedSim

Examples of csa.jportal.ai.enhancedAI.enhancedSim.CardSimList


        return ret;
    }

    public static CardSimList removeRestrictedCards(String key, CardSimList list, int phase, boolean ownTurn, VirtualMatch vMatch)
    {
        CardSimList ret = new CardSimList();
        for (int i = 0; i < list.size(); i++)
        {
            CardSim card = list.getCard(i);
            int player = card.getOwner();
            int opponent = (card.getOwner()+1)%2;
            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);

            if (hints.hasHintType(key, HintAll.HINT_TYPE_PLAY_RESTRICTION))
            {
                if (hints.hasHint(key, HintAll.PR_ONLY_WHEN_OPPONENT_MORE_LANDS))
                {
                    if (vMatch.getLand(player).size()>=vMatch.getLand(opponent).size())
                        continue;
                }
            }
            ret.addCard(card);
        }
        return ret;
    }
View Full Code Here


    }

    // regarding to phase
    public static CardSimList reduceActivationEvaluation(CardSimList list, int phase, boolean ownTurn, VirtualMatch vMatch)
    {
        CardSimList ret = new CardSimList();
        for (int i = 0; i < list.size(); i++)
        {
            CardSim card = list.getCard(i);
            boolean allowedNow = isAllowedToActivate(card, phase, ownTurn, vMatch);
            if (!allowedNow) continue;

            boolean recomendedNow = allowedNow;
            if (hasHint(card, HintAll.HINT_SITUATION_ACTIVATION, new HintBundle(PR_JIT_ACTIVATION)))
            {
                // if in stack we do not come here at all - so ignore stack checking
                // JIT means Just in Time
                // meaning here:
                // - only as stack reaction
                // - or in response to defining of blockers of opponent (after all blockers)
                // - or after opponent declares attacker (after all attackers)
                // - or while our own block declaration
              
                //
               
                // for now this leaves us to block / attack checking
                boolean goOn = false;
               
                // must do it... grml
                if ((vMatch.getStack() == null) || (vMatch.getStack().isEmpty()))
                {
                    if ((phase != MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS) && (phase != MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS))
                        continue;
                }
               
                if ((phase == MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS) && (!ownTurn))
                {
                    goOn = true;
                }
                if ((phase == MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS) /*&& (ownTurn)*/)
                {
                    goOn = true;
                }
                if (!goOn) continue;
            }
            else if ((allowedNow) && (ownTurn))
            {
                if (!((phase == MatchConstants.PHASE_MAIN1)|| (phase == MatchConstants.PHASE_MAIN2)))
                {
                    boolean allowedMain = isAllowedToActivate(card, MatchConstants.PHASE_MAIN1, ownTurn, vMatch);
                    allowedMain = allowedMain || isAllowedToActivate(card, MatchConstants.PHASE_MAIN2, ownTurn, vMatch);
                    if (allowedMain)
                        recomendedNow = false;
                }
            }
           

            if (recomendedNow)
                ret.addCard(card);
        }
        return ret;
    }
View Full Code Here

     */
    public ManaCollection getMaxAvailableMana(VirtualMatch vMatch)
    {
        ManaCollection mc = new ManaCollection();

        CardSimList lands = vMatch.getLand(E.pNumber);
        CardSimList field = vMatch.getBattlefield(E.pNumber);
        // todo cards that generate mana - played from hand

        for(int i=0; i < lands.size(); i++)
        {
            CardSim card = lands.getCard(i);
            if (card.isTapped()) continue;
            ManaItem mana = ManaItem.createManaItem(card);
            mc.addMana(mana);
        }

        for(int i=0; i < field.size(); i++)
        {
            CardSim card = field.getCard(i);

            String m = getManaGeneratingAbilityString(card.getCard());
            if (m.length() == 0) continue;
            if (card.isTapped()) continue;
            if (card.isSick()) continue;
View Full Code Here

    }
    public ManaCollection getMaxAvailableManaUnstated(VirtualMatch vMatch)
    {
        ManaCollection mc = new ManaCollection();

        CardSimList lands = vMatch.getLand(E.pNumber);
        CardSimList field = vMatch.getBattlefield(E.pNumber);
        // todo cards that generate mana - played from hand

        for(int i=0; i < lands.size(); i++)
        {
            CardSim card = lands.getCard(i);
            ManaItem mana = ManaItem.createManaItem(card);
            mc.addMana(mana);
        }

        for(int i=0; i < field.size(); i++)
        {
            CardSim card = field.getCard(i);

            String m = getManaGeneratingAbilityString(card.getCard());
            if (m.length() == 0) continue;

            ManaItem mana = ManaItem.createManaItem(m, card);
View Full Code Here

        }
        return mc;
    }
    public CardSimList getMaxAvailableManaLand(VirtualMatch vMatch)
    {
        CardSimList mc = new CardSimList();

        CardSimList lands = vMatch.getLand(E.pNumber);
        CardSimList field = vMatch.getBattlefield(E.pNumber);
        // todo cards that generate mana - played from hand

        for(int i=0; i < lands.size(); i++)
        {
            CardSim card = lands.getCard(i);
            if (card.isTapped()) continue;
            mc.addCard(card);
        }

        for(int i=0; i < field.size(); i++)
        {
            CardSim card = field.getCard(i);

            String m = getManaGeneratingAbilityString(card.getCard());
            if (m.length() == 0) continue;
            if (card.isTapped()) continue;
            if (card.isSick()) continue;
View Full Code Here

    public static ManaCollection getMaxAvailableMana(VirtualMatch vMatch, int player)
    {
        ManaCollection mc = new ManaCollection();

        CardSimList lands = vMatch.getLand(player);
        CardSimList field = vMatch.getBattlefield(player);
        // todo cards that generate mana - played from hand

        for(int i=0; i < lands.size(); i++)
        {
            CardSim card = lands.getCard(i);
            if (card.isTapped()) continue;
            ManaItem mana = ManaItem.createManaItem(card);
            mc.addMana(mana);
        }

        for(int i=0; i < field.size(); i++)
        {
            CardSim card = field.getCard(i);

            String m = getManaGeneratingAbilityString(card.getCard());
            if (m.length() == 0) continue;
            if (card.isTapped()) continue;
            if (card.isSick()) continue;
View Full Code Here

     * @param lands
     * @return list of lands which are playable
     */
    public static CardSimList onlyEnoughMana(CardSimList list, ManaCollection mana)
    {
        CardSimList ret = new CardSimList();
        for (int i=0; i < list.size();i++)
        {
            if (hasEnoughMana(list.getCard(i).getCard(), mana))
            {
                ret.addCard(list.getCard(i));
            }
        }
        return ret;
    }
View Full Code Here

        }
        return ret;
    }
    public static CardSimList onlyEnoughManaActivate(CardSimList list, ManaCollection mana)
    {
        CardSimList ret = new CardSimList();
        for (int i=0; i < list.size();i++)
        {
            if (hasEnoughManaActivate(list.getCard(i), mana))
            {
                ret.addCard(list.getCard(i));
            }
        }
        return ret;
    }
View Full Code Here

        return AIHelper.onlyEnoughManaGeneral(list, lands);
    }

    public static CardSimList onlyEnoughManaGeneral(CardSimList list, CardSimList lands)
    {
        CardSimList ret = new CardSimList();
        for (int i=0; i < list.size();i++)
        {
            if (hasEnoughManaGeneral(list.getCard(i), lands))
            {
                ret.addCard(list.getCard(i));
            }
        }
        return ret;
    }
View Full Code Here

        }
        return ret;
    }
    public static CardSimList onlyNotEnoughManaGeneral(CardSimList list, CardSimList lands)
    {
        CardSimList ret = new CardSimList();
        for (int i=0; i < list.size();i++)
        {
            if (!hasEnoughManaGeneral(list.getCard(i), lands))
            {
                ret.addCard(list.getCard(i));
            }
        }
        return ret;
    }
View Full Code Here

TOP

Related Classes of csa.jportal.ai.enhancedAI.enhancedSim.CardSimList

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.