- Fixed a Bug where AI would not block any attacker in Demo mode (bug introduced in r2759)

- Fixed a Bug where AI would not correctly assign blockers if the first attacker is super strong.
- Added a hack to prevent AI from an infinite loop while choosing a target. There are edge cases where the AI gets to choose the targets for a TargetChooser that doesn't belong to it. I couldn't dig too long for the root cause, so I added a "return 0" when the case happens. Should probably open a ticket
- Added a "Hint" System in AI decks, to help the AI with its strategy. This is not really usable yet, it only works with abilities (not cards to play), and I only added some basic code for counters and tokens. This can probably be extended, but let's wait until we see it working on that other game I'm working on, before rushing into adding hints to all AI decks...
- minor cleanup of AI Code
This commit is contained in:
wagic.the.homebrew
2011-05-05 14:27:46 +00:00
parent f0820697f8
commit 691a1e1b91
15 changed files with 423 additions and 40 deletions

View File

@@ -0,0 +1,43 @@
#ifndef _AIHINTS_H_
#define _AIHINTS_H_
#include <string>
#include <vector>
using std::string;
using std::vector;
#include "AIPlayer.h"
class ManaCost;
class MTGAbility;
class AIHint
{
public:
string mCondition;
string mAction;
int mSourceId;
AIHint(string line);
};
class AIHints
{
protected:
AIPlayer * 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 (AIPlayer * player);
AIAction * suggestAbility(ManaCost * potentialMana);
void add(string line);
~AIHints();
};
#endif