Package csa.jportal.gameModes.player.achievments

Examples of csa.jportal.gameModes.player.achievments.Achievement


                        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);
View Full Code Here


    public Achievement getNextSuccessfullAchievment()
    {
        Vector<Achievement> open = getOpenAchievements("");
        for (int i = 0; i < open.size(); i++)
        {
            Achievement achievement = open.elementAt(i);
            if (achievement.testAchievment(this))
            {
                return achievement;
            }
        }
        return null;
View Full Code Here

    public Achievement getNextSuccessfullAchievment(String notClass)
    {
        Vector<Achievement> open = getOpenAchievementsNotClass(notClass);
        for (int i = 0; i < open.size(); i++)
        {
            Achievement achievement = open.elementAt(i);
            if (achievement.testAchievment(this))
            {
                return achievement;
            }
        }
        return null;
View Full Code Here

    {
        int s =0;
        Vector<Achievement> done = getDoneAchievements("");
        for (int i = 0; i < done.size(); i++)
        {
            Achievement achievement = done.elementAt(i);
            s+=achievement.getScore();
        }
        return s;
    }
View Full Code Here

    {
        Vector<Achievement> all = Achievement.getAchievementsForClass(classes);
        Vector<Achievement> done = new Vector<Achievement>();
        for (int i = 0; i < all.size(); i++)
        {
            Achievement achievement = all.elementAt(i);
            for (int a = 0; a < mData.mAchievmentsReached.size(); a++)
            {
                String set = mData.mAchievmentsReached.elementAt(a);
                if (achievement.getName().equals(set))
                {
                    done.addElement(achievement);
                    break;
                }
            }
View Full Code Here

    {
        Vector<Achievement> all = Achievement.getAchievementsForClass(classes);
        Vector<Achievement> open = new Vector<Achievement>();
        for (int i = 0; i < all.size(); i++)
        {
            Achievement achievement = all.elementAt(i);
            boolean found = false;
            for (int a = 0; a < mData.mAchievmentsReached.size(); a++)
            {
                String set = mData.mAchievmentsReached.elementAt(a);
                if (achievement.getName().equals(set))
                {
                    found = true;
                }
            }
            if (!found)
View Full Code Here

    {
        Vector<Achievement> all = Achievement.getAchievementsForNotClass(notClass);
        Vector<Achievement> open = new Vector<Achievement>();
        for (int i = 0; i < all.size(); i++)
        {
            Achievement achievement = all.elementAt(i);
            boolean found = false;
            for (int a = 0; a < mData.mAchievmentsReached.size(); a++)
            {
                String set = mData.mAchievmentsReached.elementAt(a);
                if (achievement.getName().equals(set))
                {
                    found = true;
                }
            }
            if (!found)
View Full Code Here

    }
    public void testAchievment()
    {

        // check Achievments
        Achievement achievement = getNextSuccessfullAchievment();
        while (achievement != null)
        {
            addDoneAchievment(achievement);
            save();
            new AchievmentAnnouncementModalPanel(Configuration.getConfiguration().getMainFrame().getRootPane(),Configuration.getConfiguration().getMainFrame(), achievement);
View Full Code Here

   
    public void testAchievmentNotClass(String notClass)
    {

        // check Achievments
        Achievement achievement = getNextSuccessfullAchievment(notClass);
        while (achievement != null)
        {
            addDoneAchievment(achievement);
            save();
            new AchievmentAnnouncementModalPanel(Configuration.getConfiguration().getMainFrame().getRootPane(),Configuration.getConfiguration().getMainFrame(), achievement);
View Full Code Here

TOP

Related Classes of csa.jportal.gameModes.player.achievments.Achievement

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.