reworked some logic that was changed in last commit.
This commit is contained in:
@@ -82,7 +82,7 @@ class AIPlayerBaka: public AIPlayer{
|
|||||||
virtual int selectHintAbility();
|
virtual int selectHintAbility();
|
||||||
|
|
||||||
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL, ManaCost * mCost = NULL);
|
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card = NULL, ManaCost * mCost = NULL);
|
||||||
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card, ManaCost * mCost, map<MTGCardInstance*, bool> &usedCards);
|
virtual vector<MTGAbility*> canPayMana(MTGCardInstance * card, ManaCost * mCost, map<MTGCardInstance*, bool> &usedCards, bool searchingAgain = false);
|
||||||
virtual vector<MTGAbility*> canPaySunBurst(ManaCost * mCost = NULL);
|
virtual vector<MTGAbility*> canPaySunBurst(ManaCost * mCost = NULL);
|
||||||
|
|
||||||
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
virtual MTGCardInstance * chooseCard(TargetChooser * tc, MTGCardInstance * source, int random = 0);
|
||||||
|
|||||||
@@ -843,7 +843,7 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
return canPayMana(target, cost, usedCards);
|
return canPayMana(target, cost, usedCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * cost, map<MTGCardInstance*,bool> &used )
|
vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost * cost, map<MTGCardInstance*,bool> &used ,bool searchingAgain)
|
||||||
{
|
{
|
||||||
if(!cost->getConvertedCost())
|
if(!cost->getConvertedCost())
|
||||||
return vector<MTGAbility*>();
|
return vector<MTGAbility*>();
|
||||||
@@ -1016,7 +1016,7 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
return payments;//we didn't meet one of the color cost requirements.
|
return payments;//we didn't meet one of the color cost requirements.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cost->kicker && !used.size())
|
if(cost->kicker && !searchingAgain)
|
||||||
{
|
{
|
||||||
|
|
||||||
ManaCost * withKickerCost= NEW ManaCost(cost->kicker);
|
ManaCost * withKickerCost= NEW ManaCost(cost->kicker);
|
||||||
@@ -1025,15 +1025,14 @@ vector<MTGAbility*> AIPlayerBaka::canPayMana(MTGCardInstance * target,ManaCost *
|
|||||||
bool keepLooking = true;
|
bool keepLooking = true;
|
||||||
while(keepLooking)
|
while(keepLooking)
|
||||||
{
|
{
|
||||||
kickerPayment = canPayMana(target, withKickerCost, used);
|
kickerPayment = canPayMana(target, withKickerCost, used,true);
|
||||||
if(kickerPayment.size())
|
if(kickerPayment.size())
|
||||||
{
|
{
|
||||||
for(unsigned int w = 0;w < kickerPayment.size();++w)
|
for(unsigned int w = 0;w < kickerPayment.size();++w)
|
||||||
{
|
{
|
||||||
if(!used[kickerPayment[w]->source])
|
if(used[kickerPayment[w]->source])
|
||||||
{
|
{
|
||||||
payments.push_back(kickerPayment[w]);
|
payments.push_back(kickerPayment[w]);
|
||||||
used[kickerPayment[w]->source] = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
canKick += 1;
|
canKick += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user