Package csa.jportal.ai.standardAI.sim

Examples of csa.jportal.ai.standardAI.sim.CombatSim


            attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);
            if (attackerPlayer.size()>0)
            {
                CardList defenderOpponent = opponentCreatures.copyList();

                CombatSim cs = new CombatSim(attackerPlayer, defenderOpponent);
                CombatSim.attackerLands = myLands ;
                CombatSim.blockerLands = opponentLands;
                CombatFormation as = cs.simDefensiveBlocker(10, 0);

                int opponentLife = Match.match.getLife(Match.match.getOpponent(Match.match.getOwner(myCreatures.getCard(0))));
                if (as != null)
                if (as.playerDamage > opponentLife)
                {
                    // GO for it, we kill him!
                    return myCreatures;
                }
            }
        }

        if (opponentCreatures.size() == 0)
        {
            CardList attackerPlayer = myCreatures.copyList();
            if (minorMood==0) if (myCreatures.size()<=2) return new CardList();
            if (minorMood==1) if (myCreatures.size()<=1) return new CardList();
            if (minorMood==0)
            {
                attackerPlayer = attackerPlayer.sortListByPower();
                attackerPlayer.removeCard(attackerPlayer.getCard(0));
                attackerPlayer.removeCard(attackerPlayer.getCard(0));
            }
            else if (minorMood==1)
            {
                attackerPlayer = attackerPlayer.sortListByPower();
                attackerPlayer.removeCard(attackerPlayer.getCard(0));
            }
            return myCreatures;
        }


        // first simulate an attack of the opponent to myself
        // the cards from myself that are NOT needed in defensive
        // action will be "left" over for attack by myself
        CardList attackerPlayer = myCreatures.copyList();
        CardList attackerOpponent = opponentCreatures.copyList();
        attackerOpponent = attackerOpponent.removeWithAbility("Defender");
        if (attackerOpponent.size() !=0)
        {
            CardList defenderPlayer = myCreatures.copyList();
            CombatSim cs = new CombatSim(attackerOpponent, defenderPlayer);
            // set globals as lands
            // needed to get Swampwalk etc right in simulation
            CombatSim.attackerLands = opponentLands;
            CombatSim.blockerLands = myLands;

            // as defensive player we think the worst of our opponent
            // he will certainly be aggressive :-)
            CombatFormation as = cs.simAgressiveBlocker(intellligence, 2);
            if (as==null)
            {
                D.addLog("as1 null",2);
//                return new CardList();
                attackerPlayer = new CardList();
            }
            else
                attackerPlayer = as.unUsedBlockerList;
            attackerPlayer = adjustVigilance(attackerPlayer, myCreatures);
        }
        attackerPlayer = attackerPlayer.removeWithAbility("Defender");
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_TAPPED, false);
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);

        // System.out.println("BlockĀ“Formation: "+as);
        // all non blockers can attack!

        // idea - with attackers block opponent creatures,
        // the ones not needed for killing of blockers - can attack
        //System.out.println("Unused blocker: " + as.unUsedBlockerList);

        if (minorMood==0) if (attackerPlayer.size()<=2) return new CardList();
        if (minorMood==1) if (attackerPlayer.size()<=1) return new CardList();

        if (minorMood==0)
        {
            attackerPlayer = attackerPlayer.sortListByPower();
            attackerPlayer.removeCard(attackerPlayer.getCard(0));
            attackerPlayer.removeCard(attackerPlayer.getCard(0));
        }
        else if (minorMood==1)
        {
            attackerPlayer = attackerPlayer.sortListByPower();
            attackerPlayer.removeCard(attackerPlayer.getCard(0));
        }

        CardList defenderOpponent = opponentCreatures.copyList();
        CombatSim cs = new CombatSim(attackerPlayer, defenderOpponent);
        CombatSim.attackerLands = myLands ;
        CombatSim.blockerLands = opponentLands;
        CombatFormation as = cs.simDefensiveBlocker(10, 0);
        if (as==null)
        {
            D.addLog("as2 null",2);
            //System.out.println("as2 null");
            return attackerPlayer;
View Full Code Here


            attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);
            if (attackerPlayer.size()>0)
            {
                CardList defenderOpponent = opponentCreatures.copyList();

                CombatSim cs = new CombatSim(attackerPlayer, defenderOpponent);
                CombatSim.attackerLands = myLands ;
                CombatSim.blockerLands = opponentLands;
                CombatFormation as = cs.simDefensiveBlocker(10, 0);

                int opponentLife = Match.match.getLife(Match.match.getOpponent(Match.match.getOwner(myCreatures.getCard(0))));
                if (as != null)
                if (as.playerDamage > opponentLife)
                {
                    // GO for it, we kill him!
                    return myCreatures;
                }
            }
        }

        // first simulate an attack of the opponent to myself
        // the cards from myself that are NOT needed in defensive
        // action will be "left" over for attack by myself
        CardList attackerOpponent = opponentCreatures.copyList();
        attackerOpponent = attackerOpponent.removeWithAbility("Defender");
        CardList defenderPlayer = myCreatures.copyList();
        CardList attackerPlayer = myCreatures.copyList();
        if (attackerOpponent.size() !=0)
        {
            CombatSim cs = new CombatSim(attackerOpponent, defenderPlayer);
            // set globals as lands
            // needed to get Swampwalk etc right in simulation
            CombatSim.attackerLands = opponentLands;
            CombatSim.blockerLands = myLands;

            // as defensive player we think the worst of our opponent
            // he will certainly be aggressive :-)
            CombatFormation as = cs.simJustBlock(intellligence, 2);
            if (as==null)
            {
                D.addLog("as1 null",2);
//                return new CardList();
                attackerPlayer = new CardList();
            }
            else
                attackerPlayer = as.unUsedBlockerList;
            attackerPlayer = adjustVigilance(attackerPlayer, myCreatures);
        }
        attackerPlayer = attackerPlayer.removeWithAbility("Defender");
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_TAPPED, false);
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);

        // idea - with attackers block opponent creatures,
        // the ones not needed for killing of blockers - can attack
        //System.out.println("Unused blocker: " + as.unUsedBlockerList);

        CardList defenderOpponent = opponentCreatures.copyList();
        CombatSim cs = new CombatSim(attackerPlayer, defenderOpponent);
        CombatSim.attackerLands = myLands ;
        CombatSim.blockerLands = opponentLands;
        CombatFormation as = cs.simDefensiveBlocker(10, 0);
        if (as==null)
        {
            D.addLog("as2 null",2);
            return attackerPlayer;
        }
