Added TSR and HA4 sets, added/fixed primitives, improved Android downloader, fixed a crash when AI pays a Convoke alternative cost, fixed a random crash on Windows when opening zip files, fixed a random crash in destroy ability method (e.g. blasphemous act).
This commit is contained in:
@@ -3289,11 +3289,21 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * pMana, const char * ty
|
||||
ManaCost* manaToPay = card->getManaCost();
|
||||
if((!pMana->canAfford(card->getManaCost(),0) || card->getManaCost()->getKicker()))
|
||||
gotPayments = canPayMana(card,card->getManaCost(),card->has(Constants::ANYTYPEOFMANA));
|
||||
if(card->getManaCost()->getAlternative() && !gotPayments.size() && !pMana->canAfford(card->getManaCost(),0) && !card->getManaCost()->getKicker()){ // Now AI can cast cards using alternative cost.
|
||||
localpayAlternative = true;
|
||||
manaToPay = card->getManaCost()->getAlternative();
|
||||
if(!pMana->canAfford(manaToPay,0))
|
||||
gotPayments = canPayMana(card,card->getManaCost()->getAlternative(),card->has(Constants::ANYTYPEOFMANA));
|
||||
if(card->getManaCost()->getAlternative() && !gotPayments.size() && !pMana->canAfford(card->getManaCost(),0) && !card->getManaCost()->getKicker()){ //Now AI can cast cards using alternative cost.
|
||||
ManaCost * extra = card->getManaCost()->getAlternative(); //Fix a crash when AI try to pay convoke cost.
|
||||
bool hasConvoke = false;
|
||||
if(extra->extraCosts){
|
||||
for(unsigned int i = 0; i < extra->extraCosts->costs.size() && !hasConvoke; i++){
|
||||
if(dynamic_cast<Convoke*> (extra->extraCosts->costs[i]))
|
||||
hasConvoke = true;
|
||||
}
|
||||
}
|
||||
if(!hasConvoke){
|
||||
localpayAlternative = true;
|
||||
manaToPay = card->getManaCost()->getAlternative();
|
||||
if(!pMana->canAfford(manaToPay,0))
|
||||
gotPayments = canPayMana(card,card->getManaCost()->getAlternative(),card->has(Constants::ANYTYPEOFMANA));
|
||||
}
|
||||
}
|
||||
//for preformence reason we only look for specific mana if the payment couldn't be made with pmana.
|
||||
if ((currentCost > maxCost || hasX) && (gotPayments.size() || pMana->canAfford(manaToPay,card->has(Constants::ANYTYPEOFMANA))))
|
||||
|
||||
@@ -6060,15 +6060,13 @@ int MTGAbility::removeFromGame()
|
||||
//returns 1 if this ability needs to be removed from the list of active abilities
|
||||
int MTGAbility::testDestroy()
|
||||
{
|
||||
if (game->mLayers->stackLayer()->has(this))
|
||||
if(waitingForAnswer)
|
||||
return 0;
|
||||
if (waitingForAnswer)
|
||||
return 0;
|
||||
if (forceDestroy == 1)
|
||||
if(forceDestroy == 1)
|
||||
return 1;
|
||||
if (forceDestroy == -1)
|
||||
if(forceDestroy == -1)
|
||||
return 0;
|
||||
if (source->handEffects && game->isInHand(source))
|
||||
if(source->handEffects && game->isInHand(source))
|
||||
return 0;
|
||||
if(source->graveEffects && game->isInGrave(source))
|
||||
return 0;
|
||||
@@ -6076,11 +6074,13 @@ int MTGAbility::testDestroy()
|
||||
return 0;
|
||||
if(source->commandZoneEffects && game->isInCommandZone(source))
|
||||
return 0;
|
||||
if(this->forcedAlive == 1)
|
||||
if(forcedAlive == 1)
|
||||
return 0;
|
||||
if (!game->isInPlay(source))
|
||||
if(game->mLayers->stackLayer()->has(this)) //Moved here to avoid a random crash (e.g. blasphemous act)
|
||||
return 0;
|
||||
if(!game->isInPlay(source))
|
||||
return 1;
|
||||
if (target && !dynamic_cast<Player*>(target) && !game->isInPlay((MTGCardInstance *) target))
|
||||
if(target && !dynamic_cast<Player*>(target) && !game->isInPlay((MTGCardInstance *) target))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user