#===============================================================================
# Start a double wild battle
#===============================================================================
def pbDoubleWildBattle(species1,level1,species2,level2,variable=nil,canescape=true,canlose=false)
if (Input.press?(Input::CTRL) && $DEBUG) || $Trainer.pokemonCount==0
if $Trainer.pokemonCount>0
Kernel.pbMessage(_INTL("SKIPPING BATTLE..."))
end
pbSet(variable,1)
$PokemonGlobal.nextBattleBGM = nil
$PokemonGlobal.nextBattleME = nil
$PokemonGlobal.nextBattleBack = nil
return true
end
if species1.is_a?(String) || species1.is_a?(Symbol)
species1 = getID(PBSpecies,species1)
end
if species2.is_a?(String) || species2.is_a?(Symbol)
species2 = getID(PBSpecies,species2)
end
currentlevels = []
for i in $Trainer.party
currentlevels.push(i.level)
end
genwildpoke = pbGenerateWildPokemon(species1,level1)
genwildpoke2 = pbGenerateWildPokemon(species2,level2)
Events.onStartBattle.trigger(nil,genwildpoke)
scene = pbNewBattleScene
if $PokemonGlobal.partner
othertrainer = PokeBattle_Trainer.new($PokemonGlobal.partner[1],$PokemonGlobal.partner[0])
othertrainer.id = $PokemonGlobal.partner[2]
othertrainer.party = $PokemonGlobal.partner[3]
combinedParty = []
for i in 0...$Trainer.party.length
combinedParty[i] = $Trainer.party[i]
end
for i in 0...othertrainer.party.length
combinedParty[6+i] = othertrainer.party[i]
end
battle = PokeBattle_Battle.new(scene,combinedParty,[genwildpoke,genwildpoke2],[$Trainer,othertrainer],nil)
battle.fullparty1 = true
else
battle = PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke,genwildpoke2],$Trainer,nil)
battle.fullparty1 = false
end
battle.internalbattle = true
battle.doublebattle = battle.pbDoubleBattleAllowed?()
battle.cantescape = !canescape
pbPrepareBattle(battle)
decision = 0
pbBattleAnimation(pbGetWildBattleBGM(species1),2,[genwildpoke,genwildpoke2]) {
pbSceneStandby {
decision = battle.pbStartBattle(canlose)
}
pbAfterBattle(decision,canlose)
}
Input.update
pbSet(variable,decision)
return (decision!=2 && decision!=5)
end