def pbBattleOnStepTaken
if $Trainer.party.length > 0
encounterType=$PokemonEncounters.pbEncounterType
if encounterType>=0
encounter=$PokemonEncounters.pbGenerateEncounter(encounterType)
if $PokemonEncounters.isEncounterPossibleHere?()
encounter=EncounterModifier.trigger(encounter)
if $PokemonEncounters.pbCanEncounter?(encounter)
if $PokemonGlobal.partner
encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])
else
pbWildBattle(encounter[0],encounter[1])
end
end
EncounterModifier.triggerEncounterEnd()
end
end
end
end
That's definitely not the only thing you'd need to play with in order to actually make the battle work. A Pokémon battle very much depends on the player having a Pokémon they can use, and if you don't, there's going to be so many bits of code which don't work. I can't imagine what you want to do with such a feature will be worth the effort of making it work.
The "easiest" solution is to turn such wild battles into Safari Zone battles, but then you'll run into different issues relating to how Safari Zone battles trigger, occur and appear (e.g. Safari Zone battles are hardcoded to use Safari Balls). Not as many issues as above, but they'd still need to be resolved.
It may be easier to just turn your starter selection process into a mini-Safari Zone itself, rather than trying to take some aspects from it or make something new.
BallHandlers::ModifyCatchRate.add(:SAFARIBALL,proc{|ball,catchRate,battle,battler|
next (catchRate*3/2).floor
})
BallHandlers::ModifyCatchRate.add(:SAFARIBALL,proc{|ball,catchRate,battle,battler|
catchRate=(catchRate*3/2).floor
catchRate=255 if $game_switches[[COLOR="red"]x[/COLOR]]
next catchRate
})
if pbIsSnagBall?(ball) && @opponent
pokemon.pbUpdateShadowMoves rescue nil
@snaggedpokemon.push(pokemon)
else
pbStorePokemon(pokemon)
pbSafariState.decision=1 if $game_switches[[COLOR="red"]x[/COLOR]]
end