storm,cantwin/lose,additionallands,cast restricting
This commit is contained in:
@@ -621,6 +621,11 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
cd.setType(type);
|
||||
card = NULL;
|
||||
while((card = cd.nextmatch(game->hand, card))){
|
||||
if (card->hasType(Subtypes::TYPE_CREATURE) && this->castrestrictedcreature < 0 && this->castrestrictedspell < 0) continue;
|
||||
if (card->hasType(Subtypes::TYPE_ENCHANTMENT) && this->castrestrictedspell < 0) continue;
|
||||
if (card->hasType(Subtypes::TYPE_ARTIFACT) && this->castrestrictedspell < 0) continue;
|
||||
if (card->hasType(Subtypes::TYPE_SORCERY) && this->castrestrictedspell < 0) continue;
|
||||
if (card->hasType(Subtypes::TYPE_INSTANT) && this->castrestrictedspell < 0) continue;
|
||||
if (card->hasType(Subtypes::TYPE_LAND) && !this->canPutLandsIntoPlay) continue;
|
||||
if (card->hasType(Subtypes::TYPE_LEGENDARY) && game->inPlay->findByName(card->name)) continue;
|
||||
int currentCost = card->getManaCost()->getConvertedCost();
|
||||
@@ -709,12 +714,20 @@ int AIPlayerBaka::computeActions(){
|
||||
|
||||
nextCardToPlay = FindCardToPlay(currentMana, "land");
|
||||
//look for the most expensive creature we can afford
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "creature");
|
||||
if(castrestrictedspell == 0 && cantcastspell == 0){
|
||||
if(onlyonecast == 0 || castedspellsthisturn < onlyonecast){
|
||||
if(castrestrictedcreature == 0 && cantcastcreature == 0){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "creature");
|
||||
}
|
||||
//Let's Try an enchantment maybe ?
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "enchantment");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "artifact");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "sorcery");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "instant");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "enchantment");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "artifact");
|
||||
if (cantcastinso == 0){
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "sorcery");
|
||||
if (!nextCardToPlay) nextCardToPlay = FindCardToPlay(currentMana, "instant");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (potential) delete(currentMana);
|
||||
if (nextCardToPlay){
|
||||
if (potential){
|
||||
|
||||
Reference in New Issue
Block a user