diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index fda727b2d..9ed6bb434 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -84,7 +84,7 @@ module Settings MORE_BONUS_PREMIER_BALLS = (MECHANICS_GENERATION >= 8) # The number of steps allowed before a Safari Zone game is over (0=infinite). SAFARI_STEPS = 600 - # The number of seconds a Bug Catching Contest lasts for (0=infinite). + # The number of seconds a Bug-Catching Contest lasts for (0=infinite). BUG_CONTEST_TIME = 20 * 60 # 20 minutes #============================================================================= diff --git a/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb b/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb index c8fab9dff..0c63008a0 100644 --- a/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb +++ b/Data/Scripts/005_Sprites/008_Sprite_AnimationSprite.rb @@ -41,6 +41,8 @@ end # #=============================================================================== class Spriteset_Map + attr_reader :usersprites + alias _animationSprite_initialize initialize unless private_method_defined?(:_animationSprite_initialize) alias _animationSprite_update update unless method_defined?(:_animationSprite_update) alias _animationSprite_dispose dispose unless method_defined?(:_animationSprite_dispose) diff --git a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb index fce6e46c5..82bb8b8a0 100644 --- a/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb +++ b/Data/Scripts/011_Battle/004_Scene/003_Scene_ChooseCommands.rb @@ -22,7 +22,7 @@ class Battle::Scene # 1 = regular battle with "Cancel" # 2 = regular battle with "Call" (for Shadow Pokémon battles) # 3 = Safari Zone - # 4 = Bug Catching Contest + # 4 = Bug-Catching Contest def pbCommandMenuEx(idxBattler, texts, mode = 0) pbShowWindow(COMMAND_BOX) cw = @sprites["commandWindow"] diff --git a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb index 28915f713..674935ef3 100644 --- a/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb +++ b/Data/Scripts/011_Battle/004_Scene/005_Battle_Scene_Menus.rb @@ -108,7 +108,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" [5, 7, 6, 3], # 3 = Safari Zone - [0, 8, 1, 3] # 4 = Bug Catching Contest + [0, 8, 1, 3] # 4 = Bug-Catching Contest ] def initialize(viewport, z) @@ -450,7 +450,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase [0, 2, 1, 9], # 1 = Regular battle with "Cancel" instead of "Run" [0, 2, 1, 4], # 2 = Regular battle with "Call" instead of "Run" [5, 7, 6, 3], # 3 = Safari Zone - [0, 8, 1, 3] # 4 = Bug Catching Contest + [0, 8, 1, 3] # 4 = Bug-Catching Contest ] CMD_BUTTON_WIDTH_SMALL = 170 TEXT_BASE_COLOR = Color.new(240, 248, 224) diff --git a/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb b/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb index 6e9c951cf..81eafa7c6 100644 --- a/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb +++ b/Data/Scripts/011_Battle/007_Other battle types/002_BugContestBattle.rb @@ -1,5 +1,5 @@ #=============================================================================== -# Bug Catching Contest battle scene (the visuals of the battle) +# Bug-Catching Contest battle scene (the visuals of the battle) #=============================================================================== class Battle::Scene alias _bugContest_pbInitSprites pbInitSprites unless method_defined?(:_bugContest_pbInitSprites) @@ -27,7 +27,7 @@ class Battle::Scene end #=============================================================================== -# Bug Catching Contest battle class +# Bug-Catching Contest battle class #=============================================================================== class BugContestBattle < Battle attr_accessor :ballCount diff --git a/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb b/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb index 07b57ea88..828327ce4 100644 --- a/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb +++ b/Data/Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb @@ -36,7 +36,7 @@ class PokemonEncounters end # Returns whether encounters for the given encounter type have been defined - # for the given map. Only called by Bug Catching Contest to see if it can use + # for the given map. Only called by Bug-Catching Contest to see if it can use # the map's BugContest encounter type to generate caught Pokémon for the other # contestants. def map_has_encounter_type?(map_ID, enc_type) @@ -57,7 +57,7 @@ class PokemonEncounters end # Returns whether land-like encounters have been defined for the current map - # (ignoring the Bug Catching Contest one). + # (ignoring the Bug-Catching Contest one). # Applies only to encounters triggered by moving around. def has_normal_land_encounters? GameData::EncounterType.each do |enc_type| @@ -345,7 +345,7 @@ class PokemonEncounters # For the given map, randomly chooses a species and level from the encounter # list for the given encounter type. Returns nil if there are none defined. - # Used by the Bug Catching Contest to choose what the other participants + # Used by the Bug-Catching Contest to choose what the other participants # caught. def choose_wild_pokemon_for_map(map_ID, enc_type) if !enc_type || !GameData::EncounterType.exists?(enc_type) diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 13a870824..d2379f433 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -700,6 +700,7 @@ class PokemonParty_Scene screen = PokemonSummaryScreen.new(scene, inbattle) screen.pbStartScreen(@party, pkmnid) yield if block_given? + pbRefresh pbFadeInAndShow(@sprites, oldsprites) end diff --git a/Data/Scripts/016_UI/006_UI_Summary.rb b/Data/Scripts/016_UI/006_UI_Summary.rb index fa9d424ea..bb64f25ed 100644 --- a/Data/Scripts/016_UI/006_UI_Summary.rb +++ b/Data/Scripts/016_UI/006_UI_Summary.rb @@ -305,6 +305,8 @@ class PokemonSummary_Scene drawPageOneEgg return end + @sprites["pokemon"].setPokemonBitmap(@pokemon) + @sprites["pokeicon"].pokemon = @pokemon @sprites["itemicon"].item = @pokemon.item_id overlay = @sprites["overlay"].bitmap overlay.clear diff --git a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb index a7573aea5..9144a23a9 100644 --- a/Data/Scripts/018_Alternate battle modes/002_BugContest.rb +++ b/Data/Scripts/018_Alternate battle modes/002_BugContest.rb @@ -5,7 +5,7 @@ class BugContestState attr_accessor :ballcount attr_accessor :decision attr_accessor :lastPokemon - attr_reader :timer + attr_accessor :timer CONTESTANT_NAMES = [ _INTL("Bug Catcher Ed"), @@ -128,7 +128,7 @@ class BugContestState score = pbBugContestScore(pokemon) judgearray.push([cont, pokemon.species, score]) end - raise _INTL("Too few bug catching contestants") if judgearray.length < 3 + raise _INTL("Too few bug-catching contestants") if judgearray.length < 3 judgearray.sort! { |a, b| b[2] <=> a[2] } # sort by score in descending order @places.push(judgearray[0]) @places.push(judgearray[1]) @@ -232,6 +232,8 @@ end # #=============================================================================== class TimerDisplay # :nodoc: + attr_accessor :start + def initialize(start, maxtime) @timer = Window_AdvancedTextPokemon.newWithSize("", Graphics.width - 120, 0, 120, 64) @timer.z = 99999 @@ -265,7 +267,7 @@ end #=============================================================================== # #=============================================================================== -# Returns a score for this Pokemon in the Bug Catching Contest. +# Returns a score for this Pokemon in the Bug-Catching Contest. # Not exactly the HGSS calculation, but it should be decent enough. def pbBugContestScore(pkmn) levelscore = pkmn.level * 4 @@ -287,17 +289,17 @@ def pbBugContestState return $PokemonGlobal.bugContestState end -# Returns true if the Bug Catching Contest in progress +# Returns true if the Bug-Catching Contest in progress def pbInBugContest? return pbBugContestState.inProgress? end -# Returns true if the Bug Catching Contest in progress and has not yet been judged +# Returns true if the Bug-Catching Contest in progress and has not yet been judged def pbBugContestUndecided? return pbBugContestState.undecided? end -# Returns true if the Bug Catching Contest in progress and is being judged +# Returns true if the Bug-Catching Contest in progress and is being judged def pbBugContestDecided? return pbBugContestState.decided? end diff --git a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb index 9df55d007..9136b41f6 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/002_Debug_MenuCommands.rb @@ -65,6 +65,84 @@ MenuHandlers.add(:debug_menu, :variables, { } }) +MenuHandlers.add(:debug_menu, :safari_zone_and_bug_contest, { + "name" => _INTL("Safari Zone and Bug-Catching Contest"), + "parent" => :field_menu, + "description" => _INTL("Edit steps/time remaining and number of usable Poké Balls."), + "effect" => proc { + if pbInSafari? + safari = pbSafariState + cmd = 0 + loop do + cmds = [_INTL("Steps remaining: {1}", (Settings::SAFARI_STEPS > 0) ? safari.steps : _INTL("infinite")), + GameData::Item.get(:SAFARIBALL).name_plural + ": " + safari.ballcount.to_s] + cmd = pbShowCommands(nil, cmds, -1, cmd) + break if cmd < 0 + case cmd + when 0 # Steps remaining + if Settings::SAFARI_STEPS > 0 + params = ChooseNumberParams.new + params.setRange(0, 99999) + params.setDefaultValue(safari.steps) + safari.steps = pbMessageChooseNumber(_INTL("Set the steps remaining in this Safari game."), params) + end + when 1 # Safari Balls + params = ChooseNumberParams.new + params.setRange(0, 99999) + params.setDefaultValue(safari.ballcount) + safari.ballcount = pbMessageChooseNumber( + _INTL("Set the quantity of {1}.", GameData::Item.get(:SAFARIBALL).name_plural), params) + end + end + elsif pbInBugContest? + contest = pbBugContestState + cmd = 0 + loop do + cmds = [] + if Settings::BUG_CONTEST_TIME > 0 + curtime = [(contest.timer + Settings::BUG_CONTEST_TIME * Graphics.frame_rate) - Graphics.frame_count, 0].max + curtime /= Graphics.frame_rate + min = curtime / 60 + sec = curtime % 60 + time_string = _ISPRINTF("{1:02d}m {2:02d}s", min, sec) + else + time_string = _INTL("infinite") + end + cmds.push(_INTL("Time remaining: {1}", time_string)) + cmds.push(GameData::Item.get(:SPORTBALL).name_plural + ": " + contest.ballcount.to_s) + cmd = pbShowCommands(nil, cmds, -1, cmd) + break if cmd < 0 + case cmd + when 0 # Steps remaining + if Settings::BUG_CONTEST_TIME > 0 + params = ChooseNumberParams.new + params.setRange(0, 99999) + params.setDefaultValue(min) + new_time = pbMessageChooseNumber(_INTL("Set the time remaining (in minutes) in this Bug-Catching Contest."), params) + echoln contest.timer + echoln new_time + contest.timer += (new_time - min) * 60 * Graphics.frame_rate + echoln contest.timer + $scene.spriteset.usersprites.each do |sprite| + next if !sprite.is_a?(TimerDisplay) + sprite.start = contest.timer + break + end + end + when 1 # Safari Balls + params = ChooseNumberParams.new + params.setRange(0, 99999) + params.setDefaultValue(contest.ballcount) + contest.ballcount = pbMessageChooseNumber( + _INTL("Set the quantity of {1}.", GameData::Item.get(:SPORTBALL).name_plural), params) + end + end + else + pbMessage(_INTL("You aren't in the Safari Zone or a Bug-Catching Contest!")) + end + } +}) + MenuHandlers.add(:debug_menu, :edit_field_effects, { "name" => _INTL("Change Field Effects"), "parent" => :field_menu, @@ -139,24 +217,6 @@ MenuHandlers.add(:debug_menu, :day_care, { } }) -MenuHandlers.add(:debug_menu, :relic_stone, { - "name" => _INTL("Use Relic Stone"), - "parent" => :field_menu, - "description" => _INTL("Shadow Pokémon. Choose a Pokémon to show to the Relic Stone for purification."), - "effect" => proc { - pbRelicStone - } -}) - -MenuHandlers.add(:debug_menu, :purify_chamber, { - "name" => _INTL("Use Purify Chamber"), - "parent" => :field_menu, - "description" => _INTL("Shadow Pokémon. Open the Purify Chamber for purification."), - "effect" => proc { - pbPurifyChamber - } -}) - MenuHandlers.add(:debug_menu, :storage_wallpapers, { "name" => _INTL("Toggle Storage Wallpapers"), "parent" => :field_menu, @@ -763,39 +823,34 @@ MenuHandlers.add(:debug_menu, :player_menu, { MenuHandlers.add(:debug_menu, :set_money, { "name" => _INTL("Set Money"), "parent" => :player_menu, - "description" => _INTL("Edit how much money you have."), + "description" => _INTL("Edit how much money, Game Corner Coins and Battle Points you have."), "effect" => proc { - params = ChooseNumberParams.new - params.setRange(0, Settings::MAX_MONEY) - params.setDefaultValue($player.money) - $player.money = pbMessageChooseNumber(_INTL("Set the player's money."), params) - pbMessage(_INTL("You now have ${1}.", $player.money.to_s_formatted)) - } -}) + cmd = 0 + loop do + cmds = [_INTL("Money: ${1}", $player.money.to_s_formatted), + _INTL("Coins: {1}", $player.coins.to_s_formatted), + _INTL("Battle Points: {1}", $player.battle_points.to_s_formatted)] + cmd = pbShowCommands(nil, cmds, -1, cmd) + break if cmd < 0 + case cmd + when 0 # Money + params = ChooseNumberParams.new + params.setRange(0, Settings::MAX_MONEY) + params.setDefaultValue($player.money) + $player.money = pbMessageChooseNumber("\\ts[]" + _INTL("Set the player's money."), params) + when 1 # Coins + params = ChooseNumberParams.new + params.setRange(0, Settings::MAX_COINS) + params.setDefaultValue($player.coins) + $player.coins = pbMessageChooseNumber("\\ts[]" + _INTL("Set the player's Coin amount."), params) + when 2 # Battle Points + params = ChooseNumberParams.new + params.setRange(0, Settings::MAX_BATTLE_POINTS) + params.setDefaultValue($player.battle_points) + $player.battle_points = pbMessageChooseNumber("\\ts[]" + _INTL("Set the player's BP amount."), params) + end -MenuHandlers.add(:debug_menu, :set_coins, { - "name" => _INTL("Set Coins"), - "parent" => :player_menu, - "description" => _INTL("Edit how many Game Corner Coins you have."), - "effect" => proc { - params = ChooseNumberParams.new - params.setRange(0, Settings::MAX_COINS) - params.setDefaultValue($player.coins) - $player.coins = pbMessageChooseNumber(_INTL("Set the player's Coin amount."), params) - pbMessage(_INTL("You now have {1} Coins.", $player.coins.to_s_formatted)) - } -}) - -MenuHandlers.add(:debug_menu, :set_bp, { - "name" => _INTL("Set Battle Points"), - "parent" => :player_menu, - "description" => _INTL("Edit how many Battle Points you have."), - "effect" => proc { - params = ChooseNumberParams.new - params.setRange(0, Settings::MAX_BATTLE_POINTS) - params.setDefaultValue($player.battle_points) - $player.battle_points = pbMessageChooseNumber(_INTL("Set the player's BP amount."), params) - pbMessage(_INTL("You now have {1} BP.", $player.battle_points.to_s_formatted)) + end } }) @@ -878,13 +933,13 @@ MenuHandlers.add(:debug_menu, :toggle_pokegear, { }) MenuHandlers.add(:debug_menu, :toggle_box_link, { - "name" => _INTL("Toggle Pokémon Box Link's Effect"), + "name" => _INTL("Toggle Party Screen Access To Storage"), "parent" => :player_menu, "description" => _INTL("Toggle Box Link's effect of accessing Pokémon storage via the party screen."), "effect" => proc { $player.has_box_link = !$player.has_box_link - pbMessage(_INTL("Enabled Pokémon Box Link's effect.")) if $player.has_box_link - pbMessage(_INTL("Disabled Pokémon Box Link's effect.")) if !$player.has_box_link + pbMessage(_INTL("Enabled access to storage from the party screen.")) if $player.has_box_link + pbMessage(_INTL("Disabled access to storage from the party screen.")) if !$player.has_box_link } }) @@ -957,6 +1012,45 @@ MenuHandlers.add(:debug_menu, :random_id, { } }) +#=============================================================================== +# Shadow Pokémon options +#=============================================================================== +MenuHandlers.add(:debug_menu, :shadow_pokemon_menu, { + "name" => _INTL("Shadow Pokémon Options..."), + "parent" => :main, + "description" => _INTL("Snag Machine and purification."), + "always_show" => false +}) + +MenuHandlers.add(:debug_menu, :toggle_snag_machine, { + "name" => _INTL("Toggle Snag Machine"), + "parent" => :shadow_pokemon_menu, + "description" => _INTL("Toggle all Poké Balls being able to catch Shadow Pokémon."), + "effect" => proc { + $player.has_snag_machine = !$player.has_snag_machine + pbMessage(_INTL("Gave the Snag Machine.")) if $player.has_snag_machine + pbMessage(_INTL("Lost the Snag Machine.")) if !$player.has_snag_machine + } +}) + +MenuHandlers.add(:debug_menu, :relic_stone, { + "name" => _INTL("Use Relic Stone"), + "parent" => :shadow_pokemon_menu, + "description" => _INTL("Choose a Shadow Pokémon to show to the Relic Stone for purification."), + "effect" => proc { + pbRelicStone + } +}) + +MenuHandlers.add(:debug_menu, :purify_chamber, { + "name" => _INTL("Use Purify Chamber"), + "parent" => :shadow_pokemon_menu, + "description" => _INTL("Open the Purify Chamber for Shadow Pokémon purification."), + "effect" => proc { + pbPurifyChamber + } +}) + #=============================================================================== # PBS file editors #===============================================================================