Examples of AIEnhancedCardHints


Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

            System.out.println("Buh!");
        if (hintKey.equals(HintAll.HINT_SITUATION_CARD_PLAYED))
            if (source.isInstant())
                hintKey = HintAll.HINT_SITUATION_INSTANT;
       
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(source);
        int amount = hints.getHintValueInt(hintKey, CS_AMOUNT_COUNT);

        if (target == null) // effect on "all"
        {
            if (hints.hasAnyHint(hintKey, new HintBundle(SY_LIFE_EXCHANGE)))
            {
                int i = life[0];
                life[0] = life[1];
                life[1] = i;
            }

            else if(hints.hasAnyHint(hintKey, new HintBundle(SY_AURA)))
            {
                CardSimList effectedList = getSourceEffectedList(hintKey, source, player, hints);
                for (int i=0; i< effectedList.size(); i++)
                {
                    CardSim tCard = effectedList.getCard(i);
                    tCard = allCards.get(tCard.getCard().getUniqueID());
                    int tPlayer = tCard.owner;
//                    if (mBattlefield[0].isInList(tCard)) tPlayer = 0;
                    doSourceEffectOnOneCard(tCard, tPlayer, hintKey, hints, player, source);
                }
            }
            else if(hints.hasAnyHint(hintKey, new HintBundle(CS_ALL_CARDS)))
            {
                CardSimList effectedList = getSourceEffectedList(hintKey, source, player, hints);

                for (int i=0; i< effectedList.size(); i++)
                {
                    CardSim tCard = effectedList.getCard(i);
                    tCard = allCards.get(tCard.getCard().getUniqueID());
                    int tPlayer = tCard.owner;
//                    if (mBattlefield[0].isInList(tCard)) tPlayer = 0;

                    doSourceEffectOnOneCard(tCard, tPlayer, hintKey, hints, player, source);
                }
            }
            else if(hints.hasAnyHint(hintKey, new HintBundle(CS_ALL_PLAYERS)))
            {
                if (hints.hasAnyHint(hintKey, new HintBundle(S_IS_PLAYER)))
                {
                    doSourceEffectOnPlayer(player, hintKey, hints, source);
                }
                if (hints.hasAnyHint(hintKey, new HintBundle(S_IS_OPPONENT)))
                {
                    if (player == 0)
                        doSourceEffectOnPlayer(1, hintKey, hints, source);
                    else
                        doSourceEffectOnPlayer(0, hintKey, hints, source);
                }
            }
            else if(hints.hasAnyHint(hintKey, new HintBundle(S_IS_PLAYER)))
            {
                doSourceEffectOnPlayer(player, hintKey, hints, source);
            }
            else if(hints.hasAnyHint(hintKey, new HintBundle(S_IS_OPPONENT)))
            {
                if (player == 0)
                    doSourceEffectOnPlayer(1, hintKey, hints, source);
                else
                    doSourceEffectOnPlayer(0, hintKey, hints, source);
            }
            else if(hints.hasAnyHint(hintKey, new HintBundle(SY_INHERENT)))
            {
                doSourceEffectInherent(player, hintKey, hints, source);
            }
        }
        else if((target.getSCard() == null) && (target.targetPlayerNumber >= 0))
        {
                // target is a player
            doSourceEffectOnPlayer(target.targetPlayerNumber, hintKey, hints, source);
            if (hints.hasAnyHint(hintKey, new HintBundle(SY_LIFE_EXCHANGE)))
            {
                int i = life[0];
                life[0] = life[1];
                life[1] = i;
            }
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

            EAIAction target = action.targets.elementAt(i);
            if (!target.isSource)
                doTargetCardEffect(HintAll.HINT_SITUATION_CARD_PLAYED, card, target, player);
        }

        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(action.getCard());
       
        // e.g.: Burning of Xinye
        if (hints.hasAllHint(HintAll.HINT_SITUATION_CARD_PLAYED, new HintBundle(CT_COUNT_EACH_PLAYER, TY_TARGETS_CHOSEN_BY_OWNER)))
        {
            // than in addition to the above handled manual targets
            // the opponent player also has to chose his targets
            // and all effects must be applied to them
            CardSimList allPossibleOpponentCards = getTargetEffectedList(HintAll.HINT_SITUATION_CARD_PLAYED, card, (player+1)%2, hints, null);
            int count = hints.getHintValueInt(HintAll.HINT_SITUATION_CARD_PLAYED, CT_TARGET_COUNT);
           
            // smallest first
            allPossibleOpponentCards.sortListByCost();
           
            // assuming card effect is negative -> therfor effect card from smallest
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

    {
        CardSimList field =mBattlefield[player].copyList();
        for (int i=field.size()-1; i >= 0; i--)
        {
            CardSim card = field.getCard(i);
            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
            if (!hints.hasAnyHint(new HintBundle(TY_AURA)))
            {
                field.remove(i);
            }
        }
        return field;
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

    {
        CardSimList auras =getPlayerAuras(player);
        for (int i=auras.size()-1; i >= 0; i--)
        {
            CardSim card = auras.getCard(i);
            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
            if (!hints.hasAnyHint(bundle))
            {
                auras.remove(i);
            }
        }
        return auras;
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

        attacker.setAttacker(true);
        if (!attacker.hasAbility("Vigilance"))
            attacker.setTapped(true);
        mAttacker.addCard(attacker);

        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(attacker);
        if (hints == null)
            return;

        if (hints.hasKey(HintAll.HINT_SITUATION_ATTACKER))
        {
            if (!hints.hasHint(HintAll.HINT_SITUATION_ATTACKER, HintAll.O_WHEN_COMBAT_RESOLVING))
            {
                for (int i = 0; i < action.targets.size(); i++)
                {
                    EAIAction target = action.targets.elementAt(i);
                    if (target.isSource)
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

        attacker.setAttacker(true);
        attacker.blockers.addCard(blocker);


        // blocker
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(blocker);
        if (hints == null)
            return;

        boolean noSource = true;
        boolean noTarget = true;
        if (hints.hasKey(HintAll.HINT_SITUATION_BLOCKER))
        {
            if (!hints.hasHint(HintAll.HINT_SITUATION_BLOCKER, HintAll.O_WHEN_COMBAT_RESOLVING))
            {
                for (int i = 0; i < action.targets.size(); i++)
                {
                    EAIAction target = action.targets.elementAt(i);
                   
                    if (target.isFinished()) continue;
                   
                    if (target.isSource)
                    {
                        doSourceCardEffect(HintAll.HINT_SITUATION_BLOCKER, blocker, target, player);
                        noSource = false;
                    }
                    else
                    {
                        doTargetCardEffect(HintAll.HINT_SITUATION_BLOCKER, blocker, target, player);
                        noTarget = false;
                    }
                }
                if (noSource)
                {
                    doSourceCardEffect(HintAll.HINT_SITUATION_BLOCKER, blocker, null, player);
                }
                if (noTarget)
                {
                    doTargetCardEffect(HintAll.HINT_SITUATION_BLOCKER, blocker, null, player);
                }
            }
        }

        // blocked
        hints = AIEnhancedCardHints.getHints(attacker);
        if (hints == null)
            return;

        if (hints.hasKey(HintAll.HINT_SITUATION_BLOCKED))
        {
            // there are hints that get only evaluated DURING combat (Sylvan Basilisk e.g.)
            if (!hints.hasHint(HintAll.HINT_SITUATION_BLOCKED, HintAll.O_WHEN_IN_COMBAT))
            {
                doTargetCardEffect(HintAll.HINT_SITUATION_BLOCKED, attacker, null, player);
                doSourceCardEffect(HintAll.HINT_SITUATION_BLOCKED, attacker, null, player);
            }
        }
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

        {
            CardSim scard = action.targets.elementAt(i).getSCard();
            boolean this_ret = ensureActionVMatchCards(action.targets.elementAt(i), player);
            if (!this_ret)
            {
                AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(action.getSCard());

                action.targets.elementAt(i).setSCard(scard);
                // should be no TARGETS, but only Auras
                if (hints.hasAnyHint(new HintBundle(TY_OPENS_PLAYER_LIBRARY, TY_OPENS_OPPONENTS_LIBRARY, SY_OPENS_PLAYER_LIBRARY, SY_OPENS_OPPONENTS_LIBRARY)))
                {
                    initLibrary();
                }
                this_ret = ensureActionVMatchCards(action.targets.elementAt(i), player);
                if (!this_ret)
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

            for (int a=0; a<mAttacker.size(); a++)
            {
                CardSim attacker = mAttacker.getCard(a);
               
                AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);

                // should be no TARGETS, but only Auras
                if (aHints.hasHint(HintAll.HINT_SITUATION_ATTACKER, HintAll.O_WHEN_COMBAT_RESOLVING))
                {
                    doTargetCardEffect(HintAll.HINT_SITUATION_ATTACKER, attacker, null, attacker.owner);
                    doSourceCardEffect(HintAll.HINT_SITUATION_ATTACKER, attacker, null, attacker.owner);
                }
            }
           
           
            for (int a=0; a<mAttacker.size(); a++)
            {
                // only currently known hints supported!
                CardSim attacker = mAttacker.getCard(a);

                AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);
                CardSimList blocker = getBlocker(attacker);
                String key = HintAll.HINT_SITUATION_ATTACKER;
                if (blocker.size() == 0)
                {
                    if (aHints.hasHint(key, HintOccurrence.O_WHEN_NOT_BLOCKED))
                    {
                        if (aHints.hasHint(key, HintTargetTypes.TY_HAND_TO_GRAVE))
                        {
                            int amount = aHints.getHintValueInt(key, HintTargetCount.CT_TARGET_COUNT);
                            if (amount == 0)
                                if (aHints.hasHint(key, HintTargetCount.CT_SINGLE)) amount = 1;
                            if (mHand[blockingPlayer].size() != 0)
                            {
                                mHand[blockingPlayer].remove(0);
                            }
                        }
                       
                        if (aHints.hasHint(key, HintTargetTypes.TY_DAMAGE_AS_BLOCKED))
                        {
// CSA TODO Cunning Giant...
                            VirtualMatch vMatch = new VirtualMatch(this);
                            int damageToDo = attacker.getNowPower();
                            vMatch.getAttacker().remove(attacker);
                            vMatch.getAttacker().removeListDirect(attackersDone);

                            vMatch.doCombat(attacker.getOwner());
                            Object target = EAIPlanTree.getBestDamageTarget(vMatch, damageToDo, attacker.getOwner(), null);
                           
                            if (target != null)
                            {
                                if (target instanceof Integer)
                                {
                                    // player
                                    // do nothing, since this is the natural course of things
                                }
                                if (target instanceof CardSim)
                                {
                                    // card
                                    CardSim t = (CardSim) target;
                                    t = allCards.get(t.getCard().getUniqueID());
                                    int tough = t.getNowToughness();
                                    tough -= damageToDo;
                                    if (tough <= 0)
                                        tough = 0;
                                    t.setNowToughness(tough);
                                    combatResult.power.put(t.toUString(), t.getNowPower());
                                    combatResult.toughness.put(t.toUString(), t.getNowToughness());
                                    combatResult.noCache=true;
                                    if (t.getNowToughness() == 0)
                                    {
                                        combatResult.blockerToRemove.addCard(t);
                                    }
                                   
                                   
                                   
                                }
                            }
                        }
                    }
                }
                if (mAttacker.size() == 1)
                {
                    if (aHints.hasHint(key, HintTargetTypes.TY_NOT_BLOCKABLE_IF_SINGLE_ATTACKER))
                    {
                        attacker.addAbility("Unblockable");
                    }
                }
                if (aHints.hasHint(key, HintTargetTypes.TY_ONE_ONLY_BLOCCK))
                {
                    while (blocker.size() > 1)
                    {
                        CardSim toRemoveBlocker = blocker.getCard(blocker.size()-1);
                        blocker.remove(blocker.size()-1);
                       
                       
                        // must be done, so that combat cashing
                        // finds this entry...
                        combatResult.power.put(toRemoveBlocker.toUString(), toRemoveBlocker.getNowPower());
                        combatResult.toughness.put(toRemoveBlocker.toUString(), toRemoveBlocker.getNowToughness());
                   }
                }

                if (aHints.hasHint(key, HintTargetTypes.TY_ALL_BLOCK_ONE))
                {

// TODO ALLURING IN DOCOMBAT
                    // ALLURING, 6639, P2
                    // All creatures able to block target creature this turn do so.
                    // todo
                    // put all blockers to test if they
                    // can block the attacker
                    // if so - switch to block it

                }

                SingleFight sFight = SingleFight.getFight(attacker, blocker, configTMP, false);

                if (blocker.size() > 0)
                {
                    key = HintAll.HINT_SITUATION_ATTACKER;
                    if (aHints.hasHint(key, HintTargetTypes.TY_DAMAGE_AS_NON_BLOCKED))
                    {
                        // other daMAGE is a approximasation!
                        int otherDamage = combatResult.lifeAdjustment;

                        for (int oa=a+1; oa<mAttacker.size();oa++)
                        {
                            CardSim at1 = mAttacker.getCard(oa);
                            CardSimList blo1 = getBlocker(at1);
                            if (blo1.size() == 0)
                            {
                                otherDamage+=at1.getNowPower();
                            }
                        }
                       
                        boolean damagePlayer =  EAIPlanTree.doRatherPlayerDamage(this, sFight, attacker.getOwner(), otherDamage);
                        sFight.attackerDamageToPlayer = damagePlayer;
                    }
                }
               
               
                sFight.simAttack(true);

                for(int b=0; b<blocker.size(); b++)
                {
                    CardSim bl = blocker.getCard(b);
                    if (bl.getNowToughness() == 0)
                    {
                        combatResult.blockerToRemove.addCard(bl);
                    }
                }

                if (attacker.getNowToughness() == 0)
                {
                    combatResult.attackerToRemove.addCard(attacker);
                }
               
                combatResult.lifeAdjustment += sFight.playerDamage;
                attackersDone.addCard(attacker);
            }

            for (int a=0; a<mAttacker.size(); a++)
            {
                CardSim at = mAttacker.getCard(a);
                combatResult.power.put(at.toUString(), at.getNowPower());
                combatResult.toughness.put(at.toUString(), at.getNowToughness());
                for (int b=0; b<at.blockers.size(); b++)
                {
                    CardSim bl = at.blockers.getCard(b);
                    combatResult.power.put(bl.toUString(), bl.getNowPower());
                    combatResult.toughness.put(bl.toUString(), bl.getNowToughness());
                }
            }
           
            // noCahe means, as of yet the result is not well cacheable (e.g. Cunning Giant)
            if (!combatResult.noCache)
                mCombatMap.put(combatKey, combatResult);
            cacheNotHit++;
        }
        else
        {
            for (int a=0; a<mAttacker.size(); a++)
            {
                CardSim at = mAttacker.getCard(a);

                at.setNowPower(combatResult.power.get(at.toUString()));
                at.setNowToughness(combatResult.toughness.get(at.toUString()));

                for (int b=0; b<at.blockers.size(); b++)
                {
                    CardSim bl = at.blockers.getCard(b);
                    bl.setNowPower(combatResult.power.get(bl.toUString()));
                    bl.setNowToughness(combatResult.toughness.get(bl.toUString()));
                }
               
                AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(at);

                // e.g. hunting cheetah
                if (at.blockers.size() == 0)
                {
                    if (aHints.hasHint(HintAll.HINT_SITUATION_ATTACKER, HintDefinition.O_WHEN_PLAYER_DAMAGE_DEALT))
                    {
                        if (combatResult.power.get(at.toUString()) >0)
                        {

                           
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

        // tests for abilities must be made with card from THIS match - if ability was
        // added during vmatch life -> drudget skelettons - Regenerate!
       
        card = allCards.get(card.getCard().getUniqueID());
       
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
        if ((card.hasAbility("Regenerate")) && (!card.hasAbility("NoRevival")))
        {
            // assuming card is on battlefield
            card.setNowToughness(card.getCard().getRealToughness());
            card.setTapped(true);
        }
        // only targets looked at rightnow! Undying beast
        else if(EAIHelper.hasHint(card.getCard(), key, new HintBundle(HintAll.TY_LIBRARY_TOP)))
        {
            mBattlefield[card.owner].moveCardTo(card, mLibrary[card.owner]);
        }
        else if(EAIHelper.hasHint(card.getCard(), key, new HintBundle(HintAll.TY_LIBRARY_SHUFFLE)))
        {
            // not shuffled - just moved to lib... Alabaster Angel
            mBattlefield[card.owner].moveCardTo(card, mLibrary[card.owner]);
            libShuffled = true;
        }
        else if (hints.hasKey(key))
        {
            // do what is told on death.... / Noxious toad... e.g.
            //TOD noxious toad test with list 1
            doSourceCardEffect(key, card, null, card.owner);
            doTargetCardEffect(key, card, null, card.owner);
View Full Code Here

Examples of csa.jportal.ai.enhancedAI.enhancedHints.AIEnhancedCardHints

        {
            for (int i=0; i<mTrigger[triggerOwner].size(); i++)
            {
                CardSim triggerCard = mTrigger[triggerOwner].getCard(i);

                AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(triggerCard);
                String key = HintAll.HINT_SITUATION_TRIGGERED;

                // only supported Trigger as yet
                if (hints.hasHint(key, O_WHEN_PUT_TO_GRAVEYARD))
                {
                    boolean triggerAllowed = false;
                    // step one -> payment neccessary?

                    // Only Mana as payment is evaluated as of yet
                    if (hints.hasHint(key, PR_PAYMENT_NEEDED))
                    {
                        // for now do not evaluate multiple coices upon triggers
                        // for now we assume if payment is possible ->
                        // payment will be done, and trigger will be taken
                        int manaCost = triggerCard.getCard().getInTextManaCost();
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.