Added effect of Pokémon Box Link

This commit is contained in:
Maruno17
2021-09-12 21:08:46 +01:00
parent f9c6e142e5
commit f00f030825
6 changed files with 57 additions and 8 deletions

View File

@@ -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
#=============================================================================

View File

@@ -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

View File

@@ -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)