cards
Module that handles all the inner mechanics of libarcomage.
- Stats[]
Player;
- Players. Supports more than 2. TODO to implement it.
- bool
DiscardRound;
- Whether this turn is discard only.
- bool
InitComplete;
- Indicates whether the Queue is set up already.
- shared int
Turn;
- Number of the player whose turn it is. This is an absolute value.
- int
NextTurn;
- Number of the player who will go next.
- int
LastTurn;
- Number of the player whose turn ended before.
- CardInfo[]
Queue;
- Cards in the bank.
- size_t
ShuffleTimer;
- Countdown until a reshuffling is needed.
- void
InitLuaFunctions();
- Defines functions and sends them over to Lua.
- void
ShuffleQueue();
- Shuffles the card queue using the Fisher-Yates algorithm
- CardInfo
GetCard();
- Pops and returns the next card in the queue and moves the ShuffleTimer down.
- void
PutCard(CardInfo CI);
- Pushes the card into the queue.
- float
AlterAIPriority(float Priority, CardInfo CI);
- Changes the AI priority of the given card by looking at the general trends
of the game. This is not specific to any card; card-specific code goes to Lua.
BUGS:
Cards should use tags to denote which cards increase tower, which
damage etc.
Returns:
Altered priority.
- bool
CanPlayCard(CardInfo CI, bool Discarded);
- Check whether the card the payer is attempting to play is playable.
- bool
PlayCard(int CardPlace, bool Discarded);
- Functionality when playing a card.
Plays the animation, handles the turn sequence, distributes resources
Parameters:
CardPlace = The number of the card in the player's hand.
Discarded = Whether this card is to be discarded.
- void
SaveStatChanges(CardInfo PlayedCard, bool bDiscarded);
- Figures out what exactly the played card changed and writes it into StatChanges.
Needed for the MArcomage card abilities.
- void
GetNextTurn(CardInfo CI, bool Discarded);
- Executes the card to get the number of the player that is supposed to move
next.
- void
Normalise();
- Checks whether the card effect made us go out of bounds, and if it did,
makes the values stay within acceptable limits.