io.github.pidoveproject.showdown.battle.BattleRule.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.battle
import io.github.pidoveproject.showdown.protocol.{MessageDecoder, ProtocolError}
/**
* The rule of a battle or format.
*
* @param name the name of this rule
* @param description a short description of this rule
*/
case class BattleRule(name: String, description: String)
object BattleRule:
given MessageDecoder[BattleRule] = MessageDecoder.string.mapEither:
case s"$name: $description" => Right(BattleRule(name, description))
case value => Left(ProtocolError.InvalidInput(value, "Invalid rule format"))