No code change just reformatting of header files.
finishing up my reformatting of the source from November/December following the guidelines that were posted. some extra things I added: * Any empty virtual declarations were kept to one line. * Enums were split up into separate lines to promote uniformity across all headers. ( each header file had a different style for enums)
This commit is contained in:
@@ -18,7 +18,6 @@ using std::queue;
|
||||
#define INFO_CREATURESTOUGHNESS 3
|
||||
#define INFO_CREATURESATTACKINGPOWER 4
|
||||
|
||||
|
||||
class AIStats;
|
||||
|
||||
class AIAction
|
||||
@@ -35,22 +34,25 @@ public:
|
||||
MTGCardInstance * click;
|
||||
MTGCardInstance * target; // TODO Improve
|
||||
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL)
|
||||
: efficiency(-1), ability(a), player(NULL), click(c), target(t)
|
||||
AIAction(MTGAbility * a, MTGCardInstance * c, MTGCardInstance * t = NULL) :
|
||||
efficiency(-1), ability(a), player(NULL), click(c), target(t)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL)
|
||||
: efficiency(-1), ability(NULL), player(NULL), click(c), target(t)
|
||||
AIAction(MTGCardInstance * c, MTGCardInstance * t = NULL) :
|
||||
efficiency(-1), ability(NULL), player(NULL), click(c), target(t)
|
||||
{
|
||||
id = currentId++;
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
AIAction(Player * p)
|
||||
: efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
|
||||
AIAction(Player * p) :
|
||||
efficiency(-1), ability(NULL), player(p), click(NULL), target(NULL)
|
||||
{
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
int getEfficiency();
|
||||
int Act();
|
||||
@@ -58,22 +60,24 @@ public:
|
||||
|
||||
// compares Abilities efficiency
|
||||
class CmpAbilities
|
||||
{
|
||||
{
|
||||
public:
|
||||
bool operator()(const AIAction& a1, const AIAction& a2) const
|
||||
{
|
||||
AIAction* a1Ptr = const_cast<AIAction*>(&a1);
|
||||
AIAction* a2Ptr = const_cast<AIAction*>(&a2);
|
||||
AIAction* a1Ptr = const_cast<AIAction*> (&a1);
|
||||
AIAction* a2Ptr = const_cast<AIAction*> (&a2);
|
||||
int e1 = a1Ptr->getEfficiency();
|
||||
int e2 = a2Ptr->getEfficiency();
|
||||
if (e1 == e2) return a1Ptr->id < a2Ptr->id;
|
||||
if (e1 == e2)
|
||||
return a1Ptr->id < a2Ptr->id;
|
||||
return (e1 > e2);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<AIAction, int, CmpAbilities> RankingContainer;
|
||||
|
||||
class AIPlayer: public Player{
|
||||
class AIPlayer: public Player
|
||||
{
|
||||
protected:
|
||||
//Variables used by Test suite
|
||||
MTGCardInstance * nextCardToPlay;
|
||||
@@ -86,29 +90,40 @@ protected:
|
||||
int chooseBlockers();
|
||||
int canFirstStrikeKill(MTGCardInstance * card, MTGCardInstance *ennemy);
|
||||
int effectBadOrGood(MTGCardInstance * card, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL);
|
||||
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES , int untapMode = 0, int canAttack = 0);
|
||||
int getCreaturesInfo(Player * player, int neededInfo = INFO_NBCREATURES, int untapMode = 0, int canAttack = 0);
|
||||
AIStats * getStats();
|
||||
|
||||
// returns 1 if the AI algorithm supports a given cost (ex:simple mana cost), 0 otherwise (ex: cost involves Sacrificing a target)
|
||||
int CanHandleCost(ManaCost * cost);
|
||||
int CanHandleCost(ManaCost * cost);
|
||||
|
||||
public:
|
||||
AIStats * stats;
|
||||
int agressivity;
|
||||
bool Checked;
|
||||
bool forceBestAbilityUse;
|
||||
void End(){};
|
||||
virtual int displayStack() {return 0;};
|
||||
void End()
|
||||
{
|
||||
}
|
||||
;
|
||||
virtual int displayStack()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
;
|
||||
int receiveEvent(WEvent * event);
|
||||
void Render();
|
||||
ManaCost * getPotentialMana(MTGCardInstance * card = NULL);
|
||||
AIPlayer(MTGDeck * deck, string deckFile, string deckFileSmall);
|
||||
virtual ~AIPlayer();
|
||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget =NULL);
|
||||
virtual int chooseTarget(TargetChooser * tc = NULL, Player * forceTarget = NULL);
|
||||
virtual int Act(float dt);
|
||||
virtual int affectCombatDamages(CombatStep);
|
||||
int isAI(){return 1;};
|
||||
int isAI()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
;
|
||||
int canHandleCost(MTGAbility * ability);
|
||||
int selectAbility();
|
||||
int createAbilityTargets(MTGAbility * a, MTGCardInstance * c, RankingContainer& ranking);
|
||||
@@ -117,24 +132,24 @@ public:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class AIPlayerBaka: public AIPlayer{
|
||||
protected:
|
||||
int oldGamePhase;
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
class AIPlayerBaka: public AIPlayer
|
||||
{
|
||||
protected:
|
||||
int oldGamePhase;
|
||||
float timer;
|
||||
MTGCardInstance * FindCardToPlay(ManaCost * potentialMana, const char * type);
|
||||
public:
|
||||
int deckId;
|
||||
AIPlayerBaka(MTGDeck * deck, string deckFile, string deckfileSmall, string avatarFile);
|
||||
virtual int Act(float dt);
|
||||
void initTimer();
|
||||
virtual int computeActions();
|
||||
};
|
||||
|
||||
class AIPlayerFactory{
|
||||
public:
|
||||
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
|
||||
class AIPlayerFactory
|
||||
{
|
||||
public:
|
||||
AIPlayer * createAIPlayer(MTGAllCards * collection, Player * opponent, int deckid = 0);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user