From b258139ee83c385e4263b1ba84e46c8f160284a2 Mon Sep 17 00:00:00 2001 From: "Jasper \"JappaWakka\" Speelman" Date: Fri, 22 Jul 2022 17:32:09 +0200 Subject: [PATCH] Added Egg Hatch command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Format: @Pokemon.Hatch(PartyIndex,[CanRename],[Message]) Description: If the Pokémon specified in the PartyIndex argument is an egg, it hatches immediately Arguments: PartyIndex (int) - Index of a Pokémon in the player's party. Values can range from 0-5. CanRename (bool) - Optional. Whether the player can rename the Pokémon or not after it hatches. Message (str) - Optional. The message to display after the Pokémon hatches. --- P3D/Screens/Pokemon/HatchEggScreen.vb | 17 +++++++++++++++-- .../V2/ScriptCommands/DoPokemon.vb | 18 ++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/P3D/Screens/Pokemon/HatchEggScreen.vb b/P3D/Screens/Pokemon/HatchEggScreen.vb index 7e1aa39c7..b2d781799 100644 --- a/P3D/Screens/Pokemon/HatchEggScreen.vb +++ b/P3D/Screens/Pokemon/HatchEggScreen.vb @@ -10,18 +10,24 @@ Dim delay As Single = 4.0F Dim size As Single = 0.0F + Dim CanRename As Boolean = True + Dim Message As String = "" + Dim cPokemon As Pokemon - Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As List(Of Pokemon)) + Public Sub New(ByVal currentScreen As Screen, ByVal Pokemon As List(Of Pokemon), Optional CanRename As Boolean = True, Optional Message As String = "") Me.PreScreen = currentScreen PlayerStatistics.Track("Eggs hatched", 1) Me.Identification = Identifications.HatchEggScreen Me.Pokemons = Pokemon + Me.cPokemon = Me.Pokemons(0) cPokemon.EggSteps = 0 Core.Player.Pokemons.Add(cPokemon) + Me.CanRename = CanRename + Me.Message = Message If cPokemon.IsShiny = True Then Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, cPokemon.Number, 3) Else @@ -85,7 +91,14 @@ cPokemon.PlayCry() SoundManager.PlaySound("success", True) Stage = 7 - TextBox.Show("Congratulations!~Your egg hatched into~a " & cPokemon.GetName() & "!*Do you want to give~a nickname to the freshly~hatched " & cPokemon.GetName() & "?%Yes|No%", AddressOf Me.ResultFunction, False, False, TextBox.DefaultColor) + If Message = "" Then + TextBox.Show("Congratulations!~Your egg hatched into~a " & cPokemon.GetName() & "!") + Else + TextBox.Show(Message) + End If + If CanRename = True Then + TextBox.Show("Do you want to give~a nickname to the freshly~hatched " & cPokemon.GetName() & "?%Yes|No%", AddressOf Me.ResultFunction, False, False, TextBox.DefaultColor) + End If End If ElseIf Stage = 7 Then If Me.IsCurrentScreen = True Then diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb index ebe77f759..fb1318059 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPokemon.vb @@ -849,6 +849,24 @@ If Core.Player.Pokemons.Count - 1 >= Index Then Core.Player.Pokemons(Index).EggSteps = StepsToSet End If + Case "hatch" + ' @Pokemon.Hatch(PartyIndex,[CanRename],[Message]) + Dim Index As Integer = int(argument.GetSplit(0, ",")) + Dim CanRename As Boolean = True + Dim Message As String = "" + Dim Pokemon As Pokemon = Nothing + If argument.Split(",").Count > 1 Then + CanRename = CBool(argument.GetSplit(1, ",")) + If argument.Split(",").Count > 2 Then + Message = CStr(argument.GetSplit(2, ",")) + End If + End If + If Core.Player.Pokemons.Count - 1 >= Index Then + Pokemon = Core.Player.Pokemons(Index) + End If + Screen.TextBox.Show("?") + SetScreen(New TransitionScreen(CType(CurrentScreen, OverworldScreen), New HatchEggScreen(CType(CurrentScreen, OverworldScreen), {Pokemon}.ToList, CanRename, Message), Color.White, False)) + CanContinue = False End Select IsReady = True