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

@@ -36031,11 +36031,11 @@ type=Sorcery
[/card] [/card]
[card] [card]
name=Exotic Orchard name=Exotic Orchard
auto=this(variable{olandg}>0) {t}:add{g} auto=this(variable{olandg}>0) {t}:out{g}
auto=this(variable{olandu}>0) {t}:add{u} auto=this(variable{olandu}>0) {t}:out{u}
auto=this(variable{olandr}>0) {t}:add{r} auto=this(variable{olandr}>0) {t}:out{r}
auto=this(variable{olandb}>0) {t}:add{b} auto=this(variable{olandb}>0) {t}:out{b}
auto=this(variable{olandw}>0) {t}:add{w} auto=this(variable{olandw}>0) {t}:out{w}
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce. text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
type=Land type=Land
[/card] [/card]
@@ -37789,11 +37789,11 @@ toughness=6
[/card] [/card]
[card] [card]
name=Fellwar Stone name=Fellwar Stone
auto=this(variable{olandg}>0) {t}:add{g} auto=this(variable{olandg}>0) {t}:out{g}
auto=this(variable{olandu}>0) {t}:add{u} auto=this(variable{olandu}>0) {t}:out{u}
auto=this(variable{olandr}>0) {t}:add{r} auto=this(variable{olandr}>0) {t}:out{r}
auto=this(variable{olandb}>0) {t}:add{b} auto=this(variable{olandb}>0) {t}:out{b}
auto=this(variable{olandw}>0) {t}:add{w} auto=this(variable{olandw}>0) {t}:out{w}
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce. text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={2} mana={2}
type=Artifact type=Artifact
@@ -50008,11 +50008,11 @@ toughness=2
[/card] [/card]
[card] [card]
name=Harvester Druid name=Harvester Druid
auto=this(variable{plandg}>0) {t}:add{g} auto=this(variable{plandg}>0) {t}:out{g}
auto=this(variable{plandu}>0) {t}:add{u} auto=this(variable{plandu}>0) {t}:out{u}
auto=this(variable{plandr}>0) {t}:add{r} auto=this(variable{plandr}>0) {t}:out{r}
auto=this(variable{plandb}>0) {t}:add{b} auto=this(variable{plandb}>0) {t}:out{b}
auto=this(variable{plandw}>0) {t}:add{w} auto=this(variable{plandw}>0) {t}:out{w}
text={T}: Add to your mana pool one mana of any color that a land you control could produce. text={T}: Add to your mana pool one mana of any color that a land you control could produce.
mana={1}{G} mana={1}{G}
type=Creature type=Creature
@@ -85877,11 +85877,11 @@ toughness=1
[/card] [/card]
[card] [card]
name=Quirion Explorer name=Quirion Explorer
auto=this(variable{olandg}>0) {t}:add{g} auto=this(variable{olandg}>0) {t}:out{g}
auto=this(variable{olandu}>0) {t}:add{u} auto=this(variable{olandu}>0) {t}:out{u}
auto=this(variable{olandr}>0) {t}:add{r} auto=this(variable{olandr}>0) {t}:out{r}
auto=this(variable{olandb}>0) {t}:add{b} auto=this(variable{olandb}>0) {t}:out{b}
auto=this(variable{olandw}>0) {t}:add{w} auto=this(variable{olandw}>0) {t}:out{w}
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce. text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={1}{G} mana={1}{G}
type=Creature type=Creature
@@ -88419,12 +88419,12 @@ toughness=2
[/card] [/card]
[card] [card]
name=Reflecting Pool name=Reflecting Pool
auto=this(variable{plandg}>0) {t}:add{g} auto=this(variable{plandg}>0) {t}:out{g}
auto=this(variable{plandu}>0) {t}:add{u} auto=this(variable{plandu}>0) {t}:out{u}
auto=this(variable{plandr}>0) {t}:add{r} auto=this(variable{plandr}>0) {t}:out{r}
auto=this(variable{plandb}>0) {t}:add{b} auto=this(variable{plandb}>0) {t}:out{b}
auto=this(variable{plandw}>0) {t}:add{w} auto=this(variable{plandw}>0) {t}:out{w}
auto=this(variable{plandc}>0) {t}:add{1} auto=this(variable{plandc}>0) {t}:out{1}
text={T}: Add to your mana pool one mana of any type that a land you control could produce. text={T}: Add to your mana pool one mana of any type that a land you control could produce.
type=Land type=Land
[/card] [/card]
@@ -110856,11 +110856,11 @@ toughness=4
[/card] [/card]
[card] [card]
name=Sylvok Explorer name=Sylvok Explorer
auto=this(variable{olandg}>0) {t}:add{g} auto=this(variable{olandg}>0) {t}:out{g}
auto=this(variable{olandu}>0) {t}:add{u} auto=this(variable{olandu}>0) {t}:out{u}
auto=this(variable{olandr}>0) {t}:add{r} auto=this(variable{olandr}>0) {t}:out{r}
auto=this(variable{olandb}>0) {t}:add{b} auto=this(variable{olandb}>0) {t}:out{b}
auto=this(variable{olandw}>0) {t}:add{w} auto=this(variable{olandw}>0) {t}:out{w}
text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce. text={T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
mana={1}{G} mana={1}{G}
type=Creature type=Creature

View File

@@ -748,53 +748,53 @@ private:
} }
else if (s == "olandg") else if (s == "olandg")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target->controller()->opponent());
} }
else if (s == "olandu") else if (s == "olandu")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target->controller()->opponent());
} }
else if (s == "olandr") else if (s == "olandr")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_RED, target, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_RED, target->controller()->opponent());
} }
else if (s == "olandb") else if (s == "olandb")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target->controller()->opponent());
} }
else if (s == "olandw") else if (s == "olandw")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller()->opponent()); intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target->controller()->opponent());
} }
else if (s == "olandc") else if (s == "olandc")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()->opponent()) + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target->controller()->opponent()) +
countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller()->opponent()); countManaProducedby(Constants::MTG_COLOR_WASTE, target->controller()->opponent());
} }
else if (s == "plandg") else if (s == "plandg")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_GREEN, target->controller());
} }
else if (s == "plandu") else if (s == "plandu")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_BLUE, target->controller());
} }
else if (s == "plandr") else if (s == "plandr")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_RED, target, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_RED, target->controller());
} }
else if (s == "plandb") else if (s == "plandb")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_BLACK, target->controller());
} }
else if (s == "plandw") else if (s == "plandw")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target, target->controller()); intValue = countManaProducedby(Constants::MTG_COLOR_WHITE, target->controller());
} }
else if (s == "plandc") else if (s == "plandc")
{ {
intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target, target->controller()) + intValue = countManaProducedby(Constants::MTG_COLOR_ARTIFACT, target->controller()) +
countManaProducedby(Constants::MTG_COLOR_WASTE, target, target->controller()); countManaProducedby(Constants::MTG_COLOR_WASTE, target->controller());
} }
else if (s == "cantargetmycre")// can target my creature else if (s == "cantargetmycre")// can target my creature
{ {
@@ -1061,7 +1061,7 @@ public:
return count; return count;
} }
int countManaProducedby(int color, MTGCardInstance * target, Player * player) /*int countManaProducedby(int color, MTGCardInstance * target, Player * player)
{ {
int count = 0; int count = 0;
for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++) for (size_t i = 0; i < target->getObserver()->mLayers->actionLayer()->manaObjects.size(); i++)
@@ -1073,6 +1073,27 @@ public:
count += 1; count += 1;
} }
return count; return count;
}*/
int countManaProducedby(int color, Player * player)
{
int count = 0;
for (int i = 0; i < player->game->battlefield->nb_cards; i++)
{
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceC && (color == Constants::MTG_COLOR_ARTIFACT || color == Constants::MTG_COLOR_WASTE))
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceG && color == Constants::MTG_COLOR_GREEN)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceU && color == Constants::MTG_COLOR_BLUE)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceR && color == Constants::MTG_COLOR_RED)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceB && color == Constants::MTG_COLOR_BLACK)
count += 1;
if(((MTGCardInstance *)player->game->battlefield->cards[i])->canproduceW && color == Constants::MTG_COLOR_WHITE)
count += 1;
}
return count;
} }
WParsedInt(int value = 0) WParsedInt(int value = 0)

View File

@@ -277,6 +277,12 @@ public:
int imprintR; int imprintR;
int imprintB; int imprintB;
int imprintW; int imprintW;
int canproduceG;
int canproduceU;
int canproduceR;
int canproduceB;
int canproduceW;
int canproduceC;
string currentimprintName; string currentimprintName;
vector<string>imprintedNames; vector<string>imprintedNames;

View File

@@ -702,6 +702,25 @@ void GameObserver::gameStateBasedEffects()
card->myPair->myPair = NULL; card->myPair->myPair = NULL;
card->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 ///clear imprints
if(isInPlay(card) && card->imprintedCards.size()) if(isInPlay(card) && card->imprintedCards.size())
{ {

View File

@@ -3449,6 +3449,35 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
//Mana Producer //Mana Producer
found = s.find("add"); found = s.find("add");
if (found != string::npos) 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; bool doesntEmptyTilueot = s.find("doesntempty") != string::npos;
ManaCost * output = ManaCost::parseManaCost(s.substr(found),NULL,card); ManaCost * output = ManaCost::parseManaCost(s.substr(found),NULL,card);

View File

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