Erwan
- 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:
@@ -149,7 +149,7 @@ id=189648
|
|||||||
rarity=M
|
rarity=M
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
primitive=Dragon Token from Dragon Broodmother
|
primitive=Dragon
|
||||||
id=22222220
|
id=22222220
|
||||||
rarity=T
|
rarity=T
|
||||||
[/card]
|
[/card]
|
||||||
|
|||||||
@@ -13681,7 +13681,7 @@ toughness=4
|
|||||||
abilities=flying
|
abilities=flying
|
||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Dragon Token from Dragon Broodmother
|
name=Dragon
|
||||||
type=Creature
|
type=Creature
|
||||||
subtype=Dragon
|
subtype=Dragon
|
||||||
abilities=flying
|
abilities=flying
|
||||||
|
|||||||
28
projects/mtg/bin/Res/test/bugs/dragon_broodmother_i491.txt
Normal file
28
projects/mtg/bin/Res/test/bugs/dragon_broodmother_i491.txt
Normal 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]
|
||||||
18
projects/mtg/bin/Res/test/bugs/souls_attendant_i489.txt
Normal file
18
projects/mtg/bin/Res/test/bugs/souls_attendant_i489.txt
Normal 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]
|
||||||
@@ -91,6 +91,7 @@ class TestSuiteAI:public AIPlayerBaka{
|
|||||||
|
|
||||||
TestSuiteAI(TestSuite * suite, int playerId);
|
TestSuiteAI(TestSuite * suite, int playerId);
|
||||||
virtual int Act(float dt);
|
virtual int Act(float dt);
|
||||||
|
MTGCardInstance * getCard(string action);
|
||||||
virtual int displayStack();
|
virtual int displayStack();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
unlockedTex = NULL;
|
unlockedTex = NULL;
|
||||||
unlockedQuad = NULL;
|
unlockedQuad = NULL;
|
||||||
unlocked = -1;
|
unlocked = -1;
|
||||||
|
p1 = NULL;
|
||||||
|
p2 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Credits::~Credits(){
|
Credits::~Credits(){
|
||||||
@@ -168,6 +170,7 @@ void Credits::compute(Player * _p1, Player * _p2, GameApp * _app){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Credits::Render(){
|
void Credits::Render(){
|
||||||
|
if (!p1) return;
|
||||||
GameObserver * g = GameObserver::GetInstance();
|
GameObserver * g = GameObserver::GetInstance();
|
||||||
JRenderer * r = JRenderer::GetInstance();
|
JRenderer * r = JRenderer::GetInstance();
|
||||||
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "../include/TestSuiteAI.h"
|
#include "../include/TestSuiteAI.h"
|
||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
|
#include "../include/DebugRoutines.h"
|
||||||
#include "../include/MTGAbility.h"
|
#include "../include/MTGAbility.h"
|
||||||
#include "../include/MTGRules.h"
|
#include "../include/MTGRules.h"
|
||||||
#include "../include/ActionLayer.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){
|
Interruptible * TestSuite::getActionByMTGId(int mtgid){
|
||||||
ActionStack * as= GameObserver::GetInstance()->mLayers->stackLayer();
|
ActionStack * as= GameObserver::GetInstance()->mLayers->stackLayer();
|
||||||
Interruptible * action = NULL;
|
Interruptible * action = NULL;
|
||||||
@@ -125,29 +151,31 @@ int TestSuiteAI::Act(float dt){
|
|||||||
g->cardClick(NULL, p);
|
g->cardClick(NULL, p);
|
||||||
}else{
|
}else{
|
||||||
int mtgid = Rules::getMTGId(action);
|
int mtgid = Rules::getMTGId(action);
|
||||||
|
Interruptible * toInterrupt = NULL;
|
||||||
if (mtgid){
|
if (mtgid){
|
||||||
char buffe[512];
|
char buffe[512];
|
||||||
sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid);
|
sprintf(buffe, "TESTSUITE CARD ID : %i\n", mtgid);
|
||||||
OutputDebugString(buffe);
|
OutputDebugString(buffe);
|
||||||
Interruptible * toInterrupt = suite->getActionByMTGId(mtgid);
|
toInterrupt = suite->getActionByMTGId(mtgid);
|
||||||
if (toInterrupt)
|
}
|
||||||
g->stackObjectClicked(toInterrupt);
|
|
||||||
else{
|
if (toInterrupt) {
|
||||||
MTGCardInstance * card = Rules::getCardByMTGId(mtgid);
|
g->stackObjectClicked(toInterrupt);
|
||||||
if (card) {
|
return 1;
|
||||||
OutputDebugString("TESTSUITE Clicking ON: ");
|
}
|
||||||
OutputDebugString(card->name.c_str());
|
|
||||||
OutputDebugString("\n");
|
MTGCardInstance * card = getCard(action);
|
||||||
card->currentZone->needShuffle = true; //mimic library shuffle
|
if (card) {
|
||||||
g->cardClick(card,card);
|
OutputDebugString("TESTSUITE Clicking ON: ");
|
||||||
g->forceShuffleLibraries(); //mimic library shuffle
|
OutputDebugString(card->name.c_str());
|
||||||
}
|
OutputDebugString("\n");
|
||||||
}
|
card->currentZone->needShuffle = true; //mimic library shuffle
|
||||||
}else{
|
g->cardClick(card,card);
|
||||||
return 0;
|
g->forceShuffleLibraries(); //mimic library shuffle
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user