-some bug fixes (test suite)
This commit is contained in:
wagic.the.homebrew@gmail.com
2009-09-06 02:50:54 +00:00
parent c1accf5c6e
commit d73951ecfc
6 changed files with 22 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ inplay:raging goblin
Drudge skeletons
swamp
Drudge skeletons
choice 1
next
raging goblin
next

View File

@@ -1,4 +1,5 @@
#Testing bug with Rampage
# Whenever Pygmy Troll becomes blocked, it gets +1/+1 until end of turn for each creature blocking it. Green: Regenerate Pygmy Troll.
[INIT]
FIRSTMAIN
[PLAYER1]

View File

@@ -86,7 +86,7 @@ class MTGGameZone {
static int zoneStringToId(string zoneName);
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
bool needShuffle;
virtual const char * getName(){return "zone";};
virtual ostream& toString(ostream&) const;
};
@@ -96,27 +96,32 @@ class MTGLibrary: public MTGGameZone {
void shuffleTopToBottom(int nbcards);
MTGCardInstance * draw();
virtual ostream& toString(ostream&) const;
const char * getName(){return "library";}
};
class MTGGraveyard: public MTGGameZone {
public:
// MTGGraveyard();
virtual ostream& toString(ostream&) const;
const char * getName(){return "graveyard";}
};
class MTGHand: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
const char * getName(){return "hand";}
};
class MTGRemovedFromGame: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
const char * getName(){return "exile";}
};
class MTGStack: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
const char * getName(){return "stack";}
};
class MTGInPlay: public MTGGameZone {
@@ -128,6 +133,7 @@ class MTGInPlay: public MTGGameZone {
int nbDefensers( MTGCardInstance * attacker);
int nbPartners(MTGCardInstance * attacker);
virtual ostream& toString(ostream&) const;
const char * getName(){return "battlefield";}
};

View File

@@ -48,7 +48,17 @@ int Damage::resolve(){
GameObserver * g = GameObserver::GetInstance();
WEvent * e = NEW WEventDamage(this);
//Replacement Effects
e = g->replacementEffects->replace(e);
if (!e) return 0;
WEventDamage * ev = dynamic_cast<WEventDamage*>(e);
if (!ev) {
g->receiveEvent(e);
return 0;
}
damage = ev->damage->damage;
target = ev->damage->target;
int a = 0;
if (damage) a = target->dealDamage(damage);
@@ -110,6 +120,7 @@ int DamageStack::resolve(){
if (damage->state == RESOLVED_OK) damage->target->afterDamage();
//damage->target->afterDamage();
}
return 1;
}

View File

@@ -264,7 +264,7 @@ bool TargetChooser::canTarget(Targetable * target){
if (target->typeAsTarget() == TARGET_CARD){
MTGCardInstance * card = (MTGCardInstance *) target;
if (source && targetter && card->isInPlay() && (card->has(Constants::SHROUD)|| card->protectedAgainst(targetter) )) return false;
if (source && targetter && card->isInPlay() && (source->controller() != card->controller()) && (card->has(Constants::OPPONENTSHROUD) || card->protectedAgainst(targetter))) return false;
if (source && targetter && card->isInPlay() && (targetter->controller() != card->controller()) && (card->has(Constants::OPPONENTSHROUD) || card->protectedAgainst(targetter))) return false;
return true;
}
else if (target->typeAsTarget() == TARGET_STACKACTION)

View File

@@ -367,10 +367,9 @@ int TestSuite::assertGame(){
for (int j = 0; j < 4; j++){
MTGGameZone * zone = playerZones[j];
if (zone->nb_cards != endState.playerData[i].zones[j].nbitems){
sprintf(result, "<span class=\"error\">==Card number not the same in %i==, expected %i, got %i</span><br />",j, endState.playerData[i].zones[j].nbitems, zone->nb_cards);
sprintf(result, "<span class=\"error\">==Card number not the same in player %i's %s==, expected %i, got %i</span><br />",i, zone->getName(), endState.playerData[i].zones[j].nbitems, zone->nb_cards);
Log(result);
error++;
return 0;
}
for (int k = 0; k < endState.playerData[i].zones[j].nbitems; k++){
int cardid = endState.playerData[i].zones[j].cards[k];