Fixed primitives, added "notshare!" keyword (e.g. to search cards with different names), improved decks selection according to chosen game mode (e.g. Game will show commander decks only in commander mode and it will hide them in other modes).

This commit is contained in:
Vittorio Alfieri
2021-01-22 14:15:43 +01:00
parent 3a38e7f4ab
commit 5184132e8b
11 changed files with 63 additions and 34 deletions

View File

@@ -172,8 +172,9 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
return NULL;
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
return NULL;
if (nameComparisonMode && compareName != card->name)
if ((nameComparisonMode == COMPARISON_UNEQUAL && compareName == card->name) || (nameComparisonMode && nameComparisonMode != COMPARISON_UNEQUAL && compareName != card->name))
return NULL;
return card;
}
@@ -219,7 +220,7 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
match = NULL;
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
match = NULL;
if(nameComparisonMode && compareName != card->name)
if ((nameComparisonMode == COMPARISON_UNEQUAL && compareName == card->name) || (nameComparisonMode && nameComparisonMode != COMPARISON_UNEQUAL && compareName != card->name))
match = NULL;
return match;
@@ -233,10 +234,26 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
{
match = match_and(card);
}
else if (mode == CD_NAND)
{
match = match_and(card);
if(!match)
match = card;
else
match = NULL;
}
else if (mode == CD_OR)
{
match = match_or(card);
}
else if (mode == CD_NOR)
{
match = match_or(card);
if(!match)
match = card;
else
match = NULL;
}
//Abilities
BasicAbilitiesSet set = basicAbilities & card->basicAbilities;