Package csa.jportal.gameModes.player

Examples of csa.jportal.gameModes.player.Player


            if (mData.mRememberLastPlayer)
            {
                if (mData.mLastPlayer.trim().length() != 0)
                {
                    PlayerDataPool mPlayerDataPool = new PlayerDataPool();
                    mActivePlayer = new Player(mPlayerDataPool.get(mData.mLastPlayer));
                    if (mActivePlayer.getData() == null) mActivePlayer = null;
                }
            }
        }
        else
View Full Code Here


        Collection<NamedAIData> colNAI;
        jComboBoxComputerQuest.removeAllItems();
        colNAI = mNamedAIDataPool.getHashMap().values();
        Iterator<NamedAIData> iterNAI = colNAI.iterator();
        Player player = Configuration.getConfiguration().getAktivePlayer();
        if (player != null)
        {
            mPlayerName = player.getName();
            jTextField1.setText(mPlayerName);

            Collection<CardSetData> colC2 = CardSet.getPool().getMapForKlasse("MagicSets").values();
            Iterator<CardSetData> iterC2 = colC2.iterator();

            jComboBoxBoosterSet.addItem("");
            while (iterC2.hasNext())
            {
                CardSetData item = iterC2.next();
                jComboBoxBoosterSet.addItem(item.getSetName());
            }
            while (iterNAI.hasNext())
            {
                NamedAIData item = iterNAI.next();
                if (item.getHiddenAI()) continue;
                if (item.getIsQuestAI())continue;
                if (!item.getQuestHiddenAI())
                {
                    jComboBoxComputerQuest.addItem(item.mName);
                    if ((i==0) && (select))
                    {
                        jComboBoxComputerQuest.setSelectedIndex(0);
                    }
                    i++;
                }
                else
                {
                    Vector<String> openedAI = player.getData().getNamedAIOpen();
                    for (int j = 0; j < openedAI.size(); j++)
                    {
                        String name = openedAI.elementAt(j);
                        if (name.equals(item.mName))
                        {
View Full Code Here

        mParent.removePanel(this);
        MatchStartOptions options = new MatchStartOptions();
        PlayerDataPool mPlayerDataPool = new PlayerDataPool();
        MatchPlayable player1=null;
        AIStrategiePool mAIStrategiePool = new AIStrategiePool();
        Player player;
        player = new QuickPlayer("Quick Player");

        if (jCheckBox6.isSelected())
        {
            GenDeckPanel genPanel = new GenDeckPanel(jComboBoxGenDeck.getSelectedItem().toString());
            player.setDeckGenMode(true, "GeneratedDeck", genPanel.genDeck());
        }
        else
        {
            player.setSelectedDeckName((String) jComboBoxQuick.getSelectedItem());
        }
       
       
        player1 = new MatchHumanPlayer(player);
View Full Code Here

        mParent.removePanel(this);
        MatchStartOptions options = new MatchStartOptions();
        PlayerDataPool mPlayerDataPool = new PlayerDataPool();
        MatchPlayable player1=null;
        AIStrategiePool mAIStrategiePool = new AIStrategiePool();
        Player player;

        player = Configuration.getConfiguration().getAktivePlayer();

        CardDeckData deckData = (CardDeckData)jComboBoxDeckPlayer.getSelectedItem();
        CardDeck deck = new CardDeck(deckData);
        player.setSelectedDeckName(deck.getName() );
        player.setIsPlayerDeck(deck.isIsPlayerDeck());

        player1 = new MatchHumanPlayer(player);

        String aiName = (String) jComboBoxComputerQuest.getSelectedItem();
        NamedAIData namedAIData = mNamedAIDataPool.get(aiName);
View Full Code Here


    private void jButtonApplyQuestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonApplyQuestActionPerformed
        QuestDefinitionData quest = (QuestDefinitionData) jListActiveQuests.getSelectedValue();
        appliedQuest = quest;
        Player player = Configuration.getConfiguration().getAktivePlayer();
        mClassSetting++;
        Vector<String> pdecks = quest.getPossibleDecks();
        jComboBoxDeckPlayer.removeAllItems();
        jCheckBox15.setSelected(false);       
        jCheckBox15.setEnabled(false);       
        jComboBoxGenDeck3.setSelectedIndex(-1);
        questDeckForced = quest.getForceDeck();

        if (pdecks.size() > 0)
        {
            player.setIsPlayerDeck(false);
            for (int i = 0; i < pdecks.size(); i++)
            {
                String name = pdecks.elementAt(i);
                jComboBoxDeckPlayer.addItem(CardDeck.getComputerDeck(name).getDeckData());
            }
View Full Code Here

       BoosterPlayer p1 = player1;
       BoosterPlayer p2 = player2;
       cplayer1 = player1.cplayer;
       cplayer2 = player2.cplayer;

       Player hplayer = null;
       if (player1.hplayer != null)
       {
           hplayer=player1.hplayer;
           p1 = player1;
           p2 = player2;
           cplayer1 = player2.cplayer;
       }
       if (player2.hplayer != null)
       {
           hplayer=player2.hplayer;
           p1 = player2;
           p2 = player1;
           playerSwitch = true;
           cplayer1 = player1.cplayer;
       }
       final MatchStartOptions options = new MatchStartOptions();

       if (hplayer != null)
       {
           // human game
            MatchPlayable hplayer1=null;
            hplayer.setBoosterMode(true, player1.mDeckBase);
            hplayer1 = new MatchHumanPlayer(hplayer);

            options.setPlayer1(hplayer1);
            options.setPlayer2(cplayer1);
       }
View Full Code Here

            mOptions = options;
            mPlayers[0] = options.mPlayer1;
            if (mOptions.questMode)
            {
                // in quest mode, first player MUST be humand!
                Player player = ((MatchHumanPlayer)mPlayers[0]).getPlayer();
                if (mOptions.appliedQuest != null)
                {
                    // theoretically to be correct, this should be given to player display...
                    Player.showQuestStartInfo(mOptions.appliedQuest);
                }
View Full Code Here

            mDisplay[0].setGameOver(loser);
            mDisplay[1].setGameOver(loser);

            if (mOptions.isQuestMode())
            {
                Player player = ((MatchHumanPlayer)mPlayers[0]).getPlayer();
                AIPlayer aiplayer = ((MatchComputerPlayer)mPlayers[1]).getAIPlayer();
                player.incPlayed();
                if ((mPd[0].mLife <= 0) && (mPd[1].mLife<=0))
                {
                    player.restoreQuestState();
                    player.incDraw();
                    player.addDollar((aiplayer.getWinMoney()+1)/2);
                    player.checkQuestAfterGame(match, false);
                }
                else if (mPd[0].mLife <= 0)
                {
                    player.restoreQuestState();
                    player.incLose();
                    player.addDollar((aiplayer.getWinMoney()+9)/10);
                    player.checkQuestAfterGame(match, false);
                }
                else
                {
                    player.incWin();
                    player.addDollar(aiplayer.getWinMoney()+ player.getAdditionalWinDollars());
                    player.checkQuestAfterGame(match, true);
                }
                player.save();
            }

            for (int i = 0; i < mPlayers.length; i++)
            if (mPlayers[i] != null)
            {
View Full Code Here

                if (mPlayerTurn == 0)
                {
                    if (mPlayers[0].getPlayerType() == TYPE_HUMAN)
                    {
                        MatchHumanPlayer hp = (MatchHumanPlayer) mPlayers[0];
                        Player player = hp.getPlayer();

                        int c = getBattlefield(mPlayers[0]).getSubListByType("Creature").size();
                        if (c > player.getData().getCreatureMax())
                            player.getData().setCreatureMax(c);

                        c = getLife(mPlayers[0]);
                        if (c > player.getData().getMaxHPInGame())
                            player.getData().setMaxHPInGame(c);

                        if (combatDamageDealt > player.getData().getMaxDamageDealtToOtherPlayer())
                            player.getData().setMaxDamageDealtToOtherPlayer(combatDamageDealt);


                        // check Achievments
                        Achievement achievement = player.getNextSuccessfullAchievment("Sets");
                        while (achievement != null)
                        {
                            player.addDoneAchievment(achievement);
                            player.save();
                            mDisplay[0].setAchievmentInfo(achievement);
                            achievement = player.getNextSuccessfullAchievment();
                        }
                        combatDamageDealt = 0;

                    }
                }
                else
                {
                    if (mPlayers[0].getPlayerType() == TYPE_HUMAN)
                    {
                        MatchHumanPlayer hp = (MatchHumanPlayer) mPlayers[0];
                        Player player = hp.getPlayer();

                        if (combatDamageDealt > player.getData().getMaxDamageSurvived())
                            player.getData().setMaxDamageSurvived(combatDamageDealt);

                        int c = getLife(mPlayers[0]);
                        if (c > player.getData().getMaxHPInGame())
                            player.getData().setMaxHPInGame(c);

                        // check Achievments
                        Achievement achievement = player.getNextSuccessfullAchievment("Sets");
                        while (achievement != null)
                        {
                            player.addDoneAchievment(achievement);
                            player.save();
                            mDisplay[0].setAchievmentInfo(achievement);
                            achievement = player.getNextSuccessfullAchievment();
                        }
                        combatDamageDealt = 0;
                    }
                }
            }
            mCurrentPhase = PHASES[PHASE_BEGINNING_UNTAP];


            Weighting weightingUsed = Weighting.DEFAULT;
            if (mPlayerTurn == 0)
            {
                if (mPlayers[0] instanceof MatchComputerPlayer)
                {
                    MatchComputerPlayer cp = (MatchComputerPlayer) mPlayers[0];
                    AIPlayer aip = cp.getAIPlayer();
                    if (!aip.isScriptedAI())
                    {
                        EAIConfigurationData eaiConfig = aip.getEAIConfig();
                        if (eaiConfig != null)
                        {
                            String wName = eaiConfig.getActiveWeightingCollection();
                            weightingUsed = Weighting.buildWeighting(wName);
                        }
                    }
                }
            }
            else // if(mPlayerTurn == 1)
            {
                if (mPlayers[1] instanceof MatchComputerPlayer)
                {
                    MatchComputerPlayer cp = (MatchComputerPlayer) mPlayers[1];
                    AIPlayer aip = cp.getAIPlayer();
                    if (!aip.isScriptedAI())
                    {
                        EAIConfigurationData eaiConfig = aip.getEAIConfig();
                        if (eaiConfig != null)
                        {
                            String wName = eaiConfig.getActiveWeightingCollection();
                            weightingUsed = Weighting.buildWeighting(wName);
                        }
                    }
                }
            }


            weightingUsed.buildScore(this, mPlayerTurn, true);
            weightingUsed.buildScore(this, mPlayerNotTurn, true);

            if (!isInTestMode()) if (Configuration.getConfiguration().isShowScoreAndPauseEachRound())
            {
                setPause(true);

                WeightingPanel panel = new WeightingPanel(mPlayerTurn, weightingUsed);
                mMainDisplay.showPanelModal(panel, "Weighting player: " +mPlayerTurn);
                panel=null;
                setPause(false);
            }

            mPlayerNotTurn = mPlayerTurn;
            mPlayerTurn = (mPlayerTurn+1) % PLAYER_COUNT;
            mPlayerActive = mPlayerTurn;
            D.addLog("M:\n-------\nNew Turn " +getPhaseString(mPlayers[mPlayerTurn])+"\n-------"+mPlayers[mPlayerTurn], 3);
            mRound++;
            triggerCheck=true;
            checkAndEnqueueTriggers(mPlayers[mPlayerTurn], CardTrigger.TRIGGER_PHASE_START_TARGET_PLAYER, 0, null);
            checkRemoveTempEffectsTurnCount();
            checkEvents(0, AIEffect.AI_EFFECT_TRIGGER_ROUND_NO, null);
            checkEvents(1, AIEffect.AI_EFFECT_TRIGGER_ROUND_NO, null);
            checkEvents(0, AIEffect.AI_EFFECT_TRIGGER_EVERY_ROUND, null);
            checkEvents(1, AIEffect.AI_EFFECT_TRIGGER_EVERY_ROUND, null);
            combatDamageDealt = 0;
            initNewRound();
            if (deinitDone) return false;
        }

        checkAndEnqueueTriggers(mPlayers[mPlayerTurn], CardTrigger.TRIGGER_PHASE_START_GENERAL, 0, null);
        checkAndEnqueueTriggers(mPlayers[mPlayerNotTurn], CardTrigger.TRIGGER_PHASE_START_GENERAL, 0, null);

        if (PHASE_COMBAT_DECLARE_BLOCKERS != mCurrentPhase)
            if (!triggerCheck)
                checkAndEnqueueTriggers(mPlayers[mPlayerTurn], CardTrigger.TRIGGER_PHASE_START_TARGET_PLAYER, 0, null);
        initStackCheck(mPlayers[mPlayerTurn]);
        switch (mCurrentPhase)
        {
            case PHASE_BEGINNING_UNTAP:
            {
                // todo auto untap
                break;
            }
            case PHASE_BEGINNING_UPKEEP:
            {
                break;
            }
            case PHASE_BEGINNING_DRAW:
            {
    //         if (mCurrentPhase == PHASE_BEGINNING_DRAW)
                {
                    if (getLibrary(mPlayers[mPlayerTurn]).size()==0)
                    {
                        mPd[mPlayerTurn].mLife=0;
                        loser = mPlayers[mPlayerTurn];
                        mResults.winner[mPlayerTurn] = false;
                        mResults.winner[(mPlayerTurn+1)%2] = true;
                        mResults.lifeLeft[0] = getLife(mPlayers[0]);
                        mResults.lifeLeft[1] = getLife(mPlayers[1]);
                    }
                }

               break;
            }
            case PHASE_MAIN1:
            {
                break;
            }
            case PHASE_COMBAT_BEGIN:
            {
                break;
            }
            case PHASE_COMBAT_DECLARE_ATTACKERS:
            {
                initAttackPhase();
                break;
            }
            case PHASE_COMBAT_DECLARE_BLOCKERS:
            {
                checkEvents(mPlayerTurn, AIEffect.AI_EFFECT_TRIGGER_ATTACKING_WITH, null);
                checkEvents(mPlayerTurn, AIEffect.AI_EFFECT_TRIGGER_ATTACKING_WITH_HIGHER, null);
                mPlayerActive = mPlayerNotTurn;
                checkAndEnqueueTriggers(mPlayers[mPlayerActive], CardTrigger.TRIGGER_PHASE_START_TARGET_PLAYER, 0, null);
                initStackCheck(mPlayers[mPlayerActive]);
                break;
            }
            case PHASE_COMBAT_DAMAGE:
            {
                checkEvents(mPlayerNotTurn, AIEffect.AI_EFFECT_TRIGGER_BLOCKING_WITH, null);
                checkEvents(mPlayerNotTurn, AIEffect.AI_EFFECT_TRIGGER_BLOCKING_WITH_HIGHER, null);
                mAttackInitiated = false;
                break;
            }
            case PHASE_COMBAT_END:
            {
                cleanupCombat();
                break;
            }
            case PHASE_MAIN2:
            {
                break;
            }
            case PHASE_END_END:
            {
                break;
            }
            case PHASE_END_CLEANUP:
            {
                break;
            }
            default:
            {
                break;
            }
        }
        if (loser!=null)
        {
            playSound(null, SoundEffect.FX_EFFECT_GAME_END);
            mDisplay[0].setGameOver(loser);
            mDisplay[1].setGameOver(loser);

            if (mOptions.isQuestMode())
            {
                Player player = ((MatchHumanPlayer)mPlayers[0]).getPlayer();
                AIPlayer aiplayer = ((MatchComputerPlayer)mPlayers[1]).getAIPlayer();
                player.incPlayed();
                if ((mPd[0].mLife <= 0) && (mPd[1].mLife<=0))
                {
                    player.restoreQuestState();
                    player.incDraw();
                    player.addDollar((aiplayer.getWinMoney()+1)/2);
                    player.checkQuestAfterGame(match, false);
                }
                else if (mPd[0].mLife <= 0)
                {
                    player.restoreQuestState();
                    player.incLose();
                    player.addDollar((aiplayer.getWinMoney()+9)/10);
                    player.checkQuestAfterGame(match, false);
                }
                else
                {
                    player.incWin();
                    player.addDollar(aiplayer.getWinMoney());
                    player.checkQuestAfterGame(match, true);
                }
                player.save();

                // check Achievments
                Achievement achievement = player.getNextSuccessfullAchievment("Sets");
                while (achievement != null)
                {
                    player.addDoneAchievment(achievement);
                    player.save();
                    mDisplay[0].setAchievmentInfo(achievement);
                    achievement = player.getNextSuccessfullAchievment();
                }
            }

            for (int i = 0; i < mPlayers.length; i++)
            if (mPlayers[i] != null)
View Full Code Here

        if (mOptions.isQuestMode())
        {
            if (mLastRoundLife[1]<mPd[1].mLife)
            {
                Player player = ((MatchHumanPlayer)mPlayers[0]).getPlayer();

                if (player.checkQuestDamageOpponent(mLastRoundLife[1]-mPd[1].mLife))
                {
                    // player.save();
                }
            }
            if (mLand[1].size()< mLastLands[1])
            {
                Player player = ((MatchHumanPlayer)mPlayers[0]).getPlayer();

                if (player.checkQuestLandsDestroyed(mLand[1].size()-mLastLands[1]))
                {
                    // player.save();
                }
            }
        }
View Full Code Here

TOP

Related Classes of csa.jportal.gameModes.player.Player

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.