From 94620504da4e98ae21aa7de4c8fa332e280225c2 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Mon, 12 Oct 2015 13:00:05 +0800 Subject: [PATCH 1/3] fix urza lands the alias is used for checking of "urzatron". revised this because when using if then else in the activation makes the mana ability goes to the stack --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 15 +++++++++++---- projects/mtg/include/AllAbilities.h | 7 +++++++ projects/mtg/include/MTGGameZones.h | 2 ++ projects/mtg/src/MTGGameZones.cpp | 12 ++++++++++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index 9bd88df8e..d5701472c 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -80872,7 +80872,8 @@ toughness=1 [/card] [card] name=River of Tears -auto={t}:name(Add Mana) if type(land[fresh]|mybattlefield)~morethan~0 then add{B} else add{U} +auto=aslongas(land[fresh]|mybattlefield) {T}:add{B} >0 +auto=aslongas(land[fresh]|mybattlefield) {T}:add{U} <1 text={T}: Add {U} to your mana pool. If you played a land this turn, add {B} to your mana pool instead. type=Land [/card] @@ -106988,21 +106989,27 @@ type=Artifact [/card] [card] name=Urza's Mine -auto={t}:name(Add Mana) if type(Urza's Tower|mybattlefield)~morethan~0,type(Urza's Power Plant|mybattlefield)~morethan~0 then add{2} else add{1} +alias=4192 +auto=this(variable{urzatron} >0) produceextra:{1} +auto={T}:add{1} text={T}: Add {1} to your mana pool. If you control an Urza's Power-Plant and an Urza's Tower, add {2} to your mana pool instead. type=Land subtype=Urza's Mine [/card] [card] name=Urza's Power Plant -auto={t}:name(Add Mana) if type(Urza's Tower|mybattlefield)~morethan~0,type(Urza's Mine|mybattlefield)~morethan~0 then add{2} else add{1} +alias=4193 +auto=this(variable{urzatron} >0) produceextra:{1} +auto={T}:add{1} text={T}: Add {1} to your mana pool. If you control an Urza's Mine and an Urza's Tower, add {2} to your mana pool instead. type=Land subtype=Urza's Power-Plant [/card] [card] name=Urza's Tower -auto={t}:name(Add Mana) if type(Urza's Power Plant|mybattlefield)~morethan~0,type(Urza's Mine|mybattlefield)~morethan~0 then add{3} else add{1} +alias=4194 +auto=this(variable{urzatron} >0) produceextra:{2} +auto={T}:add{1} text={T}: Add {1} to your mana pool. If you control an Urza's Mine and an Urza's Power-Plant, add {3} to your mana pool instead. type=Land subtype=Urza's Tower diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 538dbf4da..c9fe5e22c 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -688,6 +688,13 @@ private: { intValue = target->controller()->opponent()->game->hand->nb_cards; } + else if (s == "urzatron")//Urza lands + { + if(card->controller()->game->battlefield->hasAlias(4192) && card->controller()->game->battlefield->hasAlias(4193) && card->controller()->game->battlefield->hasAlias(4194)) + intValue = 1; + else + intValue = 0; + } else if (s == "worshipped")//Worship { if(card->controller()->game->battlefield->hasType("creature")) diff --git a/projects/mtg/include/MTGGameZones.h b/projects/mtg/include/MTGGameZones.h index 97687d006..7662311d0 100644 --- a/projects/mtg/include/MTGGameZones.h +++ b/projects/mtg/include/MTGGameZones.h @@ -103,6 +103,8 @@ class MTGGameZone { //returns true if one of the cards in the zone has the ability bool hasAbility(int ability); + //returns true if one of the cards in the zone has the alias + bool hasAlias(int alias); //returns true if one of the cards in the zone has the type bool hasType(const char * value); diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 24203ed99..bcae61f0c 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -764,6 +764,18 @@ bool MTGGameZone::hasAbility(int ability) return false; } +bool MTGGameZone::hasAlias(int alias) +{ + for (int i = 0; i < (nb_cards); i++) + { + if (cards[i]->alias == alias) + { + return true; + } + } + return false; +} + int MTGGameZone::seenThisTurn(TargetChooser * tc, int castMethod, bool lastTurn) { //The following 2 lines modify the passed TargetChooser. Call this function with care :/ From 8fe5000ce13fc64dd5d493b742b1ce2514c28ea4 Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Mon, 12 Oct 2015 19:54:03 +0800 Subject: [PATCH 2/3] polished action stack --- projects/mtg/src/ActionStack.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 2bf4c5d0b..d6e59cf9a 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -93,8 +93,21 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); - - mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); + + if (!targetQuad) + { + if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) + mFont->DrawString("You play:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) + mFont->DrawString("Opponent plays:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); + //mFont->DrawString(">>>", x + 35, y+5 + GetVerticalTextOffset(), JGETEXT_LEFT); + } + else + { + mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); + mFont->DrawString(_(action).c_str(), x + 75, y + GetVerticalTextOffset(), JGETEXT_LEFT); + } JRenderer * renderer = JRenderer::GetInstance(); JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) @@ -123,12 +136,12 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string targetQuad->SetColor(ARGB(255,255,255,255)); targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2); float scale = mHeight / targetQuad->mHeight; - renderer->RenderQuad(targetQuad, x + 150, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale); + renderer->RenderQuad(targetQuad, x + 55, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale); targetQuad->SetHotSpot(backupX, backupY); } else if (alt2.size()) { - mFont->DrawString(_(alt2).c_str(), x + 120, y + GetVerticalTextOffset()); + mFont->DrawString(_(alt2).c_str(), x + 35, y+15 + GetVerticalTextOffset()); } } @@ -1241,7 +1254,7 @@ void ActionStack::Render() mFont->DrawString(stream.str(), x0 + 5, currenty); // static const float kIconVerticalOffset = 24; - static const float kIconHorizontalOffset = 9; + static const float kIconHorizontalOffset = 10; static const float kBeforeIconSpace = 10; //Render "interrupt?" text + possible actions From 9a66b0c6e4dfc7ced5c194cdd95f6e5b8317854f Mon Sep 17 00:00:00 2001 From: Anthony Calosa Date: Tue, 13 Oct 2015 19:27:25 +0800 Subject: [PATCH 3/3] some fix and polished static mana and action stack I moved the target quad near the source card and moved the action string forward so there is no overlapping of action string and the target quad if the action string is too long... --- projects/mtg/bin/Res/sets/primitives/mtg.txt | 5 ++- projects/mtg/src/ActionStack.cpp | 41 ++++++++++++-------- projects/mtg/src/GuiCombat.cpp | 2 +- projects/mtg/src/GuiMana.cpp | 8 ++-- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/mtg.txt b/projects/mtg/bin/Res/sets/primitives/mtg.txt index d5701472c..9531c0e06 100644 --- a/projects/mtg/bin/Res/sets/primitives/mtg.txt +++ b/projects/mtg/bin/Res/sets/primitives/mtg.txt @@ -8140,7 +8140,7 @@ toughness=2 [/card] [card] name=Battleflight Eagle -auto=target(creature|battlefield) 2/2 ueot && flying ueot +auto=target(creature|battlefield) transforms((,newability[2/2],newability[flying])) ueot abilities=flying text=Flying -- When Battleflight Eagle enters the battlefield, target creature gets +2/+2 and gains flying until end of turn. mana={4}{W} @@ -37095,6 +37095,7 @@ toughness=3 [/card] [card] name=Fylgja +target=creature auto=all(this) counter(0/0,4,Healing) auto={C(0/0,-1,Healing)}:prevent:1 auto={2}{W}:all(this) counter(0/0,1,Healing) @@ -45155,7 +45156,7 @@ toughness=5 [/card] [card] name=Hellkite Hatchling -auto=may target(other creature|mybattlefield) sacrifice && counter(1/1,1) all(this) && all(this) transforms((,flying,trample)) forever +auto=may target(other creature|mybattlefield) sacrifice && counter(1/1,1) all(this) && all(this) transforms((,newability[flying],newability[trample])) forever text=Devour 1 (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with that many +1/+1 counters on it.) -- Hellkite Hatchling has flying and trample if it devoured a creature. mana={2}{R}{G} type=Creature diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index d6e59cf9a..5fd4c6f3c 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -93,22 +93,27 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string WFont * mFont = observer->getResourceManager()->GetWFont(Fonts::MAIN_FONT); mFont->SetColor(ARGB(255,255,255,255)); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); + JRenderer * renderer = JRenderer::GetInstance(); if (!targetQuad) { - if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) - mFont->DrawString("You play:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI() && !alt2.size() && _(action).c_str() == source->name) + mFont->DrawString("You play ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); else if(source->controller()->isAI() && source->controller()->opponent()->isHuman() && !alt2.size() && _(action).c_str() == source->name) - mFont->DrawString("Opponent plays:", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT); + mFont->DrawString("Opponent plays ", x + 35, y-15 + GetVerticalTextOffset(), JGETEXT_LEFT);*/ mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT); - //mFont->DrawString(">>>", x + 35, y+5 + GetVerticalTextOffset(), JGETEXT_LEFT); } else { + renderer->FillRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(235,10,10,10)); + /*if(source->controller()->isHuman() && source->controller()->opponent()->isAI()) + renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,0,255,0)); + else + renderer->DrawRect(x-2,y-16 + GetVerticalTextOffset(), 73, 43, ARGB(245,255,0,0));*/ mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT); mFont->DrawString(_(action).c_str(), x + 75, y + GetVerticalTextOffset(), JGETEXT_LEFT); } - JRenderer * renderer = JRenderer::GetInstance(); + JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB); if (!quad.get()) quad = CardGui::AlternateThumbQuad(source); @@ -1235,10 +1240,14 @@ void ActionStack::Render() //stack shadow //renderer->FillRoundRect(x0 - 7, y0+2, width + 17, height + 2, 9.0f, ARGB(128,0,0,0)); //stack fill - renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(215,10,10,10)); + renderer->FillRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(225,5,5,5)); + //stack highlight + renderer->FillRect(x0 - 6, y0+3, width + 15, 30, ARGB(255,89,89,89)); + //another border + renderer->DrawRect(x0 - 6, y0+33, width + 15, height - 18, ARGB(255,89,89,89)); //stack border - renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(180,240,240,240)); - + renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(255,240,240,240)); + std::ostringstream stream; // WALDORF - changed "interrupt ?" to "Interrupt?". Don't display count down // seconds if the user disables auto progressing interrupts by setting the seconds @@ -1251,11 +1260,11 @@ void ActionStack::Render() else stream << _(kInterruptMessageString) << " " << static_cast(timer); - mFont->DrawString(stream.str(), x0 + 5, currenty); + mFont->DrawString(stream.str(), x0 + 5, currenty - 2); // static const float kIconVerticalOffset = 24; static const float kIconHorizontalOffset = 10; - static const float kBeforeIconSpace = 10; + static const float kBeforeIconSpace = 12; //Render "interrupt?" text + possible actions { @@ -1264,25 +1273,25 @@ void ActionStack::Render() if (gModRules.game.canInterrupt()) { - renderer->RenderQuad(pspIcons[7].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[7].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kInterruptString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kInterruptString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kInterruptString).c_str()) + kBeforeIconSpace; } noBtnXOffset = static_cast(currentx); - renderer->RenderQuad(pspIcons[4].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[4].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kNoString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kNoString).c_str()) + kBeforeIconSpace; noToAllBtnXOffset = static_cast(currentx); if (mObjects.size() > 1) { - renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset, 0, kGamepadIconSize, kGamepadIconSize); + renderer->RenderQuad(pspIcons[6].get(), currentx, kIconVerticalOffset - 2, 0, kGamepadIconSize, kGamepadIconSize); currentx+= kIconHorizontalOffset; - mFont->DrawString(_(kNoToAllString), currentx, kIconVerticalOffset - 6); + mFont->DrawString(_(kNoToAllString), currentx, kIconVerticalOffset - 8); currentx+= mFont->GetStringWidth(_(kNoToAllString).c_str()) + kBeforeIconSpace; } diff --git a/projects/mtg/src/GuiCombat.cpp b/projects/mtg/src/GuiCombat.cpp index 2e367ce28..ad9a05a98 100644 --- a/projects/mtg/src/GuiCombat.cpp +++ b/projects/mtg/src/GuiCombat.cpp @@ -504,7 +504,7 @@ void GuiCombat::Render() ok_quad->SetHotSpot(28, 22); ok.Render(ok_quad.get()); } - renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0)); + renderer->DrawLine(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2, ARGB(255, 255, 64, 0)); if (FIRST_STRIKE == step) { WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); diff --git a/projects/mtg/src/GuiMana.cpp b/projects/mtg/src/GuiMana.cpp index c4ca3d257..e5ab1145c 100644 --- a/projects/mtg/src/GuiMana.cpp +++ b/projects/mtg/src/GuiMana.cpp @@ -262,7 +262,7 @@ void GuiMana::RenderStatic() float x0 = x - 20 * totalColors; x0 = max(40.f, x0); float xEnd = x0 + 20 * totalColors; - r->FillRoundRect(x0, y - 5, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,0,0,0)); + r->FillRoundRect(x0, y - 8, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,0,0,0)); int offset = 0; for (int i = 0; i < Constants::NB_Colors; ++i) @@ -270,10 +270,10 @@ void GuiMana::RenderStatic() if (values[i]) { offset -= 20; - r->RenderQuad(manaIcons[i].get(), xEnd + 15 + offset, y + 5, 0, 0.7f, 0.7f); + r->RenderQuad(manaIcons[i].get(), xEnd + 15 + offset, y + 3, 0, 0.65f, 0.65f); } } - r->FillRoundRect(x0, y, static_cast (20 * totalColors + 5), 8, 2, ARGB(100,0,0,0)); + //r->DrawRoundRect(x0, y - 8, static_cast (20 * totalColors + 5), 20, 2, ARGB(128,255,255,255)); offset = 0; for (int i = 0; i < Constants::NB_Colors; ++i) { @@ -283,7 +283,7 @@ void GuiMana::RenderStatic() char buf[4]; sprintf(buf, "%i", values[i]); mFont->SetColor(ARGB(255,255,255,255)); - mFont->DrawString(buf, xEnd + offset + 9, y); + mFont->DrawString(buf, xEnd + offset + 18, y + 5); } } }