Fix for Devotion, added some "Chroma" cards
This commit is contained in:
@@ -580,6 +580,24 @@ unsigned int MTGGameZone::countTotalManaSymbols(TargetChooser * tc, int color)
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int MTGGameZone::countDevotion(TargetChooser * tc, int color)
|
||||
{
|
||||
if (!tc) {
|
||||
return 0;
|
||||
}
|
||||
// we don't care if cards have protection.
|
||||
bool withoutProtections = true;
|
||||
int result = 0;
|
||||
for (int i = 0; i < nb_cards; i++)
|
||||
{
|
||||
if (tc->canTarget(cards[i], withoutProtections))
|
||||
{
|
||||
result += cards[i]->getManaCost()->getManaSymbolsHybridMerged(color);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGGameZone::findByName(string name)
|
||||
{
|
||||
for (int i = 0; i < (nb_cards); i++)
|
||||
|
||||
@@ -618,6 +618,27 @@ int ManaCost::getManaSymbols(int color)
|
||||
return result;
|
||||
}
|
||||
|
||||
int ManaCost::getManaSymbolsHybridMerged(int color)
|
||||
{
|
||||
int result = cost[color];
|
||||
for (size_t i = 0; i < hybrids.size(); ++i)
|
||||
{
|
||||
result = hybrids[i].getManaSymbolsHybridMerged(color);//removed +
|
||||
}
|
||||
if (extraCosts && extraCosts->costs.size())
|
||||
{
|
||||
for (size_t i = 0; i < extraCosts->costs.size(); ++i)
|
||||
{
|
||||
LifeorManaCost * phyrexianMana = dynamic_cast<LifeorManaCost*>(extraCosts->costs[i]);
|
||||
if (phyrexianMana)
|
||||
{
|
||||
result += phyrexianMana->getManaCost()->getManaSymbolsHybridMerged(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int ManaCost::parseManaSymbol(char symbol)
|
||||
{
|
||||
switch (symbol)
|
||||
|
||||
@@ -58,6 +58,14 @@ int ManaCostHybrid::getManaSymbols(int color)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ManaCostHybrid::getManaSymbolsHybridMerged(int color)
|
||||
{
|
||||
// we assume that color1 and color2 are different
|
||||
if (color1 == color) return value1;
|
||||
if (color2 == color) return value2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ManaCostHybrid::hasColor(int color)
|
||||
{
|
||||
if (((color1 == color) && value1) || ((color2 == color) && value2))
|
||||
|
||||
Reference in New Issue
Block a user