added a hint that allows you to override how ai views a cards effects.

#HINT:good(icy prison)
ai will act as though the effects of this card are now good, choosing to cast it on it's own creatures.

#HINT:bad(ancestral recall)
ai will now use this card targeting the opponent. 
good in cases where you are trying to mill the opponent

the effects in wagic have gotten so complex that ai simply has no idea what some cards should target. this helps in most of the cases.
This commit is contained in:
omegablast2002@yahoo.com
2013-04-10 02:38:52 +00:00
parent f9410f695a
commit 9ffe7349e2
3 changed files with 64 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ public:
string mCombatBlockTip;
string mCombatAlwaysBlockTip;
string mCombatAlwaysAttackTip;
string mCardEffGood;
string mCardEffBad;
vector<string>castOrder;
vector<string>combos;
//for preformance we disect the combo on first run.
@@ -55,6 +57,8 @@ public:
bool HintSaysAlwaysAttack(GameObserver* observer,MTGCardInstance * card = NULL);
bool HintSaysDontBlock(GameObserver* observer,MTGCardInstance * card = NULL);
bool HintSaysAlwaysBlock(GameObserver* observer,MTGCardInstance * card = NULL);
bool AIHints::HintSaysCardIsGood(GameObserver* observer,MTGCardInstance * card);
bool AIHints::HintSaysCardIsBad(GameObserver* observer,MTGCardInstance * card);
bool HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card = NULL);
bool canWeCombo(GameObserver* observer,MTGCardInstance * card = NULL,AIPlayerBaka * Ai = NULL);
vector<string> mCastOrder();

View File

@@ -54,6 +54,18 @@ AIHint::AIHint(string _line)
mCombatAlwaysBlockTip = splitAlwaysBlock[1];
}
vector<string> splitSetEffgood = parseBetween(action, "good(", ")");
if(splitSetEffgood.size())
{
mCardEffGood = splitSetEffgood[1];
}
vector<string> splitSetEffbad = parseBetween(action, "bad(", ")");
if(splitSetEffbad.size())
{
mCardEffBad = splitSetEffbad[1];
}
vector<string> splitCastOrder = parseBetween(action, "castpriority(", ")");
if(splitCastOrder.size())
{
@@ -178,6 +190,46 @@ bool AIHints::HintSaysAlwaysBlock(GameObserver* observer,MTGCardInstance * card)
return false;
}
bool AIHints::HintSaysCardIsGood(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);
TargetChooser * hintTc = NULL;
for(unsigned int i = 0; i < hints.size();i++)
{
if (hints[i]->mCardEffGood.size())
{
hintTc = tfc.createTargetChooser(hints[i]->mCardEffGood,card);
if(hintTc && hintTc->canTarget(card,true))
{
SAFE_DELETE(hintTc);
return true;
}
SAFE_DELETE(hintTc);
}
}
return false;
}
bool AIHints::HintSaysCardIsBad(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);
TargetChooser * hintTc = NULL;
for(unsigned int i = 0; i < hints.size();i++)
{
if (hints[i]->mCardEffBad.size())
{
hintTc = tfc.createTargetChooser(hints[i]->mCardEffBad,card);
if(hintTc && hintTc->canTarget(card,true))
{
SAFE_DELETE(hintTc);
return true;
}
SAFE_DELETE(hintTc);
}
}
return false;
}
bool AIHints::HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);

View File

@@ -1461,6 +1461,14 @@ int AIPlayerBaka::interruptIfICan()
int AIPlayerBaka::effectBadOrGood(MTGCardInstance * card, int mode, TargetChooser * tc)
{
if(hints && hints->HintSaysCardIsGood(observer,card))
{
return BAKA_EFFECT_GOOD;
}
if(hints && hints->HintSaysCardIsBad(observer,card))
{
return BAKA_EFFECT_BAD;
}
int id = card->getMTGId();
AbilityFactory af(observer);
int autoGuess = af.magicText(id, NULL, card, mode, tc);