Package csa.jportal.ai.standardAI.hints

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


        boolean ok = true;
        if (mOldHints.size() != 0)
        {
            for (int i = 0; i < mOldHints.size(); i++)
            {
                AIHint oHint = mOldHints.elementAt(i);
                error = false;
                Vector<AIEnhancedHint> nHints = convertFromOld(oHint, card);
                if (nHints.size() == 0)
                {
                    if (!oHint.mData.getHintName().equals("EFFECT_WHEN_PLAYED"))
View Full Code Here


                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())))
                {
                    if (!E.match.isFinalStackCall())
                    {
                        goodInstants.removeCard(instant);
                        continue;
View Full Code Here

        // 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);
                        }
                    }
                    target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
                    AIHelper.addToRS(target, c, E.match, E.player);
View Full Code Here

        // 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);
                        }
                    }
                    target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
View Full Code Here

        // 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);
                    }
                }
                target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
                AIHelper.addToRS(target, c, E.match, E.player);
View Full Code Here

        // 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);
                    }
                }
                target = AIHelper.getDamageTarget(targetList, damageAmount, myself,E.match, E.player);
                AIHelper.addToRS(target, c, E.match, E.player);
View Full Code Here

     * @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

     * @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

     * @return 0 if no hint was found, value of hint otherwise (which might also be 0)
     */
    public static int getHintInt(Card card, String varName)
    {
        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname(varName);
        if (hint == null) return 0;
        Integer i = hint.getInteger();
        if (i==null) i=0;
        return i;
    }
View Full Code Here

     * @return "" (empty string) if no hint was found, value of hint otherwise
     */
    public static String getHintString(Card card, String varName)
    {
        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname(varName);
        if (hint == null) return "";
        String s = hint.getString();
        if (s==null) s="";
        return s;
    }
View Full Code Here

TOP

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

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.