fix produce color
when you produce the chosen color, add mana of that color.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user