format is as follows
HINT#combo hold(blah|myhand)^until(blah|mygraveyard)^until(blah|opponentshand)^restriction{type(creature|mybattlefield)~morethan~2}^cast(blah) targeting(blah|mygraveyard)^totalmananneeded({g}{g}{r}{u}{2})
the ai can be told to hold more then one card, until as many condiations as you want are met, until( is a TC and can basically be used in a fasion of saying "hold arbor elf until you have a lord of atlantas in play and a gaint growth in you hand"
once the condiations are met you can later tell it to cast(gaint growth) targeting(arbor elf[fresh]|mybattlefield)...
I also included the whole of the games restrictions system...
so you can get really really creative with this so far.
the next thing I will do is ability targeting and card favoring.
59 lines
1.5 KiB
C++
59 lines
1.5 KiB
C++
#ifndef _AIHINTS_H_
|
|
#define _AIHINTS_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
#include "AIPlayerBaka.h"
|
|
#include "AllAbilities.h"
|
|
|
|
class ManaCost;
|
|
class MTGAbility;
|
|
|
|
class AIHint
|
|
{
|
|
public:
|
|
string mCondition;
|
|
string mAction;
|
|
string mCombatAttackTip;
|
|
vector<string>castOrder;
|
|
vector<string>combos;
|
|
//for preformance we disect the combo on first run.
|
|
vector<string>partOfCombo;
|
|
vector<string>hold;
|
|
vector<string>until;
|
|
vector<string>restrict;
|
|
map<string,string>cardTargets;
|
|
string manaNeeded;
|
|
int mSourceId;
|
|
AIHint(string line);
|
|
};
|
|
|
|
|
|
class AIHints
|
|
{
|
|
protected:
|
|
AIPlayerBaka * mPlayer;
|
|
vector<AIHint *> hints;
|
|
AIHint * getByCondition (string condition);
|
|
AIAction * findAbilityRecursive(AIHint * hint, ManaCost * potentialMana);
|
|
vector<MTGAbility *> findAbilities(AIHint * hint);
|
|
RankingContainer findActions(AIHint * hint);
|
|
string constraintsNotFulfilled(AIAction * a, AIHint * hint, ManaCost * potentialMana);
|
|
bool findSource(int sourceId);
|
|
bool abilityMatches(MTGAbility * a, AIHint * hint);
|
|
public:
|
|
AIHints (AIPlayerBaka * player);
|
|
AIAction * suggestAbility(ManaCost * potentialMana);
|
|
bool HintSaysDontAttack(GameObserver* observer,MTGCardInstance * card = NULL);
|
|
bool HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card = NULL);
|
|
bool canWeCombo(GameObserver* observer,MTGCardInstance * card = NULL,AIPlayerBaka * Ai = NULL);
|
|
vector<string> mCastOrder();
|
|
void add(string line);
|
|
~AIHints();
|
|
};
|
|
|
|
#endif
|