Erwan
-fix issue related to drawing card (underworld dreams)
This commit is contained in:
@@ -398,6 +398,7 @@ titanic_ultimatum.txt
|
||||
torture.txt
|
||||
tranquil_domain.txt
|
||||
twitch.txt
|
||||
underworld_dreams.txt
|
||||
unstable_mutation.txt
|
||||
unstable_mutation2.txt
|
||||
unwilling_recruit.txt
|
||||
|
||||
17
projects/mtg/bin/Res/test/underworld_dreams.txt
Normal file
17
projects/mtg/bin/Res/test/underworld_dreams.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
#Test underworld dream
|
||||
[INIT]
|
||||
DRAW
|
||||
[PLAYER1]
|
||||
library:forest
|
||||
[PLAYER2]
|
||||
inplay:Underworld Dreams
|
||||
[DO]
|
||||
next
|
||||
[ASSERT]
|
||||
FIRSTMAIN
|
||||
[PLAYER1]
|
||||
life:19
|
||||
hand:forest
|
||||
[PLAYER2]
|
||||
inplay:Underworld Dreams
|
||||
[END]
|
||||
@@ -74,7 +74,6 @@ class MTGGameZone {
|
||||
MTGGameZone();
|
||||
~MTGGameZone();
|
||||
void shuffle();
|
||||
virtual MTGCardInstance * draw();
|
||||
void addCard(MTGCardInstance * card);
|
||||
void debugPrint();
|
||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||
@@ -96,7 +95,6 @@ class MTGGameZone {
|
||||
class MTGLibrary: public MTGGameZone {
|
||||
public:
|
||||
void shuffleTopToBottom(int nbcards);
|
||||
MTGCardInstance * draw();
|
||||
virtual ostream& toString(ostream&) const;
|
||||
const char * getName(){return "library";}
|
||||
};
|
||||
|
||||
@@ -78,13 +78,13 @@ void MTGPlayerCards::initGame(int shuffle, int draw){
|
||||
}
|
||||
|
||||
void MTGPlayerCards::drawFromLibrary(){
|
||||
MTGCardInstance * drawnCard = library->draw();
|
||||
if(drawnCard){
|
||||
hand->addCard(drawnCard);
|
||||
GameObserver *g = GameObserver::GetInstance();
|
||||
WEvent * e = NEW WEventZoneChange(drawnCard,library,hand);
|
||||
g->receiveEvent(e);
|
||||
if (!library->nb_cards) {
|
||||
GameObserver::GetInstance()->gameOver = library->owner;
|
||||
return;
|
||||
}
|
||||
MTGCardInstance * toMove = library->cards[library->nb_cards-1];
|
||||
library->lastCardDrawn = toMove;
|
||||
putInZone(toMove, library, hand);
|
||||
}
|
||||
|
||||
void MTGPlayerCards::resetLibrary(){
|
||||
@@ -290,21 +290,6 @@ void MTGGameZone::addCard(MTGCardInstance * card){
|
||||
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGGameZone::draw(){
|
||||
if (!nb_cards) return NULL;
|
||||
nb_cards--;
|
||||
lastCardDrawn = cards[nb_cards];
|
||||
cards.pop_back();
|
||||
cardsMap.erase( lastCardDrawn);
|
||||
return lastCardDrawn;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGLibrary::draw(){
|
||||
if (!nb_cards) {
|
||||
GameObserver::GetInstance()->gameOver = this->owner;
|
||||
}
|
||||
return MTGGameZone::draw();
|
||||
}
|
||||
|
||||
void MTGGameZone::debugPrint(){
|
||||
for (int i = 0; i < nb_cards; i++)
|
||||
|
||||
@@ -330,6 +330,7 @@ TargetChooser::TargetChooser(MTGCardInstance * card, int _maxtargets, bool _othe
|
||||
//Default targetter : every card can be targetted, unless it is protected from the targetter card
|
||||
// For spells that do not "target" a specific card, set targetter to NULL
|
||||
bool TargetChooser::canTarget(Targetable * target){
|
||||
if (!target) return false;
|
||||
if (target->typeAsTarget() == TARGET_CARD){
|
||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||
if (other){
|
||||
|
||||
Reference in New Issue
Block a user