Erwan
-fix issue related to drawing card (underworld dreams)
This commit is contained in:
@@ -398,6 +398,7 @@ titanic_ultimatum.txt
|
|||||||
torture.txt
|
torture.txt
|
||||||
tranquil_domain.txt
|
tranquil_domain.txt
|
||||||
twitch.txt
|
twitch.txt
|
||||||
|
underworld_dreams.txt
|
||||||
unstable_mutation.txt
|
unstable_mutation.txt
|
||||||
unstable_mutation2.txt
|
unstable_mutation2.txt
|
||||||
unwilling_recruit.txt
|
unwilling_recruit.txt
|
||||||
|
|||||||
@@ -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();
|
||||||
~MTGGameZone();
|
~MTGGameZone();
|
||||||
void shuffle();
|
void shuffle();
|
||||||
virtual MTGCardInstance * draw();
|
|
||||||
void addCard(MTGCardInstance * card);
|
void addCard(MTGCardInstance * card);
|
||||||
void debugPrint();
|
void debugPrint();
|
||||||
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||||
@@ -96,7 +95,6 @@ class MTGGameZone {
|
|||||||
class MTGLibrary: public MTGGameZone {
|
class MTGLibrary: public MTGGameZone {
|
||||||
public:
|
public:
|
||||||
void shuffleTopToBottom(int nbcards);
|
void shuffleTopToBottom(int nbcards);
|
||||||
MTGCardInstance * draw();
|
|
||||||
virtual ostream& toString(ostream&) const;
|
virtual ostream& toString(ostream&) const;
|
||||||
const char * getName(){return "library";}
|
const char * getName(){return "library";}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -78,13 +78,13 @@ void MTGPlayerCards::initGame(int shuffle, int draw){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MTGPlayerCards::drawFromLibrary(){
|
void MTGPlayerCards::drawFromLibrary(){
|
||||||
MTGCardInstance * drawnCard = library->draw();
|
if (!library->nb_cards) {
|
||||||
if(drawnCard){
|
GameObserver::GetInstance()->gameOver = library->owner;
|
||||||
hand->addCard(drawnCard);
|
return;
|
||||||
GameObserver *g = GameObserver::GetInstance();
|
|
||||||
WEvent * e = NEW WEventZoneChange(drawnCard,library,hand);
|
|
||||||
g->receiveEvent(e);
|
|
||||||
}
|
}
|
||||||
|
MTGCardInstance * toMove = library->cards[library->nb_cards-1];
|
||||||
|
library->lastCardDrawn = toMove;
|
||||||
|
putInZone(toMove, library, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MTGPlayerCards::resetLibrary(){
|
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(){
|
void MTGGameZone::debugPrint(){
|
||||||
for (int i = 0; i < nb_cards; i++)
|
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
|
//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
|
// For spells that do not "target" a specific card, set targetter to NULL
|
||||||
bool TargetChooser::canTarget(Targetable * target){
|
bool TargetChooser::canTarget(Targetable * target){
|
||||||
|
if (!target) return false;
|
||||||
if (target->typeAsTarget() == TARGET_CARD){
|
if (target->typeAsTarget() == TARGET_CARD){
|
||||||
MTGCardInstance * card = (MTGCardInstance *) target;
|
MTGCardInstance * card = (MTGCardInstance *) target;
|
||||||
if (other){
|
if (other){
|
||||||
|
|||||||
Reference in New Issue
Block a user