From 514ef510f1e27737e17ecfd01a5eacbec51f4e14 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Tue, 7 Dec 2021 23:28:14 +0000 Subject: [PATCH] Added speed order viewer in battle debug menu, Pokemon#foreign? now defaults to comparing to the player --- Data/Scripts/014_Pokemon/001_Pokemon.rb | 4 ++-- .../007_Debug_BattleCommands.rb | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index 6cdc789b4..90bfa25a5 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -828,9 +828,9 @@ class Pokemon @owner = new_owner end - # @param trainer [Player, NPCTrainer] the trainer to compare to the original trainer + # @param trainer [Player, NPCTrainer, nil] the trainer to compare to the original trainer # @return [Boolean] whether the given trainer is not this Pokémon's original trainer - def foreign?(trainer) + def foreign?(trainer = $player) return @owner.id != trainer.id || @owner.name != trainer.name end diff --git a/Data/Scripts/020_Debug/003_Debug menus/007_Debug_BattleCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/007_Debug_BattleCommands.rb index 8d3595e07..7108e0ffe 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/007_Debug_BattleCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/007_Debug_BattleCommands.rb @@ -17,6 +17,8 @@ poke_ball_failed - both for Ball Fetch View party screen for each trainer's team, be able to edit properties of Pokémon that aren't in battle. +Choose each battler's next action. + =end #=============================================================================== @@ -370,3 +372,22 @@ BattleDebugMenuCommands.register("mega_evolution", { end } }) + +BattleDebugMenuCommands.register("speed_order", { + "parent" => "main", + "name" => _INTL("Battler Speed Order"), + "description" => _INTL("Show all battlers in order from fastest to slowest."), + "always_show" => true, + "effect" => proc { |battle| + battlers = [] + battlers = battle.allBattlers.map { |b| [b, b.pbSpeed] } + battlers.sort! { |a, b| b[1] <=> a[1] } + commands = [] + battlers.each do |value| + b = value[0] + commands.push(sprintf("[%d] %s (speed: %d)", b.index, b.pbThis, value[1])) + end + pbMessage("\\ts[]" + _INTL("Battlers are listed from fastest to slowest. Speeds include modifiers."), + commands, -1) + } +})