Added/fixed primitives, improved "anytypeofmana" ability for both player and AI and implemented "anytypeofmanaability" keyword to allow the user and the AI to spend mana of any color to activate abilities.

This commit is contained in:
Vittorio Alfieri
2021-01-15 18:25:38 +01:00
parent 77c48dc1d5
commit 2ff2d4ac79
17 changed files with 199 additions and 175 deletions

View File

@@ -560,7 +560,7 @@ int AbilityFactory::parseCastRestrictions(MTGCardInstance * card, Player * playe
{
ManaCost * costToCheck = ManaCost::parseManaCost(restriction[i]);
ManaCost * spent = card->getManaCost()->getManaUsedToCast();
if(spent && costToCheck && !spent->canAfford(costToCheck))
if(spent && costToCheck && !spent->canAfford(costToCheck,0))
{
SAFE_DELETE(costToCheck);
return 0;
@@ -6196,7 +6196,7 @@ int ActivatedAbility::isReactingToClick(MTGCardInstance * card, ManaCost * mana)
if (!mana)
mana = player->getManaPool();
if (!mana->canAfford(cost))
if (!mana->canAfford(cost,card->has(Constants::ANYTYPEOFMANAABILITY)))
return 0;
if (!cost->canPayExtra())
return 0;
@@ -7106,7 +7106,7 @@ int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana)
if (!source->isPhased)
{
ManaCost * cost = getCost();
if (!cost || (mana->canAfford(cost) && (!cost->extraCosts || cost->extraCosts->canPay())))/*counter cost bypass react to click*/
if (!cost || (mana->canAfford(cost,_card->has(Constants::ANYTYPEOFMANAABILITY)) && (!cost->extraCosts || cost->extraCosts->canPay())))/*counter cost bypass react to click*/
{
result = 1;
}