It's me again. Sorry.
So, I was looking for a way to for an enemy trainer to hold a certain Pokémon to send out last after the rest of their team has been defeated.
And I found this on PokeCommunity:
def pbDefaultChooseNewEnemy(index,party)
enemies=[]
for i in 0..party.length-1
if pbCanSwitchLax?(index,i,false)
enemies.push(i) if i != party.length-1 || enemies.length==0
end
end
if enemies.length>0
return pbChooseBestNewEnemy(index,party,enemies)
end
return -1
end
This was posted in response to someone asking a similar question, where the bolded part is to be added to line 4269 in PokeBattle_AI in v.17.2.
I don't quite understand what the snippet implies but I think it's referring to any trainer's last Pokémon listed. Upon testing this with and without
the added code, I can confirm the AI always holds the last Pokémon specified in the PBS trainer's party until they have nothing left.