Erwan
- Adding external rules mechanism. It is very crude for the moment, but I hope it will grow. Have a look at Rules/mtg.txt for basic usage
This commit is contained in:
@@ -14,12 +14,11 @@
|
||||
//Players Game
|
||||
//------------------------------
|
||||
|
||||
MTGPlayerCards::MTGPlayerCards(MTGAllCards * _collection, int * idList, int idListSize){
|
||||
MTGPlayerCards::MTGPlayerCards(int * idList, int idListSize){
|
||||
init();
|
||||
int i;
|
||||
collection = _collection;
|
||||
for (i=0;i<idListSize;i++){
|
||||
MTGCard * card = collection->getCardById(idList[i]);
|
||||
MTGCard * card = GameApp::collection->getCardById(idList[i]);
|
||||
if (card){
|
||||
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
|
||||
library->addCard(newCard);
|
||||
@@ -27,9 +26,14 @@ MTGPlayerCards::MTGPlayerCards(MTGAllCards * _collection, int * idList, int idLi
|
||||
}
|
||||
}
|
||||
|
||||
MTGPlayerCards::MTGPlayerCards(MTGAllCards * _collection, MTGDeck * deck){
|
||||
MTGPlayerCards::MTGPlayerCards(MTGDeck * deck){
|
||||
init();
|
||||
collection = _collection;
|
||||
initDeck(deck);
|
||||
}
|
||||
|
||||
|
||||
void MTGPlayerCards::initDeck(MTGDeck * deck){
|
||||
resetLibrary();
|
||||
map<int,int>::iterator it;
|
||||
for (it = deck->cards.begin(); it!=deck->cards.end(); it++){
|
||||
MTGCard * card = deck->getCardById(it->first);
|
||||
@@ -83,6 +87,11 @@ void MTGPlayerCards::drawFromLibrary(){
|
||||
}
|
||||
}
|
||||
|
||||
void MTGPlayerCards::resetLibrary(){
|
||||
SAFE_DELETE(library);
|
||||
library = NEW MTGLibrary();
|
||||
}
|
||||
|
||||
void MTGPlayerCards::init(){
|
||||
library = NEW MTGLibrary();
|
||||
graveyard = NEW MTGGraveyard();
|
||||
|
||||
Reference in New Issue
Block a user