- Modified gameObserver and related classes to be able to work with a precise JGE instance given at construction and not the static global one. That allows to run gameObserver without JGE instance (for example in a worker thread).
- Added an "ACTION_LOGGING_TESTING" mode in the gameObserver. When this is defined, the game reloads itself in every update. I want to use that to track undo problems. Be aware that it kills performances and crashes with the testsuite if you want to activate it. - Various cleanup/refactor of the game observer. - Added a gameObserver == operator to compare two games - Added player mode to the player serialization - Added a multi-threaded mode to AI_CHANGE_TESTING. For the moment it's only useable with Qt. If you want to use it without, just defined a thread_count higher than 1. - Refactored random generator class to use list intead of queue - Defined a specific type for interrupt decision instead of int
This commit is contained in:
@@ -1223,7 +1223,7 @@ int AIPlayerBaka::createAbilityTargets(MTGAbility * a, MTGCardInstance * c, Rank
|
||||
if(!realTargets.size() || (int(realTargets.size()) < a->getActionTc()->maxtargets && a->getActionTc()->targetMin))
|
||||
return 0;
|
||||
OrderedAIAction aiAction(this, a, c,realTargets);
|
||||
aiAction.target = (MTGCardInstance*)realTargets[0];
|
||||
aiAction.target = dynamic_cast<MTGCardInstance*>(realTargets[0]);
|
||||
ranking[aiAction] = 1;
|
||||
}
|
||||
return 1;
|
||||
@@ -1770,6 +1770,7 @@ int AIPlayerBaka::computeActions()
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef AI_CHANGE_TESTING
|
||||
static bool findingCard = false;
|
||||
//this guard is put in place to prevent Ai from
|
||||
//ever running computeActions() function WHILE its already doing so.
|
||||
@@ -1779,6 +1780,8 @@ int AIPlayerBaka::computeActions()
|
||||
{//is already looking kick me out of this function!
|
||||
return 0;
|
||||
}
|
||||
#endif //AI_CHANGE_TESTING
|
||||
|
||||
Interruptible * action = observer->mLayers->stackLayer()->getAt(-1);
|
||||
Spell * spell = dynamic_cast<Spell *>(action);
|
||||
Player * lastStackActionController = spell ? spell->source->controller() : NULL;
|
||||
@@ -1791,7 +1794,9 @@ int AIPlayerBaka::computeActions()
|
||||
bool ipotential = false;
|
||||
if(p->game->hand->hasType("instant") || p->game->hand->hasAbility(Constants::FLASH))
|
||||
{
|
||||
#ifndef AI_CHANGE_TESTING
|
||||
findingCard = true;
|
||||
#endif //AI_CHANGE_TESTING
|
||||
ManaCost * icurrentMana = getPotentialMana();
|
||||
icurrentMana->add(this->getManaPool());
|
||||
if (icurrentMana->getConvertedCost())
|
||||
@@ -1822,12 +1827,16 @@ int AIPlayerBaka::computeActions()
|
||||
gotPayments.clear();
|
||||
}
|
||||
}
|
||||
#ifndef AI_CHANGE_TESTING
|
||||
findingCard = false;
|
||||
#endif //AI_CHANGE_TESTING
|
||||
nextCardToPlay = NULL;
|
||||
return 1;
|
||||
}
|
||||
nextCardToPlay = NULL;
|
||||
#ifndef AI_CHANGE_TESTING
|
||||
findingCard = false;
|
||||
#endif //AI_CHANGE_TESTING
|
||||
return 1;
|
||||
}
|
||||
else if(observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
||||
|
||||
Reference in New Issue
Block a user