And I think venom12 meant that since if $Trainer.party.length>=1 checks for Pokémon number 1, in the code 1 basically means 2, and 0 means 1. That would make the code actually search for the second Pokémon in the party, not the first since the first is 0. Although, if they function the way you describe, then there should be no problem.
When it comes to party.length, it literally is just that, checking the length of the party. if it's >=1 it's seeing if the party length is 1 or higher. The 0 being 1 logic however, applies to the number of the party, i.e $Trainer.party being the first Pokémon. Found that out the hard way on the length checks when I was getting errors calling the Pokémon into a menu XD.