Exemple #1
0
        // Methods
        /*Start Battle Method Outline */
        /* 1) Get good and bad guys.
         * 2) Create an array that can hold all characters.
         * 3) Sort array by agility.
         * 4) Loop through array, giving each character a turn. Start over at the first element you the last goes.(L)
         * 5) For each players turn, MATH and handle choices. (F)
         * 6) If a player character defeats an enemy, call the gainExperience method of the character and send the worth of the enemy it defeated.
         */
        public void startBattle()
        {
            mGoodGuys = mGame.getParty();
            mBadGuys = new EnemyFactory().getEnemyParty(mGoodGuys.getLevel());

            turnOrder = mGoodGuys.getTurnOrder(mBadGuys);
            selectFirstCharacter();

            while(!battleOver())
            {
                if (currentActor.mIsPlayer)
                {
                    executeAction(mGame.getPlayerAction());
                }
                else
                {
                    executeAction(currentActor.mAI.ai(turnOrder));
                }
            }
        }