Package moe.maika.ygofm.gamedata
Class Deck
java.lang.Object
moe.maika.ygofm.gamedata.Deck
Implementation of a deck of cards in Forbidden Memories. A deck must be exactly
40 cards and cannot contain more than 3 copies of a single card. Deck sorts that
are done on the Build Deck screen before duels are also implemented to facilitate
RNG manipulation simulations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final int
The size of a deck in Forbidden Memories.static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
static final Comparator<Card>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Deck
createDuelistDeck
(Duelist duelist, RNG seed) Creates an AI duelist's deck.boolean
get
(int index) Gets the card in the deck at the given index.static List<Comparator<Card>>
Gets all the deck sorts available in Forbidden Memories.getRange
(int start, int end) Gets the range of cards in the deck from the given start index to the given end index.int
hashCode()
void
Shuffles the deck, with its current order as the starting point.void
shuffle
(RNG seed, Comparator<? super Card> deckOrderBeforeDuel) Shuffles the deck, with its current order as the starting point.void
sort
(Comparator<? super Card> comparator) Sorts the deck according to the given deck sort.boolean
startsWith
(List<Card> cards) Determines whether the deck starts with the given sequence of cards.toList()
Converts this deck to a list of cards.toString()
-
Field Details
-
DECK_SIZE
public static final int DECK_SIZEThe size of a deck in Forbidden Memories.- See Also:
-
CARD_ID_ORDER
-
ALPHABETICAL_ORDER
-
MAX_ORDER
-
ATTACK_ORDER
-
DEFENSE_ORDER
-
TYPE_ORDER
-
JAPANESE_ALPHABETICAL_ORDER
-
JAPANESE_MAX_ORDER
-
JAPANESE_ATTACK_ORDER
-
JAPANESE_DEFENSE_ORDER
-
JAPANESE_TYPE_ORDER
-
-
Constructor Details
-
Deck
public Deck()Creates a new deck with no cards. -
Deck
Creates a new deck with the given composition of cards. The composition must contain exactly 40 cards.- Parameters:
composition
- the cards of the deck
-
Deck
Creates a copy of another deck- Parameters:
toCopy
- the deck to copy
-
-
Method Details
-
get
Gets the card in the deck at the given index.- Parameters:
index
- the index of the card in the deck- Returns:
- the card at the given index
-
getRange
Gets the range of cards in the deck from the given start index to the given end index.- Parameters:
start
- the start index, inclusiveend
- the end index, exclusive- Returns:
-
toList
Converts this deck to a list of cards.- Returns:
- a list of cards in the deck in the same order
-
hashCode
public int hashCode() -
equals
-
sort
Sorts the deck according to the given deck sort. The deck in modified in place.- Parameters:
comparator
- the deck sort
-
shuffle
Shuffles the deck, with its current order as the starting point. Use this method for player decks.- Parameters:
seed
- the RNG seeddeckOrderBeforeDuel
- the sort order of the deck on the Build Deck screen before the duel
-
shuffle
Shuffles the deck, with its current order as the starting point. Use this shuffle method for AI decks.- Parameters:
seed
- the RNG seed
-
startsWith
Determines whether the deck starts with the given sequence of cards.- Parameters:
cards
- the sequence of cards- Returns:
- true if the deck starts with the given sequence of cards
-
createDuelistDeck
Creates an AI duelist's deck.- Parameters:
duelist
- the duelist whose deck to createseed
- the RNG seed- Returns:
- an unshuffled AI deck
-
getAllSorts
Gets all the deck sorts available in Forbidden Memories.- Returns:
- a list of all deck sorts
-
toString
-