View Full Code Here

        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_TAPPED, false);
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);
        attackerPlayer = attackerPlayer.removeWithAbility("Defender");
        if (attackerPlayer.size()==0) return new CardList();
        CardList defenderOpponent = opponentCreatures.copyList();
        CombatSim cs = new CombatSim(attackerPlayer, defenderOpponent);
        CombatSim.attackerLands = myLands ;
        CombatSim.blockerLands = opponentLands;

        // we think our opponent is VERY smart - > 10 (out of 10)
        CombatFormation as = cs.simDefensiveBlocker(10, 0);
        if (intellligence == 10)
        {
            int opponentLife = Match.match.getLife(Match.match.getOpponent(Match.match.getOwner(myCreatures.getCard(0))));

            if (as != null)
            if (as.playerDamage > opponentLife)
            {
                // GO for it, we kill him!
                return myCreatures;
            }
        }

        int myLife = Match.match.getLife(Match.match.getOwner(myCreatures.getCard(0)));

        attackerPlayer = myCreatures.copyList();
        attackerPlayer = attackerPlayer.sortListByPower();
        defenderOpponent = opponentCreatures.copyList();
        defenderOpponent = defenderOpponent.removeWithAbility("Defender");
        defenderOpponent = defenderOpponent.sortListByPower();
        int maxDamageOpponentCreatures = getPowerSum(defenderOpponent);

        // do it so I will survive an attack of opponent
        while ((myLife-maxDamageOpponentCreatures <0) && (attackerPlayer.size()!=0))
        {
            attackerPlayer.removeCard(attackerPlayer.getCard(0));
            defenderOpponent.removeCard(defenderOpponent.getCard(defenderOpponent.size()-1));
            maxDamageOpponentCreatures = getPowerSum(defenderOpponent);
        }
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_TAPPED, false);
        attackerPlayer = attackerPlayer.getSubListBooleanState(Card.CARD_SICKNESS, false);
        attackerPlayer = attackerPlayer.removeWithAbility("Defender");
        if (attackerPlayer.size()==0) return new CardList();

        if (minorMood<2)
            attackerPlayer.removeCard(attackerPlayer.getCard(0));
        if (attackerPlayer.size()==0) return new CardList();


        defenderOpponent = opponentCreatures.copyList();

        cs = new CombatSim(attackerPlayer, defenderOpponent);
        CombatSim.attackerLands = myLands ;
        CombatSim.blockerLands = opponentLands;
        as = cs.simDefensiveBlocker(10, 0);
        if (as==null)
        {
            D.addLog("as2 null",2);
            return attackerPlayer;
        }
View Full Code Here

        }

        CardList defenderPlayer = myCreatures.getSubListTapState(false);
        if (intellligence > 7) defenderPlayer = removeWithHint(defenderPlayer, "CAN_BE_TAPPED_INSTEAD_ATTACK");

        CombatSim cs = new CombatSim(attackerOpponent, defenderPlayer);
        CombatSim.attackerLands = opponentLands;
        CombatSim.blockerLands = myLands;

        result = cs.simDefensiveBlocker(intellligence, minorMood);
        if (result==null)
            return new CombatFormation();;
        return result;
    }
View Full Code Here

            return result;
        }
        CardList defenderPlayer = myCreatures.getSubListTapState(false);
        if (intellligence > 5) defenderPlayer = removeWithHint(defenderPlayer, "CAN_BE_TAPPED_INSTEAD_ATTACK");

        CombatSim cs = new CombatSim(attackerOpponent, defenderPlayer);
        CombatSim.attackerLands = opponentLands;
        CombatSim.blockerLands = myLands;

        result = cs.simMediumBlocker(intellligence, minorMood);
        int myLife = Match.match.getLife(Match.match.getOwner(myCreatures.getCard(0)));

        if (result != null)
        if (result.attackerDead == 0)
        {
View Full Code Here

            return result;
        }
        CardList defenderPlayer = myCreatures.getSubListTapState(false);
        if (intellligence > 3) defenderPlayer = removeWithHint(defenderPlayer, "CAN_BE_TAPPED_INSTEAD_ATTACK");

        CombatSim cs = new CombatSim(attackerOpponent, defenderPlayer);
        CombatSim.attackerLands = opponentLands;
        CombatSim.blockerLands = myLands;

        result = cs.simAgressiveBlocker(intellligence, minorMood);
        int myLife = Match.match.getLife(Match.match.getOwner(myCreatures.getCard(0)));

        if (result != null)
        if (result.attackerDead == 0)
        {
View Full Code Here

TOP

Related Classes of csa.jportal.ai.standardAI.sim.CombatSim

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.