Package csa.jportal.ai.standardAI.hints

Examples of csa.jportal.ai.standardAI.hints.AICardHints


            while (goodInstants.size()>0)
            {
                Card instant = goodInstants.getCard(0);     // todo chose one!

                CardList attackers = E.match.getAttackerList();
                AICardHints hints = new AICardHints(instant);

                AIHint hint = hints.getHintbyVarname("EFFECT_PLAYER_CREATURE_UNTAP");
                E.D.addLog("EAI: Hint: " +hint,debugLevel);
                if (hint != null)
                    E.D.addLog("EAI: Hint.EFFECT_PLAYER_CREATURE_UNTAP: " +hint.getBoolean(),debugLevel);
                if (((hint != null) && (hint.getBoolean())))
                {
                    CardList ownCreatures = E.match.getBattlefield(E.player);
                    CardList tapped = ownCreatures.getSubListTapState(true);

                    if (tapped.size() == 0)
                    {
                        goodInstants.removeCard(instant);
                        continue;
                    }
                }

                hint = hints.getHintbyVarname("INSTANT_WHEN_ATTACKING_FINAL");
                E.D.addLog("EAI: Hint: " +hint,debugLevel);
                if (hint != null)
                    E.D.addLog("EAI: Hint.INSTANT_WHEN_ATTACKING_FINAL: " +hint.getBoolean(),debugLevel);
                if (((hint != null) && (hint.getBoolean())))
                {
View Full Code Here


        // a) my creatures
        // b) Opponent creatures
        // c) even a stack creature
        //#import "scripts\Allround\SorceryComboCast.java"

        AICardHints hints = new AICardHints(card);
        AIHint hint;

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

        //if (E.player == c.E.mInitiatorPlayer)
        {
          E.D.addLog("EAI: Asked from myself!",debugLevel);

            CardList targetList=null;
            Card target=null;
            CardList myCreatures = E.match.getBattlefield(E.player);
            myCreatures = AIHelper.removeRS(myCreatures, c, E.match, E.player);
            myCreatures=AIHelper.adjustListWithCardNeeds(myCreatures, card);

            CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
            opponentCreatures = AIHelper.removeRS(opponentCreatures, c, E.match, E.player);
            opponentCreatures=AIHelper.adjustListWithCardNeeds(opponentCreatures, card);

            CardList stack = E.match.getStackCardList();
            boolean myself = true;

            if (AIHelper.isDamageCard(card))
            {
                if (opponentCreatures.size()>0)
                {
                    targetList=opponentCreatures;

                    myself = false;
                }
                E.D.addLog("EAI: opponentCreatures.size():"+opponentCreatures.size(),debugLevel);
                E.D.addLog("EAI: myCreatures.size():"+myCreatures.size(),debugLevel);
                E.D.addLog("EAI: c.mIsMust:"+c.mIsMust,debugLevel);
                if ((targetList==null) && (myCreatures.size()>0))
                {
                  if (c.mIsMust)
                  {
                    targetList=myCreatures;
                  }
                }
                if ((targetList==null) && (stack.size()>0))
                {
                  if (c.mIsMust)
                      if (stack.getCard(0).isCreature())
                          targetList=stack;
                }
                if (targetList==null)
                {
                    c.E.mTargetCardTo = null;
                    c.setCardResult(null);
                    if (c.mIsMust)
                    {
                      c.setCancled(true);
                      c.setMaybeTaken(false);
                    }
                    else
                    {
                        c.setCancled(false);
                        c.setMaybeTaken(true);
                    }
                    c.setSuccessfull(false);
                    E.D.addLog("EAI: No creature (d)!",debugLevel);
                    // c.E.ev.iRet.bRet=false;
                    return;
                }
                E.D.addLog("EAI: TragetList:"+targetList,debugLevel);

                if (AIHelper.hasBoolHint(card, "EFFECT_ONE_CREATURE_DAMAGE"))
                {
                    int damageAmount = 0;
                    try
                    {
                        damageAmount = c.callerEv.amount;
                        // damageAmount = c.E.ev.amount;

                    }catch (Throwable e){}

                    if (damageAmount == 0)
                    {
                        hint = hints.getHintbyVarname("DAMAGE_AMOUNT");
                        if (hint != null)
                        {
                            damageAmount = hint.getInteger();
                            E.D.addLog("EAI: Hint.DAMAGE_AMOUNT: " + damageAmount,debugLevel);
                        }
View Full Code Here

        // a) my creatures
        // b) Opponent creatures
        // c) even a stack creature
        //#import "scripts\Allround\SorceryComboCast.java"

        AICardHints hints = new AICardHints(card);
        AIHint hint;

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

        if (E.player == c.E.mInitiatorPlayer)
        {
             E.D.addLog("EAI: Asked from myself!",debugLevel);

            CardList targetList=null;
            Card target=null;
            CardList opponentCreatures = E.match.getBattlefieldOpponent(E.player);
            opponentCreatures = AIHelper.removeRS(opponentCreatures, c, E.match, E.player);

            opponentCreatures=AIHelper.adjustListWithCardNeeds(opponentCreatures, card);
            boolean myself = true;

            if (AIHelper.isDamageCard(card))
            {
                if (opponentCreatures.size()>0)
                {
                    targetList=opponentCreatures;

                    myself = false;
                }
                E.D.addLog("EAI: opponentCreatures.size():"+opponentCreatures.size(),debugLevel);
                E.D.addLog("EAI: c.mIsMust:"+c.mIsMust,debugLevel);
                if (targetList==null)
                {
                    c.E.mTargetCardTo = null;
                    c.setCardResult(null);
                    if (c.mIsMust)
                    {
                      c.setCancled(true);
                      c.setMaybeTaken(false);
                    }
                    else
                    {
                        c.setCancled(false);
                        c.setMaybeTaken(true);
                    }
                    c.setSuccessfull(false);
                    E.D.addLog("EAI: No creature (d)!",debugLevel);
                    // c.E.ev.iRet.bRet=false;
                    return;
                }
                E.D.addLog("EAI: TragetList:"+targetList,debugLevel);

                if (AIHelper.hasBoolHint(card, "EFFECT_ONE_CREATURE_DAMAGE"))
                {
                    int damageAmount = 0;
                    try
                    {
                        damageAmount = c.callerEv.amount;
                    }catch (Throwable e){}

                    if (damageAmount == 0)
                    {
                        hint = hints.getHintbyVarname("DAMAGE_AMOUNT");
                        if (hint != null)
                        {
                            damageAmount = hint.getInteger();
                            E.D.addLog("EAI: Hint.DAMAGE_AMOUNT: " + damageAmount,debugLevel);
                        }
View Full Code Here

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

        // this can be from
        // a) my creatures
        Card card = c.E.mInitiatorCard;
        AICardHints hints = new AICardHints(card);
        AIHint hint;

        Card chosen = null;
        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.createCreaturePlayerCreature(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);
                    }
View Full Code Here

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

        // this can be from
        // a) my creatures
        Card card = c.E.mInitiatorCard;
        AICardHints hints = new AICardHints(card);
        AIHint hint;

        Card chosen = null;
        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);
                    }
View Full Code Here

        E.D.addLog("EAI: Enter com select E.player!",debugLevel);
        // this can be from
        // a) I myself
        // b) E.opponent
        Card card = c.E.mInitiatorCard;
        AICardHints hints = new AICardHints(card);
        Card chosen = null;
        E.D.addLog("EAI: Player:!" + E.player,debugLevel);
        E.D.addLog("EAI: InitiatorPlayer:!" + c.E.mInitiatorPlayer,debugLevel);

        // not done selecting E.player - well it is a simple AI :-)=
View Full Code Here

        };
        return model;
    }
    public Vector<csa.jportal.ai.standardAI.hints.AIHint> getHints(Card card)
    {
        AICardHints hints = new AICardHints(card);
        return hints.getHints();
    }
View Full Code Here

        setScriptingForCard();
        setAIHintsForCard();

        // AI Hints
        AICardHints otherHints = new AICardHints(otherCard);
        AICardHints myHints = new AICardHints(mCurrentCard);

        for (int i=0; i< otherHints.size();i++)
        {
            AIHintsData otherHint = otherHints.getHintByRow(i);
            AIHintsData aHint = AICardHints.buildNewHint(mCurrentCard);

            aHint.setHintComment(otherHint.getHintComment());
            aHint.setHintName(otherHint.getHintName());
            aHint.setHintValue(otherHint.getHintValue());
            aHint.setSituation(otherHint.getSituation());
            aHint.setHintVarName(otherHint.getHintVarName());
            aHint.setHintVarType(otherHint.getHintVarType());
            aHint.setIsTemplate(false);
            aHint.setCardID(mCurrentCard.getId());
            aHint.setCardSet(mCurrentCard.getSet());
            myHints.addHint(aHint);
        }
        myHints.save();
        setAIHintsForCard();


        // TODO EnhancedAI Hints
        AIEnhancedCardHints eotherHints = AIEnhancedCardHints.getHints(otherCard);
View Full Code Here

     * @param varName name of the hint
     * @return false if no such hint, false also if hint is available but false and true if hint is available and has the value true
     */
    public static boolean hasBoolHint(Card card, String varName)
    {
        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname(varName);
        return ((hint != null) && (hint.getBoolean()));
    }
View Full Code Here

     * @param varName name of the hint
     * @return false if no such hint, true if any hint was found with provided name
     */
    public static boolean hasHint(Card card, String varName)
    {
        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname(varName);
        return (hint != null);
    }
View Full Code Here

TOP

Related Classes of csa.jportal.ai.standardAI.hints.AICardHints

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.