Battle

io.github.pidoveproject.showdown.battle.Battle
See theBattle companion object
case class Battle(state: BattleState, activePokemon: Map[ActivePosition, ActivePokemon], battleType: Option[BattleType], players: Map[PlayerNumber, Player], generation: Option[Generation], format: Option[FormatName], rules: Set[BattleRule], timerEnabled: Boolean, currentTurn: Option[TurnNumber], result: Option[BattleResult], currentRequest: Option[ChoiceRequest], weather: Option[Weather], field: Map[FieldEffect, TurnNumber], sides: Map[PlayerId, SideCondition])

The state of a battle. Represents all data about a battle.

Value parameters

activePokemon

the pokemon currently active on the battlefield

battleType

the type of the battle (e.g singles)

currentRequest

the last pending choice request sent by the server

currentTurn

the current turn of this battle

field

the currently active terrain effects

format

this battle's format

generation

this battle's generation

players

this battle's participants

result

the result of this battle if it ended

rules

this battle's rules

sides

the currently active side-bound effects

state

the game state of this battle (initialization, playing...)

timerEnabled

whether the time for each turn is limited or not

weather

the weather currently active on the battlefield

Attributes

Companion
object
Source
Battle.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Change the local position of a pokemon.

Change the local position of a pokemon.

Value parameters

position

the current position of the pokemon

slot

the slot to move the pokemon to

Attributes

Returns

a copy of this battle with the given pokemon moved

Source
Battle.scala
def declareTeamMember(playerNumber: PlayerNumber, teamPokemon: TeamMember): (Option[TeamSlot], Battle)

Declare a new team member.

Declare a new team member.

Value parameters

playerNumber

the pokemon's owner

teamPokemon

the pokemon to add to the team

Attributes

Returns

a copy of this battle with the given pokemon added

Source
Battle.scala

Get the pokemon active at the given position.

Get the pokemon active at the given position.

Value parameters

position

the position of the pokemon

Attributes

Returns

the pokemon currently active at position

Source
Battle.scala
def getTeamMember(player: PlayerNumber, slot: TeamSlot): Option[TeamMember]

Get the team member of a player.

Get the team member of a player.

Value parameters

player

the pokemon's owner

slot

the slot of the pokemon in the player's team

Attributes

Returns

the inactive pokemon at the given position

Source
Battle.scala
def getTeamMemberAt(position: ActivePosition): Option[TeamMember]

Get the inactive data of the pokemon active at the given position.

Get the inactive data of the pokemon active at the given position.

Value parameters

position

the position of the pokemon

Attributes

Returns

the TeamMember of the pokemon currently active at position

Source
Battle.scala
def getTeamSlot(playerNumber: PlayerNumber, details: PokemonDetails): Option[TeamSlot]

Retrieve the slot of a team member using its details.

Retrieve the slot of a team member using its details.

Value parameters

details

the details of the pokemon

playerNumber

the owner of the member's team

Attributes

Returns

the slot matching with the given details

Source
Battle.scala
def transformPokemon(pokemonPosition: ActivePosition, targetPosition: ActivePosition): Battle

Transform a pokemon into another, like the ability.

Transform a pokemon into another, like the ability.

Value parameters

pokemonPosition

the position of the pokemon to transform

targetPosition

the position of the pokemon to copy

Attributes

Returns

a copy of this battle with the pokemon transformed

Source
Battle.scala
def update(message: BattleMessage): Battle

Update this data according to the passed server event/message.

Update this data according to the passed server event/message.

Value parameters

message

the message sent by the server

Attributes

Returns

a new Battle updated according to the given message

Source
Battle.scala

Update a pokemon represented by its position.

Update a pokemon represented by its position.

Value parameters

f

the function to apply to the pokemon

position

the position of the pokemon

Attributes

Returns

a copy of this battle with the pokemon updated

Source
Battle.scala

Update all currently active pokemon.

Update all currently active pokemon.

Value parameters

f

the function to apply to the pokemon

Attributes

Returns

a copy of this battle with the active pokemon updated

Source
Battle.scala

Update a player represented by its number.

Update a player represented by its number.

Value parameters

f

the function to apply to the player

number

the numeric id of the player

Attributes

Returns

a copy of this battle with the player updated

Source
Battle.scala

Update the side condition of a player.

Update the side condition of a player.

Value parameters

f

the function to apply to the side condition

side

the side to update

Attributes

Returns

a copy of this battle with the given side updated

Source
Battle.scala

Update the inactive data of a currently active pokemon represented by its position.

Update the inactive data of a currently active pokemon represented by its position.

Value parameters

f

the function to apply to the pokemon

position

the position of the pokemon

Attributes

Returns

a copy of this battle with the pokemon updated

Source
Battle.scala

Set the active pokemon at a given position.

Set the active pokemon at a given position.

Value parameters

pokemon

the pokemon to set at position

position

the position to place the pokemon at

Attributes

Returns

a copy of this battle with the given pokemon

Source
Battle.scala
def withTeamMemberAt(position: ActivePosition, teamPokemon: TeamMember): Battle

Set the inactive information of a pokemon currently active at a given position.

Set the inactive information of a pokemon currently active at a given position.

Value parameters

position

the current position of the pokemon

teamPokemon

the inactive information to set

Attributes

Returns

a copy of this battle with the given pokemon

Source
Battle.scala

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product