Example #1
0
 private void doPlayerWin(BattlePlayer winner, BattlePlayer loser)
 {
     winner.RewardWinningPokemonExperience(loser.CurrentPokemon);
     loser.RewardLosingPokemonExperience(loser.CurrentPokemon);
     winner.DeterminePokemonLevelUp();
     loser.DeterminePokemonLevelUp();
 }
Example #2
0
        private void DetermineConclusion(BattlePlayer playerOne, BattlePlayer playerTwo)
        {
            var pokemonOne = playerOne.CurrentPokemon;
            var pokemonTwo = playerTwo.CurrentPokemon;

            if (pokemonOne.isDead())
            {
                _currentState = PokeBattleStates.PLAYER_TWO_WIN;
            }
            else if (pokemonTwo.isDead())
            {
                _currentState = PokeBattleStates.PLAYER_ONE_WIN;
            }
        }
Example #3
0
        public BattlePlayer GetPlayerForMove()
        {
            BattlePlayer playerToReturn = null;

            System.Console.WriteLine("STATE: " + StateManager._currentState);

            if (StateManager._currentState == PokeBattleStates.PLAYER_ONE)
            {
                playerToReturn = StateManager._playerOne;
            }
            else if (StateManager._currentState == PokeBattleStates.PLAYER_TWO)
            {
                playerToReturn = StateManager._playerTwo;
            }

            return(playerToReturn);
        }
Example #4
0
        private string DoPlayerMove(int moveIndex, BattlePlayer attacker, BattlePlayer defender, PokeBattleStates nextState)
        {
            var logMessage       = "";
            var attackingPokemon = attacker.CurrentPokemon;
            var defendingPokemon = defender.CurrentPokemon;

            var attackerMove = attackingPokemon.Moves[moveIndex - 1];

            var combatActionMessage    = "";
            var successfulAttack       = attackingPokemon.CombatAction(defendingPokemon, attackerMove, out combatActionMessage);
            var defendingAfflictionMsg = attackingPokemon.TriggerAilments(defendingPokemon);
            var attackingAfflictionMsg = defendingPokemon.TriggerAilments(attackingPokemon);

            if (successfulAttack && !isPlayerDisabled(defender))
            {
                logMessage += $"|{attackingPokemon.Name} used [{attackerMove.Name}]!\n";
                logMessage += combatActionMessage;
                logMessage += CreateEffectLogMessage(attackerMove, attackingPokemon, defendingPokemon);
                logMessage += defendingAfflictionMsg;
                logMessage += attackingAfflictionMsg;
                UpdateState(nextState);
            }


            if (!successfulAttack)
            {
                logMessage += $"|{attackingPokemon.Name} can't use {attackerMove.Name}! It's out of PP.";
            }
            else if (isPlayerDisabled(defender))
            {
                logMessage += $"|{attackingPokemon.Name} used [{attackerMove.Name}]!\n";
                logMessage += combatActionMessage;
                logMessage += CreateEffectLogMessage(attackerMove, attackingPokemon, defendingPokemon);
                logMessage += defendingAfflictionMsg;
                logMessage += attackingAfflictionMsg;
            }

            return(logMessage);
        }
Example #5
0
 private bool isPlayerDisabled(BattlePlayer player)
 {
     return(player.CurrentPokemon.Disabled);
 }
Example #6
0
 public PokeBattleStateManager(BattlePlayer playerOne, BattlePlayer playerTwo)
 {
     _playerOne    = playerOne;
     _playerTwo    = playerTwo;
     _currentState = PokeBattleStates.GAME_START;
 }