diff --git a/P3D/Pokemon/Monster/Resource/PokemonForms.vb b/P3D/Pokemon/Monster/Resource/PokemonForms.vb index 4918ebf9c..23b1acd4b 100644 --- a/P3D/Pokemon/Monster/Resource/PokemonForms.vb +++ b/P3D/Pokemon/Monster/Resource/PokemonForms.vb @@ -475,6 +475,24 @@ Public Class PokemonForms Return Nothing + End Function + Public Shared Function GetDataFileForms(ByVal Number As Integer) As List(Of String) + Dim Forms As New List(Of String) + Forms.Add(Number.ToString) + If _pokemonList.Count > 0 Then + For Each listP In _pokemonList + If listP.IsNumber(Number) = True AndAlso listP.AdditionalValue <> "" AndAlso listP.DataFileSuffix <> "" Then + Forms.Add(listP.AdditionalValue) + End If + Next + End If + + If Forms.Count > 0 Then + Return Forms + End If + + Return Nothing + End Function Public Shared Function GetAdditionalValueFromDataFile(ByVal DataFile As String) As String diff --git a/P3D/Screens/Inventory/PokegearScreen.vb b/P3D/Screens/Inventory/PokegearScreen.vb index 3e8616102..9ee9358fc 100644 --- a/P3D/Screens/Inventory/PokegearScreen.vb +++ b/P3D/Screens/Inventory/PokegearScreen.vb @@ -1859,6 +1859,7 @@ Select Case Me.Content.ToLower() Case "[pokedexentry]" Dim triedIDs As New List(Of Integer) + Dim triedADs As New List(Of String) Dim chosenID As Integer = -1 Dim chosenAD As String = "" @@ -1868,16 +1869,18 @@ If Pokedex.GetEntryType(Core.Player.PokedexData, Pokedex.PokemonIDs(ID)) < 2 Then triedIDs.Add(ID) Else - If Pokedex.PokemonIDs(ID).Contains("_") Then - chosenID = CInt(Pokedex.PokemonIDs(ID).GetSplit(0, "_")) - chosenAD = PokemonForms.GetAdditionalValueFromDataFile(Pokedex.PokemonIDs(ID)) - ElseIf Pokedex.PokemonIDs(ID).Contains(";") Then - chosenID = CInt(Pokedex.PokemonIDs(ID).GetSplit(0, ";")) - chosenAD = Pokedex.PokemonIDs(ID).GetSplit(1, ";") + If PokemonForms.GetDataFileForms(ID).Count > 0 Then + Dim FormList As List(Of String) = PokemonForms.GetDataFileForms(ID) + Dim FormString As Integer = Core.Random.Next(0, FormList.Count - 1) + If Pokedex.PokemonIDs(FormString).Contains("_") Then + chosenID = CInt(Pokedex.PokemonIDs(FormString).GetSplit(0, "_")) + chosenAD = PokemonForms.GetAdditionalValueFromDataFile(Pokedex.PokemonIDs(FormString)) + Else + chosenID = FormString + End If Else chosenID = ID End If - End If End If End While