Added Egg Hatch command

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.
This commit is contained in:
Jasper "JappaWakka" Speelman 2022-07-22 17:32:09 +02:00
parent d1698db4ba
commit b258139ee8
2 changed files with 33 additions and 2 deletions

View File

@ -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

View File

@ -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