View Source Riot.LoR.Card (Riot LoR v1.1.1)

Struct and functions to represent LoR Cards.

Link to this section Summary

Functions

Represent a Card as a tuple of its set, faction id, and number.

Create a Card from a tuple of it's set, faction id, and number.

Create a Card from a card code string.

Represent a Card as its card code string.

Link to this section Types

@type t() :: %Riot.LoR.Card{
  fac: non_neg_integer(),
  num: non_neg_integer(),
  set: non_neg_integer()
}

Link to this section Functions

Link to this function

as_tuple(card)

View Source (since 1.0.0)
@spec as_tuple(t()) :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}

Represent a Card as a tuple of its set, faction id, and number.

examples

Examples

iex> card = %Riot.LoR.Card{set: 1, fac: 0, num: 1}
%Riot.LoR.Card{fac: 0, num: 1, set: 1}
iex> Riot.LoR.Card.as_tuple(card)
{1, 0, 1}
@spec new({non_neg_integer(), non_neg_integer(), non_neg_integer()}) :: t()

Create a Card from a tuple of it's set, faction id, and number.

examples

Examples

iex> Riot.LoR.Card.new({1, 0, 1})
%Riot.LoR.Card{fac: 0, num: 1, set: 1}
Link to this function

parse!(arg)

View Source (since 1.0.0)
@spec parse!(binary()) :: t()

Create a Card from a card code string.

examples

Examples

iex> Riot.LoR.Card.parse!("01DE001")
%Riot.LoR.Card{fac: 0, num: 1, set: 1}
Link to this function

to_code!(card)

View Source (since 1.0.0)
@spec to_code!(t()) :: binary()

Represent a Card as its card code string.

examples

Examples

iex> card = %Riot.LoR.Card{set: 1, fac: 0, num: 1}
%Riot.LoR.Card{fac: 0, num: 1, set: 1}
iex> Riot.LoR.Card.to_code!(card)
"01DE001"