Examples of AIEnhancedCardHints


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

            mBattlefield[owner].moveCardTo(matchCard, mGraveyard[owner]);
        }
    }
    public int getDamageAmount(CardSim card, String key, int player)
    {
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
        int amount = hints.getHintValueInt(key, CT_AMOUNT_COUNT);
        if (hints.hasHint(key, CT_HAS_MULTIPLYER))
            amount = getTargetMultiplyAmount(player, key, hints);
        if (hints.hasHint(key, CT_X_COUNT))
           amount = card.xMana;
        if (amount == 0)
        {
            amount = hints.getHintValueInt(key, CS_AMOUNT_COUNT);
            if (hints.hasHint(key, CS_HAS_MULTIPLYER))
                amount = getSourceMultiplyAmount(player, key, hints);
            if (hints.hasHint(key, CS_X_COUNT))
               amount = card.xMana;
        }
        if (hints.hasHint(key, TY_DIVIDE_AMOUNT)) // forked lightning
        {
            amount = hints.getHintValueInt(key, CT_MAX);
        }
        return amount;
    }
View Full Code Here

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

                action.setSCard(allCards.get(action.getSCard().getCard().getUniqueID()));
            }
            else
            {
                // test if triggered
                AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(item.card);
                if (hints.hasKey(HintAll.HINT_SITUATION_TRIGGERED))
                {
                    action = EAIAction.createTriggeredAction(i, mMatch.getPhase(), item.card, targets, null);
                    // ensure vMatch correct card
                    action.setSCard(allCards.get(action.getSCard().getCard().getUniqueID()));
                }
View Full Code Here

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

        // to our blocker formation, which is now complete and can be returned as one
        // complete formation, the "returning" is done by adding it to "all" and returning it.

        CardSim a1 = attackersRest.getCard(0);
        boolean oneOnly = false;
        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(a1);
        String key = "ATTACKING";
        if (aHints.hasHint(key, HintTargetTypes.TY_ONE_ONLY_BLOCCK)) oneOnly= true;


        attackersRest.remove(a1);
        Vector <CardSimList> allBlockerGroups;
View Full Code Here

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

                                }
                            }
                        }
                       
       
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(initiator);

                       
                       
                       
                        String key = HintAll.HINT_SITUATION_BLOCKED;
                        if (aHints.hasHint(key, HintOccurrence.O_WHEN_BLOCKED))
                        {
                            if (aHints.hasHint(key, HintTargetTypes.TY_DAMAGE_AS_NON_BLOCKED))
                            {
                               
                                VirtualMatch vMatch = new VirtualMatch(c.E.mInitiatorMatch);
                                int damageToDo = initiator.getNowPower();
                               
View Full Code Here

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

        if (c.E != null)
        {
            if (c.E.mInitiatorCard != null)
            {
                CardSim initiator = new CardSim(c.E.mInitiatorCard, c.E.mInitiatorMatch.getIntOwner(c.E.mInitiatorCard));
                AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(initiator);
               
                String key = HintAll.HINT_SITUATION_ATTACKER;
                if (aHints.hasHint(key, HintOccurrence.O_WHEN_NOT_BLOCKED))
                {
                    if (aHints.hasHint(key, HintTargetTypes.TY_DAMAGE_AS_BLOCKED))
                    {
                        VirtualMatch vMatch = new VirtualMatch(c.E.mInitiatorMatch);
                        int damageToDo = initiator.getNowPower();
                        vMatch.getAttacker().remove(initiator);
                        CardSimList attackersToRemove = new CardSimList( c.E.mInitiatorMatch.getAttacksDone());
View Full Code Here

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

        myHints.save();
        setAIHintsForCard();


        // TODO EnhancedAI Hints
        AIEnhancedCardHints eotherHints = AIEnhancedCardHints.getHints(otherCard);
        AIEnhancedCardHints emyHints = AIEnhancedCardHints.getHints(mCurrentCard);

        for (int i=0; i< eotherHints.size();i++)
        {
            AIEnhancedHintData otherHint = eotherHints.getHintByRow(i);
            AIEnhancedHintData aHint = AIEnhancedHint.buildNewHint(mCurrentCard);

            aHint.setHintKey(otherHint.getHintKey());
            aHint.setHintNumber(otherHint.getHintNumber());
            aHint.setHintName(otherHint.getHintName());
            aHint.setHintType(otherHint.getHintType());
            aHint.setHintValue(otherHint.getHintValue());
            aHint.setCardID(mCurrentCard.getId());
            aHint.setCardSet(mCurrentCard.getSet());
            emyHints.addHint(aHint);
        }
        emyHints.save();
        setAIHintsForCard();


    }//GEN-LAST:event_jButtonCloneFromActionPerformed
View Full Code Here

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

    // not checked if enough or/ at all fitting targets for are card are present!
    // land not checked to any "match" if played already...
    public static boolean isAllowedToPlay(CardSim card, int phase, boolean ownTurn, Vector<EAIAction> stack, boolean isFinalCall)
    {
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
        boolean notAllowed = false;

        if (    (card.isArtifact()) ||
                (card.isCreature()) ||
                (card.isLand()) ||
                (card.isSorcery()) ||
                (card.isEnchantment()) )
        {
            // non of the above can be played if not in Main phase
            if (!((phase == MatchConstants.PHASE_MAIN1) || (phase == MatchConstants.PHASE_MAIN2)))
            {
                return false;
            }
            if (!ownTurn)
            {
                return false;
            }
            if ((stack != null) && (stack.size()>0))
                return false;
        }
        else if(card.isInstant())
        {
            if (ownTurn)
            {
                notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_INSTANT, PR_PLAYER_TURN_NOT_ALLOWED);
            }
            else
            {
                notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_INSTANT, PR_OPPONENT_TURN_NOT_ALLOWED);
            }
            if (phase != MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS)
            {
                notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_IN_ATTACKER)
                                      || hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_IN_ATTACKER_FINAL);
            }

            if (phase == MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS)
            {
                boolean isAttackFinalCard = hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_IN_ATTACKER_FINAL);
           
                if ((isAttackFinalCard) && (!isFinalCall))
                    notAllowed = true;
            }

            if (phase != MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS)
            {
                notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_IN_BLOCKER)
                                      || hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_IN_BLOCKER_FINAL);
            }
            if (hints.hasHint(HINT_SITUATION_INSTANT, PR_REACT_ONLY_AFTER_CARD_PLAYED))
            {
                if ((stack == null)||(stack.isEmpty()))
                    notAllowed = true;
            }

            if (hints.hasHint(HINT_SITUATION_INSTANT, TY_NEGATE_STACK_CARD))
            {
                if ((stack == null)||(stack.isEmpty()))
                {
                    notAllowed = true;
                }
                else
                {
                    if (hints.hasHint(HINT_SITUATION_INSTANT, TR_CARD_TYPE_NEED))
                    {
                        String types = hints.getHintValue(HintTargetRestrictions.TR_CARD_TYPE_NEED).toUpperCase();
                        CardSim target = stack.elementAt(stack.size()-1).getSCard();
                        if (!target.getCard().hasAnyType(types))
                        {
                            notAllowed = true;
                        }
View Full Code Here

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

    }
   
    // regarding to phase
    public static boolean isAllowedToActivate(CardSim card, int phase, boolean ownTurn, VirtualMatch vMatch)
    {
        AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);
        boolean notAllowed = false;

        notAllowed = !hints.hasHint(HINT_SITUATION_ACTIVATION, O_WHEN_ACTIVATED);
        if (phase != MatchConstants.PHASE_COMBAT_DECLARE_ATTACKERS)
        {
            notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_REACT_ONLY_IN_ATTACKER)
                                  || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_REACT_ONLY_IN_ATTACKER_FINAL);
        }
        if (phase != MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS)
        {
            notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_REACT_ONLY_IN_BLOCKER)
                                  || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_REACT_ONLY_IN_BLOCKER_FINAL);
        }
        if (ownTurn)
        {
            notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_PLAYER_TURN_NOT_ALLOWED);
        }
        else
        {
            notAllowed = notAllowed || hints.hasHint(HINT_SITUATION_ACTIVATION, PR_OPPONENT_TURN_NOT_ALLOWED);
        }
        if (hints.hasHint(HINT_SITUATION_ACTIVATION, PR_BEFOR_ATTACKER))
        {
            if (vMatch.getAttacker().size() > 0)
                notAllowed = true;
        }
