Example #1
0
        private void TryToRun(GameTime gameTime)
        {
            if(!EnemyTrainer.Name.Equals("Tall Grass"))
            {
                _textPanel.BattleText.FirstLine = "You can't run from an enemy trainer!";
                _textPanel.BattleText.SecondLine = "";
                _textPanel.TextPromptArrow.WaitingForTextToAppear(gameTime);

                if (_textPanel.TextPromptArrow.State == TextArrowState.Clicked)
                    CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction;
            }
            else
            {
                CurrentPhase = BattlePhase.Ending;
                BattleConclusion = BattleConclusion.PlayerRan;
            }
        }
Example #2
0
        private void ChangePokemon(GameTime gameTime)
        {
            ChangingPokemonState = ChangingPokemon.None;

            _textPanel.TextPromptArrow.WaitingForTextToAppear(gameTime);

            if (ActiveAlliedPokemon.PokemonInstance.CurrentHealth == 0)
            {
                foreach (var pokemon in AlliedTrainer.PokemonSet.Where(pokemon => pokemon.CurrentHealth > 0))
                {
                    ActiveAlliedPokemon.PokemonInstance = pokemon;
                    ActiveAlliedPokemon.PokemonInstance.PrepareForCombat(RenderingPosition.Ally);
                    _attackMenu.SetPokemon(ActiveAlliedPokemon.PokemonInstance);
                    _allyPokemonPanel.SetPokemon(ActiveAlliedPokemon.PokemonInstance);

                    ChangingPokemonState = ChangingPokemon.Ally;
                    CurrentPhase = BattlePhase.AllyTurn;
                    AttackState = AttackState.Undecided;
                    break;
                }

                if (ChangingPokemonState == ChangingPokemon.None)
                {
                    BattleConclusion = BattleConclusion.PlayerLost;
                    Game1.StateManager.ChangeState(((Game1) Game).GameOverScreen);
                }
            }
            else if (ActiveEnemyPokemon.PokemonInstance.CurrentHealth == 0)
            {
                foreach (var pokemon in EnemyTrainer.PokemonSet.Where(pokemon => pokemon.CurrentHealth > 0))
                {
                    ActiveEnemyPokemon.PokemonInstance = pokemon;
                    ActiveEnemyPokemon.PokemonInstance.PrepareForCombat(RenderingPosition.Enemy);
                    _enemyPokemonPanel.SetPokemon(ActiveEnemyPokemon.PokemonInstance);

                    ChangingPokemonState = ChangingPokemon.Enemy;
                    CurrentPhase = BattlePhase.AllyTurn;
                    AttackState = AttackState.Undecided;
                    break;
                }

                if (ChangingPokemonState == ChangingPokemon.None)
                {
                    if (EnemyTrainer.Name.Equals("Lehmann"))
                        Game1.StateManager.ChangeState(((Game1)Game).VictoryScreen);
                }
            }

            if (ChangingPokemonState == ChangingPokemon.None)
            {
                CurrentPhase = BattlePhase.Ending;
                if (ActiveEnemyPokemon.PokemonInstance.CurrentHealth == 0)
                {
                    AudioController.RequestTrack("battle").Stop();
                    AudioController.RequestTrack("victory").Play();
                    BattleConclusion = BattleConclusion.PlayerWon;
                }
                else
                {
                    BattleConclusion = BattleConclusion.PlayerLost;
                }
            }
        }
Example #3
0
        private void PlayerRunning(GameTime gameTime)
        {
            _textPanel.BattleText.FirstLine = "Got away safely.";
            _textPanel.BattleText.SecondLine = "";

            _textPanel.TextPromptArrow.WaitingForTextToAppear(gameTime);

            if (_textPanel.TextPromptArrow.State == TextArrowState.Clicked)
            {
                CurrentPhase = BattlePhase.Ending;
                BattleConclusion = BattleConclusion.PlayerRan;
            }
        }
Example #4
0
        public Battle(Game1 game, Trainer alliedTrainer, Trainer enemyTrainer, bool trainerBattle)
            : base(game)
        {
            Camera = new Camera(game.ScreenRectangle) {Zoom = 4f};
            Camera.LockToCenter(game.ScreenRectangle);

            _trainerBattle = trainerBattle;
            CurrentPhase = BattlePhase.Starting;

            AlliedTrainer = alliedTrainer;
            AlliedTrainer.PrepareForCombat(RenderingPosition.Ally);

            EnemyTrainer = enemyTrainer;
            EnemyTrainer.PrepareForCombat(RenderingPosition.Enemy);

            foreach (var pokemon in EnemyTrainer.PokemonSet.Where(pokemon => pokemon.CurrentHealth > 0))
            {
                ActiveEnemyPokemon = new PokemonWrapper(game, pokemon);
                break;
            }

            foreach (var pokemon in AlliedTrainer.PokemonSet.Where(pokemon => pokemon.CurrentHealth > 0))
            {
                ActiveAlliedPokemon = new PokemonWrapper(game, pokemon);
                break;
            }

            ActiveAlliedPokemon.PokemonInstance.PrepareForCombat(RenderingPosition.Ally);
            ActiveEnemyPokemon.PokemonInstance.PrepareForCombat(RenderingPosition.Enemy);

            // Initiate state
            BattleConclusion = BattleConclusion.Undecided;
            EndStage = EndStage.DisplayResult;
            CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction;
            RewardState = RewardState.ExperienceToBeAwarded;

            LoadContent();
        }