Overview
TheSide class represents one player’s side in a Pokemon battle. It manages the player’s team, active Pokemon, and side-wide conditions.
Key Properties
Identity
Side identifier: ‘p1’, ‘p2’, ‘p3’, or ‘p4’
Player name
Player avatar identifier
Side number (0-3)
The opposing side (in singles)
Allied side in doubles/triples
Team
Array of all Pokemon on this side
Array of currently active Pokemon (1-3 depending on format)
Number of unfainted Pokemon remaining
Side Conditions
Active side conditions (Stealth Rock, Reflect, etc.)
Conditions on specific field positions
Battle State
Current request for player input
Parsed player choice
Last move used by this side
Core Methods
addSideCondition()
Add a side condition like Stealth Rock or Reflect.Condition ID
Source Pokemon
Causing effect
True if condition was added successfully
removeSideCondition()
Remove a side condition.getSideCondition()
Get data for a specific side condition.addSlotCondition()
Add a condition to a specific field position.getChoice()
Get the current parsed choice.chooseMove()
Make a move choice.Move ID or slot number
Target location (for doubles/triples)
‘mega’, ‘zmove’, or ‘ultra’ for special mechanics
chooseSwitch()
Make a switch choice.Target Pokemon slot or species name
chooseTeam()
Choose team order during Team Preview.Team order as a string of positions
chooseShift()
Shift the active Pokemon’s position.clearChoice()
Clear the pending choice.Request Methods
emitRequest()
Generate and emit a choice request to the player.getRequestData()
Get data for generating a choice request.emitChoiceError()
Send an error message about an invalid choice.Utility Methods
isChoiceDone()
Check if the side has made all required choices.faintedLastTurn()
Check if a Pokemon fainted last turn.faintedThisTurn()
Check if a Pokemon fainted this turn.getTeamPreviewSort()
Get team preview sort order.destroy()
Clean up side resources.Choice Request Structure
When a player needs to make a choice, they receive a request:Example Usage
Related APIs
Battle
Battle class
Pokemon
Pokemon class
Choice Requests
Request protocol
Battle Protocol
Battle messages
