ok sorry about the confusion, so the issue was with {1}{c} and how its handled. we only need to replace the adding of colorless in the manapool, the old colorless is still very very valid and should be left in place as is.
{1} can be paid with anything
{c} is a mana supertype, it pays for diamond and colorless.
however all card such as "sol ring" now add diamond instead of old colorless.
reverted waste to {c}, but moved it under counters to avoid crashes. parse for a counter if its not a counter than parse {c} otherwise we would end up with case where it was parsing {c} instead of building counters or vice versa.
This commit is contained in:
@@ -254,35 +254,43 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
{
|
{
|
||||||
manaCost->addExtraCost(NEW CycleCost(tc));
|
manaCost->addExtraCost(NEW CycleCost(tc));
|
||||||
}
|
}
|
||||||
else
|
else if(size_t counterCheck = value.find("(") != string::npos)
|
||||||
{
|
{
|
||||||
size_t counter_start = value.find("(");
|
size_t counter_start = value.find("(");
|
||||||
size_t counter_end = value.find(")", counter_start);
|
size_t counter_end = value.find(")", counter_start);
|
||||||
AbilityFactory abf(g);
|
AbilityFactory abf(g);
|
||||||
string counterString = value.substr(counter_start + 1, counter_end - counter_start - 1);
|
string counterString = value.substr(counter_start + 1, counter_end - counter_start - 1);
|
||||||
Counter * counter = abf.parseCounter(counterString, c);
|
Counter * counter = abf.parseCounter(counterString, c);
|
||||||
size_t separator = value.find(",", counter_start);
|
size_t separator = value.find(",", counter_start);
|
||||||
size_t separator2 = string::npos;
|
size_t separator2 = string::npos;
|
||||||
if (separator != string::npos)
|
if (separator != string::npos)
|
||||||
{
|
{
|
||||||
separator2 = value.find(",", counter_end + 1);
|
separator2 = value.find(",", counter_end + 1);
|
||||||
}
|
}
|
||||||
SAFE_DELETE(tc);
|
SAFE_DELETE(tc);
|
||||||
size_t target_start = string::npos;
|
size_t target_start = string::npos;
|
||||||
if (separator2 != string::npos)
|
if (separator2 != string::npos)
|
||||||
{
|
{
|
||||||
target_start = value.find(",", counter_end + 1);
|
target_start = value.find(",", counter_end + 1);
|
||||||
}
|
}
|
||||||
size_t target_end = value.length();
|
size_t target_end = value.length();
|
||||||
if (target_start != string::npos && target_end != string::npos)
|
if (target_start != string::npos && target_end != string::npos)
|
||||||
{
|
{
|
||||||
string target = value.substr(target_start + 1, target_end - 1 - target_start);
|
string target = value.substr(target_start + 1, target_end - 1 - target_start);
|
||||||
tc = tcf.createTargetChooser(target, c);
|
tc = tcf.createTargetChooser(target, c);
|
||||||
}
|
}
|
||||||
manaCost->addExtraCost(NEW CounterCost(counter, tc));
|
manaCost->addExtraCost(NEW CounterCost(counter, tc));
|
||||||
}
|
break;
|
||||||
break;
|
}
|
||||||
}
|
else if (value == "c")
|
||||||
|
{
|
||||||
|
manaCost->add(Constants::MTG_COLOR_WASTE, 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: //uncolored cost and hybrid costs and special cost
|
default: //uncolored cost and hybrid costs and special cost
|
||||||
{
|
{
|
||||||
if(value == "unattach")
|
if(value == "unattach")
|
||||||
@@ -290,12 +298,6 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
|||||||
manaCost->addExtraCost(NEW UnattachCost(c));
|
manaCost->addExtraCost(NEW UnattachCost(c));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (value == "waste")
|
|
||||||
{
|
|
||||||
manaCost->add(Constants::MTG_COLOR_WASTE, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
int intvalue = atoi(value.c_str());
|
int intvalue = atoi(value.c_str());
|
||||||
int colors[2];
|
int colors[2];
|
||||||
int values[2];
|
int values[2];
|
||||||
@@ -1103,6 +1105,8 @@ int ManaPool::remove(int color, int value)
|
|||||||
|
|
||||||
int ManaPool::add(int color, int value, MTGCardInstance * source)
|
int ManaPool::add(int color, int value, MTGCardInstance * source)
|
||||||
{
|
{
|
||||||
|
if (color == Constants::MTG_COLOR_ARTIFACT)
|
||||||
|
color = Constants::MTG_COLOR_WASTE;
|
||||||
int result = ManaCost::add(color, value);
|
int result = ManaCost::add(color, value);
|
||||||
for (int i = 0; i < value; ++i)
|
for (int i = 0; i < value; ++i)
|
||||||
{
|
{
|
||||||
@@ -1116,6 +1120,15 @@ int ManaPool::add(ManaCost * _cost, MTGCardInstance * source)
|
|||||||
{
|
{
|
||||||
if (!_cost)
|
if (!_cost)
|
||||||
return 0;
|
return 0;
|
||||||
|
//while colorless is still exactly the same, there are now cards that require
|
||||||
|
//true colorless mana, ei:eldrazi. so whenever we add mana, we now replace it with the
|
||||||
|
//new type. keeping the old type intact for payment methods {1}{c} ....
|
||||||
|
int replaceArtifact = _cost->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||||
|
if (replaceArtifact)
|
||||||
|
{
|
||||||
|
_cost->add(Constants::MTG_COLOR_WASTE, replaceArtifact);
|
||||||
|
_cost->remove(Constants::MTG_COLOR_ARTIFACT, replaceArtifact);
|
||||||
|
}
|
||||||
int result = ManaCost::add(_cost);
|
int result = ManaCost::add(_cost);
|
||||||
for (int i = 0; i < Constants::NB_Colors; i++)
|
for (int i = 0; i < Constants::NB_Colors; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user