Split HardGameRules into Hard and SuperHard

This commit is contained in:
JappaWakka 2024-05-19 13:08:53 +02:00
parent 7ea152fbe5
commit f346a32495

View File

@ -374,6 +374,8 @@ Public Class GameMode
''' <param name="PokemonDataPath">The Pokemon-Datapath to load Pokemon data from.</param> ''' <param name="PokemonDataPath">The Pokemon-Datapath to load Pokemon data from.</param>
''' <param name="ContentPath">The path to load images, sound and music from.</param> ''' <param name="ContentPath">The path to load images, sound and music from.</param>
''' <param name="GameRules">The GameRules that apply to the new GameMode.</param> ''' <param name="GameRules">The GameRules that apply to the new GameMode.</param>
''' <param name="HardGameRules">The GameRules that apply to the new GameMode for the Hard Difficulty.</param>
''' <param name="SuperHardGameRules">The GameRules that apply to the new GameMode for the Super Hard Difficulty.</param>
''' <param name="StartMap">The start map for the new GameMode.</param> ''' <param name="StartMap">The start map for the new GameMode.</param>
''' <param name="StartPosition">The start position for the new GameMode.</param> ''' <param name="StartPosition">The start position for the new GameMode.</param>
''' <param name="StartRotation">The start rotation for the new GameMode.</param> ''' <param name="StartRotation">The start rotation for the new GameMode.</param>
@ -385,7 +387,7 @@ Public Class GameMode
''' <param name="SkinFiles">The skin files for the new GameMode. Must be the same amount as SkinColors and SkinNames.</param> ''' <param name="SkinFiles">The skin files for the new GameMode. Must be the same amount as SkinColors and SkinNames.</param>
''' <param name="SkinNames">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param> ''' <param name="SkinNames">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param>
''' <param name="SkinGenders">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param> ''' <param name="SkinGenders">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param>
Public Sub New(ByVal Name As String, ByVal Description As String, ByVal Version As String, ByVal Author As String, ByVal MapPath As String, ByVal ScriptPath As String, ByVal PokeFilePath As String, ByVal PokemonDataPath As String, ByVal ContentPath As String, ByVal LocalizationsPath As String, ByVal GameRules As List(Of GameRule), ByVal HardGameRules As List(Of GameRule), Public Sub New(ByVal Name As String, ByVal Description As String, ByVal Version As String, ByVal Author As String, ByVal MapPath As String, ByVal ScriptPath As String, ByVal PokeFilePath As String, ByVal PokemonDataPath As String, ByVal ContentPath As String, ByVal LocalizationsPath As String, ByVal GameRules As List(Of GameRule), ByVal HardGameRules As List(Of GameRule), ByVal SuperHardGameRules As List(Of GameRule),
ByVal StartMap As String, ByVal StartPosition As Vector3, ByVal StartRotation As Single, ByVal StartLocationName As String, ByVal StartDialogue As String, ByVal StartColor As Color, ByVal PokemonAppear As String, ByVal IntroMusic As String, ByVal IntroType As String, ByVal SkinColors As List(Of Color), ByVal SkinFiles As List(Of String), ByVal SkinNames As List(Of String), ByVal SkinGenders As List(Of String), Optional WaterSpeed As Integer = 8) ByVal StartMap As String, ByVal StartPosition As Vector3, ByVal StartRotation As Single, ByVal StartLocationName As String, ByVal StartDialogue As String, ByVal StartColor As Color, ByVal PokemonAppear As String, ByVal IntroMusic As String, ByVal IntroType As String, ByVal SkinColors As List(Of Color), ByVal SkinFiles As List(Of String), ByVal SkinNames As List(Of String), ByVal SkinGenders As List(Of String), Optional WaterSpeed As Integer = 8)
Me._name = Name Me._name = Name
Me._description = Description Me._description = Description
@ -399,6 +401,7 @@ Public Class GameMode
Me._localizationsPath = LocalizationsPath Me._localizationsPath = LocalizationsPath
Me._gameRules = GameRules Me._gameRules = GameRules
Me._hardGameRules = HardGameRules Me._hardGameRules = HardGameRules
Me._superHardGameRules = SuperHardGameRules
Me._waterspeed = WaterSpeed Me._waterspeed = WaterSpeed
Me._startMap = StartMap Me._startMap = StartMap
@ -460,6 +463,7 @@ Public Class GameMode
_gameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|"))) _gameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
_hardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|"))) _hardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
_superHardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
End If End If
Next Next
End If End If
@ -477,7 +481,34 @@ Public Class GameMode
End If End If
End If End If
Next Next
For i = 0 To _superHardGameRules.Count - 1
If i <= _superHardGameRules.Count - 1 Then
If _superHardGameRules(i).RuleName.ToLower = rule.GetSplit(0, "|").ToLower Then
_superHardGameRules.RemoveAt(i)
i -= 1
End If
End If
Next
_hardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|"))) _hardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
_superHardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
End If
Next
End If
Case "superhardgamerules"
If Value <> "" And Value.Contains("(") And Value.Contains(")") And Value.Contains("|") = True Then
Dim rules() As String = Value.Split(CChar(")"))
For Each rule As String In rules
If rule.StartsWith("(") = True Then
rule = rule.Remove(0, 1)
For i = 0 To _superHardGameRules.Count - 1
If i <= _superHardGameRules.Count - 1 Then
If _superHardGameRules(i).RuleName.ToLower = rule.GetSplit(0, "|").ToLower Then
_superHardGameRules.RemoveAt(i)
i -= 1
End If
End If
Next
_superHardGameRules.Add(New GameRule(rule.GetSplit(0, "|"), rule.GetSplit(1, "|")))
End If End If
Next Next
End If End If
@ -593,7 +624,7 @@ Public Class GameMode
Dim SkinNames As List(Of String) = {"Ethan", "Lyra", "Nate", "Rosa", "Hilbert", "Hilda"}.ToList() Dim SkinNames As List(Of String) = {"Ethan", "Lyra", "Nate", "Rosa", "Hilbert", "Hilda"}.ToList()
Dim SkinGenders As List(Of String) = {"Male", "Female", "Male", "Female", "Male", "Female"}.ToList() Dim SkinGenders As List(Of String) = {"Male", "Female", "Male", "Female", "Male", "Female"}.ToList()
Dim gameMode As New GameMode("Kolben", "The normal game mode.", GameController.GAMEVERSION, "Kolben Games", "\Content\Data\maps\", "\Content\Data\Scripts\", "\Content\Data\maps\poke\", "\Content\Pokemon\Data\", "\Content\", "\Content\Localization\", New List(Of GameRule), New List(Of GameRule), Dim gameMode As New GameMode("Kolben", "The normal game mode.", GameController.GAMEVERSION, "Kolben Games", "\Content\Data\maps\", "\Content\Data\Scripts\", "\Content\Data\maps\poke\", "\Content\Pokemon\Data\", "\Content\", "\Content\Localization\", New List(Of GameRule), New List(Of GameRule), New List(Of GameRule),
"newgame\intro0.dat", New Vector3(1.0F, 0.1F, 3.0F), MathHelper.PiOver2, "Your Room", "", New Color(59, 123, 165), "0", "welcome", "1", SkinColors, SkinFiles, SkinNames, SkinGenders, 8) "newgame\intro0.dat", New Vector3(1.0F, 0.1F, 3.0F), MathHelper.PiOver2, "Your Room", "", New Color(59, 123, 165), "0", "welcome", "1", SkinColors, SkinFiles, SkinNames, SkinGenders, 8)
gameMode.StartScript = "startscript\main" gameMode.StartScript = "startscript\main"
@ -621,7 +652,10 @@ Public Class GameMode
Dim hardGameRules As New List(Of GameRule) Dim hardGameRules As New List(Of GameRule)
hardGameRules.Add(New GameRule("OverworldPoison", "1")) hardGameRules.Add(New GameRule("OverworldPoison", "1"))
Dim superHardGameRules As New List(Of GameRule)
gameMode._hardGameRules = hardGameRules gameMode._hardGameRules = hardGameRules
gameMode._superHardGameRules = superHardGameRules
Return gameMode Return gameMode
End Function End Function
@ -655,7 +689,13 @@ Public Class GameMode
HardGameRuleString &= "(" & rule.RuleName & "|" & rule.RuleValue & ")" HardGameRuleString &= "(" & rule.RuleName & "|" & rule.RuleValue & ")"
Next Next
Dim SuperHardGameRuleString As String = "SuperHardGameRules|"
For Each rule As GameRule In Me._superHardGameRules
SuperHardGameRuleString &= "(" & rule.RuleName & "|" & rule.RuleValue & ")"
Next
s &= HardGameRuleString & Environment.NewLine & s &= HardGameRuleString & Environment.NewLine &
SuperHardGameRuleString & Environment.NewLine &
"StartMap|" & Me._startMap & Environment.NewLine & "StartMap|" & Me._startMap & Environment.NewLine &
"StartPosition|" & Me._startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine & "StartPosition|" & Me._startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me._startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine &
"StartRotation|" & Me._startRotation.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine & "StartRotation|" & Me._startRotation.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine &
@ -762,6 +802,7 @@ Public Class GameMode
Private _contentPath As String = "" Private _contentPath As String = ""
Private _gameRules As New List(Of GameRule) Private _gameRules As New List(Of GameRule)
Private _hardGameRules As New List(Of GameRule) Private _hardGameRules As New List(Of GameRule)
Private _superHardGameRules As New List(Of GameRule)
Private _waterspeed As Integer = 8 Private _waterspeed As Integer = 8
''' <summary> ''' <summary>
@ -906,18 +947,30 @@ Public Class GameMode
''' </summary> ''' </summary>
Public Property GameRules() As List(Of GameRule) Public Property GameRules() As List(Of GameRule)
Get Get
If Core.Player.DifficultyMode > 0 Then Select Case Core.Player.DifficultyMode
Return Me._hardGameRules Case 0
Else Return Me._gameRules
Return Me._gameRules Case 1
End If Return Me._hardGameRules
Case 2
Return Me._superHardGameRules
Case Else
Return Me._gameRules
End Select
End Get End Get
Set(value As List(Of GameRule)) Set(value As List(Of GameRule))
If Core.Player.DifficultyMode > 0 Then Select Case Core.Player.DifficultyMode
Me._hardGameRules = value Case 0
Else Me._gameRules = value
Me._gameRules = value Case 1
End If Me._hardGameRules = value
Case 2
Me._superHardGameRules = value
Case Else
Me._gameRules = value
Me._hardGameRules = value
Me._superHardGameRules = value
End Select
End Set End Set
End Property End Property