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; } }
private void ChoosingPokemon(GameTime gameTime) { _textPanel.BattleText.FirstLine = "You have forgotten how to change"; _textPanel.BattleText.SecondLine = "your active Pokemon!"; _textPanel.TextPromptArrow.WaitingForTextToAppear(gameTime); if (_textPanel.TextPromptArrow.State == TextArrowState.Clicked) { CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction; } }
private void ChoosingItem(GameTime gameTime) { _textPanel.BattleText.FirstLine = "You have no items in your bag!"; _textPanel.BattleText.SecondLine = ""; _textPanel.TextPromptArrow.WaitingForTextToAppear(gameTime); if (_textPanel.TextPromptArrow.State == TextArrowState.Clicked) { CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction; } }
public void ChoosingAttack(GameTime gameTime) { _textPanel.BattleText.FirstLine = ""; _textPanel.BattleText.SecondLine = ""; _attackMenu.SetPokemon(ActiveAlliedPokemon.PokemonInstance); _attackMenu.Visible = true; _attackChoiceArrow.Visible = true; if (InputHandler.ActionKeyPressed(ActionKey.Back, PlayerIndex.One)) { // Return to action menu CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction; _attackMenu.Visible = false; _attackChoiceArrow.Visible = false; } else if (InputHandler.ActionKeyPressed(ActionKey.ConfirmAndInteract, PlayerIndex.One)) { bool validMoveChosen = false; switch (_attackChoiceArrow.AttackChoiceArrowPosition) { case AttackChoiceArrowPosition.Move1: if (ActiveAlliedPokemon.PokemonInstance.Moves[0].RemainingPP > 0) { PlayerChosenAttack = AttackChoiceArrowPosition.Move1; validMoveChosen = true; } break; case AttackChoiceArrowPosition.Move2: if (ActiveAlliedPokemon.PokemonInstance.Moves[1].RemainingPP > 0) { PlayerChosenAttack = AttackChoiceArrowPosition.Move2; validMoveChosen = true; } break; case AttackChoiceArrowPosition.Move3: if (ActiveAlliedPokemon.PokemonInstance.Moves[2].RemainingPP > 0) { PlayerChosenAttack = AttackChoiceArrowPosition.Move3; validMoveChosen = true; } break; case AttackChoiceArrowPosition.Move4: if (ActiveAlliedPokemon.PokemonInstance.Moves[3].RemainingPP > 0) { PlayerChosenAttack = AttackChoiceArrowPosition.Move4; validMoveChosen = true; } break; } if (validMoveChosen) { CurrentPhase = BattlePhase.EnemyTurn; CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAction; PreviousPlayerAttack = PlayerChosenAttack; _attackMenu.Visible = false; _attackChoiceArrow.Visible = false; } } }
public void ChoosingAction(GameTime gameTime) { _actionMenu.Visible = true; _actionChoiceArrow.Visible = true; _textPanel.BattleText.FirstLine = "What will"; _textPanel.BattleText.SecondLine = ActiveAlliedPokemon.PokemonInstance.Archetype.Name + " do?"; if (InputHandler.ActionKeyPressed(ActionKey.ConfirmAndInteract, PlayerIndex.One)) { switch (_actionChoiceArrow.ActionChoiceArrowPosition) { case ActionChoiceArrowPosition.Fight: CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingAttack; _attackChoiceArrow.SetPosition(PreviousPlayerAttack); break; case ActionChoiceArrowPosition.Pokemon: CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingPokemon; break; case ActionChoiceArrowPosition.Bag: CurrentPlayerTurnPhase = PlayerTurnPhase.ChoosingItem; break; case ActionChoiceArrowPosition.Run: CurrentPlayerTurnPhase = PlayerTurnPhase.Running; break; } _actionMenu.Visible = false; _actionChoiceArrow.Visible = false; } }
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(); }