Added/Fixed primitives, improved PAYZERO rule for commandzone.
This commit is contained in:
@@ -3429,7 +3429,7 @@ int AIPlayerBaka::computeActions()
|
||||
CardDescriptor cd;
|
||||
if (game->hand->hasAbility(Constants::PAYZERO))
|
||||
{
|
||||
//Attempt to put free cards into play
|
||||
//Attempt to put free cards into play from hand
|
||||
cd.init();
|
||||
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
|
||||
MTGCardInstance *freecard = cd.match(game->hand);
|
||||
@@ -3444,7 +3444,7 @@ int AIPlayerBaka::computeActions()
|
||||
}
|
||||
if (game->graveyard->hasAbility(Constants::PAYZERO) && game->graveyard->hasAbility(Constants::CANPLAYFROMGRAVEYARD))
|
||||
{
|
||||
//Attempt to put free cards into play
|
||||
//Attempt to put free cards into play from graveyard
|
||||
cd.init();
|
||||
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
|
||||
MTGCardInstance *freecard = cd.match(game->graveyard);
|
||||
@@ -3459,7 +3459,7 @@ int AIPlayerBaka::computeActions()
|
||||
}
|
||||
if (game->exile->hasAbility(Constants::PAYZERO) && game->exile->hasAbility(Constants::CANPLAYFROMEXILE))
|
||||
{
|
||||
//Attempt to put free cards into play
|
||||
//Attempt to put free cards into play from exile
|
||||
cd.init();
|
||||
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
|
||||
MTGCardInstance *freecard = cd.match(game->exile);
|
||||
@@ -3472,6 +3472,21 @@ int AIPlayerBaka::computeActions()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (game->commandzone->hasAbility(Constants::PAYZERO))
|
||||
{
|
||||
//Attempt to put free cards into play from commandzone
|
||||
cd.init();
|
||||
cd.SetExclusionColor(Constants::MTG_COLOR_LAND);
|
||||
MTGCardInstance *freecard = cd.match(game->commandzone);
|
||||
int canCastCard = game->playRestrictions->canPutIntoZone(freecard, game->inPlay);
|
||||
if (freecard && (canCastCard == PlayRestriction::CAN_PLAY) && freecard->has(Constants::PAYZERO) && (freecard->getIncreasedManaCost()->getConvertedCost() < 1) && (!freecard->isCDA))
|
||||
{
|
||||
MTGAbility * castFreeCard = observer->mLayers->actionLayer()->getAbility(MTGAbility::PAYZERO_COST);
|
||||
AIAction * aa = NEW AIAction(this, castFreeCard, freecard); //TODO putinplay action
|
||||
clickstream.push(aa);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}//end
|
||||
}
|
||||
|
||||
|
||||
@@ -1511,9 +1511,8 @@ int MTGPayZeroRule::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
|
||||
if (!card->has(Constants::PAYZERO))
|
||||
return 0;
|
||||
Player * player = game->currentlyActing();
|
||||
if (card->isLand() || (!player->game->library->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card)))
|
||||
if (card->isLand() || (!player->game->library->hasCard(card) && !player->game->graveyard->hasCard(card) && !player->game->exile->hasCard(card) && !player->game->hand->hasCard(card) && !player->game->commandzone->hasCard(card)))
|
||||
{
|
||||
//only allowed to pay zero for cards in library??? above is "if you dont have it in hand, grave, or exile"
|
||||
return 0;
|
||||
}
|
||||
if ((!card->canPlayFromLibrary() && player->game->library->hasCard(card))||(!card->has(Constants::CANPLAYFROMGRAVEYARD) && player->game->graveyard->hasCard(card)) || (!card->has(Constants::CANPLAYFROMEXILE) && player->game->exile->hasCard(card)))
|
||||
|
||||
Reference in New Issue
Block a user