diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index ba43c0016..5a183cf55 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -320,6 +320,10 @@ module Settings # The Game Switch which, while ON, makes all Pokémon created considered to be # met via a fateful encounter. FATEFUL_ENCOUNTER_SWITCH = 32 + # The Game Switch which, while ON, disables the effect of the Pokémon Box Link + # and prevents the player from accessing Pokémon storage via the party screen + # with it. + DISABLE_BOX_LINK_SWITCH = 35 #============================================================================= diff --git a/Data/Scripts/013_Items/Gen 8 items.rb b/Data/Scripts/013_Items/Gen 8 items.rb index 7f0a3dfe7..3a6d575d8 100644 --- a/Data/Scripts/013_Items/Gen 8 items.rb +++ b/Data/Scripts/013_Items/Gen 8 items.rb @@ -388,9 +388,4 @@ When holder's stat(s) is lowered, consume item and holder switches out. Not triggered by Parting Shot, or if a faster mon's Eject Button/Eject Pack triggers. -Pokémon Box Link -Key item, unusable. Enables pressing a button while in the party screen to open -the "Organise Boxes" mode of Pokémon storage. This is disabled at certain times, -perhaps when a Game Switch is on. - =end diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 49de7e891..22408c6db 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -444,18 +444,27 @@ end # Pokémon party visuals #=============================================================================== class PokemonParty_Scene - def pbStartScene(party,starthelptext,annotations=nil,multiselect=false) + def pbStartScene(party, starthelptext, annotations = nil, multiselect = false, can_access_storage = false) @sprites = {} @party = party @viewport = Viewport.new(0,0,Graphics.width,Graphics.height) @viewport.z = 99999 @multiselect = multiselect + @can_access_storage = can_access_storage addBackgroundPlane(@sprites,"partybg","Party/bg",@viewport) @sprites["messagebox"] = Window_AdvancedTextPokemon.new("") @sprites["messagebox"].viewport = @viewport @sprites["messagebox"].visible = false @sprites["messagebox"].letterbyletter = true pbBottomLeftLines(@sprites["messagebox"],2) + @sprites["storagetext"] = Window_UnformattedTextPokemon.new( + @can_access_storage ? _INTL("[Special]: To Boxes") : "") + @sprites["storagetext"].x = 32 + @sprites["storagetext"].y = Graphics.height - @sprites["messagebox"].height - 16 + @sprites["storagetext"].viewport = @viewport + @sprites["storagetext"].baseColor = Color.new(248, 248, 248) + @sprites["storagetext"].shadowColor = Color.new(0, 0, 0) + @sprites["storagetext"].windowskin = nil @sprites["helpwindow"] = Window_UnformattedTextPokemon.new(starthelptext) @sprites["helpwindow"].viewport = @viewport @sprites["helpwindow"].visible = true @@ -719,7 +728,15 @@ class PokemonParty_Scene end end cancelsprite = Settings::MAX_PARTY_SIZE + ((@multiselect) ? 1 : 0) - if Input.trigger?(Input::ACTION) && canswitch==1 && @activecmd!=cancelsprite + if Input.trigger?(Input::SPECIAL) && @can_access_storage && canswitch != 2 + pbPlayDecisionSE + pbFadeOutIn { + scene = PokemonStorageScene.new + screen = PokemonStorageScreen.new(scene, $PokemonStorage) + screen.pbStartScreen(0) + pbHardRefresh + } + elsif Input.trigger?(Input::ACTION) && canswitch==1 && @activecmd!=cancelsprite pbPlayDecisionSE return [1,@activecmd] elsif Input.trigger?(Input::ACTION) && canswitch==2 @@ -1131,8 +1148,16 @@ class PokemonPartyScreen end def pbPokemonScreen + can_access_storage = false + if GameData::Item.exists?(:POKEMONBOXLINK) && $PokemonBag.pbHasItem?(:POKEMONBOXLINK) + if !$game_switches[Settings::DISABLE_BOX_LINK_SWITCH] && + !$game_map.metadata&.has_flag?("DisableBoxLink") + can_access_storage = true + end + end @scene.pbStartScene(@party, - (@party.length>1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."),nil) + (@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."), + nil, false, can_access_storage) loop do @scene.pbSetHelpText((@party.length>1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel.")) pkmnid = @scene.pbChoosePokemon(false,-1,1) diff --git a/PBS/Gen 8/items.txt b/PBS/Gen 8/items.txt index 96aa4ed3f..52bf9404b 100644 --- a/PBS/Gen 8/items.txt +++ b/PBS/Gen 8/items.txt @@ -6517,6 +6517,14 @@ Price = 0 Flags = KeyItem Description = This ring contains an untold power that somehow enables Pokémon carrying Mega Stones to Mega Evolve. #------------------------------- +[POKEMONBOXLINK] +Name = Pokémon Box Link +NamePlural = Pokémon Box Links +Pocket = 8 +Price = 0 +Flags = KeyItem +Description = A device that allows you to access the Pokémon storage system. There are some places where it won't work. +#------------------------------- [AURORATICKET] Name = Aurora Ticket NamePlural = Aurora Tickets diff --git a/PBS/items.txt b/PBS/items.txt index 96aa4ed3f..52bf9404b 100644 --- a/PBS/items.txt +++ b/PBS/items.txt @@ -6517,6 +6517,14 @@ Price = 0 Flags = KeyItem Description = This ring contains an untold power that somehow enables Pokémon carrying Mega Stones to Mega Evolve. #------------------------------- +[POKEMONBOXLINK] +Name = Pokémon Box Link +NamePlural = Pokémon Box Links +Pocket = 8 +Price = 0 +Flags = KeyItem +Description = A device that allows you to access the Pokémon storage system. There are some places where it won't work. +#------------------------------- [AURORATICKET] Name = Aurora Ticket NamePlural = Aurora Tickets diff --git a/PBS/metadata.txt b/PBS/metadata.txt index ab2f4d077..3511023bb 100644 --- a/PBS/metadata.txt +++ b/PBS/metadata.txt @@ -63,6 +63,7 @@ MapPosition = 0,14,10 MapPosition = 0,13,10 BattleBack = indoor3 Environment = Rock +Flags = DisableBoxLink #------------------------------- [011] # Pokémon Institute @@ -184,10 +185,12 @@ MapPosition = 0,13,6 # Pokémon League MapPosition = 0,13,6 BattleBack = elite1 +Flags = DisableBoxLink #------------------------------- [038] # Hall of Fame MapPosition = 0,13,6 +Flags = DisableBoxLink #------------------------------- [039] # Route 4 @@ -292,6 +295,7 @@ MapPosition = 0,17,10 # Battle Tower arena MapPosition = 0,17,10 BattleBack = indoor1 +Flags = DisableBoxLink #------------------------------- [057] # Stadium Cup lobby @@ -305,6 +309,7 @@ MapPosition = 0,17,10 # Battle Palace arena MapPosition = 0,17,10 BattleBack = indoor1 +Flags = DisableBoxLink #------------------------------- [060] # Battle Arena @@ -314,6 +319,7 @@ MapPosition = 0,17,10 # Battle Arena arena MapPosition = 0,17,10 BattleBack = indoor1 +Flags = DisableBoxLink #------------------------------- [062] # Battle Factory @@ -322,15 +328,18 @@ MapPosition = 0,17,10 [063] # Battle Factory intro corridor MapPosition = 0,17,10 +Flags = DisableBoxLink #------------------------------- [064] # Battle Factory arena MapPosition = 0,17,10 BattleBack = indoor1 +Flags = DisableBoxLink #------------------------------- [065] # Battle Factory corridor MapPosition = 0,17,10 +Flags = DisableBoxLink #------------------------------- [066] # Safari Zone