Package csa.jportal.ai.enhancedAI.enhancedSim

Examples of csa.jportal.ai.enhancedAI.enhancedSim.CombatFormation


        c.attackers = allAttackers;
        c.attackerLands = vMatch.getLand(attacker);
        c.blockerLands = vMatch.getLand((attacker+1)%2);
        int blockerHealth = vMatch.getLife((attacker+1)%2);
        CombatSimNew csim = new CombatSimNew(allAttackers, allBlockers, c, false);
        CombatFormation formation = csim.computeBestBlock(blockerHealth, Weighting.DEFAULT,0);

        CardSimList blockersUsed = new CardSimList();
       
        for (int i=0; i< formation.singleFights.size(); i++)
        {
View Full Code Here


                    CombatSimNew csim = new CombatSimNew(possibleAttackers, blocker, c, false);
                    int blockerHealth = vMatch.getLife(player);

                    // TEST new Attacking!
                    CombatFormation attackFormation = csim.computeBestAttack(Weighting.DEFAULT, blockerHealth);

                    for (int a=0; a< attackFormation.singleFights.size(); a++)
                    {
                        CardSim at = attackFormation.singleFights.elementAt(a).attacker;
                        EAIAction attack = EAIAction.createDeclareAttackerAction(no++, at);
View Full Code Here

        blocker = vMatch.removeAllreadyBlocking(blocker);
        blocker = blocker.onlyTapstate(false);


        String blKey = generateBlockerKey(attacker, blocker);
        CombatFormation formation = blockerCache.get(blKey);

        if (formation == null)
        {
            CombatSimConfig c = new CombatSimConfig(E.aiPlayer);
            c.attackers = attacker;
            c.attackerLands = vMatch.getLand(E.pNumber);
            c.blockerLands = vMatch.getLand(opponentNo);

            CombatSimNew csim = new CombatSimNew(attacker, blocker, c, false);
            int blockerHealth = vMatch.getLife(opponentNo);

            int preventDamage = EAIHelper.getDamagePrevention(vMatch, player, vMatch.getBattlefield((player)));
            // TEST new Blocking!
            formation = csim.computeBestBlock(blockerHealth, Weighting.DEFAULT, preventDamage);
           
            if (formation != null)
            {
                blockerCache.put(blKey, formation);
            }
            else
            {
                formation = new CombatFormation();
                blockerCache.put(blKey, formation);
            }
            cacheNotHit++;
        }
        else
        {
            cacheHit++;
        }

        Vector <SingleFight> fights = formation.getFormation();
        int no=0;
        for (int f = 0; f < fights.size(); f++)
        {
            SingleFight singleFight = fights.elementAt(f);
            CardSim matchAttacker = vMatch.getAttacker(singleFight.attacker);
View Full Code Here

       
        blocker = blocker.removeTapped();
        blocker = removeBlocking(blocker);

        String blKey = generateBlockerKey(attacker, blocker);
        CombatFormation formation = blockerCache.get(blKey);

        if (formation == null)
        {
            CombatSimConfig c = new CombatSimConfig(E.aiPlayer);
            c.attackers = attacker;
            c.attackerLands = vMatch.getLand(opponentNo);
            c.blockerLands = vMatch.getLand(playerNo);
            int blockerHealth = vMatch.getLife(playerNo);
           
            CombatSimNew csim = new CombatSimNew(attacker, blocker, c, false);

            // TEST new Blocking!
           
           
            int preventDamage = EAIHelper.getDamagePrevention(vMatch, (player+1)%2, vMatch.getBattlefield((player+1)%2));
           
           
            if (strategy == BLOCK_PLAYER_LEAST_CREATURE_DEAD)
                formation = csim.computeBestBlock(blockerHealth, Weighting.DEFAULT, preventDamage);
            else
                formation = csim.computeBestBlockHealth(blockerHealth, Weighting.DEFAULT, preventDamage);
            if (formation != null)
            {
                blockerCache.put(blKey, formation);
            }
            else
            {
                formation = new CombatFormation();
                blockerCache.put(blKey, formation);
            }
            cacheNotHit++;
        }
        else
View Full Code Here

TOP

Related Classes of csa.jportal.ai.enhancedAI.enhancedSim.CombatFormation

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.