- Attempt to fix a bug in 0.5.0 with persuasion. Haven't tried to compile/test yet :/
This commit is contained in:
wagic.the.homebrew
2009-03-18 04:04:34 +00:00
parent 415061642d
commit bc7c689eab
3 changed files with 34 additions and 9 deletions

View File

@@ -0,0 +1,18 @@
#Testing Persuasion on a serra angel in opponent's play, make sure the angel ends up in the correct zone
[INIT]
FIRSTMAIN
[PLAYER1]
hand:129900
manapool:{3}{U}{U}
[PLAYER2]
inplay:1366
[DO]
129900
1366
[ASSERT]
FIRSTMAIN
[PLAYER1]
manapool:{0}
inplay:129900,1366
[PLAYER2]
[END]

View File

@@ -28,7 +28,7 @@ class MTGGameZone {
virtual MTGCardInstance * draw();
void addCard(MTGCardInstance * card);
void debugPrint();
MTGCardInstance * removeCard(MTGCardInstance * card);
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
MTGCardInstance * hasCard(MTGCardInstance * card);
void cleanupPhase();
int countByType(const char * value);

View File

@@ -95,7 +95,14 @@ MTGCardInstance * MTGPlayerCards::putInGraveyard(MTGCardInstance * card){
MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to){
MTGCardInstance * copy = NULL;
if (copy = from->removeCard(card)){
//Special case, a card is not a new object if it goes from inplay to inplay, because it technically doesn't change zone
int newObject = 1;
if ((from = g->players[0]->game->inPlay || from = g->players[1]->game->inPlay) &&
(to = g->players[0]->game->inPlay || to = g->players[1]->game->inPlay) {
newObject = 0;
}
if (copy = from->removeCard(card,newObject)){
if (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME].getIntValue() > 0){
if (to == graveyard){
@@ -155,29 +162,29 @@ MTGGameZone::~MTGGameZone(){
}
void MTGGameZone::setOwner(Player * player){
char buf[4096];
sprintf(buf, "Setting Owner : %p\n", player);
OutputDebugString(buf);
for (int i=0; i<nb_cards; i++) {
cards[i]->owner = player;
}
owner = player;
}
MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card){
MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy){
int i;
cardsMap.erase(card);
for (i=0; i<(nb_cards); i++) {
if (cards[i] == card){
cards[i] = cards[nb_cards -1];
nb_cards--;
MTGCardInstance * copy = card;
if (card->isToken){ //TODO better than this ?
return card;
}
card->lastController = card->controller();
MTGCardInstance * copy = NEW MTGCardInstance(card->model,card->owner->game);
copy->previous = card;
card->next = copy;
if (createCopy) {
copy = NEW MTGCardInstance(card->model,card->owner->game);
copy->previous = card;
card->next = copy;
}
copy->previousZone = this;
return copy;
}