Examples of AIHint


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

    {
        AICardHints hints = new AICardHints(card);
        boolean ret = false;
        for (int i = 0; i < varName.length; i++)
        {
            AIHint hint = hints.getHintbyVarname(varName[i]);
            ret = (hint != null);
            if (ret) break;
        }
        return ret;
    }
View Full Code Here

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

    {
        AICardHints hints = new AICardHints(card);
        boolean ret = false;
        for (int i = 0; i < varName.length; i++)
        {
            AIHint hint = hints.getHintbyVarname(varName[i]);
            ret = ((hint != null) && (hint.getBoolean()));
            if (ret) break;
        }
        return ret;
    }
View Full Code Here

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

        Logable D = Configuration.getConfiguration().getDebugEntity();
        int debugLevel = 3;
        boolean ret = true;
        if (l.size()==0) return false;

        AIHint hint = hints.getHintbyVarname("CARD_TYPES_NEEDED");
        if (hint != null) l=l.onlyWithTypes(hint.getString());
        if (l.size()==0) return false;

        hint = hints.getHintbyVarname("CARD_ABILITIES_NEEDED");
        if (hint != null) l=l.onlyWithAbility(hint.getString());
        if (l.size()==0) return false;

        hint = hints.getHintbyVarname("CARD_COLORS_NEEDED");
        if (hint != null) l=l.onlyWithColors(hint.getString());
        if (l.size()==0) return false;

        hint = hints.getHintbyVarname("CARD_SUBCARD_TYPES_NEEDED");
        if (hint != null) l=l.onlyWithSubtypes(hint.getString());
        if (l.size()==0) return false;

              // last!
        hint = hints.getHintbyVarname("CARD_MIN_NEED");
        if (hint != null)
            if (l.size()<hint.getInteger()) return false;

        D.addLog("CheckList passed checks: " + l,debugLevel);
        return ret;
    }
