Beispiel #1
0
        public void continueBattle(BattleAction battleAction)
        {
            if (battleAction != null)
            {
                battleTurns[battleTurns.Count - 1].addBattleAction(battleAction);
            }
            BattleCharacter nextNotActionedCharacter = battleTurns[battleTurns.Count - 1].getNextNotActionedCharacter();

            if (nextNotActionedCharacter == null)
            {
                //no next character
                //means all characters already choose actions, start this turn
                battleTurns[battleTurns.Count - 1].start();
                //judge the result of this battle
                if (this.isWin())
                {
                    this.result = BattleConstants.RESULT_WIN;
                    battleManager.log(result);
                }
                else if (this.isLose())
                {
                    this.result = BattleConstants.RESULT_LOSE;
                    battleManager.log(result);
                }
                //Enter next turn
                BattleTurn battleTurn = new BattleTurn(battleManager, battleCharacters);
                battleTurns.Add(battleTurn);
                battleManager.log("Turn: " + battleTurns.Count + "\n\n");
                //get new next character
                nextNotActionedCharacter = battleTurns[battleTurns.Count - 1].getNextNotActionedCharacter();
            }
            battleManager.updateBattleActionOptions(nextNotActionedCharacter);
        }
Beispiel #2
0
 public void continueBattle(BattleAction battleAction)
 {
     if (battleAction != null) {
         battleTurns[battleTurns.Count - 1].addBattleAction(battleAction);
     }
     BattleCharacter nextNotActionedCharacter = battleTurns[battleTurns.Count - 1].getNextNotActionedCharacter();
     if (nextNotActionedCharacter == null) {
         //no next character
         //means all characters already choose actions, start this turn
         battleTurns[battleTurns.Count - 1].start();
         //judge the result of this battle
         if (this.isWin()) {
             this.result = BattleConstants.RESULT_WIN;
             battleManager.log(result);
         } else if (this.isLose()) {
             this.result = BattleConstants.RESULT_LOSE;
             battleManager.log(result);
         }
         //Enter next turn
         BattleTurn battleTurn = new BattleTurn(battleManager, battleCharacters);
         battleTurns.Add(battleTurn);
         battleManager.log("Turn: " + battleTurns.Count + "\n\n");
         //get new next character
         nextNotActionedCharacter = battleTurns[battleTurns.Count - 1].getNextNotActionedCharacter();
     }
     battleManager.updateBattleActionOptions(nextNotActionedCharacter);
 }
Beispiel #3
0
        public void start()
        {
            string log = "battle: (";

            for (int i = 0; i < battleCharacters.Count; i++)
            {
                log += battleCharacters[i].name + "(HP:" + battleCharacters[i].statuses["HP"] + ")  ";
            }
            log += ")";
            battleManager.log(log);

            BattleTurn battleTurn = new BattleTurn(battleManager, battleCharacters);

            battleTurns.Add(battleTurn);
            battleManager.log("Turn: " + battleTurns.Count);

            this.continueBattle(null);
        }
Beispiel #4
0
        public void start()
        {
            string log = "battle: (";
            for (int i = 0; i < battleCharacters.Count; i++) {
                log += battleCharacters[i].name + "(HP:" + battleCharacters[i].statuses["HP"] + ")  ";
            }
            log += ")";
            battleManager.log(log);

            BattleTurn battleTurn = new BattleTurn(battleManager, battleCharacters);
            battleTurns.Add(battleTurn);
            battleManager.log("Turn: " + battleTurns.Count);

            this.continueBattle(null);
        }