Erwan
- Attempt to fix a bug in 0.5.0 with persuasion. Haven't tried to compile/test yet :/
This commit is contained in:
@@ -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]
|
||||||
@@ -28,7 +28,7 @@ class MTGGameZone {
|
|||||||
virtual MTGCardInstance * draw();
|
virtual MTGCardInstance * draw();
|
||||||
void addCard(MTGCardInstance * card);
|
void addCard(MTGCardInstance * card);
|
||||||
void debugPrint();
|
void debugPrint();
|
||||||
MTGCardInstance * removeCard(MTGCardInstance * card);
|
MTGCardInstance * removeCard(MTGCardInstance * card, int createCopy = 1);
|
||||||
MTGCardInstance * hasCard(MTGCardInstance * card);
|
MTGCardInstance * hasCard(MTGCardInstance * card);
|
||||||
void cleanupPhase();
|
void cleanupPhase();
|
||||||
int countByType(const char * value);
|
int countByType(const char * value);
|
||||||
|
|||||||
@@ -95,7 +95,14 @@ MTGCardInstance * MTGPlayerCards::putInGraveyard(MTGCardInstance * card){
|
|||||||
|
|
||||||
MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to){
|
MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to){
|
||||||
MTGCardInstance * copy = NULL;
|
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 (GameOptions::GetInstance()->values[OPTIONS_SFXVOLUME].getIntValue() > 0){
|
||||||
if (to == graveyard){
|
if (to == graveyard){
|
||||||
@@ -155,29 +162,29 @@ MTGGameZone::~MTGGameZone(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MTGGameZone::setOwner(Player * player){
|
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++) {
|
for (int i=0; i<nb_cards; i++) {
|
||||||
cards[i]->owner = player;
|
cards[i]->owner = player;
|
||||||
}
|
}
|
||||||
owner = player;
|
owner = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card){
|
MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy){
|
||||||
int i;
|
int i;
|
||||||
cardsMap.erase(card);
|
cardsMap.erase(card);
|
||||||
for (i=0; i<(nb_cards); i++) {
|
for (i=0; i<(nb_cards); i++) {
|
||||||
if (cards[i] == card){
|
if (cards[i] == card){
|
||||||
cards[i] = cards[nb_cards -1];
|
cards[i] = cards[nb_cards -1];
|
||||||
nb_cards--;
|
nb_cards--;
|
||||||
|
MTGCardInstance * copy = card;
|
||||||
if (card->isToken){ //TODO better than this ?
|
if (card->isToken){ //TODO better than this ?
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
card->lastController = card->controller();
|
card->lastController = card->controller();
|
||||||
MTGCardInstance * copy = NEW MTGCardInstance(card->model,card->owner->game);
|
if (createCopy) {
|
||||||
copy->previous = card;
|
copy = NEW MTGCardInstance(card->model,card->owner->game);
|
||||||
card->next = copy;
|
copy->previous = card;
|
||||||
|
card->next = copy;
|
||||||
|
}
|
||||||
copy->previousZone = this;
|
copy->previousZone = this;
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user