io.github.pidoveproject.showdown.protocol.server.choice.MoveRange.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-showdown-api_3 Show documentation
Show all versions of scala-showdown-api_3 Show documentation
A Scala wrapper of Pokemon Showdown's API
The newest version!
package io.github.pidoveproject.showdown.protocol.server.choice
import zio.json.*
/**
* The range of a move.
*/
@jsonMemberNames(CamelCase)
enum MoveRange:
/**
* Target a single opponent.
*/
case Normal
/**
* Target the user's side.
*/
case AllySide
/**
* Target the user.
*/
case Self
/**
* Target everyone.
*/
case All
/**
* Target all adjacent pokemon.
*/
case AllAdjacent
/**
* Target all adjacent opponents.
*/
case AllAdjacentFoes
/**
* Target all opponents.
*/
case FoeSide
/**
* Random normal.
*/
case RandomNormal
/**
* Target any pokemon.
*/
case Any
object MoveRange:
given JsonDecoder[MoveRange] =
JsonDecoder
.string
.mapOrFail(name => MoveRange.values.find(_.toString.equalsIgnoreCase(name)).toRight(s"Invalid move range: $name"))