Improved Commander format card selection rule, added new keyword

"autocommandzone=" to trigger abilities from Command Zone (e.g. Commander Ninjutsu), added/fixed some primitives, added a new GUI Button to show Player's Sideboard.
This commit is contained in:
valfieri
2020-12-08 20:48:11 +01:00
parent d18232df10
commit 7c696ac213
25 changed files with 207 additions and 74 deletions

View File

@@ -207,7 +207,7 @@ void GuiGameZone::Render()
bool showopponenttop = (zone && zone->owner->opponent()->game->battlefield->nb_cards && zone->owner->opponent()->game->battlefield->hasAbility(Constants::SHOWOPPONENTTOPLIBRARY))?true:false;
quad->SetColor(ARGB((int)(actA),255,255,255));
if(type == GUI_EXILE || type == GUI_COMMANDZONE)
if(type == GUI_EXILE || type == GUI_COMMANDZONE || type == GUI_SIDEBOARD)
{
quad->SetColor(ARGB((int)(actA),255,240,255));
}
@@ -218,6 +218,7 @@ void GuiGameZone::Render()
JQuadPtr iconlibrary = WResourceManager::Instance()->RetrieveTempQuad("iconlibrary.png");
JQuadPtr iconexile = WResourceManager::Instance()->RetrieveTempQuad("iconexile.png");
JQuadPtr iconcommandzone = WResourceManager::Instance()->RetrieveTempQuad("iconcommandzone.png");
JQuadPtr iconsideboard = WResourceManager::Instance()->RetrieveTempQuad("iconsideboard.png");
if(iconlibrary && type == GUI_LIBRARY)
{
@@ -259,6 +260,14 @@ void GuiGameZone::Render()
iconcommandzone->SetColor(ARGB((int)(actA),255,255,255));
quad = iconcommandzone;
}
if(iconsideboard && type == GUI_SIDEBOARD)
{
scale2 = defaultHeight / iconsideboard->mHeight;
modx = -0.f;
mody = -2.f;
iconsideboard->SetColor(ARGB((int)(actA),255,255,255));
quad = iconsideboard;
}
//
if(type == GUI_LIBRARY && zone->nb_cards && !showCards)
@@ -575,6 +584,52 @@ ostream& GuiCommandZone::toString(ostream& out) const
return out << "GuiCommandZone :::";
}
GuiSideboard::GuiSideboard(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) :
GuiGameZone(x, y, hasFocus, player->game->sideboard, parent), player(player)
{
type = GUI_SIDEBOARD;
}
int GuiSideboard::receiveEventPlus(WEvent* e)
{
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e))
if (event->to == zone)
{
CardView* t;
if (event->card->view)
t = NEW CardView(CardView::nullZone, event->card, *(event->card->view));
else
t = NEW CardView(CardView::nullZone, event->card, x, y);
t->x = x + Width / 2;
t->y = y + Height / 2;
t->zoom = 0.6f;
t->alpha = 0;
cards.push_back(t);
return 1;
}
return 0;
}
int GuiSideboard::receiveEventMinus(WEvent* e)
{
if (WEventZoneChange* event = dynamic_cast<WEventZoneChange*>(e))
if (event->from == zone)
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
if (event->card->previous == (*it)->card)
{
CardView* cv = *it;
cards.erase(it);
zone->owner->getObserver()->mTrash->trash(cv);
return 1;
}
return 0;
}
ostream& GuiSideboard::toString(ostream& out) const
{
return out << "GuiSideboard :::";
}
//opponenthand begins
GuiOpponentHand::GuiOpponentHand(float x, float y, bool hasFocus, Player * player, GuiAvatars* parent) :
GuiGameZone(x, y, hasFocus, player->game->hand, parent), player(player)