change plandtype & olandtype parsing

This commit is contained in:
Anthony Calosa
2016-08-19 23:34:01 +08:00
parent 8d7b9293b5
commit 60411027ca
6 changed files with 127 additions and 46 deletions

View File

@@ -702,6 +702,25 @@ void GameObserver::gameStateBasedEffects()
card->myPair->myPair = NULL;
card->myPair = NULL;
}
///set basic land mana objects canproduce
for (size_t gg = 0; gg < mLayers->actionLayer()->manaObjects.size(); gg++)
{
if (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])) &&
(dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->source->isLand() &&
(dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->source == card)
{
if (card->hasType("forest") && (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->output->hasColor(Constants::MTG_COLOR_GREEN))
card->canproduceG = 1;
if (card->hasType("island") && (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->output->hasColor(Constants::MTG_COLOR_BLUE))
card->canproduceU = 1;
if (card->hasType("mountain") && (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->output->hasColor(Constants::MTG_COLOR_RED))
card->canproduceR = 1;
if (card->hasType("swamp") && (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->output->hasColor(Constants::MTG_COLOR_BLACK))
card->canproduceB = 1;
if (card->hasType("plains") && (dynamic_cast<AManaProducer*> (((MTGAbility *) mLayers->actionLayer()->manaObjects[gg])))->output->hasColor(Constants::MTG_COLOR_WHITE))
card->canproduceW = 1;
}
}
///clear imprints
if(isInPlay(card) && card->imprintedCards.size())
{

View File

@@ -3449,6 +3449,35 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
//Mana Producer
found = s.find("add");
if (found != string::npos)
{
bool doesntEmptyTilueot = s.find("doesntempty") != string::npos;
ManaCost * output = ManaCost::parseManaCost(s.substr(found),NULL,card);
Targetable * t = spell ? spell->getNextTarget() : NULL;
if(output->getConvertedCost() > 0)
{
if(output->hasColor(Constants::MTG_COLOR_ARTIFACT)||output->hasColor(Constants::MTG_COLOR_WASTE))
card->canproduceC = 1;
if(output->hasColor(Constants::MTG_COLOR_GREEN))
card->canproduceG = 1;
if(output->hasColor(Constants::MTG_COLOR_BLUE))
card->canproduceU = 1;
if(output->hasColor(Constants::MTG_COLOR_RED))
card->canproduceR = 1;
if(output->hasColor(Constants::MTG_COLOR_BLACK))
card->canproduceB = 1;
if(output->hasColor(Constants::MTG_COLOR_WHITE))
card->canproduceW = 1;
}
MTGAbility * a = NEW AManaProducer(observer, id, card, t, output, NULL, who,s.substr(found),doesntEmptyTilueot);
a->oneShot = 1;
if(newName.size())
((AManaProducer*)a)->menutext = newName;
return a;
}
//another mana producer exempted for canproduce
found = s.find("out");
if (found != string::npos)
{
bool doesntEmptyTilueot = s.find("doesntempty") != string::npos;
ManaCost * output = ManaCost::parseManaCost(s.substr(found),NULL,card);

View File

@@ -252,6 +252,12 @@ void MTGCardInstance::initMTGCI()
imprintR = 0;
imprintB = 0;
imprintW = 0;
canproduceG = 0;
canproduceU = 0;
canproduceR = 0;
canproduceB = 0;
canproduceW = 0;
canproduceC = 0;
currentimprintName = "";
imprintedNames.clear();
CountedObjects = 0;