# getRandomPlayerPokemon | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Function getRandomPlayerPokemon

- getRandomPlayerPokemon(
  isAllowed?: boolean,
  isFainted?: boolean,
  doNotReturnLastAllowedMon?: boolean,
  ): PlayerPokemon

  Will never remove the player's last non-fainted Pokemon (if they only have 1). Otherwise, picks a Pokemon completely at random and removes from the party

  #### Parameters

  - isAllowed: boolean = false

    Default `false`. If `true`, only picks from legal mons. If no legal mons are found (or there is 1, with `doNotReturnLastAllowedMon = true`), will return a mon that is not allowed.

  - isFainted: boolean = false

    Default `false`. If `true`, includes fainted mons.

  - doNotReturnLastAllowedMon: boolean = false

    Default `false`. If `true`, will never return the last unfainted pokemon in the party. Useful when this function is being used to determine what Pokemon to remove from the party (Don't want to remove last unfainted)

  #### Returns PlayerPokemon

  - Defined in src/data/mystery-encounters/utils/encounter-pokemon-utils.ts:100