def pbSwitch(index,lax,cancancel)
[email protected](index)
[email protected]
ret=-1
# Fade out and hide all sprites
visiblesprites=pbFadeOutAndHide(@sprites)
pbShowWindow(BLANK)
pbSetMessageMode(true)
modparty=[]
for i in 0...6
modparty.push(party[partypos[i]])
end
scene=PokemonParty_Scene.new
@switchscreen=PokemonPartyScreen.new(scene,modparty)
@switchscreen.pbStartScene(_INTL("Choose a Pokémon."),
@battle.doublebattle && [email protected])
loop do
scene.pbSetHelpText(_INTL("Choose a Pokémon."))
[email protected]
if cancancel && activecmd==-1
ret=-1
break
end
[B]if activecmd>=0
commands=[]
cmdShift=-1
cmdSummary=-1
pkmnindex=partypos[activecmd]
commands[cmdShift=commands.length]=_INTL("Switch In") if !party[pkmnindex].isEgg?
commands[cmdSummary=commands.length]=_INTL("Summary")
commands[commands.length]=_INTL("Cancel")
command=scene.pbShowCommands(_INTL("Do what with {1}?",party[pkmnindex].name),commands)
if cmdShift>=0 && command==cmdShift
canswitch=lax ? @battle.pbCanSwitchLax?(index,pkmnindex,true) :
@battle.pbCanSwitch?(index,pkmnindex,true)
if canswitch
ret=pkmnindex
break
end
elsif cmdSummary>=0 && command==cmdSummary
scene.pbSummary(activecmd)
end
end[/B]
end
@switchscreen.pbEndScene
@switchscreen=nil
pbShowWindow(BLANK)
pbSetMessageMode(false)
# back to main battle screen
pbFadeInAndShow(@sprites,visiblesprites)
return ret
end