mirror of
https://github.com/P3D-Legacy/P3D-Legacy.git
synced 2025-07-26 07:15:48 +02:00
Engine changes to support Regional forms
This commit is contained in:
parent
1b3218bb67
commit
3345bf5ffc
@ -260,9 +260,16 @@ Public Class Trainer
|
|||||||
readData = readData.Remove(0, 1)
|
readData = readData.Remove(0, 1)
|
||||||
End While
|
End While
|
||||||
|
|
||||||
Dim ID As Integer = ScriptConversion.ToInteger(ScriptCommander.Parse(firstPart))
|
Dim PK As String = ScriptCommander.Parse(firstPart).ToString()
|
||||||
Dim Level As Integer = ScriptConversion.ToInteger(ScriptCommander.Parse(secondPart))
|
Dim Level As Integer = ScriptConversion.ToInteger(ScriptCommander.Parse(secondPart))
|
||||||
|
|
||||||
|
Dim ID As Integer = CInt(PK.Split(CChar("_"))(0))
|
||||||
|
Dim AD As String = ""
|
||||||
|
|
||||||
|
If PK.Contains(CChar("_")) Then
|
||||||
|
AD = PK.Split(CChar("_"))(1)
|
||||||
|
End If
|
||||||
|
|
||||||
Dim addLevel As Integer = 0
|
Dim addLevel As Integer = 0
|
||||||
If Core.Player.DifficultyMode = 1 Then
|
If Core.Player.DifficultyMode = 1 Then
|
||||||
addLevel = CInt(Math.Ceiling(Level / 10))
|
addLevel = CInt(Math.Ceiling(Level / 10))
|
||||||
@ -282,8 +289,13 @@ Public Class Trainer
|
|||||||
If FrontierTrainer > -1 Then
|
If FrontierTrainer > -1 Then
|
||||||
p = FrontierSpawner.GetPokemon(Level, FrontierTrainer, Nothing)
|
p = FrontierSpawner.GetPokemon(Level, FrontierTrainer, Nothing)
|
||||||
Else
|
Else
|
||||||
p = Pokemon.GetPokemonByID(ID)
|
If AD <> "" Then
|
||||||
p.Generate(Level, True)
|
p = Pokemon.GetPokemonByID(ID, AD)
|
||||||
|
p.Generate(Level, True, AD)
|
||||||
|
Else
|
||||||
|
p = Pokemon.GetPokemonByID(ID)
|
||||||
|
p.Generate(Level, True)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If p.IsGenderless = False Then
|
If p.IsGenderless = False Then
|
||||||
|
@ -16,6 +16,7 @@ Public Class EvolutionCondition
|
|||||||
InParty
|
InParty
|
||||||
InPartyType
|
InPartyType
|
||||||
Weather
|
Weather
|
||||||
|
Region
|
||||||
End Enum
|
End Enum
|
||||||
|
|
||||||
Public Structure Condition
|
Public Structure Condition
|
||||||
@ -24,10 +25,10 @@ Public Class EvolutionCondition
|
|||||||
End Structure
|
End Structure
|
||||||
|
|
||||||
Public Trigger As EvolutionTrigger
|
Public Trigger As EvolutionTrigger
|
||||||
Public Evolution As Integer = 0
|
Public Evolution As String = ""
|
||||||
Public Conditions As New List(Of Condition)
|
Public Conditions As New List(Of Condition)
|
||||||
|
|
||||||
Public Sub SetEvolution(ByVal evolution As Integer)
|
Public Sub SetEvolution(ByVal evolution As String)
|
||||||
Me.Evolution = evolution
|
Me.Evolution = evolution
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -66,6 +67,8 @@ Public Class EvolutionCondition
|
|||||||
c.ConditionType = ConditionTypes.InPartyType
|
c.ConditionType = ConditionTypes.InPartyType
|
||||||
Case "weather"
|
Case "weather"
|
||||||
c.ConditionType = ConditionTypes.Weather
|
c.ConditionType = ConditionTypes.Weather
|
||||||
|
Case "region"
|
||||||
|
c.ConditionType = ConditionTypes.Region
|
||||||
End Select
|
End Select
|
||||||
Me.Conditions.Add(c)
|
Me.Conditions.Add(c)
|
||||||
End Sub
|
End Sub
|
||||||
@ -102,10 +105,10 @@ Public Class EvolutionCondition
|
|||||||
''' <param name="p">The Pokémon to get the evolution from.</param>
|
''' <param name="p">The Pokémon to get the evolution from.</param>
|
||||||
''' <param name="trigger">The trigger that triggered the evolution.</param>
|
''' <param name="trigger">The trigger that triggered the evolution.</param>
|
||||||
''' <param name="arg">An argument (for example Item ID)</param>
|
''' <param name="arg">An argument (for example Item ID)</param>
|
||||||
Public Shared Function EvolutionNumber(ByVal p As Pokemon, ByVal trigger As EvolutionTrigger, ByVal arg As String) As Integer
|
Public Shared Function EvolutionNumber(ByVal p As Pokemon, ByVal trigger As EvolutionTrigger, ByVal arg As String) As String
|
||||||
Dim e As EvolutionCondition = GetEvolutionCondition(p, trigger, arg)
|
Dim e As EvolutionCondition = GetEvolutionCondition(p, trigger, arg)
|
||||||
If e Is Nothing Then
|
If e Is Nothing Then
|
||||||
Return 0
|
Return ""
|
||||||
Else
|
Else
|
||||||
Return e.Evolution
|
Return e.Evolution
|
||||||
End If
|
End If
|
||||||
@ -225,6 +228,15 @@ Public Class EvolutionCondition
|
|||||||
If World.GetCurrentRegionWeather().ToString.ToLower <> c.Argument.ToLower Then
|
If World.GetCurrentRegionWeather().ToString.ToLower <> c.Argument.ToLower Then
|
||||||
canEvolve = False
|
canEvolve = False
|
||||||
End If
|
End If
|
||||||
|
Case ConditionTypes.Region
|
||||||
|
canEvolve = False
|
||||||
|
Dim eregions As List(Of String) = c.Argument.ToLower.Split(CChar(";")).ToList()
|
||||||
|
Dim regions As List(Of String) = Screen.Level.CurrentRegion.ToLower.Split(CChar(",")).ToList()
|
||||||
|
For Each r As String In regions
|
||||||
|
If eregions.Contains(r) Then
|
||||||
|
canEvolve = True
|
||||||
|
End If
|
||||||
|
Next
|
||||||
End Select
|
End Select
|
||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
@ -170,9 +170,15 @@ Public Class Pokemon
|
|||||||
Return Me._additionalData
|
Return Me._additionalData
|
||||||
End Get
|
End Get
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
Me._additionalData = value
|
Dim oldval As String = Me._additionalData
|
||||||
|
|
||||||
|
If oldval <> value Then
|
||||||
|
Me._additionalData = value
|
||||||
|
Me.ReloadDefinitions()
|
||||||
|
Me.ClearTextures()
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Me.ClearTextures()
|
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@ -563,6 +569,7 @@ Public Class Pokemon
|
|||||||
Public PokedexEntry As PokedexEntry
|
Public PokedexEntry As PokedexEntry
|
||||||
Public Cry As SoundEffect
|
Public Cry As SoundEffect
|
||||||
Public WildItems As New Dictionary(Of Integer, Integer)
|
Public WildItems As New Dictionary(Of Integer, Integer)
|
||||||
|
Public RegionalForms As String = ""
|
||||||
|
|
||||||
Private _name As String
|
Private _name As String
|
||||||
Private _number As Integer
|
Private _number As Integer
|
||||||
@ -1306,6 +1313,7 @@ Public Class Pokemon
|
|||||||
''' Loads definition data from the data files and empties the temp textures.
|
''' Loads definition data from the data files and empties the temp textures.
|
||||||
''' </summary>
|
''' </summary>
|
||||||
Public Sub ReloadDefinitions()
|
Public Sub ReloadDefinitions()
|
||||||
|
|
||||||
Me.LoadDefinitions(Me.Number, Me.AdditionalData)
|
Me.LoadDefinitions(Me.Number, Me.AdditionalData)
|
||||||
Me.ClearTextures()
|
Me.ClearTextures()
|
||||||
End Sub
|
End Sub
|
||||||
@ -1423,6 +1431,8 @@ Public Class Pokemon
|
|||||||
End If
|
End If
|
||||||
Case "eggpokemon"
|
Case "eggpokemon"
|
||||||
Me.EggPokemon = CInt(Value)
|
Me.EggPokemon = CInt(Value)
|
||||||
|
Case "regionalforms"
|
||||||
|
Me.RegionalForms = Value
|
||||||
Case "canbreed"
|
Case "canbreed"
|
||||||
Me.CanBreed = CBool(Value)
|
Me.CanBreed = CBool(Value)
|
||||||
Case "basehp"
|
Case "basehp"
|
||||||
@ -1477,7 +1487,7 @@ Public Class Pokemon
|
|||||||
|
|
||||||
Dim EvolutionData() As String = Value.Split(CChar(","))
|
Dim EvolutionData() As String = Value.Split(CChar(","))
|
||||||
|
|
||||||
Dim Evolution As Integer = CInt(EvolutionData(0))
|
Dim Evolution As String = EvolutionData(0)
|
||||||
Dim Type As String = EvolutionData(1)
|
Dim Type As String = EvolutionData(1)
|
||||||
Dim Argument As String = EvolutionData(2)
|
Dim Argument As String = EvolutionData(2)
|
||||||
Dim Trigger As String = EvolutionData(3)
|
Dim Trigger As String = EvolutionData(3)
|
||||||
@ -1901,12 +1911,17 @@ Public Class Pokemon
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="newLevel">The level to set the Pokémon's level to.</param>
|
''' <param name="newLevel">The level to set the Pokémon's level to.</param>
|
||||||
''' <param name="SetParameters">If the parameters like Nature and Ability should be set. Otherwise, it just loads the attacks and sets the level.</param>
|
''' <param name="SetParameters">If the parameters like Nature and Ability should be set. Otherwise, it just loads the attacks and sets the level.</param>
|
||||||
Public Sub Generate(ByVal newLevel As Integer, ByVal SetParameters As Boolean)
|
''' <param name="OpAdData">Optional value for setting the additional data, defaults to xXx to assume no additional data.</param>
|
||||||
|
Public Sub Generate(ByVal newLevel As Integer, ByVal SetParameters As Boolean, Optional OpAdData As String = "xXx")
|
||||||
Me.Level = 0
|
Me.Level = 0
|
||||||
|
|
||||||
If SetParameters = True Then
|
If SetParameters = True Then
|
||||||
Me.GenerateIndividualValue()
|
Me.GenerateIndividualValue()
|
||||||
Me.AdditionalData = PokemonForms.GetInitialAdditionalData(Me)
|
If OpAdData = "xXx" Then
|
||||||
|
Me.AdditionalData = PokemonForms.GetInitialAdditionalData(Me)
|
||||||
|
Else
|
||||||
|
Me.AdditionalData = OpAdData
|
||||||
|
End If
|
||||||
|
|
||||||
Me.Nature = CType(Core.Random.Next(0, 25), Natures)
|
Me.Nature = CType(Core.Random.Next(0, 25), Natures)
|
||||||
|
|
||||||
@ -2748,8 +2763,8 @@ Public Class Pokemon
|
|||||||
''' <param name="trigger">The trigger of the evolution.</param>
|
''' <param name="trigger">The trigger of the evolution.</param>
|
||||||
''' <param name="argument">An argument that specifies the evolution.</param>
|
''' <param name="argument">An argument that specifies the evolution.</param>
|
||||||
Public Function CanEvolve(ByVal trigger As EvolutionCondition.EvolutionTrigger, ByVal argument As String) As Boolean
|
Public Function CanEvolve(ByVal trigger As EvolutionCondition.EvolutionTrigger, ByVal argument As String) As Boolean
|
||||||
Dim n As Integer = EvolutionCondition.EvolutionNumber(Me, trigger, argument)
|
Dim n As String = EvolutionCondition.EvolutionNumber(Me, trigger, argument)
|
||||||
If n = 0 Then
|
If n = "" Then
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
Return True
|
Return True
|
||||||
@ -2760,7 +2775,7 @@ Public Class Pokemon
|
|||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="trigger">The trigger of the evolution.</param>
|
''' <param name="trigger">The trigger of the evolution.</param>
|
||||||
''' <param name="argument">An argument that specifies the evolution.</param>
|
''' <param name="argument">An argument that specifies the evolution.</param>
|
||||||
Public Function GetEvolutionID(ByVal trigger As EvolutionCondition.EvolutionTrigger, ByVal argument As String) As Integer
|
Public Function GetEvolutionID(ByVal trigger As EvolutionCondition.EvolutionTrigger, ByVal argument As String) As String
|
||||||
Return EvolutionCondition.EvolutionNumber(Me, trigger, argument)
|
Return EvolutionCondition.EvolutionNumber(Me, trigger, argument)
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ Public Class Spawner
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim Pokemons As New List(Of Integer)
|
Dim Pokemons As New List(Of String)
|
||||||
Dim Chances As New List(Of Integer)
|
Dim Chances As New List(Of Integer)
|
||||||
Dim LevelCaps As New List(Of String)
|
Dim LevelCaps As New List(Of String)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ Public Class Spawner
|
|||||||
Dim splits() As String = Line.Split(CChar("|"))
|
Dim splits() As String = Line.Split(CChar("|"))
|
||||||
|
|
||||||
Dim PMethod As Integer = CInt(splits(0))
|
Dim PMethod As Integer = CInt(splits(0))
|
||||||
Dim Pokemon As Integer = CInt(splits(1))
|
Dim Pokemon As String = splits(1)
|
||||||
Dim Chance As Integer = CInt(splits(2))
|
Dim Chance As Integer = CInt(splits(2))
|
||||||
Dim DayTime() As String = splits(3).Split(CChar(","))
|
Dim DayTime() As String = splits(3).Split(CChar(","))
|
||||||
Dim levelCap As String = splits(4)
|
Dim levelCap As String = splits(4)
|
||||||
@ -131,7 +131,7 @@ Public Class Spawner
|
|||||||
Return Nothing
|
Return Nothing
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Shared Function CalculatePokemon(ByVal Pokemons As List(Of Integer), ByVal Chances As List(Of Integer), ByVal LevelCaps As List(Of String)) As Pokemon
|
Private Shared Function CalculatePokemon(ByVal Pokemons As List(Of String), ByVal Chances As List(Of Integer), ByVal LevelCaps As List(Of String)) As Pokemon
|
||||||
Dim totalNumber As Integer = 0
|
Dim totalNumber As Integer = 0
|
||||||
For Each c As Integer In Chances
|
For Each c As Integer In Chances
|
||||||
totalNumber += c
|
totalNumber += c
|
||||||
@ -174,8 +174,21 @@ Public Class Spawner
|
|||||||
level = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100"))
|
level = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100"))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim p As Pokemon = Pokemon.GetPokemonByID(Pokemons(i))
|
Dim PkID As Integer = CInt(Pokemons(i).Split(CChar("_"))(0))
|
||||||
p.Generate(level, True)
|
Dim PkAD As String = ""
|
||||||
|
Dim p As Pokemon = Pokemon.GetPokemonByID(PkID)
|
||||||
|
For Each region As String In Screen.Level.RegionalForm.ToLower().Split(CChar(","))
|
||||||
|
If p.RegionalForms <> Nothing AndAlso p.RegionalForms.ToLower().Contains(region) Then
|
||||||
|
PkAD = region
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If Pokemons(i).Contains("_") Then
|
||||||
|
PkAD = Pokemons(i).Split(CChar("_"))(1)
|
||||||
|
End If
|
||||||
|
p = Pokemon.GetPokemonByID(PkID, PkAD)
|
||||||
|
p.Generate(level, True, PkAD)
|
||||||
|
p.ReloadDefinitions()
|
||||||
|
p.CalculateStats()
|
||||||
|
|
||||||
BattleSystem.BattleScreen.TempPokeFile = pokeFile
|
BattleSystem.BattleScreen.TempPokeFile = pokeFile
|
||||||
|
|
||||||
|
@ -1267,8 +1267,8 @@ Public Class PokedexViewScreen
|
|||||||
If Me.Pokemon.EvolutionConditions.Count > 0 Then
|
If Me.Pokemon.EvolutionConditions.Count > 0 Then
|
||||||
Dim evolutions As New List(Of Integer)
|
Dim evolutions As New List(Of Integer)
|
||||||
For Each ev As EvolutionCondition In Me.Pokemon.EvolutionConditions
|
For Each ev As EvolutionCondition In Me.Pokemon.EvolutionConditions
|
||||||
If evolutions.Contains(ev.Evolution) = False And fromEvolution <> ev.Evolution Then
|
If evolutions.Contains(CInt(ev.Evolution.Split(CChar("_"))(0))) = False And fromEvolution <> CInt(ev.Evolution.Split(CChar("_"))(0)) Then
|
||||||
evolutions.Add(ev.Evolution)
|
evolutions.Add(CInt(ev.Evolution.Split(CChar("_"))(0)))
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
@ -32,6 +32,48 @@
|
|||||||
p.SetCatchInfos(Item.GetItemByID(5), "obtained at")
|
p.SetCatchInfos(Item.GetItemByID(5), "obtained at")
|
||||||
p.CatchBall = Item.GetItemByID(GetEggPokeballID({parent1, parent2}.ToList()))
|
p.CatchBall = Item.GetItemByID(GetEggPokeballID({parent1, parent2}.ToList()))
|
||||||
|
|
||||||
|
' Regional Form check
|
||||||
|
If Screen.Level.RegionalForm.Contains(CChar(",")) Then
|
||||||
|
For Each r As String In Screen.Level.RegionalForm.Split(CChar(","))
|
||||||
|
If p.RegionalForms.Contains(r.ToLower()) Then
|
||||||
|
p.AdditionalData = r.ToLower()
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
If p.RegionalForms.ToLower.Contains(Screen.Level.RegionalForm.ToLower()) Then
|
||||||
|
p.AdditionalData = Screen.Level.RegionalForm.ToLower()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Form inheritance
|
||||||
|
Select Case DittoAsParent
|
||||||
|
Case 0
|
||||||
|
If parent1.Gender = P3D.Pokemon.Genders.Female Then
|
||||||
|
If parent1.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent1.AdditionalData
|
||||||
|
ElseIf parent2.Number = parent1.Number And parent2.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent2.AdditionalData
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If parent2.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent2.AdditionalData
|
||||||
|
ElseIf parent1.Number = parent2.Number And parent1.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent1.AdditionalData
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Case 1
|
||||||
|
If parent2.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent2.AdditionalData
|
||||||
|
End If
|
||||||
|
Case 2
|
||||||
|
If parent1.Item.Name.ToLower() = "everstone" Then
|
||||||
|
p.AdditionalData = parent1.AdditionalData
|
||||||
|
End If
|
||||||
|
End Select
|
||||||
|
|
||||||
|
p.ReloadDefinitions()
|
||||||
|
p.CalculateStats()
|
||||||
|
|
||||||
' Adding Egg Moves:
|
' Adding Egg Moves:
|
||||||
Dim EggMoves As New List(Of BattleSystem.Attack)
|
Dim EggMoves As New List(Of BattleSystem.Attack)
|
||||||
|
|
||||||
@ -602,7 +644,7 @@
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Shared Sub EggCircle()
|
Public Shared Sub EggCircle()
|
||||||
Core.Player.PlayerTemp.DayCareCycle = 256
|
Core.Player.PlayerTemp.DayCareCycle = 2
|
||||||
ObtainEgg()
|
ObtainEgg()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@
|
|||||||
Private Sub EvolvePokemon()
|
Private Sub EvolvePokemon()
|
||||||
Dim HPpercentage As Integer = CInt((currentPokemon.HP / currentPokemon.MaxHP) * 100)
|
Dim HPpercentage As Integer = CInt((currentPokemon.HP / currentPokemon.MaxHP) * 100)
|
||||||
|
|
||||||
evolvedPokemon = Pokemon.GetPokemonByID(currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg))
|
evolvedPokemon = Pokemon.GetPokemonByID(CInt(currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg).Split(CChar("_"))(0)))
|
||||||
evolvedPokemon.Status = currentPokemon.Status
|
evolvedPokemon.Status = currentPokemon.Status
|
||||||
|
|
||||||
evolvedPokemon.EVHP = currentPokemon.EVHP
|
evolvedPokemon.EVHP = currentPokemon.EVHP
|
||||||
@ -359,7 +359,11 @@
|
|||||||
evolvedPokemon.Attacks = currentPokemon.Attacks
|
evolvedPokemon.Attacks = currentPokemon.Attacks
|
||||||
evolvedPokemon.Gender = currentPokemon.Gender
|
evolvedPokemon.Gender = currentPokemon.Gender
|
||||||
evolvedPokemon.Nature = currentPokemon.Nature
|
evolvedPokemon.Nature = currentPokemon.Nature
|
||||||
|
If currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg).Contains(CChar("_")) Then
|
||||||
|
evolvedPokemon.AdditionalData = currentPokemon.GetEvolutionID(Me.EvolutionTrigger, Me.EvolutionArg).Split(CChar("_"))(1)
|
||||||
|
End If
|
||||||
|
|
||||||
|
evolvedPokemon.ReloadDefinitions()
|
||||||
evolvedPokemon.CalculateStats()
|
evolvedPokemon.CalculateStats()
|
||||||
|
|
||||||
Dim hasOldAbility As Boolean = False
|
Dim hasOldAbility As Boolean = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user