Package csa.jportal.match

Examples of csa.jportal.match.MatchComputerPlayer$MyMessageQueue


        TestMatch match = new TestMatch();

        MatchStartOptions options = new MatchStartOptions();
        CardDeck.mDummyLoadingActive = true;
        // assuming a AI named SimpleAI exists!
        options.setPlayer1(new MatchComputerPlayer(new AIPlayer("SimpleAI")));
        options.setPlayer2(new MatchComputerPlayer(new AIPlayer("SimpleAI")));
        CardDeck.mDummyLoadingActive = false;

        Match.loadMatchUnstated(matchName, null, match, options);

        if (!match.didMatchStart()) return;
View Full Code Here


            Weighting.resetAllWeightings();
            Weighting weightingUsed = Weighting.DEFAULT;

            if (mPlayer instanceof MatchComputerPlayer)
            {
                MatchComputerPlayer cp = (MatchComputerPlayer) mPlayer;
                AIPlayer aip = cp.getAIPlayer();
                if (!aip.isScriptedAI())
                {
                    EAIConfigurationData eaiConfig = aip.getEAIConfig();
                    if (eaiConfig != null)
                    {
View Full Code Here

      
        Weighting weightingUsed = Weighting.DEFAULT;
        if (mPlayer instanceof MatchComputerPlayer)
        {
            MatchComputerPlayer cp = (MatchComputerPlayer) mPlayer;
            AIPlayer aip = cp.getAIPlayer();
            if (!aip.isScriptedAI())
            {
                EAIConfigurationData eaiConfig = aip.getEAIConfig();
                if (eaiConfig != null)
                {
View Full Code Here

            NamedAIData namedAIData = mNamedAIDataPool.get(aiName);
            AIPlayer cplayer = new AIPlayer(namedAIData.getAIUsed());
            cplayer.mNamedAI = namedAIData;
            cplayer.setSelectedDeckName("NoDeck");
            CardDeck.mDummyLoadingActive = true;
            mHintPlayer = new MatchComputerPlayer(cplayer);
            CardDeck.mDummyLoadingActive = false;
        }
        return mHintAI;
    }
View Full Code Here

    // only for EAI supported types
    // -> meaning at the moment not for stack!
    void generateHint()
    {
        String note="<P><b>Note:</B><BR>Phases where no usefull actions were found are omitted!</P>";
        MatchComputerPlayer hp = EnhancedAI.getHintPlayer();
        eai.setMatch(mMatch, mPlayerNo);
        mAiPlayer = hp.getAIPlayer();
        if (!mMatch.isMyTurn(mPlayerNo))
        {
            if (mMatch.getPhase() != MatchConstants.PHASE_COMBAT_DECLARE_BLOCKERS)
            {
                String text = "<H2>No Hint available!</h2>";
View Full Code Here

            Weighting.resetAllWeightings();
            Weighting weightingUsed = Weighting.DEFAULT;

            if (mPlayer instanceof MatchComputerPlayer)
            {
                MatchComputerPlayer cp = (MatchComputerPlayer) mPlayer;
                AIPlayer aip = cp.getAIPlayer();
                if (!aip.isScriptedAI())
                {
                    EAIConfigurationData eaiConfig = aip.getEAIConfig();
                    if (eaiConfig != null)
                    {
View Full Code Here

        jLabel1.setText("");
        if (p1.cplayer != null)
        {
            try
            {
                MatchComputerPlayer p = p1.cplayer;
                Image image = csa.util.UtilityImage.loadImage(p.getAIPlayer().mNamedAI.getImagePath());
                jLabel1.setIcon(new ImageIcon(image.getScaledInstance(40, 48, java.awt.Image.SCALE_SMOOTH)));
            }
            catch (Throwable e){}
        }
        else
        {
            jButton2.setEnabled(false);
            Image image = p1.hplayer.getAvatar();
            if (image != null)
                jLabel1.setIcon(new ImageIcon(image.getScaledInstance(40, 48, java.awt.Image.SCALE_SMOOTH)));

        }
        jLabel3.setText("");
        if (p2.cplayer != null)
        {
            try
            {
                MatchComputerPlayer p = p2.cplayer;
                Image image = csa.util.UtilityImage.loadImage(p.getAIPlayer().mNamedAI.getImagePath());
                jLabel3.setIcon(new ImageIcon(image.getScaledInstance(40, 48, java.awt.Image.SCALE_SMOOTH)));
            }
            catch (Throwable e){}
        }
        else
View Full Code Here

        if (st != null) cplayer.mStrategie = st;
        if (bst != null) cplayer.mBoosterStrategie = bst;
        cplayer.setBoosterMode(true);
       
        cplayer.setSelectedDeckName("Booster");
        MatchComputerPlayer player = new MatchComputerPlayer(cplayer);
        BoosterPlayer p = new BoosterPlayer();
        ComputerQuickPanel panel = new ComputerQuickPanel();
        panel.setParent(this);
        panel.setNumber(mPlayers.size());
        //p.name = namedAIName;
        p.name = namedAIData.getNamedName();
        p.type = player.getPlayerType();
        p.no = mPlayers.size()+playerAvailable;
        p.cplayer = player;
        p.panel = panel;

        jPanel3.add(panel);
View Full Code Here

    public void checkQuestAfterGame(Match match, boolean win)
    {
        Logable D = Configuration.getConfiguration().getDebugEntity();
        MatchPlayable p = match.getPlayer(1);
        MatchComputerPlayer cplayer = null;
        if (p instanceof MatchComputerPlayer) cplayer = (MatchComputerPlayer)p; else return;

        QuestDefinitionDataPool mQuestDefinitionDataPool = new QuestDefinitionDataPool();

        for (int i = 0; i < mData.mQuestsActive.size(); i++)
        {
            String qname = mData.mQuestsActive.elementAt(i);
            QuestDefinitionData quest = mQuestDefinitionDataPool.get(qname);
            if (quest == null) continue; // only possible by renaming quests or the like
            if (win)
            {
                D.addLog("Quest type was("+i+"): "+quest.getTaskType(), 3);
                if ((quest.getTaskType().equals(Q_DEFEAT_OPPONENT))
                    || (quest.getTaskType().equals(Q_DEFEAT_OPPONENT_ONCE))
                    || (quest.getTaskType().equals(Q_DEFEAT_OPPONENT_TIMES))
                    || (quest.getTaskType().equals(Q_DEFEAT_OPPONENT_TIMES_IN_ROW))
                    )
                {
                    // OPPONENT CORRECT DEFEATED
                    if (quest.getNeededOponent().equals(cplayer.getAIPlayer().mNamedAI.mName))
                    {
                        QuestData data = getQuestData(quest);
                        data.opponentName = cplayer.getAIPlayer().mNamedAI.mName;
                        data.count++;
                        replaceNewQuestDataStorage(quest, data);
                    }
                }

                if (quest.getTaskType().equals(Q_DONT_LOSE_MORE_X_CREATURES))
                {

                    D.addLog("Q_DONT_LOSE_MORE_X_CREATURES creaturesWereDestroyed"+match.mResults.creaturesWereDestroyed[0], 3);
                    D.addLog("Q_DONT_LOSE_MORE_X_CREATURES quest.getCount()"+quest.getCount(), 3);
                    if (match.mResults.creaturesWereDestroyed[0] <= quest.getCount())
                    {
                        QuestData data = getQuestData(quest);
                        data.count = match.mResults.creaturesWereDestroyed[0];
                        replaceNewQuestDataStorage(quest, data);
                    }
                }
                if (quest.getTaskType().equals(Q_KILL_X_OPPONENT_CREATURES))
                {

                    D.addLog("Q_KILL_X_OPPONENT_CREATURES creaturesWereDestroyed"+match.mResults.creaturesWereDestroyed[1], 3);
                    D.addLog("Q_KILL_X_OPPONENT_CREATURES quest.getCount()"+quest.getCount(), 3);
                    if (match.mResults.creaturesWereDestroyed[1] >= quest.getCount())
                    {
                        QuestData data = getQuestData(quest);
                        data.count = match.mResults.creaturesWereDestroyed[1];
                        replaceNewQuestDataStorage(quest, data);
                    }
                }


                if (quest.getTaskType().equals(Q_WIN_IN_X_TURNS))
                {
                    D.addLog("Q_WIN_IN_X_TURNS match.getRound()"+match.getRound(), 3);
                    D.addLog("Q_WIN_IN_X_TURNS quest.getCount()"+quest.getCount(), 3);
                    // Rounds played AT GAME END
                    if (match.getRound() <= quest.getCount())
                    {
                        QuestData data = getQuestData(quest);
                        data.count = match.getRound();
                        replaceNewQuestDataStorage(quest, data);
                    }
                }
                if ((quest.getTaskType().equals(Q_LIFE_WHEN_QUIT))
                    )
                {
                    // LIFE AT GAME END
                    if (match.getLife(match.getPlayer(0)) >= quest.getCount())
                    {
                        QuestData data = getQuestData(quest);
                        data.count = match.getLife(match.getPlayer(0));
                        replaceNewQuestDataStorage(quest, data);
                    }
                }
                if ((quest.getTaskType().equals(Q_DEFEAT_OPPONENT_WITH_DECK))
                    )
                {
                    // OPPONENT CORRECT DEFEATED
                    if (quest.getNeededOponent().equals(cplayer.getAIPlayer().mNamedAI.mName))
                    {
                        if (quest.getPossibleDecks().elementAt(0).equals(getSelectedDeckName()))
                        {
                            QuestData data = getQuestData(quest);
                            data.opponentName = cplayer.getAIPlayer().mNamedAI.mName;
                            data.opponentDeck = getSelectedDeckName();
                            data.count++;
                            replaceNewQuestDataStorage(quest, data);
                        }
                    }
                }



                /*
                // OPPONENT DECK CORRECT DEFEATED
                if (quest.getOpponentDeck().equals(cplayer.getAIPlayer().getSelectedDeckName()))
                {
                    QuestData data = getQuestData(quest);
                    data.opponentDeck = cplayer.getAIPlayer().getSelectedDeckName();
                    replaceNewQuestDataStorage(quest, data);
                }
                */
            }
            else
            {
                if ( (quest.getTaskType().equals(Q_DEFEAT_OPPONENT_TIMES_IN_ROW))
                    )
                {
                    // OPPONENT CORRECT DEFEATED
                    if (quest.getNeededOponent().equals(cplayer.getAIPlayer().mNamedAI.mName))
                    {
                        QuestData data = getQuestData(quest);
                        data.opponentName = cplayer.getAIPlayer().mNamedAI.mName;
                        data.count = 0;
                        replaceNewQuestDataStorage(quest, data);
                    }
                }

View Full Code Here

TOP

Related Classes of csa.jportal.match.MatchComputerPlayer$MyMessageQueue

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.