From 4ddf689887a3a3be06541e831f0f1590a0112b7f Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sun, 2 Oct 2022 16:01:35 +0100 Subject: [PATCH] Improved Debug running options in battle, allowed Debug running from battle by choosing Call, removed support for save files in the old save location --- Data/Scripts/002_Save data/001_SaveData.rb | 15 ------ .../003_Game processing/001_StartGame.rb | 1 - .../001_Battle/007_Battle_ActionRunning.rb | 52 +++++++++++++------ .../001_Battle/008_Battle_ActionOther.rb | 3 ++ 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/Data/Scripts/002_Save data/001_SaveData.rb b/Data/Scripts/002_Save data/001_SaveData.rb index 6a7b76628..1afb656b5 100644 --- a/Data/Scripts/002_Save data/001_SaveData.rb +++ b/Data/Scripts/002_Save data/001_SaveData.rb @@ -79,19 +79,4 @@ module SaveData end return hash end - - # Moves a save file from the old Saved Games folder to the new - # location specified by {FILE_PATH}. Does nothing if a save file - # already exists in {FILE_PATH}. - def self.move_old_windows_save - return if File.file?(FILE_PATH) - game_title = System.game_title.gsub(/[^\w ]/, "_") - home = ENV["HOME"] || ENV["HOMEPATH"] - return if home.nil? - old_location = File.join(home, "Saved Games", game_title) - return unless File.directory?(old_location) - old_file = File.join(old_location, "Game.rxdata") - return unless File.file?(old_file) - File.move(old_file, FILE_PATH) - end end diff --git a/Data/Scripts/003_Game processing/001_StartGame.rb b/Data/Scripts/003_Game processing/001_StartGame.rb index b803a2e94..9143bc376 100644 --- a/Data/Scripts/003_Game processing/001_StartGame.rb +++ b/Data/Scripts/003_Game processing/001_StartGame.rb @@ -19,7 +19,6 @@ module Game # Loads bootup data from save file (if it exists) or creates bootup data (if # it doesn't). def self.set_up_system - SaveData.move_old_windows_save if System.platform[/Windows/] save_data = (SaveData.exists?) ? SaveData.read_from_file(SaveData::FILE_PATH) : {} if save_data.empty? SaveData.initialize_bootup_values diff --git a/Data/Scripts/011_Battle/001_Battle/007_Battle_ActionRunning.rb b/Data/Scripts/011_Battle/001_Battle/007_Battle_ActionRunning.rb index 61ad9863c..5e46c83a1 100644 --- a/Data/Scripts/011_Battle/001_Battle/007_Battle_ActionRunning.rb +++ b/Data/Scripts/011_Battle/001_Battle/007_Battle_ActionRunning.rb @@ -21,6 +21,36 @@ class Battle return true end + # Return values: + # -1: Chose not to end the battle via Debug means + # 0: Couldn't end the battle via Debug means; carry on trying to run + # 1: Ended the battle via Debug means + def pbDebugRun + return 0 if !$DEBUG || !Input.press?(Input::CTRL) + commands = [_INTL("Treat as a win"), _INTL("Treat as a loss"), + _INTL("Treat as a draw"), _INTL("Treat as running away/forfeit")] + commands.push(_INTL("Treat as a capture")) if wildBattle? + commands.push(_INTL("Cancel")) + case pbShowCommands(_INTL("Choose the outcome of this battle."), commands) + when 0 # Win + @decision = 1 + when 1 # Loss + @decision = 2 + when 2 # Draw + @decision = 5 + when 3 # Run away/forfeit + pbSEPlay("Battle flee") + pbDisplayPaused(_INTL("You got away safely!")) + @decision = 3 + when 4 # Capture + return -1 if trainerBattle? + @decision = 4 + else + return -1 + end + return 1 + end + # Return values: # -1: Failed fleeing # 0: Wasn't possible to attempt fleeing, continue choosing action for the round @@ -36,17 +66,12 @@ class Battle @choices[idxBattler][2] = nil return -1 end - # Fleeing from trainer battles + # Debug ending the battle + debug_ret = pbDebugRun + return debug_ret if debug_ret != 0 + # Running from trainer battles if trainerBattle? - if $DEBUG && Input.press?(Input::CTRL) - if pbDisplayConfirm(_INTL("Treat this battle as a win?")) - @decision = 1 - return 1 - elsif pbDisplayConfirm(_INTL("Treat this battle as a loss?")) - @decision = 2 - return 1 - end - elsif @internalBattle + if @internalBattle pbDisplayPaused(_INTL("No! There's no running from a Trainer battle!")) elsif pbDisplayConfirm(_INTL("Would you like to forfeit the match and quit now?")) pbSEPlay("Battle flee") @@ -56,13 +81,6 @@ class Battle end return 0 end - # Fleeing from wild battles - if $DEBUG && Input.press?(Input::CTRL) - pbSEPlay("Battle flee") - pbDisplayPaused(_INTL("You got away safely!")) - @decision = 3 - return 1 - end if !@canRun pbDisplayPaused(_INTL("You can't escape!")) return 0 diff --git a/Data/Scripts/011_Battle/001_Battle/008_Battle_ActionOther.rb b/Data/Scripts/011_Battle/001_Battle/008_Battle_ActionOther.rb index e1f87c861..f6fe0b961 100644 --- a/Data/Scripts/011_Battle/001_Battle/008_Battle_ActionOther.rb +++ b/Data/Scripts/011_Battle/001_Battle/008_Battle_ActionOther.rb @@ -36,6 +36,9 @@ class Battle end def pbCall(idxBattler) + # Debug ending the battle + return if pbDebugRun != 0 + # Call the battler battler = @battlers[idxBattler] trainerName = pbGetOwnerName(idxBattler) pbDisplay(_INTL("{1} called {2}!", trainerName, battler.pbThis(true)))