From b6ba893a5db096622b53dd61ed224480bbb23fd2 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Sat, 1 Jul 2023 20:47:06 +0200 Subject: [PATCH] Coin Case Cap is now a GameRule --- P3D/Resources/GameModeManager.vb | 1 + P3D/Screens/VoltorbFlipScreen.vb | 6 +++--- P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb | 4 ++-- P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb | 9 ++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/P3D/Resources/GameModeManager.vb b/P3D/Resources/GameModeManager.vb index 517bc3de3..01b29a320 100644 --- a/P3D/Resources/GameModeManager.vb +++ b/P3D/Resources/GameModeManager.vb @@ -609,6 +609,7 @@ Public Class GameMode gameRules.Add(New GameRule("SavingDisabled", "0")) gameRules.Add(New GameRule("SingleUseTM", "0")) gameRules.Add(New GameRule("CanForgetHM", "0")) + gameRules.Add(New GameRule("CoinCaseCap", "0")) gameMode._gameRules = gameRules diff --git a/P3D/Screens/VoltorbFlipScreen.vb b/P3D/Screens/VoltorbFlipScreen.vb index e7cec02c2..1f4472984 100644 --- a/P3D/Screens/VoltorbFlipScreen.vb +++ b/P3D/Screens/VoltorbFlipScreen.vb @@ -1034,8 +1034,8 @@ TryAgain: 'Completed the level If GameState = States.GameWon Then - If Core.Player.Coins + TotalCoins > 50000 Then - TotalCoins = 50000 - Core.Player.Coins + If CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) > 0 AndAlso Core.Player.Coins + TotalCoins > CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) Then + TotalCoins = CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) - Core.Player.Coins CurrentCoins = 0 TextBox.Show(Localization.GetString("VoltorbFlip_MaxCoins", "Your Coin Case can't fit~any more Coin(s)!")) Quit() @@ -1286,7 +1286,7 @@ TryAgain: Delay = 5 End If If Delay > 3 Then - If Core.Player.Coins + TotalCoins > 50000 Then + If CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) > 0 AndAlso Core.Player.Coins + TotalCoins > CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) Then If CurrentLevel < PreviousLevel Then TextBox.Show(Localization.GetString("VoltorbFlip_NewLevel_Lower1", "Dropped to Game Lv.") & " " & CurrentLevel & Localization.GetString("VoltorbFlip_NewLevel_Lower2", "!")) End If diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb index 8778b64f3..5f5d938fc 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoPlayer.vb @@ -303,8 +303,8 @@ Case "addcoins" Dim coins As Integer = int(argument) - If Core.Player.Coins + coins > 50000 Then - coins = 50000 - Core.Player.Coins + If CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) > 0 AndAlso Core.Player.Coins + coins > CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) Then + coins = CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) - Core.Player.Coins End If Core.Player.Coins += coins diff --git a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb index 9524f31a6..b9bbd4aee 100644 --- a/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb +++ b/P3D/World/ActionScript/V2/ScriptCommands/DoScreen.vb @@ -284,7 +284,10 @@ CanContinue = False Case "voltorbflip" If Core.Player.Inventory.GetItemAmount(54.ToString) > 0 Then - If Core.Player.Coins < 50000 Then + If CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) > 0 AndAlso Core.Player.Coins > CInt(GameModeManager.GetGameRuleValue("CoinCaseCap", "0")) Then + Screen.TextBox.Show(Localization.GetString("VoltorbFlip_BeforeGame_FullCoinCase", "Your Coin Case is already full!")) + IsReady = True + Else If VoltorbFlip.VoltorbFlipScreen.TotalCoins = -1 Then Core.SetScreen(New VoltorbFlip.VoltorbFlipScreen(CurrentScreen)) End If @@ -303,10 +306,6 @@ IsReady = True End If End If - - Else - Screen.TextBox.Show(Localization.GetString("VoltorbFlip_BeforeGame_FullCoinCase", "Your Coin Case is already full!")) - IsReady = True End If Else Screen.TextBox.Show(Localization.GetString("VoltorbFlip_BeforeGame_NoCoinCase", "You don't have a Coin Case!~Come back when you have one!"))