From 0b69b854b9fe868374a66d3237dd348fd1efc077 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Thu, 13 Jul 2023 16:15:19 +0200 Subject: [PATCH] =?UTF-8?q?More=20Pok=C3=A9dex=20form=20support=20progress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- P3D/Content/Pokemon/Data/386.dat | 1 + P3D/Player/Pokedex.vb | 25 ++++++++++++++++---- P3D/Pokemon/Monster/Pokemon.vb | 12 ++++++++++ P3D/Screens/Pokedex/PokedexScreen.vb | 34 +++++++++++++++++++++------- 4 files changed, 60 insertions(+), 12 deletions(-) diff --git a/P3D/Content/Pokemon/Data/386.dat b/P3D/Content/Pokemon/Data/386.dat index a40996e87..6c593721a 100644 --- a/P3D/Content/Pokemon/Data/386.dat +++ b/P3D/Content/Pokemon/Data/386.dat @@ -49,3 +49,4 @@ Move|81,105 Move|89,354 Move|97,63 TradeValue|120 +DexForms|attack,defense,speed diff --git a/P3D/Player/Pokedex.vb b/P3D/Player/Pokedex.vb index 590c54735..5ec760a63 100644 --- a/P3D/Player/Pokedex.vb +++ b/P3D/Player/Pokedex.vb @@ -6,6 +6,7 @@ '3 = shiny + caught + seen Public Shared AutoDetect As Boolean = True + Public Shared PokemonMaxCount As Integer = 893 Public Shared PokemonCount As Integer = 893 Public Shared PokemonIDs As New List(Of String) @@ -92,14 +93,20 @@ cOriginalEntry = GetEntryType(Data, ID.GetSplit(0, ";")).ToString End If + If ID.Contains("_") Then + If Pokemon.GetPokemonByID(CInt(ID.GetSplit(0, "_"))).DexForms.Contains(ID.GetSplit(1, "_")) Then + cOriginalEntry = GetEntryType(Data, ID.GetSplit(0, "_")).ToString + End If + End If + Dim cEntry As Integer = GetEntryType(Data, ID) Dim cData As String = Data If cOriginalEntry <> "" Then If CInt(cOriginalEntry) < Type Then - If Data.Contains("{" & ID.GetSplit(0, ";") & "|") = True Then - cData = Data.Replace("{" & ID.GetSplit(0, ";") & "|" & cEntry & "}", "{" & ID.GetSplit(0, ";") & "|" & Type & "}") + If Data.Contains("{" & ID.GetSplit(0, ";").GetSplit(0, "_") & "|") = True Then + cData = Data.Replace("{" & ID.GetSplit(0, ";").GetSplit(0, "_") & "|" & cEntry & "}", "{" & ID.GetSplit(0, ";").GetSplit(0, "_") & "|" & Type & "}") Else - cData &= Environment.NewLine & "{" & ID.GetSplit(0, ";") & "|" & Type & "}" + cData &= Environment.NewLine & "{" & ID.GetSplit(0, ";").GetSplit(0, "_") & "|" & Type & "}" End If End If End If @@ -114,6 +121,15 @@ If cData <> "" Then cData &= Environment.NewLine End If + + If ID.Contains("_") Then + If Pokemon.GetPokemonByID(CInt(ID.GetSplit(0, "_"))).DexForms.Contains(ID.GetSplit(1, "_")) Then + If cData.Contains("{" & ID.GetSplit(0, "_") & "|") = False Then + cData &= "{" & ID.GetSplit(0, "_") & "|" & Type & "}" & Environment.NewLine + End If + End If + End If + If ID.Contains(";") Then If cData.Contains("{" & ID.GetSplit(0, ";") & "|") = False Then cData &= "{" & ID.GetSplit(0, ";") & "|" & Type & "}" & Environment.NewLine @@ -236,6 +252,7 @@ Public IncludeExternalPokemon As Boolean = False 'for the pokedex screen, if true, this pokedex view will include all Pokémon seen/caught at the end. Public Sub New(ByVal input As String) + Dim data() As String = input.Split(CChar("|")) Me.Name = data(0) @@ -246,7 +263,7 @@ Dim Place As Integer = 1 For Each l As String In pokemonData - l = l.Replace("[MAX]", POKEMONCOUNT.ToString()) + l = l.Replace("[MAX]", PokemonMaxCount.ToString()) If l.Contains("-") = True AndAlso l.Contains("_") = False Then Dim range() As String = l.Split(CChar("-")) diff --git a/P3D/Pokemon/Monster/Pokemon.vb b/P3D/Pokemon/Monster/Pokemon.vb index 43f4f9a91..3d3c75427 100644 --- a/P3D/Pokemon/Monster/Pokemon.vb +++ b/P3D/Pokemon/Monster/Pokemon.vb @@ -632,6 +632,7 @@ Public Class Pokemon Public Cry As SoundEffect Public WildItems As New Dictionary(Of Integer, String) Public RegionalForms As String = "" + Public DexForms As New List(Of String) Private _name As String Private _number As Integer @@ -1490,6 +1491,17 @@ Public Class Pokemon Me.EggPokemon = Value Case "regionalforms" Me.RegionalForms = Value + Case "dexforms" + If Value <> "" Then + If Value.Contains(",") = True Then + Dim FormValue() As String = Value.Split(CChar(",")) + For i = 0 To FormValue.Length - 1 + Me.DexForms.Add(FormValue(i)) + Next + Else + Me.DexForms.Add(Value) + End If + End If Case "canbreed" Me.CanBreed = CBool(Value) Case "basehp" diff --git a/P3D/Screens/Pokedex/PokedexScreen.vb b/P3D/Screens/Pokedex/PokedexScreen.vb index b5bb187c5..99117015d 100644 --- a/P3D/Screens/Pokedex/PokedexScreen.vb +++ b/P3D/Screens/Pokedex/PokedexScreen.vb @@ -403,13 +403,15 @@ Public Class PokedexScreen If CHabitat Is Nothing Then ' Add any external Pokémon if specified to do so: If Profile.Pokedex.IncludeExternalPokemon = True Then - For i = 0 To Pokedex.PokemonCount - 1 - If Me.Profile.Pokedex.HasPokemon(Pokedex.PokemonIDs(i), False) = False Then - If Pokedex.GetEntryType(Core.Player.PokedexData, Pokedex.PokemonIDs(i)) > 0 Then - Profile.Pokedex.PokemonList.Add(Profile.Pokedex.PokemonList.Count + 1, Pokedex.PokemonIDs(i)) + If Pokedex.PokemonMaxCount > 0 Then + For i = 1 To Pokedex.PokemonMaxCount + If Me.Profile.Pokedex.HasPokemon(i.ToString, False) = False Then + If Pokedex.GetEntryType(Core.Player.PokedexData, i.ToString) > 0 Then + Profile.Pokedex.PokemonList.Add(Profile.Pokedex.PokemonList.Count + 1, i.ToString) + End If End If - End If - Next + Next + End If End If For Each i As String In Profile.Pokedex.PokemonList.Values pokeSearchList.Add(i) @@ -1312,6 +1314,9 @@ Public Class PokedexViewScreen Me.PokemonID = pokemonID If pokemonID.Contains("_") Then Me.PokemonAD = PokemonForms.GetAdditionalValueFromDataFile(pokemonID) + ElseIf pokemonID.Contains(";") Then + Me.PokemonID = pokemonID.GetSplit(0, ";") + Me.PokemonAD = pokemonID.GetSplit(1, ";") End If Me.Pokemon = Pokemon.GetPokemonByID(CInt(Me.PokemonID.GetSplit(0, "_")), Me.PokemonAD) @@ -1330,6 +1335,17 @@ Public Class PokedexViewScreen Me.Evolutions.Add(New EvolutionLinePokemon(Me.Level + 1, ev, vS, "")) Next End If + + If Me.Pokemon.DexForms.Count > 0 Then + For Each form As String In Me.Pokemon.DexForms + If form <> "" Then + If vS.maximumLevel < Me.Level + 1 Then + vS.maximumLevel = Me.Level + 1 + End If + Me.Evolutions.Add(New EvolutionLinePokemon(Me.Level + 1, CStr(Me.Pokemon.Number & "_" & form), vS, "")) + End If + Next + End If End Sub End Class @@ -1732,7 +1748,8 @@ Public Class PokedexViewScreen Dim pokeTexture = pokemon1.GetMenuTexture() Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width * 2), CSng(32 / pokeTexture.Height * 2)) Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(mv.X + (level1 * (128 * scale))), CInt(mv.Y + level1Offset), CInt(pokeTexture.Width * pokeTextureScale.X * scale), CInt(pokeTexture.Height * pokeTextureScale.Y * scale)), Color.White) - Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon1.GetName(), New Vector2(CInt(mv.X + (level1 * (128 * scale)) + CInt(pokeTexture.Width * pokeTextureScale.X / 2 * scale) - (FontManager.MainFont.MeasureString(pokemon1.GetName()).X / 2 * CSng(scale / 2))), CInt(mv.Y + level1Offset + (72 * scale))), Color.Black, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon1.GetName(), New Vector2(CInt(mv.X + (level1 * (128 * scale)) + CInt(pokeTexture.Width * pokeTextureScale.X / 2 * scale) - (FontManager.MainFont.MeasureString(pokemon1.GetName()).X / 2 * CSng(scale / 2)) + 2), CInt(mv.Y + level1Offset + (64 * scale)) + 2), Color.Black, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon1.GetName(), New Vector2(CInt(mv.X + (level1 * (128 * scale)) + CInt(pokeTexture.Width * pokeTextureScale.X / 2 * scale) - (FontManager.MainFont.MeasureString(pokemon1.GetName()).X / 2 * CSng(scale / 2))), CInt(mv.Y + level1Offset + (64 * scale))), Color.White, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) End If If Pokedex.GetEntryType(Core.Player.PokedexData, dexID2) = 0 Then Dim pokeTexture = pokemon2.GetMenuTexture() @@ -1742,7 +1759,8 @@ Public Class PokedexViewScreen Dim pokeTexture = pokemon2.GetMenuTexture() Dim pokeTextureScale As Vector2 = New Vector2(CSng(32 / pokeTexture.Width * 2), CSng(32 / pokeTexture.Height * 2)) Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(mv.X + (level2 * CInt(128 * scale))), CInt(mv.Y + level2Offset), CInt(pokeTexture.Width * pokeTextureScale.X * scale), CInt(pokeTexture.Height * pokeTextureScale.Y * scale)), Color.White) - Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon2.GetName(), New Vector2(CInt(mv.X + (level2 * (128 * scale)) + (32 * scale) - (FontManager.MainFont.MeasureString(pokemon2.GetName()).X / 2 * CSng(scale / 2))), CInt(mv.Y + level2Offset + (72 * scale))), Color.Black, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon2.GetName(), New Vector2(CInt(mv.X + (level2 * (128 * scale)) + (32 * scale) - (FontManager.MainFont.MeasureString(pokemon2.GetName()).X / 2 * CSng(scale / 2)) + 2), CInt(mv.Y + level2Offset + (64 * scale)) + 2), Color.Black, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) + Core.SpriteBatch.DrawString(FontManager.MainFont, pokemon2.GetName(), New Vector2(CInt(mv.X + (level2 * (128 * scale)) + (32 * scale) - (FontManager.MainFont.MeasureString(pokemon2.GetName()).X / 2 * CSng(scale / 2))), CInt(mv.Y + level2Offset + (64 * scale))), Color.White, 0.0F, Vector2.Zero, CInt(scale / 2), SpriteEffects.None, 0.0F) End If Next End If