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:
@@ -21,6 +21,8 @@ public:
|
|||||||
string mCombatBlockTip;
|
string mCombatBlockTip;
|
||||||
string mCombatAlwaysBlockTip;
|
string mCombatAlwaysBlockTip;
|
||||||
string mCombatAlwaysAttackTip;
|
string mCombatAlwaysAttackTip;
|
||||||
|
string mCardEffGood;
|
||||||
|
string mCardEffBad;
|
||||||
vector<string>castOrder;
|
vector<string>castOrder;
|
||||||
vector<string>combos;
|
vector<string>combos;
|
||||||
//for preformance we disect the combo on first run.
|
//for preformance we disect the combo on first run.
|
||||||
@@ -55,6 +57,8 @@ public:
|
|||||||
bool HintSaysAlwaysAttack(GameObserver* observer,MTGCardInstance * card = NULL);
|
bool HintSaysAlwaysAttack(GameObserver* observer,MTGCardInstance * card = NULL);
|
||||||
bool HintSaysDontBlock(GameObserver* observer,MTGCardInstance * card = NULL);
|
bool HintSaysDontBlock(GameObserver* observer,MTGCardInstance * card = NULL);
|
||||||
bool HintSaysAlwaysBlock(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 HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card = NULL);
|
||||||
bool canWeCombo(GameObserver* observer,MTGCardInstance * card = NULL,AIPlayerBaka * Ai = NULL);
|
bool canWeCombo(GameObserver* observer,MTGCardInstance * card = NULL,AIPlayerBaka * Ai = NULL);
|
||||||
vector<string> mCastOrder();
|
vector<string> mCastOrder();
|
||||||
|
|||||||
@@ -54,6 +54,18 @@ AIHint::AIHint(string _line)
|
|||||||
mCombatAlwaysBlockTip = splitAlwaysBlock[1];
|
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(", ")");
|
vector<string> splitCastOrder = parseBetween(action, "castpriority(", ")");
|
||||||
if(splitCastOrder.size())
|
if(splitCastOrder.size())
|
||||||
{
|
{
|
||||||
@@ -178,6 +190,46 @@ bool AIHints::HintSaysAlwaysBlock(GameObserver* observer,MTGCardInstance * card)
|
|||||||
return false;
|
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)
|
bool AIHints::HintSaysItsForCombo(GameObserver* observer,MTGCardInstance * card)
|
||||||
{
|
{
|
||||||
TargetChooserFactory tfc(observer);
|
TargetChooserFactory tfc(observer);
|
||||||
|
|||||||
@@ -1461,6 +1461,14 @@ int AIPlayerBaka::interruptIfICan()
|
|||||||
|
|
||||||
int AIPlayerBaka::effectBadOrGood(MTGCardInstance * card, int mode, TargetChooser * tc)
|
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();
|
int id = card->getMTGId();
|
||||||
AbilityFactory af(observer);
|
AbilityFactory af(observer);
|
||||||
int autoGuess = af.magicText(id, NULL, card, mode, tc);
|
int autoGuess = af.magicText(id, NULL, card, mode, tc);
|
||||||
|
|||||||
Reference in New Issue
Block a user