View Source Riot.LoR.Card (Riot LoR v1.0.0)
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
@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}
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}
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"