Merge pull request #924 from kevlahnota/master
Refactor countManaProducedby
This commit is contained in:
@@ -3065,7 +3065,7 @@ type=Artifact
|
|||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Amulet of Vigor
|
name=Amulet of Vigor
|
||||||
auto=lord(*|mybattlefield) transforms((,newability[untap])) forever
|
auto=lord(*[recent]|mybattlefield) transforms((,newability[untap])) forever
|
||||||
text=Whenever a permanent enters the battlefield tapped and under your control, untap it.
|
text=Whenever a permanent enters the battlefield tapped and under your control, untap it.
|
||||||
mana={1}
|
mana={1}
|
||||||
type=Artifact
|
type=Artifact
|
||||||
@@ -109171,7 +109171,7 @@ toughness=2
|
|||||||
[/card]
|
[/card]
|
||||||
[card]
|
[card]
|
||||||
name=Spirespine
|
name=Spirespine
|
||||||
auto=mustblock
|
abilities=mustblock
|
||||||
auto=bestow bstw
|
auto=bestow bstw
|
||||||
auto=bestow teach(creature) mustblock
|
auto=bestow teach(creature) mustblock
|
||||||
auto=bestow teach(creature) +3/+2
|
auto=bestow teach(creature) +3/+2
|
||||||
|
|||||||
@@ -1125,14 +1125,29 @@ public:
|
|||||||
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++)
|
MTGGameZone * zone = player->game->battlefield;
|
||||||
|
for(int k = 0; k < zone->nb_cards; k++)
|
||||||
|
{
|
||||||
|
MTGCardInstance * card = zone->cards[k];
|
||||||
|
if(card->isLand() && (card != target) && card->hasSubtype("forest") && color == 1)
|
||||||
|
count++;
|
||||||
|
if(card->isLand() && (card != target) && card->hasSubtype("island") && color == 2)
|
||||||
|
count++;
|
||||||
|
if(card->isLand() && (card != target) && card->hasSubtype("mountain") && color == 3)
|
||||||
|
count++;
|
||||||
|
if(card->isLand() && (card != target) && card->hasSubtype("swamp") && color == 4)
|
||||||
|
count++;
|
||||||
|
if(card->isLand() && (card != target) && card->hasSubtype("plains") && color == 5)
|
||||||
|
count++;
|
||||||
|
if(card->isLand() && (card != target) && card->cardsAbilities.size())
|
||||||
{
|
{
|
||||||
if (dynamic_cast<AManaProducer*> (((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i])) &&
|
for(unsigned int j = 0; j < card->cardsAbilities.size(); j++)
|
||||||
(dynamic_cast<AManaProducer*> (((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i])))->source->isLand() &&
|
{
|
||||||
(dynamic_cast<AManaProducer*> (((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i])))->source->controller() == player &&
|
if(dynamic_cast<AManaProducer*> (card->cardsAbilities[j]) && dynamic_cast<AManaProducer*> (card->cardsAbilities[j])->output->hasColor(color) )
|
||||||
(dynamic_cast<AManaProducer*> (((MTGAbility *) target->getObserver()->mLayers->actionLayer()->manaObjects[i])))->output->hasColor(color))
|
count++;
|
||||||
count += 1;
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3760,21 +3760,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
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);
|
||||||
Targetable * t = spell ? spell->getNextTarget() : NULL;
|
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);
|
MTGAbility * a = NEW AManaProducer(observer, id, card, t, output, NULL, who,s.substr(found),doesntEmptyTilueot);
|
||||||
a->oneShot = 1;
|
a->oneShot = 1;
|
||||||
if(newName.size())
|
if(newName.size())
|
||||||
|
|||||||
Reference in New Issue
Block a user