Package csa.jportal.ai.enhancedAI

Examples of csa.jportal.ai.enhancedAI.EAIAction


            {
                SingleFight singleFight = fights.elementAt(f);
                CardSim matchAttacker = match.getAttacker(singleFight.attacker);
                CardSimList blockers = singleFight.blocker;

                EAIAction target = EAIAction.createTargetAction(0, MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS, matchAttacker , -1);

                for (int b = 0; b < blockers.size(); b++)
                {
                    EAIAction block = EAIAction.createDeclareBlockerAction(no, blockers.getCard(b), target);
                    boolean success = match.executeAction(block, player,false);
                    no++;
                }
            }
        }
View Full Code Here


            // and at most one source!
            if (mCurrentMasterAction != null)
            {
                for (int i = 0; i < mCurrentMasterAction.targets.size(); i++)
                {
                    EAIAction target = mCurrentMasterAction.targets.elementAt(i);
                    if (target.isSource)
                    {
                        amount = target.getSCard().getNowPower();
                        break;
                    }
                }
            }
        }
View Full Code Here

            {
                if (currentAction != null)
                {
                    for (int i = 0; i < currentAction.targets.size(); i++)
                    {
                        EAIAction target = currentAction.targets.elementAt(i);
                        if (target.isSource)
                        {
                            list.addCard(target.getSCard());
                        }
                    }
                   
                }
               
View Full Code Here

        {
            // no checking done here!
            // we negate the last card on stack
            if (mStack.size()>=2)
            {
                EAIAction removed = mStack.elementAt(mStack.size()-2);
                CardSim rCard = removed.getSCard();
                int owner = rCard.owner;

                if (removed.type == EAIAction.ACTION_PLAY_CARD)
                {
                    mHand[owner].remove(rCard);
View Full Code Here

        {
            // no checking done here!
            // we negate the last card on stack
            if (mStack.size()>=2)
            {
                EAIAction removed = mStack.elementAt(mStack.size()-2);
                CardSim rCard = removed.getSCard();
                int owner = rCard.owner;

                if (removed.type == EAIAction.ACTION_PLAY_CARD)
                {
                    mHand[owner].remove(rCard);
View Full Code Here

//        if (card==null)
//            System.out.println("Buh");
       
        for (int i = 0; i < action.manaPayment.size(); i++)
        {
            EAIAction manaSource = action.manaPayment.elementAt(i);
            executeAction(manaSource, player, false);
        }
        if (manaOnly) return true;

        if (card.getCard().getId().equals("4262"))
             System.out.println("Buh");


        if (action.getCard().hasType("Legendary Creature"))
        {
            csa.jportal.config.Configuration C = csa.jportal.config.Configuration.getConfiguration();
            boolean legandaryRuling = C.isLegendaryRuling();
            if (legandaryRuling)
            {
                int opponent = (player +1)%2;
               

                CardSimList myField = getBattlefield(player);
    CardSim otherCard = myField.getCardID(card.getId());
                boolean foundOne = false;

    while (otherCard != null)
    {
                    creatureToGrave(otherCard);
                    foundOne = true;
                    myField = getBattlefield(player);
                    otherCard = myField.getCardID(card.getId());
    }

    CardSimList otherField = getBattlefield(opponent);
    otherCard = otherField.getCardID(card.getId());
    while (otherCard != null)
    {
                    creatureToGrave(otherCard);
                    foundOne = true;
                    otherField = getBattlefield(opponent);
                    otherCard = otherField.getCardID(card.getId());
    }

    if (foundOne)
    {
                    // remove card - and dont play it out!
                    mHand[player].moveCardTo(card, mGraveyard[player]);
                    checkTriggerMoveToGrave(card);

                    // return true
                    // so EAI has a chance to evaulate this
                    // and possibly kill an opponents legendary

                    return true;
    }
            }
        }

        currentAction = action;
        if (isSourceEmpty(action))
        {
            doSourceCardEffect(HintAll.HINT_SITUATION_CARD_PLAYED, card, null, player);
        }
        for (int i = 0; i < action.targets.size(); i++)
        {
            EAIAction target = action.targets.elementAt(i);
            if (target.isSource)
                doSourceCardEffect(HintAll.HINT_SITUATION_CARD_PLAYED, card, target, player);
        }
        if (isTargetEmpty(action))
        {
             doTargetCardEffect(HintAll.HINT_SITUATION_CARD_PLAYED, card, null, player);
        }
        for (int i = 0; i < action.targets.size(); i++)
        {
            EAIAction target = action.targets.elementAt(i);
            if (!target.isSource)
                doTargetCardEffect(HintAll.HINT_SITUATION_CARD_PLAYED, card, target, player);
        }

        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(action.getCard());
View Full Code Here

    boolean isSourceEmpty(EAIAction action)
    {
        for (int i = 0; i < action.targets.size(); i++)
        {
            EAIAction target = action.targets.elementAt(i);
            if (target.isSource) return false;
        }
        return true;
    }
View Full Code Here

    }
    boolean isTargetEmpty(EAIAction action)
    {
        for (int i = 0; i < action.targets.size(); i++)
        {
            EAIAction target = action.targets.elementAt(i);
            if (target.isTarget) return false;
        }
        return true;
    }
View Full Code Here

        {
            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)
                        doSourceCardEffect(HintAll.HINT_SITUATION_ATTACKER, attacker, target, player);
                    else
                        doTargetCardEffect(HintAll.HINT_SITUATION_ATTACKER, attacker, target, player);
                }
View Full Code Here

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

TOP

Related Classes of csa.jportal.ai.enhancedAI.EAIAction

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.