Examples of AIEnhancedCardHints


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

            {
                ret.addCard(sBlock);
                return ret;
            }

            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(attacker);
            if (hints.hasHint(HintAll.TY_ONE_ONLY_BLOCCK))
            {
                return null;
            }
        }
       
View Full Code Here

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

            if (sBlock != null)
            {
                ret.addCard(sBlock);
                return ret;
            }
            AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(attacker);
            if (hints.hasHint(HintAll.TY_ONE_ONLY_BLOCCK))
            {
                return null;
            }
        }
View Full Code Here

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

        for (int b = 0; b <blockers.size(); b++)
        {
            CardSim blocker = blockers.getCard(b);
            if (!SingleFight.canBlock(blocker, attacker, config, false)) continue;
            AIEnhancedCardHints bHints = AIEnhancedCardHints.getHints(blocker);
            String bKey = HintAll.HINT_SITUATION_BLOCKER;
            if (bHints.hasHint(bKey, HintAll.TY_FIELD_TO_GRAVE))
            {
                return blocker;
            }

            int bPow = blocker.getNowPower();
View Full Code Here

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

        // if tapped...
        if (checkForTapped)
            if (attacker.isTapped()) return false;

        boolean ret = true;
        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);
        String key = "ATTACKING";

        // if no key available for "ATTACKING" -> than no restriction!
        if (!aHints.hasKey(key)) return true;

        if (aHints.hasHint(key, HintOccurrence.O_WHEN_PLAYER_DAMAGE_DEALT)) return true;


        // TODO:
        // for now only "LAND" restrictions implemented!
        String typeNeeded = aHints.getHintValue(key, HintTargetRestrictions.TR_CARD_TYPE_NEED);
        if (typeNeeded.toUpperCase().equals("LAND"))
        {
            CardSimList lands = new CardSimList();
            if (aHints.hasHint(key, HintTargetRestrictions.TR_CARD_PLAYER))
            {
                lands.addList(config.attackerLands);
            }
            if (aHints.hasHint(key, HintTargetRestrictions.TR_CARD_OPPONENT))
            {
                lands.addList(config.blockerLands);
            }
            String subType = aHints.getHintValue(key, HintTargetRestrictions.TR_CARD_SUBTYPE_NEED);
            if (subType.length() != 0)
            {
                CardSimList subListLands = lands.getSubListBySubType(subType);
                if (subListLands.size() == 0) return false;
            }
            subType = aHints.getHintValue(key, HintTargetRestrictions.TR_CARD_SUBTYPE_RESTRICTION);
            if (subType.length() != 0)
            {
                CardSimList subListLands = lands.getSubListBySubType(subType);
                if (subListLands.size() != 0) return false;
            }
View Full Code Here

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

        // TODO
        // check if only a limited number of blockers are allowed
       
        // from attackers View
        boolean ret = true;
        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);
        String aKey = "ATTACKING";

        // if no key available for "ATTACKING" -> than no restriction!
        if (aHints.hasKey(aKey))
        {
            // attacker gives limitation to blocker...
            if (aHints.hasHint(aKey, HintTargetTypes.TY_GENERAL_BLOCKER_LIMITATION))
            {
                if (aHints.hasHint(aKey, HintTargetTypes.TY_NOT_BLOCKABLE))
                {
                    boolean restriction = false;
                    String colorRestriction = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_COLOR_RESTRICTION);
                    if (colorRestriction.length() != 0)
                    {
                        if (blocker.hasOneColor(colorRestriction))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String colorNeed = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_COLOR_NEED);
                    if (colorNeed.length() != 0)
                    {
                        if (!blocker.hasOneColor(colorNeed))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String abilityRestriction = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_ABILITY_RESTRICTION);
                    if (abilityRestriction.length() != 0)
                    {
                        if (blocker.hasOneAbility(abilityRestriction))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String abilityNeed = aHints.getHintValue(aKey, HintTargetRestrictions.TR_CARD_ABILITY_NEED);
                    if (abilityNeed.length() != 0)
                    {
                        if (!blocker.hasOneAbility(abilityNeed))
                        {
                            return false;
                        }
                        restriction = true;
                    }

                    int powerRestriction = aHints.getHintValueInt(aKey, HintTargetRestrictions.TR_CARD_POWER_MAX);
                    if (powerRestriction != 0)
                    {
                        if (blocker.getNowPower()>powerRestriction)
                        {
                            return false;
                        }
                        restriction = true;
                    }

                    int countRestriction = aHints.getHintValueInt(aKey, HintTargetRestrictions.TR_CARD_COUNT_MAX);
                    if (countRestriction != 0)
                    {
                        CardSimList blockers = attacker.getBlocker();
                        if (blockers.size()>countRestriction)
                        {
                            int blNum = 0;
                            for (int b = 0; b< blockers.size(); b++)
                            {
                                if (blocker.getCard().getUniqueID().equals(blockers.getCard(b).getCard().getUniqueID()))
                                {
                                    blNum = b;
                                }
                            }
                            if (blNum>=countRestriction)
                                return false;
                        }
                        restriction = true;
                    }
                   
                   
                    // this attacker is in general unblockanle!
                    if (!restriction)
                    {
                        boolean anyRestriction = aHints.hasHintType(aKey, HintDefinition.HINT_TYPE_TARGET_RESTRICTION);
                        if (!anyRestriction)
                            return false;
                        // TODO:
                        // other restrctions must still be programmed!
                        System.out.println("CAN block not supported attacker restriction found! -> " + attacker );
                    }
                }
            }
            if (aHints.hasHint(aKey, HintTargetTypes.TY_NOT_BLOCKABLE_IF_SINGLE_ATTACKER))
            {
                int size = config.attackers.size();
                if (size == 1) return false;
            }
        }

        AIEnhancedCardHints bHints = AIEnhancedCardHints.getHints(blocker);
        String bKey = "BLOCKING";
        // if no key available for "ATTACKING" -> than no restriction!
        if (bHints.hasKey(bKey))
        {
            // attacker gives limitation to blocker...
            if (bHints.hasHint(bKey, HintTargetTypes.TY_GENERAL_BLOCK_LIMITATION))
            {
                if (bHints.hasHint(bKey, HintTargetTypes.TY_CANT_BLOCK))
                {
                    boolean restriction = false;

                    String colorRestriction = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_COLOR_RESTRICTION);
                    if (colorRestriction.length() != 0)
                    {
                        if (attacker.hasOneColor(colorRestriction))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String colorNeed = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_COLOR_NEED);
                    if (colorNeed.length() != 0)
                    {
                        if (!attacker.hasOneColor(colorNeed))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String abilityRestriction = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_ABILITY_RESTRICTION);
                    if (abilityRestriction.length() != 0)
                    {
                        if (attacker.hasOneAbility(abilityRestriction))
                        {
                            return false;
                        }
                        restriction = true;
                    }
                    String abilityNeed = bHints.getHintValue(bKey, HintTargetRestrictions.TR_CARD_ABILITY_NEED);
                    if (abilityNeed.length() != 0)
                    {
                        if (!attacker.hasOneAbility(abilityNeed))
                        {
                            return false;
                        }
                        restriction = true;
                    }

                    // this blocker in general c an not block!
                    if (!restriction)
                    {
                        boolean anyRestriction = bHints.hasHintType(bKey, HintDefinition.HINT_TYPE_TARGET_RESTRICTION);
                        if (!anyRestriction)
                            return false;
                        // TODO:
                        // other restrctions must still be programmed!
                        System.out.println("CAN block not supported blocker restriction found! -> " + blocker );
View Full Code Here

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

        buildSims();
        int blockedByNo = 0;
        attacker.didAttack = true;

        applyAttackingHints(attacker);
        AIEnhancedCardHints aHints = AIEnhancedCardHints.getHints(attacker);
        for (int b=0; b<blocker.size(); b++)
        {
            CardSim bl = blocker.getCard(b);

            if (config!=null)
            if (!canBlock(bl, attacker , config, true))
            {
                continue;
            }

            applyBlockingHints(bl);
            AIEnhancedCardHints bHints = AIEnhancedCardHints.getHints(bl);
            String bKey = HintAll.HINT_SITUATION_BLOCKER;
            if (bHints.hasHint(bKey, HintTargetTypes.TY_FIELD_TO_GRAVE))
            {
                // destroy befor doing damage
                attacker.setNowToughness(0);
                attacker.setNowPower(0);
            }
            if (bHints.hasHint(bKey, HintTargetTypes.TY_SELF_DESTRUCT))
            {
                bl.setNowToughness(0);
            }
            String aKey = HintAll.HINT_SITUATION_BLOCKED;
            if (aHints.hasHint(aKey, HintTargetTypes.TY_FIELD_TO_GRAVE))
            {
                // destroy befor doing damage
                bl.setNowToughness(0);
                bl.setNowPower(0);
            }

            int pNow = attacker.getNowPower();
            aKey = HintAll.HINT_SITUATION_ATTACKER;
            boolean notBlocked = false;
            int powerRestriction = aHints.getHintValueInt(aKey, HintTargetRestrictions.TR_CARD_POWER_MAX);
            if (powerRestriction != 0)
            {
                if (bl.getNowPower() > powerRestriction)
                {
                    bl.setNowPower(0);
                    notBlocked = true;
                }
            }

            if (!notBlocked)
            {
                bl.didBlock=true;
                blockedByNo++;
                attacker.wasBlocked = true;
                if (!attackerDamageToPlayer)
                {
                    attacker.addPower(-bl.getNowToughness());

                }
                if (attacker.getNowPower()<0) attacker.setNowPower(0);

                aKey = HintAll.HINT_SITUATION_INHERENT;
                if (!aHints.hasHint(aKey, HintTargetTypes.TY_NOT_DAMAGEABLE_BY_CREATURE))
                {
                    int adjust = 0;

                    if (attacker.getPreventDamage() > 0)
                    {
                        if (attacker.getPreventDamage() <=bl.getNowPower())
                        {
                            adjust = attacker.getPreventDamage();
                        }
                        else
                        {
                            adjust = bl.getNowPower();
                        }
                        attacker.reducePreventedDamage(adjust);
                    }
                    attacker.addToughness(-(bl.getNowPower()-adjust) );
                }
                if (attacker.getNowToughness()<0)
                    attacker.setNowToughness(0);

                bKey = HintAll.HINT_SITUATION_INHERENT;
                if (!attackerDamageToPlayer)
                    if (!bHints.hasHint(bKey, HintTargetTypes.TY_NOT_DAMAGEABLE_BY_CREATURE))
                    {
                        int adjust = 0;
                        if (bl.getPreventDamage() > 0)
                        {
                            if (bl.getPreventDamage() <=pNow)
View Full Code Here

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

        if (card.getAIOk().equals("CV")) return false;


        csa.jportal.ai.standardAI.hints.AICardHints mOHints = new csa.jportal.ai.standardAI.hints.AICardHints(card);
        AIEnhancedCardHints mNHints= AIEnhancedCardHints.getHints(card);


        Vector<AIHint> mOldHints = mOHints.getHints();
        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"))
                    if (!oHint.mData.getHintName().equals("EFFECT_WHEN_ATTACKING"))

                        ok = false;
                }
                ok = ok & (!error);
                for (int j = 0; j < nHints.size(); j++)
                {
                    AIEnhancedHint aIEnhancedHint = nHints.elementAt(j);

                   
                    // this is bad - but what the heck - one time conversion...
                    if (aIEnhancedHint.mData.getHintName().equals("TYPE NEEDED"))
                    {
                        if (aIEnhancedHint.mData.getHintValue().equals("true"))
                        {
                            aIEnhancedHint.mData.setHintValue("Creature");
                        }
                    }
                    mNHints.addHint(aIEnhancedHint.mData);
                }
if (error) System.out.println("Error at: "+oHint.mData.getHintVarName());
            }
          
           

            mNHints.save();
            if (ok)
                card.setAIOk("COK");
            else
                card.setAIOk("COFF");
            card.save();
View Full Code Here

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

    static boolean error = false;

    public static boolean convertToHint(Card card)
    {
        AIEnhancedCardHints mNHints= AIEnhancedCardHints.getHints(card);

        boolean ok = true;
        error = false;
        Vector<AIEnhancedHint> nHints = convertFromText(card);

        for (int j = 0; j < nHints.size(); j++)
        {
            AIEnhancedHint aIEnhancedHint = nHints.elementAt(j);
            mNHints.addHint(aIEnhancedHint.mData);
        }
        mNHints.save();

        card.setAIOk("CGEN");
        card.save();
        return false;
    }
View Full Code Here

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

                leafs.addElement(leaf);
                leaf.buildAttackerLeafs(attackers, analyze, shorter, removedPossibleAttackers);

                CardAndMana cam = new CardAndMana(CardAndMana.CAM_ATTACK , at, ManaCollection.NO_COST );

                AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(at);
                Vector<Vector> sources = createSources(cam, hints); // at least one empty target! or null -> must targets not available!
                if (sources == null) { continue; }

                int sourceCount = sources.size();
                for (int s=0; s< sourceCount; s++)
View Full Code Here

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

                // but this also means, that this card
                // is "dead" so we dont have to do anything and can just go on
                if (source == null) return;
               
                reverseEffect = true;
                AIEnhancedCardHints hints = AIEnhancedCardHints.getHints(source);
                String key = effect.key;

                CardSimList effectedList = getTargetEffectedList(key, source, effect.effectOnTargetPlayer, hints, null);
                for (int e=0; e< effectedList.size(); e++)
                {
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.