added HINT:alwaysattackwith(targetchooser) and HINT:alwaysblockwith(targetchooser)

This commit is contained in:
omegablast2002@yahoo.com
2013-04-07 00:56:44 +00:00
parent ce656adeba
commit 6727c1af52
3 changed files with 69 additions and 0 deletions

View File

@@ -36,12 +36,24 @@ AIHint::AIHint(string _line)
mCombatAttackTip = splitDontAttack[1];
}
vector<string> splitAlwaysAttack = parseBetween(action, "alwaysattackwith(", ")");
if(splitAlwaysAttack.size())
{
mCombatAlwaysAttackTip = splitAlwaysAttack[1];
}
vector<string> splitDontBlock = parseBetween(action, "dontblockwith(", ")");
if(splitDontBlock.size())
{
mCombatBlockTip = splitDontBlock[1];
}
vector<string> splitAlwaysBlock = parseBetween(action, "alwaysblockwith(", ")");
if(splitAlwaysBlock.size())
{
mCombatAlwaysBlockTip = splitAlwaysBlock[1];
}
vector<string> splitCastOrder = parseBetween(action, "castpriority(", ")");
if(splitCastOrder.size())
{
@@ -106,6 +118,26 @@ bool AIHints::HintSaysDontAttack(GameObserver* observer,MTGCardInstance * card)
return false;
}
bool AIHints::HintSaysAlwaysAttack(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);
TargetChooser * hintTc = NULL;
for(unsigned int i = 0; i < hints.size();i++)
{
if (hints[i]->mCombatAlwaysAttackTip.size())
{
hintTc = tfc.createTargetChooser(hints[i]->mCombatAlwaysAttackTip,card);
if(hintTc && hintTc->canTarget(card,true))
{
SAFE_DELETE(hintTc);
return true;
}
SAFE_DELETE(hintTc);
}
}
return false;
}
bool AIHints::HintSaysDontBlock(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);
@@ -126,6 +158,26 @@ bool AIHints::HintSaysDontBlock(GameObserver* observer,MTGCardInstance * card)
return false;
}
bool AIHints::HintSaysAlwaysBlock(GameObserver* observer,MTGCardInstance * card)
{
TargetChooserFactory tfc(observer);
TargetChooser * hintTc = NULL;
for(unsigned int i = 0; i < hints.size();i++)
{
if (hints[i]->mCombatAlwaysBlockTip.size())
{
hintTc = tfc.createTargetChooser(hints[i]->mCombatAlwaysBlockTip,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);