fix produce color

when you produce the chosen color, add mana of that color.
This commit is contained in:
Anthony Calosa
2016-06-23 17:44:50 +08:00
parent 7c9d52abbf
commit 4d3277f41b
7 changed files with 113 additions and 61 deletions
+10
View File
@@ -346,6 +346,16 @@ int GuiMana::receiveEventPlus(WEvent* e)
manas.push_back(NEW ManaIcon(event->color, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, x, y));
return 1;
}
else if (WEventEngageManaExtra *event = dynamic_cast<WEventEngageManaExtra*>(e))
{
if (event->destination != owner->getManaPool())
return 0;
if (event->card && event->card->view)
manas.push_back(NEW ManaIcon(event->color, event->card->view->actX, event->card->view->actY, x, y));
else
manas.push_back(NEW ManaIcon(event->color, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, x, y));
return 1;
}
else
return 0;
}
+8 -2
View File
@@ -1119,14 +1119,20 @@ int ManaPool::remove(int color, int value)
return result;
}
int ManaPool::add(int color, int value, MTGCardInstance * source)
int ManaPool::add(int color, int value, MTGCardInstance * source, bool extra)
{
if (color == Constants::MTG_COLOR_ARTIFACT)
color = Constants::MTG_COLOR_WASTE;
int result = ManaCost::add(color, value);
for (int i = 0; i < value; ++i)
{
WEvent * e = NEW WEventEngageMana(color, source, this);
WEvent * e = NEW WEvent;
if(extra)
e = NEW WEventEngageManaExtra(color, source, this);
else
e = NEW WEventEngageMana(color, source, this);
player->getObserver()->receiveEvent(e);
}
return result;
+29
View File
@@ -147,6 +147,35 @@ WEventCreatureBlockerRank::WEventCreatureBlockerRank(MTGCardInstance * card, MTG
{
}
WEventEngageManaExtra::WEventEngageManaExtra(int color, MTGCardInstance* card, ManaPool * destination) :
WEvent(), color(color), card(card), destination(destination)
{//controller snow
if(color == 1 && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaG += 1;
if(color == 2 && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaU += 1;
if(color == 3 && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaR += 1;
if(color == 4 && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaB += 1;
if(color == 5 && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaW += 1;
if((color == 0 || color == 6) && card->controller()->getManaPool() == destination && card->hasType("snow"))
card->controller()->snowManaC += 1;
//opponent snow
if(color == 1 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaG += 1;
if(color == 2 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaU += 1;
if(color == 3 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaR += 1;
if(color == 4 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaB += 1;
if(color == 5 && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaW += 1;
if((color == 0 || color == 6) && card->controller()->opponent()->getManaPool() == destination && card->hasType("snow"))
card->controller()->opponent()->snowManaC += 1;
}
WEventEngageMana::WEventEngageMana(int color, MTGCardInstance* card, ManaPool * destination) :
WEvent(), color(color), card(card), destination(destination)
{//controller snow