- various compilations fixes for Symbian
- small cleanups of the TestSuite and Player classes
This commit is contained in:
@@ -389,7 +389,7 @@ public:
|
||||
int triggerOnEventImpl(WEvent * event)
|
||||
{
|
||||
//general restrictions
|
||||
if (opponentPoisoned && !source->controller()->opponent()->isPoisoned)
|
||||
if (opponentPoisoned && !source->controller()->opponent()->isPoisoned())
|
||||
return 0;
|
||||
if (sourceUntapped && source->isTapped() == 1)
|
||||
return 0;
|
||||
|
||||
@@ -28,7 +28,6 @@ public:
|
||||
JQuadPtr mAvatar;
|
||||
int playMode;
|
||||
bool nomaxhandsize;
|
||||
bool isPoisoned;
|
||||
MTGPlayerCards * game;
|
||||
MTGDeck * mDeck;
|
||||
string deckFile;
|
||||
@@ -56,6 +55,7 @@ public:
|
||||
int loseLife(int value);
|
||||
int gainOrLoseLife(int value);
|
||||
|
||||
bool isPoisoned() {return (poisonCount > 0);}
|
||||
int poisoned();
|
||||
int damaged();
|
||||
int prevented();
|
||||
|
||||
@@ -59,45 +59,52 @@ public:
|
||||
|
||||
class TestSuite
|
||||
{
|
||||
public:
|
||||
MTGAllCards* collection;
|
||||
int summoningSickness;
|
||||
bool forceAbility;
|
||||
int gameType;
|
||||
float timerLimit;
|
||||
unsigned int seed;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
TestSuiteState initState;
|
||||
private:
|
||||
int currentfile;
|
||||
int nbfiles;
|
||||
string files[1024];
|
||||
TestSuiteState endState;
|
||||
TestSuiteActions actions;
|
||||
string files[1024];
|
||||
int nbfiles;
|
||||
int currentfile;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
bool forceAbility;
|
||||
int summoningSickness;
|
||||
|
||||
int load(const char * filename);
|
||||
TestSuite(const char * filename,MTGAllCards* _collection);
|
||||
void cleanup();
|
||||
|
||||
public:
|
||||
/* but only used by the testsuite classes */
|
||||
float timerLimit;
|
||||
int aiMaxCalls;
|
||||
int currentAction;
|
||||
|
||||
TestSuiteState initState;
|
||||
string getNextAction();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int assertGame();
|
||||
|
||||
public:
|
||||
int gameType;
|
||||
unsigned int seed;
|
||||
int nbFailed, nbTests, nbAIFailed, nbAITests;
|
||||
TestSuite(const char * filename);
|
||||
void initGame();
|
||||
void pregameTests();
|
||||
int assertGame();
|
||||
MTGPlayerCards * buildDeck(int playerId);
|
||||
string getNextAction();
|
||||
Interruptible * getActionByMTGId(int mtgid);
|
||||
int loadNext();
|
||||
void cleanup();
|
||||
static int Log(const char * text);
|
||||
|
||||
};
|
||||
|
||||
class TestSuiteAI:public AIPlayerBaka
|
||||
{
|
||||
public:
|
||||
TestSuite * suite;
|
||||
private:
|
||||
MTGCardInstance * getCard(string action);
|
||||
float timer;
|
||||
TestSuite * suite;
|
||||
|
||||
public:
|
||||
TestSuiteAI(TestSuite * suite, int playerId);
|
||||
virtual int Act(float dt);
|
||||
MTGCardInstance * getCard(string action);
|
||||
virtual int displayStack();
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ void GameObserver::nextGamePhase()
|
||||
cleanupPhase();
|
||||
currentPlayer->damageCount = 0;
|
||||
currentPlayer->preventable = 0;
|
||||
currentPlayer->isPoisoned = false;
|
||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
||||
mLayers->actionLayer()->Update(0);
|
||||
@@ -371,8 +370,6 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
if(getCurrentTargetChooser() && int(getCurrentTargetChooser()->targets.size()) == getCurrentTargetChooser()->maxtargets)
|
||||
getCurrentTargetChooser()->done = true;
|
||||
for (int i = 0; i < 2; i++)
|
||||
players[i]->isPoisoned = (players[i]->poisonCount > 0);
|
||||
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
|
||||
return;
|
||||
if (mLayers->actionLayer()->menuObject)
|
||||
|
||||
@@ -105,7 +105,7 @@ void GameStateDuel::Start()
|
||||
|
||||
#ifdef TESTSUITE
|
||||
SAFE_DELETE(testSuite);
|
||||
testSuite = NEW TestSuite("test/_tests.txt",MTGCollection());
|
||||
testSuite = NEW TestSuite("test/_tests.txt");
|
||||
#endif
|
||||
|
||||
setGamePhase(DUEL_STATE_CHOOSE_DECK1);
|
||||
|
||||
@@ -551,9 +551,8 @@ int TestSuite::assertGame()
|
||||
return 1;
|
||||
}
|
||||
|
||||
TestSuite::TestSuite(const char * filename, MTGAllCards* _collection)
|
||||
TestSuite::TestSuite(const char * filename)
|
||||
{
|
||||
collection = _collection;
|
||||
timerLimit = 0;
|
||||
|
||||
std::string s;
|
||||
|
||||
Reference in New Issue
Block a user