- adding tests for issue 489 and issue 491
- check for null pointers in Credits.cpp
- Test suite can now select tokens by their name
- Fixed Dragon Broodmothere's token name
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-10-17 10:21:08 +00:00
parent d9f5b1586c
commit 8fdb64e9ce
7 changed files with 97 additions and 19 deletions

View File

@@ -149,7 +149,7 @@ id=189648
rarity=M
[/card]
[card]
primitive=Dragon Token from Dragon Broodmother
primitive=Dragon
id=22222220
rarity=T
[/card]

View File

@@ -13681,7 +13681,7 @@ toughness=4
abilities=flying
[/card]
[card]
name=Dragon Token from Dragon Broodmother
name=Dragon
type=Creature
subtype=Dragon
abilities=flying

View File

@@ -0,0 +1,28 @@
#Bug: "new school" Tokens can't have two colors
[INIT]
UNTAP
[PLAYER1]
inplay:mountain
hand:shock
[PLAYER2]
inplay:dragon broodmother,Boartusk Liege
[DO]
next
#upkeep
choice 1
next
#draw
next
#main
mountain
shock
Dragon
[ASSERT]
FIRSTMAIN
[PLAYER1]
graveyard:shock
inplay:mountain
[PLAYER2]
inplay:dragon broodmother,Boartusk Liege,*
[END]

View File

@@ -0,0 +1,18 @@
#Bug: Triggers are "targetting", making Black Knight immune to soul's attendant ability
# http://code.google.com/p/wagic/issues/detail?id=489
[INIT]
FIRSTMAIN
[PLAYER1]
inplay:soul's attendant
hand:black knight
manapool:{B}{B}
[PLAYER2]
[DO]
black knight
[ASSERT]
FIRSTMAIN
[PLAYER1]
inplay:soul's attendant,black knight
life:21
[PLAYER2]
[END]

View File

@@ -91,6 +91,7 @@ class TestSuiteAI:public AIPlayerBaka{
TestSuiteAI(TestSuite * suite, int playerId);
virtual int Act(float dt);
MTGCardInstance * getCard(string action);
virtual int displayStack();
};

View File

@@ -27,6 +27,8 @@
unlockedTex = NULL;
unlockedQuad = NULL;
unlocked = -1;
p1 = NULL;
p2 = NULL;
}
Credits::~Credits(){
@@ -168,6 +170,7 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app){
}
void Credits::Render(){
if (!p1) return;
GameObserver * g = GameObserver::GetInstance();
JRenderer * r = JRenderer::GetInstance();
WFont * f = resources.GetWFont(Constants::MAIN_FONT);

View File

@@ -1,5 +1,6 @@
#include "../include/TestSuiteAI.h"
#include "../include/config.h"
#include "../include/DebugRoutines.h"
#include "../include/MTGAbility.h"
#include "../include/MTGRules.h"
#include "../include/ActionLayer.h"
@@ -23,6 +24,31 @@ TestSuiteAI::TestSuiteAI(TestSuite * _suite, int playerId):AIPlayerBaka(NULL, "t
}
MTGCardInstance * TestSuiteAI::getCard(string action){
int mtgid = Rules::getMTGId(action);
if (mtgid) return Rules::getCardByMTGId(mtgid);
//This mostly handles tokens
GameObserver * g = GameObserver::GetInstance();
std::transform(action.begin(), action.end(), action.begin(),::tolower );
for (int i = 0; i < 2; i++){
Player * p = g->players[i];
MTGGameZone * zones[] = {p->game->library,p->game->hand, p->game->inPlay, p->game->graveyard};
for (int j = 0; j < 4; j++){
MTGGameZone * zone = zones[j];
for (int k = 0; k < zone->nb_cards; k++){
MTGCardInstance * card = zone->cards[k];
if (!card) return NULL;
string name = card->getLCName();
if (name.compare(action) == 0) return card;
}
}
}
DebugTrace("TESTUISTEAI: Can't find card:" << action.c_str());
return NULL;
}
Interruptible * TestSuite::getActionByMTGId(int mtgid){
ActionStack * as= GameObserver::GetInstance()->mLayers->stackLayer();
Interruptible * action = NULL;
@@ -125,29 +151,31 @@ int TestSuiteAI::Act(float dt){
g->cardClick(NULL, p);
}else{
int mtgid = Rules::getMTGId(action);
Interruptible * toInterrupt = NULL;
if (mtgid){
char buffe[512];
sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid);
OutputDebugString(buffe);
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
if (toInterrupt)
g->stackObjectClicked(toInterrupt);
else{
MTGCardInstance * card = Rules::getCardByMTGId(mtgid);
if (card) {
OutputDebugString("TESTSUITE Clicking ON: ");
OutputDebugString(card->name.c_str());
OutputDebugString("\n");
card->currentZone->needShuffle = true; //mimic library shuffle
g->cardClick(card,card);
g->forceShuffleLibraries(); //mimic library shuffle
}
}
}else{
return 0;
toInterrupt = suite->getActionByMTGId(mtgid);
}
if (toInterrupt) {
g->stackObjectClicked(toInterrupt);
return 1;
}
MTGCardInstance * card = getCard(action);
if (card) {
OutputDebugString("TESTSUITE Clicking ON: ");
OutputDebugString(card->name.c_str());
OutputDebugString("\n");
card->currentZone->needShuffle = true; //mimic library shuffle
g->cardClick(card,card);
g->forceShuffleLibraries(); //mimic library shuffle
return 1;
}
}
return 1;
return 0;
}