View Full Code Here

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

                    scorting.removeType(Scoring.LAND_DESTROY);

                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (aHints.hasHint(HintTargetTypes.TY_LAND_TO_GRAVE))
                        {
                            if (!(aHints.hasHint(HintTargetCount.CT_ALL_CARDS)))
                            {
                                result = card;
                                D.addLog("Found: "+result,debugLevel);
                            }
                        }
                    }
                    break;
                }

                case Scoring.LAND:
                {
                    D.addLog("Taken LAND",debugLevel);
                    scorting.removeType(Scoring.LAND);
                    CardSimList l = list.getSubListByType("Land");
                    if (l.size()>0)
                    {
                        result = l.getCard(0);
                        break;
                    }

                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (aHints.hasHint(HintTargetTypes.TY_LIBRARY_TO_HAND))
                        if ((aHints.getHintValue(HintTargetRestrictions.TR_CARD_TYPE_NEED).toUpperCase().indexOf("Land") != -1)
                            ||
                            (aHints.getHintValue(HintTargetRestrictions.TR_CARD_TYPE_RESTRICTION).toUpperCase().indexOf("Land") == -1))
                        {
                            result = card;
                            D.addLog("Found: "+result,debugLevel);
                            break;
                        }

                    }
                    if (result == null)
                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (aHints.hasHint(HintTargetTypes.TY_LIBRARY_TO_LAND))
                        {
                            result = card;
                            D.addLog("Found: "+result,debugLevel);
                            break;
                        }
                    }
                    break;
                }
                case Scoring.HEALTH:
                {
                    D.addLog("Taken HEALTH",debugLevel);
                    scorting.removeType(Scoring.HEALTH);

                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (aHints.hasHint(HintTargetTypes.TY_HEAL))
                        {
                            result = card;
                            D.addLog("Found: "+result,debugLevel);
                            break;
                        }

                    }
                    break;
                }
                case Scoring.DAMAGE:
                {
                    D.addLog("Taken DAMAGE",debugLevel);
                    scorting.removeType(Scoring.DAMAGE);
                    String[] h={"EFFECT_ONE_PLAYER_DAMAGE"};
                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if ((aHints.hasHint(HintTargetTypes.TY_DAMAGE))
                            || (aHints.hasHint(HintSourceTypes.SY_DAMAGE)))
                        {
                            if ((aHints.hasHint(HintTargetRestrictions.TR_CARD_OPPONENT))
                                || (aHints.hasHint(HintSourceRestrictions.SR_CARD_OPPONENT)))
                            {
                                if (!(card.isCreature()))
                                    result = card;
                            }
                        }
                    }
                    break;
                }
                case Scoring.CREATURE:
                {
                    D.addLog("Taken CREATURE",debugLevel);
                    scorting.removeType(Scoring.CREATURE);
                    CardSimList l = list.getSubListByType("Creature");

                    boolean testMana=true;
                    if (initiator!=null)
                    {
                        AIEnhancedCardHints iHints = AIEnhancedCardHints.getHints(initiator);

                        if (iHints.hasHint(HintTargetTypes.TY_LIBRARY_TO_FIELD))
                        {
                            testMana=false;
                        }
                        if (iHints.hasHint(HintTargetTypes.TY_HAND_TO_FIELD))
                        {
                            testMana=false;
                        }
                    }
                    if (testMana)
                        l = onlyEnoughManaGeneral(l, lands);

                    l = l.sortListByManaCost();
                    if (l.size()>0)
                    {
                        result = l.getCard(l.size()-1);
                    }
                    break;
                }
                case Scoring.CREATURE_DAMAGE:
                {
                    D.addLog("Taken CREATURE_DAMAGE",debugLevel);
                    scorting.removeType(Scoring.CREATURE_DAMAGE);

                    // NOT checked if one of the sorcueries does damage to the player!
                    // (e.g. "Rain of Daggers")
                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (   ((aHints.hasHint(HintTargetTypes.TY_FIELD_TO_GRAVE)) && (aHints.hasHint(HintTargetRestrictions.TR_CARD_OPPONENT)))
                            || ((aHints.hasHint(HintSourceTypes.SY_FIELD_TO_GRAVE)) && (aHints.hasHint(HintSourceRestrictions.SR_CARD_OPPONENT)))
                             )
                        {
                            {
                                result = card;
                                break;
                            }
                        }
                    }


                    if (result == null)
                    {
                        for (int i=0; i< list.size(); i++)
                        {
                            CardSim card = list.getCard(i);
                            AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                            if (   ((aHints.hasHint(HintTargetTypes.TY_FIELD_TO_HAND)) && (aHints.hasHint(HintTargetRestrictions.TR_CARD_OPPONENT)))
                                || ((aHints.hasHint(HintSourceTypes.SY_FIELD_TO_HAND)) && (aHints.hasHint(HintSourceRestrictions.SR_CARD_OPPONENT)))
                                || ((aHints.hasHint(HintTargetTypes.TY_LIBRARY_TOP)) && (aHints.hasHint(HintTargetRestrictions.TR_CARD_OPPONENT)))
                                )
                                {
                                    result = card;
                                    break;
                                }
                        }
                    }
                    if (result == null)
                    {
                        for (int i=0; i< list.size(); i++)
                        {
                            CardSim card = list.getCard(i);
                            AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                            if (   ((aHints.hasHint(HintTargetTypes.TY_DAMAGE)) && (aHints.hasHint(HintTargetRestrictions.TR_CARD_OPPONENT)))
                                || ((aHints.hasHint(HintSourceTypes.SY_DAMAGE)) && (aHints.hasHint(HintSourceRestrictions.SR_CARD_OPPONENT)))
                                )
                                {
                                    result = card;
                                    break;
                                }
                        }
                    }
                    break;
                }

                case Scoring.HAND:
                {
                    D.addLog("Taken HAND",debugLevel);
                    scorting.removeType(Scoring.HAND);

                    String[] h={"EFFECT_WHEN_DRAW_CARD"};
                    for (int i=0; i< list.size(); i++)
                    {
                        CardSim card = list.getCard(i);
                        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(card);
                        if (   ((aHints.hasHint(HintTargetTypes.TY_LIBRARY_TO_HAND)) && (aHints.hasHint(HintTargetRestrictions.TR_CARD_PLAYER)))
                            || ((aHints.hasHint(HintSourceTypes.SY_LIBRARY_TO_HAND)) && (aHints.hasHint(HintSourceRestrictions.SR_CARD_PLAYER)))
                            )
                            {
                                result = card;
                                break;
                            }
View Full Code Here

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

        {
            CardSim card = list.getCard(i);
            if (!card.isCreature()) continue;
            if (card.hasAbility("Haste")) continue;
            String key = HintAll.HINT_SITUATION_CARD_PLAYED;
            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(card);

            // damgae is 1
            // get land is 1
            // get from grave is 1
            // opponent destroy creature is 1
            if (hints.hasAnyHint(key, MAIN1_CREATURE_HINTS) ) continue;

            list.remove(i);
        }
        return list;
    }
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.