Make ShinyRate & LevelMultiplier GameRules

This commit is contained in:
JappaWakka 2024-05-19 19:26:16 +02:00
parent f346a32495
commit 25bcc154a2
4 changed files with 55 additions and 26 deletions

View File

@ -212,27 +212,30 @@ Public Class Trainer
If PokeData.StartsWith("{") = True And PokeData.EndsWith("}") = True Then
Dim p As Pokemon = Pokemon.GetPokemonByData(PokeData)
If Core.Player.DifficultyMode > 0 Then
Dim level As Integer = p.Level
Dim level As Integer = p.Level
Dim addLevel As Integer = 0
If Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Ceiling(level / 10))
ElseIf Core.Player.DifficultyMode = 2 Then
addLevel = CInt(Math.Ceiling(level / 5))
End If
If level + addLevel > CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then
addLevel = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) - level
End If
While level + addLevel > p.Level
p.LevelUp(False)
p.Experience = p.NeedExperience(p.Level)
End While
p.HP = p.MaxHP
Dim addLevel As Integer = 0
If Core.Player.DifficultyMode = 0 Then
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.0")) - level))
ElseIf Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.1")) - level))
ElseIf Core.Player.DifficultyMode = 2 Then
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.2")) - level))
End If
If level + addLevel > CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then
addLevel = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) - level
End If
If addLevel <= 0 Then
addLevel = 0
End If
While level + addLevel > p.Level
p.LevelUp(False)
p.Experience = p.NeedExperience(p.Level)
End While
p.HP = p.MaxHP
Pokemons.Add(p)
Else
Dim firstPart As String = ""
@ -275,14 +278,19 @@ Public Class Trainer
End If
Dim addLevel As Integer = 0
If Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Ceiling(Level / 10))
If Core.Player.DifficultyMode = 0 Then
addLevel = CInt(Math.Ceiling(Level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.0")) - Level))
ElseIf Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Ceiling(Level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.1")) - Level))
ElseIf Core.Player.DifficultyMode = 2 Then
addLevel = CInt(Math.Ceiling(Level / 5))
addLevel = CInt(Math.Ceiling(Level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.2")) - Level))
End If
If Level + addLevel > CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then
addLevel = CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) - Level
End If
If addLevel <= 0 Then
addLevel = 0
End If
Level += addLevel

View File

@ -10,7 +10,7 @@ Public Class Pokemon
Public Shared ReadOnly Property MasterShinyRate(Optional ByVal adjusted As Boolean = True) As Integer
Get
Dim shinyRate As Integer = 4096
Dim shinyRate As Integer = GameModeManager.ActiveGameMode.MasterShinyRate '4096 by default
If adjusted Then
For Each mysteryEvent As MysteryEventScreen.MysteryEvent In MysteryEventScreen.ActivatedMysteryEvents

View File

@ -170,10 +170,12 @@ Public Class Spawner
End If
Dim addLevel As Integer = 0
If Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Floor(level / 10))
If Core.Player.DifficultyMode = 0 Then
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.0")) - level))
ElseIf Core.Player.DifficultyMode = 1 Then
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.1")) - level))
ElseIf Core.Player.DifficultyMode = 2 Then
addLevel = CInt(Math.Floor(level / 5))
addLevel = CInt(Math.Ceiling(level * CSng(GameModeManager.GetGameRuleValue("LevelMultiplier", "1.2")) - level))
End If
level += addLevel
If level > CInt(GameModeManager.GetGameRuleValue("MaxLevel", "100")) Then

View File

@ -388,7 +388,7 @@ Public Class GameMode
''' <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>
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, Optional MasterShinyRate As Integer = 4096)
Me._name = Name
Me._description = Description
Me._version = Version
@ -403,6 +403,7 @@ Public Class GameMode
Me._hardGameRules = HardGameRules
Me._superHardGameRules = SuperHardGameRules
Me._waterspeed = WaterSpeed
Me._masterShinyRate = MasterShinyRate
Me._startMap = StartMap
Me._startPosition = StartPosition
@ -514,6 +515,8 @@ Public Class GameMode
End If
Case "waterspeed"
Me._waterspeed = CInt(Value)
Case "shinyrate"
Me._masterShinyRate = CInt(Value)
Case "startmap"
Me._startMap = Value
Case "startposition"
@ -646,13 +649,17 @@ Public Class GameMode
gameRules.Add(New GameRule("CanForgetHM", "0"))
gameRules.Add(New GameRule("CoinCaseCap", "0"))
gameRules.Add(New GameRule("GainExpAfterCatch", "1"))
gameRules.Add(New GameRule("ShinyRate", "4096"))
gameRules.Add(New GameRule("LevelMultiplier", "1.0"))
gameMode._gameRules = gameRules
Dim hardGameRules As New List(Of GameRule)
hardGameRules.Add(New GameRule("OverworldPoison", "1"))
hardGameRules.Add(New GameRule("LevelMultiplier", "1.1"))
Dim superHardGameRules As New List(Of GameRule)
hardGameRules.Add(New GameRule("LevelMultiplier", "1.2"))
gameMode._hardGameRules = hardGameRules
gameMode._superHardGameRules = superHardGameRules
@ -804,6 +811,7 @@ Public Class GameMode
Private _hardGameRules As New List(Of GameRule)
Private _superHardGameRules As New List(Of GameRule)
Private _waterspeed As Integer = 8
Private _masterShinyRate As Integer = 4096
''' <summary>
''' The name of this GameMode.
@ -940,6 +948,17 @@ Public Class GameMode
Me._waterspeed = value
End Set
End Property
''' <summary>
''' The master shiny rate
''' </summary>
Public Property MasterShinyRate As Integer
Get
Return Me._masterShinyRate
End Get
Set(value As Integer)
Me._masterShinyRate = value
End Set
End Property
''' <summary>