private void CheckForLearnMoves() { if (_learningMoves.Count != 0) { int index = _pkmn.Moveset.GetFirstEmptySlot(); if (index == -1) { SetWantsToLearnMove(); } else { Moveset.MovesetSlot slot = _pkmn.Moveset[index]; PBEMove move = _learningMoves.Dequeue(); // Remove from queue string moveStr = PBELocalizedString.GetMoveName(move).English; slot.Move = move; PBEMoveData mData = PBEMoveData.Data[move]; slot.PP = PBEDataUtils.CalcMaxPP(mData.PPTier, 0, PkmnConstants.PBESettings); slot.PPUps = 0; CreateMessage(string.Format("{0} learned {1}!", _pkmn.Nickname, moveStr)); _state = State.LearnMove_ForgotMsg; } } else { SetFadeOut(); } }
public TestPartyMovesetSlot(PBEMove move, byte ppUps, PBESettings settings) { Move = move; PPUps = ppUps; PP = PBEDataUtils.CalcMaxPP(move, ppUps, settings); }
public void SetMaxPP() { PP = PBEDataUtils.CalcMaxPP(Move, PPUps, PkmnConstants.PBESettings); }
private unsafe void DrawMovesPage(uint *bmpAddress, int bmpWidth, int bmpHeight) { const float winX = 0.08f; const float winY = 0.15f; const float winW = 0.75f - winX; const float winH = 0.9f - winY; const float moveColX = winX + 0.03f; const float moveTextX = moveColX + 0.02f; const float moveColW = 0.69f - winX; const float itemSpacingY = winH / (PkmnConstants.NumMoves + 0.75f); const float moveX = 0.21f; const float moveY = 0.03f; const float ppX = 0.12f; const float ppNumX = 0.35f; const float ppY = itemSpacingY / 2; const float cancelY = winY + moveY + (PkmnConstants.NumMoves * itemSpacingY); RenderUtils.FillRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, winX, winY, winX + winW, winY + winH, 15, RenderUtils.Color(250, 128, 120, 255)); Font moveFont = Font.Default; uint[] moveColors = Font.DefaultWhite_DarkerOutline_I; uint[] ppColors = Font.DefaultBlack_I; void Place(int i, PBEMove move, int pp, int maxPP) { PBEMoveData mData = PBEMoveData.Data[move]; float x = moveTextX; float y = winY + moveY + (i * itemSpacingY); string str = PBELocalizedString.GetTypeName(mData.Type).English; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, x, y, str, moveColors); x += moveX; str = PBELocalizedString.GetMoveName(move).English; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, x, y, str, moveColors); x = moveTextX + ppX; y += ppY; str = "PP"; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, x, y, str, ppColors); x = moveTextX + ppNumX; str = string.Format("{0}/{1}", pp, maxPP); moveFont.MeasureString(str, out int strW, out _); moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, RenderUtils.GetCoordinatesForCentering(bmpWidth, strW, x), (int)(bmpHeight * y), str, ppColors); DrawSelection(i); } void DrawSelection(int i) { if (_selectingMove != i) { return; } float x = moveColX; float y = winY + moveY + (i * itemSpacingY); float w = moveColW; float h = i == PkmnConstants.NumMoves ? itemSpacingY / 2 : itemSpacingY; RenderUtils.DrawRoundedRectangle(bmpAddress, bmpWidth, bmpHeight, x, y, x + w, y + h, 5, RenderUtils.Color(48, 180, 255, 200)); } // Moves if (_pPkmn is not null) { Moveset moves = _pPkmn.Moveset; for (int m = 0; m < PkmnConstants.NumMoves; m++) { Moveset.MovesetSlot slot = moves[m]; PBEMove move = slot.Move; if (move == PBEMove.None) { continue; } int pp = slot.PP; int maxPP = PBEDataUtils.CalcMaxPP(move, slot.PPUps, PkmnConstants.PBESettings); Place(m, move, pp, maxPP); } } else if (_pcPkmn is not null) { BoxMoveset moves = _pcPkmn.Moveset; for (int m = 0; m < PkmnConstants.NumMoves; m++) { BoxMoveset.BoxMovesetSlot slot = moves[m]; PBEMove move = slot.Move; if (move == PBEMove.None) { continue; } int maxPP = PBEDataUtils.CalcMaxPP(move, slot.PPUps, PkmnConstants.PBESettings); Place(m, move, maxPP, maxPP); } } else { PBEBattlePokemon bPkmn = _bPkmn.Pkmn; PBEBattleMoveset moves = bPkmn.Status2.HasFlag(PBEStatus2.Transformed) ? bPkmn.TransformBackupMoves : bPkmn.Moves; for (int m = 0; m < PkmnConstants.NumMoves; m++) { PBEBattleMoveset.PBEBattleMovesetSlot slot = moves[m]; PBEMove move = slot.Move; if (move == PBEMove.None) { continue; } int pp = slot.PP; int maxPP = slot.MaxPP; Place(m, move, pp, maxPP); } } // Cancel or new move if (_learningMove != PBEMove.None) { uint[] learnColors = Font.DefaultBlue_I; PBEMoveData mData = PBEMoveData.Data[_learningMove]; float x = moveTextX; string str = PBELocalizedString.GetTypeName(mData.Type).English; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, x, cancelY, str, learnColors); x += moveX; str = PBELocalizedString.GetMoveName(_learningMove).English; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, x, cancelY, str, learnColors); DrawSelection(PkmnConstants.NumMoves); } else { if (_selectingMove != -1) { string str = "Cancel"; moveFont.DrawString(bmpAddress, bmpWidth, bmpHeight, moveTextX, cancelY, str, moveColors); DrawSelection(PkmnConstants.NumMoves); } } }
private void CB_Evolution() { switch (_state) { case State.FadeIn: { if (_fadeTransition.IsDone) { _fadeTransition = null; _stringWindow = new Window(0, 0.79f, 1, 0.16f, RenderUtils.Color(255, 255, 255, 255)); CreateMessage(string.Format("{0} is evolving!", _oldNickname)); _state = State.IsEvolvingMsg; } return; } case State.IsEvolvingMsg: { if (ReadMessage()) { _stringPrinter.Close(); _stringPrinter = null; _fadeTransition = new FadeToColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200)); _state = State.FadeToWhite; } return; } case State.FadeToWhite: { if (TryCancelEvolution()) { _fadeTransition = null; CreateMessage(string.Format("{0} stopped evolving!", _oldNickname)); _state = State.CancelledMsg; return; } if (_fadeTransition.IsDone) { _fadeTransition = null; if (_evo.Method == EvoMethod.Ninjask_LevelUp) { Evolution.TryCreateShedinja(_pkmn); } _pkmn.Evolve(_evo); LoadPkmnImage(); _fadeTransition = new FadeFromColorTransition(1_000, RenderUtils.ColorNoA(200, 200, 200)); _state = State.FadeToEvo; } return; } case State.FadeToEvo: { if (_fadeTransition.IsDone) { _fadeTransition = null; SoundControl.PlayCry(_pkmn.Species, _pkmn.Form); CreateMessage(string.Format("{0} evolved into {1}!", _oldNickname, PBELocalizedString.GetSpeciesName(_pkmn.Species).English)); _state = State.EvolvedIntoMsg; } return; } case State.EvolvedIntoMsg: { if (ReadMessage()) { _stringPrinter.Close(); _stringPrinter = null; // Check for moves to learn _learningMoves = new Queue <PBEMove>(new LevelUpData(_pkmn.Species, _pkmn.Form).GetNewMoves(_pkmn.Level)); CheckForLearnMoves(); } return; } case State.FadeOut: { if (_fadeTransition.IsDone) { _fadeTransition = null; OverworldGUI.Instance.ReturnToFieldWithFadeInAfterEvolutionCheck(); } return; } case State.CancelledMsg: { if (ReadMessage()) { _stringPrinter.Close(); _stringPrinter = null; SetFadeOut(); } return; } // Learning moves case State.LearnMove_WantsToLearnMoveMsg: { if (ReadMessageEnded()) { TextGUIChoices.CreateStandardYesNoChoices(ShouldLearnMoveAction, out _textChoices, out _textChoicesWindow); _state = State.LearnMove_WantsToLearnMoveChoice; } return; } case State.LearnMove_WantsToLearnMoveChoice: case State.LearnMove_GiveUpLearningChoice: { HandleMultichoice(); return; } case State.LearnMove_FadeToSummary: { if (_fadeTransition.IsDone) { _fadeTransition = null; _stringWindow.IsInvisible = true; _textChoicesWindow.Close(); _textChoicesWindow = null; _textChoices.Dispose(); _textChoices = null; _stringPrinter.Close(); _stringPrinter = null; _ = new SummaryGUI(_pkmn, SummaryGUI.Mode.LearnMove, OnSummaryClosed, learningMove: _learningMoves.Peek()); } return; } case State.LearnMove_FadeFromSummary: { if (_fadeTransition.IsDone) { // Give up on learning if (_forgetMove == -1 || _forgetMove == PkmnConstants.NumMoves) { SetGiveUpLearningMove(); } else { Moveset.MovesetSlot slot = _pkmn.Moveset[_forgetMove]; PBEMove oldMove = slot.Move; string oldMoveStr = PBELocalizedString.GetMoveName(oldMove).English; PBEMove move = _learningMoves.Dequeue(); // Remove from queue string moveStr = PBELocalizedString.GetMoveName(move).English; slot.Move = move; PBEMoveData mData = PBEMoveData.Data[move]; slot.PP = PBEDataUtils.CalcMaxPP(mData.PPTier, 0, PkmnConstants.PBESettings); slot.PPUps = 0; CreateMessage(string.Format("{0} forgot {1}\nand learned {2}!", _pkmn.Nickname, oldMoveStr, moveStr)); _state = State.LearnMove_ForgotMsg; } } return; } case State.LearnMove_GiveUpLearningMsg: { if (ReadMessageEnded()) { TextGUIChoices.CreateStandardYesNoChoices(ShouldGiveUpMoveAction, out _textChoices, out _textChoicesWindow); _state = State.LearnMove_GiveUpLearningChoice; } return; } case State.LearnMove_DidNotLearnMsg: case State.LearnMove_ForgotMsg: { if (ReadMessage()) { _stringPrinter.Close(); _stringPrinter = null; CheckForLearnMoves(); } return; } } }
public void SetMaxPP() { PP = PBEDataUtils.CalcMaxPP(Move, PPUps, PBESettings.DefaultSettings); }