Ejemplo n.º 1
0
 private unsafe void CB_FadeOutToSummary()
 {
     _sprites.DoCallbacks();
     if (_fadeTransition.IsDone)
     {
         _fadeTransition = null;
         _textChoicesWindow.IsInvisible = true;
         if (_useGamePartyData)
         {
             _ = new SummaryGUI(_gameParty.Party[_selectionForSummary], SummaryGUI.Mode.JustView, OnSummaryClosed);
         }
         else
         {
             SpritedBattlePokemonParty party = _battleParty.Party;
             PBEBattlePokemon          bPkmn = party.BattleParty[_selectionForSummary];
             SpritedBattlePokemon      sPkmn = party[bPkmn];
             _ = new SummaryGUI(sPkmn, SummaryGUI.Mode.JustView, OnSummaryClosed);
         }
     }
 }
Ejemplo n.º 2
0
        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;
            }
            }
        }