Added new decks for AI, improved "genrand", "altercost" and "changecost" keywords in order to allow the usage of a variable instead of a simple number (e.g. "altercost(colorless, -phandcount)").
This commit is contained in:
@@ -7388,8 +7388,8 @@ void AAlterCost::refreshCost(MTGCardInstance * card)
|
||||
original->remove(card->getReducedManaCost());
|
||||
card->getManaCost()->copy(original);
|
||||
delete original;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
void AAlterCost::increaseTheCost(MTGCardInstance * card)
|
||||
{
|
||||
if(card->getIncreasedManaCost()->getConvertedCost())
|
||||
|
||||
@@ -4639,7 +4639,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
if(splitChangeCost[1].size())
|
||||
{
|
||||
vector<string> ccParameters = split( splitChangeCost[1], ':');
|
||||
int amount = atoi(ccParameters[1].c_str());
|
||||
WParsedInt * value = NEW WParsedInt(ccParameters[1].c_str(), NULL, card);
|
||||
int amount = value->getValue();
|
||||
int color = Constants::GetColorStringIndex(ccParameters[0]);
|
||||
if(ccParameters[0] == "colorless")
|
||||
color = 0;
|
||||
@@ -6263,7 +6264,8 @@ MTGAbility * AbilityFactory::getManaReduxAbility(string s, int id, Spell *, MTGC
|
||||
{
|
||||
int color = -1;
|
||||
string manaCost = s.substr(s.find(",") + 1);
|
||||
|
||||
replace(manaCost.begin(), manaCost.end(), ')', ' ');
|
||||
trim(manaCost);
|
||||
const string ColorStrings[] = { Constants::kManaColorless, Constants::kManaGreen, Constants::kManaBlue, Constants::kManaRed, Constants::kManaBlack, Constants::kManaWhite };
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(ColorStrings)/sizeof(ColorStrings[0]); ++i)
|
||||
@@ -6280,7 +6282,8 @@ MTGAbility * AbilityFactory::getManaReduxAbility(string s, int id, Spell *, MTGC
|
||||
return NULL;
|
||||
}
|
||||
// figure out the mana cost
|
||||
int amount = atoi(manaCost.c_str());
|
||||
WParsedInt * value = NEW WParsedInt(manaCost.c_str(), NULL, card);
|
||||
int amount = value->getValue();
|
||||
return NEW AAlterCost(observer, id, card, target, amount, color);
|
||||
}
|
||||
|
||||
|
||||
@@ -735,7 +735,8 @@ void WParsedInt::init(string s, Spell * spell, MTGCardInstance * card)
|
||||
}
|
||||
else if (s.find("genrand") != string::npos) //Return a random value between 0 and a specific number (minus 1);
|
||||
{
|
||||
intValue = std::rand() % atoi(s.substr(7).c_str());
|
||||
WParsedInt * value = NEW WParsedInt(s.substr(7).c_str(), NULL, card);
|
||||
intValue = std::rand() % value->getValue();
|
||||
}
|
||||
else if (s == "manacost") //Return the converted manacost
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user