private void SetUpPositionQuery(int index, bool left, bool center, bool right) { SpritedBattlePokemonParty party = _battleParty.Party; PBEBattlePokemon bPkmn = party.BattleParty[index]; SpritedBattlePokemon sPkmn = party[bPkmn]; PartyPokemon pkmn = sPkmn.PartyPkmn; _message = string.Format("Send {0} where?", pkmn.Nickname); CloseChoices(); void BackCommand() { CloseChoices(); BringUpPkmnActions(index); } _textChoices = new TextGUIChoices(0, 0, backCommand: BackCommand, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O); if (left) { _textChoices.Add(new TextGUIChoice("Send Left", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Left))); } if (center) { _textChoices.Add(new TextGUIChoice("Send Center", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Center))); } if (right) { _textChoices.Add(new TextGUIChoice("Send Right", () => SelectForBattleReplacement(bPkmn, PBEFieldPosition.Right))); } _textChoices.Add(new TextGUIChoice("Cancel", BackCommand)); _textChoices.GetSize(out int width, out int height); _textChoicesWindow = new Window(0.6f, 0.3f, width, height, RenderUtils.Color(255, 255, 255, 255)); RenderChoicesOntoWindow(); Game.Instance.SetCallback(CB_Choices); }
public ActionsGUI(SpritedBattlePokemonParty party, PBEBattlePokemon pkmn) { _party = party; _pkmn = pkmn; _fightChoices = new TextGUIChoices(0.75f, 0.75f, bottomAlign: true, font: Font.Default, fontColors: Font.DefaultWhite_I, selectedColors: Font.DefaultYellow_O, disabledColors: Font.DefaultDisabled); _fightChoices.Add(new TextGUIChoice("Fight", FightChoice)); bool enabled = pkmn.CanSwitchOut(); // Cannot switch out or use item if TempLockedMove exists Action command = enabled ? PokemonChoice : null; _fightChoices.Add(new TextGUIChoice("Pokémon", command, isEnabled: enabled)); command = enabled ? BagChoice : null; _fightChoices.Add(new TextGUIChoice("Bag", command, isEnabled: enabled)); enabled = pkmn.Trainer.ActiveBattlersOrdered.First() == pkmn && pkmn.Trainer.IsFleeValid() is null; // Only first Pokémon can "select" run command = enabled ? RunChoice : null; _fightChoices.Add(new TextGUIChoice("Run", command, isEnabled: enabled)); }
private void BringUpPkmnActions(int index) { string nickname; _textChoices = new TextGUIChoices(0, 0, backCommand: CloseChoicesThenGoToLogicTick, font: Font.Default, fontColors: Font.DefaultDarkGray_I, selectedColors: Font.DefaultYellow_O); switch (_mode) { case Mode.PkmnMenu: { PartyPokemon pkmn = _gameParty.Party[index]; nickname = pkmn.Nickname; _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); AddFieldMovesToActions(pkmn, index); break; } case Mode.SelectDaycare: { PartyPokemon pkmn = _gameParty.Party[index]; nickname = pkmn.Nickname; if (!pkmn.IsEgg) { _textChoices.Add(new TextGUIChoice("Select", () => Action_SelectPartyPkmn(index))); } _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); break; } case Mode.BattleSwitchIn: case Mode.BattleReplace: // Currently same logic { SpritedBattlePokemonParty party = _battleParty.Party; PBEBattlePokemon bPkmn = party.BattleParty[index]; SpritedBattlePokemon sPkmn = party[bPkmn]; PartyPokemon pkmn = sPkmn.PartyPkmn; nickname = pkmn.Nickname; // Cannot switch in if active already or fainted, or in the switch stand by if (!pkmn.IsEgg && bPkmn.FieldPosition == PBEFieldPosition.None && bPkmn.HP > 0 && !BattleGUI.Instance.StandBy.Contains(bPkmn)) { _textChoices.Add(new TextGUIChoice("Switch In", () => Action_SelectPartyPkmn(index))); } _textChoices.Add(new TextGUIChoice("Check summary", () => Action_BringUpSummary(index))); break; } default: throw new Exception(); } _textChoices.Add(new TextGUIChoice("Cancel", CloseChoicesThenGoToLogicTick)); _textChoices.GetSize(out int width, out int height); _textChoicesWindow = new Window(0.6f, 0.3f, width, height, RenderUtils.Color(255, 255, 255, 255)); RenderChoicesOntoWindow(); _message = string.Format("Do what with {0}?", nickname); Game.Instance.SetCallback(CB_Choices); }
private void AddFieldMovesToActions(PartyPokemon pkmn, int index) { void Add(PBEMove move, Action command) { string str = PBELocalizedString.GetMoveName(move).English; _textChoices.Add(new TextGUIChoice(str, command, fontColors: Font.DefaultBlue_I)); } Moveset moves = pkmn.Moveset; if (moves.Contains(PBEMove.Surf)) { Add(PBEMove.Surf, () => Action_FieldSurf(index)); } }
private void CreateMoveChoices() { if (_moveChoices is null) { PBEBattleMoveset moves = _pkmn.Moves; PBEMove[] usableMoves = _pkmn.GetUsableMoves(); _moveChoices = new TextGUIChoices(0.75f, 0.75f, bottomAlign: true, backCommand: SetCallbacksForAllChoices, font: Font.Default, fontColors: Font.DefaultWhite_I, selectedColors: Font.DefaultYellow_O, disabledColors: Font.DefaultDisabled); for (int i = 0; i < PkmnConstants.NumMoves; i++) { PBEBattleMoveset.PBEBattleMovesetSlot slot = moves[i]; PBEMove m = slot.Move; string text = PBEDataProvider.Instance.GetMoveName(m).English; bool enabled = Array.IndexOf(usableMoves, m) != -1; Action command = enabled ? () => SelectMoveForTurn(m) : null; _moveChoices.Add(new TextGUIChoice(text, command, isEnabled: enabled)); } } }