View Full Code Here

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

        int debugLevel = 3;
        MatchComputerPlayer player = (MatchComputerPlayer)p;

        boolean ret = true;
        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname("HINT_TARGET");
        if (hint != null)
        {
            if (!(hint.getString().equals("TAP"))) return true;
        }

        CardList grave = match.getGraveyard(p);
        CardList creature = match.getBattlefield(p).getSubListByType("Creature");
        CardList land = match.getLand(p);
        CardList hand = match.getHand(p);
        CardList attacker = match.getAttackerList();
        CardList opponentCreature = match.getBattlefieldOpponent(p).getSubListByType("Creature");
        CardList opponentLand = match.getLandOpponent(p);
        CardList opponentHand = match.getHandOpponent(p);

        Vector ands = new Vector ();

        // NEED are and booleans!
        hint = hints.getHintbyVarname("PLAYER_CREATURE_GRAVE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(grave.getSubListByType("Creature"), hints));

        hint = hints.getHintbyVarname("PLAYER_GRAVE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(grave.size()>0);


        hint = hints.getHintbyVarname("PLAYER_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
            ands.add(checkList(creature, hints));
            if (!(AIHelper.hasBoolHint(card, "MAINPHASE2_NEEDED")))
                ands.add(checkListCreaturesCombatEnabled(creature));
        }

        hint = hints.getHintbyVarname("PLAYER_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(land, hints));

        hint = hints.getHintbyVarname("PLAYER_HAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(hand, hints));

        hint = hints.getHintbyVarname("PLAYER_HAND_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(hand, hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_HAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
            boolean helper = checkList(hand.getSubListByType("Creature"), hints);
            ands.add(helper);
            hint = hints.getHintbyVarname("CARD_SELF_OK");
            if (((hint != null) && (!hint.getBoolean())))
            {
                ands.add(hand.getSubListByType("Creature").size() != 1);
            }
        }

        hint = hints.getHintbyVarname("OPPONENT_ATTACKER_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(attacker, hints));

        hint = hints.getHintbyVarname("OPPONENT_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature, hints));

        hint = hints.getHintbyVarname("OPPONENT_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentLand, hints));

        hint = hints.getHintbyVarname("OPPONENT_HAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentHand, hints));

        hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentLand.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_TAPPED_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(creature.getSubListTapState(true), hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_UNTAPPED_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(creature.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("OPPONENT_TAPPED_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature.getSubListTapState(true), hints));

        hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("MAINPHASE2_NEEDED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add( match.getPhase() == match.PHASE_MAIN2 );

        for (int i = 0; i < ands.size(); i++)
        {
            Boolean boolean1 = (Boolean) ands.elementAt(i);
            ret = ret && boolean1;
        }

        if (!ret) return ret;

        hint = hints.getHintbyVarname("PLAYER_CREATURE_ATTACKER_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
                CardList myCreatures = match.getBattlefield(player).getSubListByType("Creature");
                //to ignore! CAN_BE_TAPPED_INSTEAD_ATTACK
                myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_ATTACK");
                CardList attackerList;
View Full Code Here

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

        D.addLog("AI: getInstantsForMain()!",debugLevel);

        CardList ret = new CardList();
        Vector v = cards.getCards();
        AICardHints hints;
        AIHint hint;
        D.addLog("AI: Examining "+cards.size()+" cards.",debugLevel);
        for (int i = 0; i < v.size(); i++)
        {
            Card card = (Card) v.elementAt(i);
            D.addLog("AI: Examining card: "+card,debugLevel);
            hints = new AICardHints(card);
            hint = hints.getHintbyVarname("INSTANT_WHEN_OPPONENT_SORCERY_PLAYED");
            if ((hint != null) && (hint.getBoolean()))
            {
                D.addLog("AI: hint: INSTANT_WHEN_OPPONENT_SORCERY_PLAYED found!",debugLevel);
                ret.addCard(card);
                continue;
            }

            hint = hints.getHintbyVarname("INSTANT_WHEN_OPPONENT_CREATURE_PLAYED");
            if ((hint != null) && (hint.getBoolean()))
            {
                D.addLog("AI: hint: INSTANT_WHEN_OPPONENT_CREATURE_PLAYED found!",debugLevel);
                ret.addCard(card);
                continue;
            }
View Full Code Here

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

        D.addLog("AI: getInstantsForAttackers()!",debugLevel);
        CardList ret = new CardList();
        Vector v = cards.getCards();
        AICardHints hints;
        AIHint hint;
        D.addLog("AI: Examining "+cards.size()+" cards.",debugLevel);
        for (int i = 0; i < v.size(); i++)
        {
            Card card = (Card) v.elementAt(i);
            D.addLog("AI: Examining card: "+card,debugLevel);
            hints = new AICardHints(card);
            hint = hints.getHintbyVarname("INSTANT_WHEN_ATTACKING");
            if ((hint != null) && (hint.getBoolean()))
            {
                D.addLog("AI: hint: INSTANT_WHEN_ATTACKING found: "+card,debugLevel);
                ret.addCard(card);
                continue;
            }
View Full Code Here

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

        Logable D = Configuration.getConfiguration().getDebugEntity();
        int debugLevel = 3;
        MatchComputerPlayer player = (MatchComputerPlayer)p;

        AICardHints hints = new AICardHints(card);
        AIHint hint = hints.getHintbyVarname("HINT_TARGET");
        if (hint != null)
        {
            if (hint.getString().equals("TAP")) return true;
        }
        if (hint != null)
        {
            if (hint.getString().equals("ATTACK")) return true;
        }
        if (hint != null)
        {
            if (hint.getString().equals("LIBRARY")) return true;
        }

        CardList grave = match.getGraveyard(p);
        CardList creature = match.getBattlefield(p).getSubListByType("Creature");
        CardList land = match.getLand(p);
        CardList hand = match.getHand(p);
        CardList attacker = match.getAttackerList();
        CardList opponentCreature = match.getBattlefieldOpponent(p).getSubListByType("Creature");
        CardList opponentLand = match.getLandOpponent(p);
        CardList opponentHand = match.getHandOpponent(p);

        Vector ands = new Vector ();

        // NEED are and booleans!
        hint = hints.getHintbyVarname("PLAYER_CREATURE_GRAVE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(grave.getSubListByType("Creature"), hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
            ands.add(checkList(creature, hints));
            if (!(AIHelper.hasBoolHint(card, "MAINPHASE2_NEEDED")))
                    ands.add(checkListCreaturesCombatEnabled(creature));
        }

        hint = hints.getHintbyVarname("PLAYER_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(land, hints));

        hint = hints.getHintbyVarname("PLAYER_HAND_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(hand, hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_HAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
            boolean helper = checkList(hand.getSubListByType("Creature"), hints);
            ands.add(helper);
            hint = hints.getHintbyVarname("CARD_SELF_OK");
            if (((hint != null) && (!hint.getBoolean())))
            {
                ands.add(hand.getSubListByType("Creature").size() != 1);
            }
        }

        hint = hints.getHintbyVarname("OPPONENT_ATTACKER_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(attacker, hints));

        hint = hints.getHintbyVarname("OPPONENT_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature, hints));

        hint = hints.getHintbyVarname("OPPONENT_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentLand, hints));

        hint = hints.getHintbyVarname("OPPONENT_HAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentHand, hints));

        hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_LAND_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentLand.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_TAPPED_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(creature.getSubListTapState(true), hints));

        hint = hints.getHintbyVarname("PLAYER_CREATURE_UNTAPPED_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(creature.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("OPPONENT_TAPPED_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature.getSubListTapState(true), hints));

        hint = hints.getHintbyVarname("OPPONENT_UNTAPPED_CREATURE_NEED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add(checkList(opponentCreature.getSubListTapState(false), hints));

        hint = hints.getHintbyVarname("MAINPHASE2_NEEDED");
        if (((hint != null) && (hint.getBoolean())))
            ands.add( match.getPhase() == match.PHASE_MAIN2 );

        hint = hints.getHintbyVarname("OPPONENT_HIGHER_HEALTH_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
          boolean ok = false;
          int myLife = match.getLife(p);
          int opLife = match.getLifeOpponent(p);
          if (myLife < opLife)
          {
            ok = true;
            hint = hints.getHintbyVarname("COUNT");
            if (hint != null)
            {
              int dif = opLife - myLife;
              int count = AIHelper.getHintInt(card, "COUNT");
              if (dif > count) ok = false;
            }
          }

          ands.add( ok );
        }


        if (card.isCreature())
        {
            hint = hints.getHintbyVarname("CARD_ONLY_ONE");
            if (((hint != null) && (hint.getBoolean())))
            {
                ands.add( !creature.isInListID(card) );
            }
        }

        for (int i = 0; i < ands.size(); i++)
        {
            Boolean boolean1 = (Boolean) ands.elementAt(i);
            ret = ret && boolean1;
        }

        if (!ret) return ret;

        ret = !checkDeath(card, match, player);
        if (!ret) return ret;

        hint = hints.getHintbyVarname("PLAYER_CREATURE_ATTACKER_NEED");
        if (((hint != null) && (hint.getBoolean())))
        {
                CardList myCreatures = match.getBattlefield(player).getSubListByType("Creature");
                //to ignore! CAN_BE_TAPPED_INSTEAD_ATTACK
                myCreatures = AIHelper.removeWithHint(myCreatures, "CAN_BE_TAPPED_INSTEAD_ATTACK");
                CardList attackerList;
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.