- 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:
wagic.the.homebrew@gmail.com
2009-12-06 04:47:29 +00:00
parent c5e106ba27
commit 0d2c6cf3e5
26 changed files with 638 additions and 195 deletions
+14 -5
View File
@@ -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();