diff --git a/projects/mtg/bin/Res/graphics/alphabeta.png b/projects/mtg/bin/Res/graphics/alphabeta.png index 668425817..bc2c38a02 100644 Binary files a/projects/mtg/bin/Res/graphics/alphabeta.png and b/projects/mtg/bin/Res/graphics/alphabeta.png differ diff --git a/projects/mtg/bin/Res/test/TirelessGraf.txt b/projects/mtg/bin/Res/test/TirelessGraf.txt new file mode 100644 index 000000000..ad71b77c6 --- /dev/null +++ b/projects/mtg/bin/Res/test/TirelessGraf.txt @@ -0,0 +1,39 @@ +#Tireless Tracker counters vs Graf Mole opponents +[INIT] +FIRSTMAIN +[PLAYER1] +inplay:Concordant Crossroads, Swamp, Tireless Tracker, Mortician Beetle +library:Mountain +hand:Plains +[PLAYER2] +inplay:Graf Mole +[DO] +Plains +Swamp +Plains +Clue +#Tireless Tracker gets a counter +#Mortician sacrificed event must not trigger +#Graf Mole in opponents must not trigger and his life must not change +#begins +next +#attack +next +Tireless Tracker +Mortician Beetle +next +#damage +next +#end +eot +#untap +[ASSERT] +UNTAP +[PLAYER1] +inplay:Concordant Crossroads, Swamp, Tireless Tracker, Plains, Mortician Beetle +hand:Mountain +life:20 +[PLAYER2] +inplay:Graf Mole +life:15 +[END] diff --git a/projects/mtg/bin/Res/test/_tests.txt b/projects/mtg/bin/Res/test/_tests.txt index 13feabb28..1dcc987d7 100644 --- a/projects/mtg/bin/Res/test/_tests.txt +++ b/projects/mtg/bin/Res/test/_tests.txt @@ -683,6 +683,7 @@ tidal_warrior_i649.txt tidal_warrior_i652.txt Timely_Reinforcements.txt TirelessTracker.txt +TirelessGraf.txt titanic_ultimatum.txt tokenizer.txt tokenizer2.txt diff --git a/projects/mtg/include/AllAbilities.h b/projects/mtg/include/AllAbilities.h index 17498f0fc..139f9e9c8 100644 --- a/projects/mtg/include/AllAbilities.h +++ b/projects/mtg/include/AllAbilities.h @@ -1372,7 +1372,7 @@ public: if (!e) return 0; MTGCardInstance * check = e->cardAfter; MTGGameZone * oldZone = e->cardAfter->currentZone; - MTGGameZone * currZone = check->currentZone; + //MTGGameZone * currZone = check->currentZone; check->currentZone = check->previousZone; if (check->next && (check->next->currentZone|| check->isToken)) { diff --git a/projects/mtg/include/CardGui.h b/projects/mtg/include/CardGui.h index 4ef10700b..0060d79db 100644 --- a/projects/mtg/include/CardGui.h +++ b/projects/mtg/include/CardGui.h @@ -33,7 +33,7 @@ protected: /* ** Tries to render the Big version of a card picture, backups to text version in case of failure */ - static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false); + static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool smallerscale = false); static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal); static void AlternateRender(MTGCard * card, const Pos& pos); @@ -55,9 +55,9 @@ public: virtual void Render(); virtual void Update(float dt); - void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false); - static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false); - + void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); + static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false); + static void DrawBorder(string setname, const Pos& inPosition, float x, bool noborder = false, bool smallscale = false); static JQuadPtr AlternateThumbQuad(MTGCard * card); virtual ostream& toString(ostream&) const; }; diff --git a/projects/mtg/include/MTGCardInstance.h b/projects/mtg/include/MTGCardInstance.h index 356203bd0..4e78569ac 100644 --- a/projects/mtg/include/MTGCardInstance.h +++ b/projects/mtg/include/MTGCardInstance.h @@ -98,6 +98,7 @@ public: bool exileEffects; bool suspended; bool miracle; + bool hasCopiedToken; bool isBestowed; int chooseacolor; string chooseasubtype; diff --git a/projects/mtg/src/ActionStack.cpp b/projects/mtg/src/ActionStack.cpp index 7dc7e14d7..aecf87ddc 100644 --- a/projects/mtg/src/ActionStack.cpp +++ b/projects/mtg/src/ActionStack.cpp @@ -130,25 +130,9 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string if (bigQuad) { - //Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); - Pos npos = Pos(CardGui::BigWidth / 2 + 8.f, CardGui::BigHeight / 2 - 2.f, 1.0f - (1.0f/10), 0.0, 220); - //border - if(observer->getCardSelector()->GetDrawMode() < 2) - { - string cardsetname = setlist[source->setId].c_str(); - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } - //render card - CardGui::DrawCard(source, npos, observer->getCardSelector()->GetDrawMode(),false,true); + Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.90f, 0.0, 220); + pos.actY = 142;//adjust y a little bit + CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode()); } if (targetQuad) diff --git a/projects/mtg/src/AllAbilities.cpp b/projects/mtg/src/AllAbilities.cpp index f7b052513..b9cc7215b 100644 --- a/projects/mtg/src/AllAbilities.cpp +++ b/projects/mtg/src/AllAbilities.cpp @@ -1466,18 +1466,23 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M int AACopier::resolve() { + bool tokencopied = false; MTGCardInstance * _target = (MTGCardInstance *) target; if (_target) { MTGCard* clone ; - if(_target->isToken || _target->isACopier) + if(_target->isToken || (_target->isACopier && _target->hasCopiedToken)) + { clone = _target; + tokencopied = true; + } else clone = MTGCollection()->getCardById(_target->copiedID); MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game); source->copy(myClone); SAFE_DELETE(myClone); source->isACopier = true; + source->hasCopiedToken = tokencopied; source->copiedID = _target->copiedID; if(_target->isMorphed) { @@ -3880,8 +3885,8 @@ int AACloner::resolve() // Use id of the card to have the same image as the original MTGCard* clone = (_target->isToken ? _target: MTGCollection()->getCardById(_target->getId())); - // If its a copier then copy what it is - if(_target->isACopier) + // If its a copier and copied a token then copy what it is + if(_target->isACopier && _target->hasCopiedToken) clone = _target; Player * targetPlayer = who == 1 ? source->controller()->opponent() : source->controller(); diff --git a/projects/mtg/src/CardDisplay.cpp b/projects/mtg/src/CardDisplay.cpp index 13c9f2fcd..d9147acdf 100644 --- a/projects/mtg/src/CardDisplay.cpp +++ b/projects/mtg/src/CardDisplay.cpp @@ -263,11 +263,11 @@ void CardDisplay::Render() { mObjects[mCurr]->Render(); CardGui * cardg = ((CardGui *) mObjects[mCurr]); - Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220); - int drawMode = DrawMode::kNormal; + Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.90f, 0.0, 220); + int drawMode = DrawMode::kNormal;//scale card display from 1.0f to 0.90f if (observer) { - pos.actY = 145; + pos.actY = 142;//reduce y a little if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2; drawMode = observer->getCardSelector()->GetDrawMode(); } diff --git a/projects/mtg/src/CardGui.cpp b/projects/mtg/src/CardGui.cpp index 63de518ab..7de73603b 100644 --- a/projects/mtg/src/CardGui.cpp +++ b/projects/mtg/src/CardGui.cpp @@ -111,17 +111,17 @@ void CardGui::Update(float dt) PlayGuiObject::Update(dt); } -void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder) +void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale) { - DrawCard(card, inPosition, inMode, thumb, noborder); + DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale); } -void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder) +void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale) { switch (inMode) { case DrawMode::kNormal: - RenderBig(inCard, inPosition, thumb, noborder); + RenderBig(inCard, inPosition, thumb, noborder, smallerscale); break; case DrawMode::kText: AlternateRender(inCard, inPosition); @@ -157,9 +157,14 @@ void CardGui::Render() //I want the below for melded cards but I dont know how to adjust everything else //to look neat and clean. leaving this here incase someone else wants to pretty up the p/t box //and line up the position. - /* if (card->MeldedFrom.size()) - cardScale = cardScale + (10 / quad->mHeight);*/ - float scale = actZ * cardScale; + float zz = 1.0f; + float yy = 0.0f; + if (card->MeldedFrom.size()) + { + zz = 1.15f; + yy = 2.0f; + } + float scale = (actZ*zz) * cardScale; JQuadPtr shadow; if (actZ > 1) @@ -168,7 +173,7 @@ void CardGui::Render() if (shadow) { shadow->SetColor(ARGB(static_cast(actA)/2,255,255,255)); - renderer->RenderQuad(shadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16); + renderer->RenderQuad(shadow.get(), actX + ((actZ*zz) - 1) * 15, (actY-yy) + ((actZ*zz) - 1) * 15, actT, 28 * (actZ*zz) / 16, 40 * (actZ*zz) / 16); } } @@ -179,7 +184,7 @@ void CardGui::Render() if (extracostshadow) { extracostshadow->SetColor(ARGB(static_cast(actA)/2,100,0,0)); - renderer->RenderQuad(extracostshadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16); + renderer->RenderQuad(extracostshadow.get(), actX + ((actZ*zz) - 1) * 15, (actY-yy) + ((actZ*zz) - 1) * 15, actT, 28 * (actZ*zz) / 16, 40 * (actZ*zz) / 16); } } @@ -208,7 +213,7 @@ void CardGui::Render() if(white) { white->SetColor(ARGB(255,230,50,50)); - renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16); + renderer->RenderQuad(white.get(), actX, (actY-yy), actT, 30 * (actZ*zz) / 16, 42 * (actZ*zz) / 16); } } @@ -235,7 +240,7 @@ void CardGui::Render() if(white) { white->SetColor(ARGB(255,0,0,255)); - renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16); + renderer->RenderQuad(white.get(), actX, (actY-yy), actT, 30 * (actZ*zz) / 16, 42 * (actZ*zz) / 16); } } } @@ -253,7 +258,7 @@ void CardGui::Render() fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border else fakeborder->SetColor(ARGB((int)(actA),15,15,15)); - renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16); + renderer->RenderQuad(fakeborder.get(), actX, (actY-yy), actT, (29 * (actZ*zz) + 1) / 16, 42 * (actZ*zz) / 16); } //draw border for highlighting if (game) @@ -261,26 +266,26 @@ void CardGui::Render() if (card && card->isTargetted() && highlightborder) { highlightborder->SetColor(ARGB(95,255,0,0)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } if (card && card->isTargetter() && highlightborder) { highlightborder->SetColor(ARGB(95,0,245,0)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } if(card->myPair && card->myPair->isInPlay(game) && highlightborder) { if(mHasFocus) { highlightborder->SetColor(ARGB(200,7,98,248)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } if(CardView* cv = dynamic_cast(card->myPair->view)) { if(cv->mHasFocus) { highlightborder->SetColor(ARGB(200,57,28,248)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } } } @@ -293,7 +298,7 @@ void CardGui::Render() else highlightborder->SetColor(ARGB(200,57,28,248)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } if(CardView* cv = dynamic_cast(card->shackled->view)) { @@ -304,20 +309,20 @@ void CardGui::Render() else highlightborder->SetColor(ARGB(200,57,28,248)); - renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16); + renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (30 * (actZ*zz) + 1) / 16, 43 * (actZ*zz) / 16); } } } } //draw the card image - renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale); + renderer->RenderQuad(quad.get(), actX, (actY-yy), actT, scale, scale); } if (alternate) { mFont->SetColor(ARGB(static_cast(actA), 0, 0, 0)); - mFont->SetScale(DEFAULT_MAIN_FONT_SCALE * 0.5f * actZ); - mFont->DrawString(_(card->getName()), actX - actZ * Width / 2 + 1, actY - actZ * Height / 2 + 1); + mFont->SetScale(DEFAULT_MAIN_FONT_SCALE * 0.5f * (actZ*zz)); + mFont->DrawString(_(card->getName()), actX - (actZ*zz) * Width / 2 + 1, (actY-yy) - (actZ*zz) * Height / 2 + 1); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); JQuadPtr icon; @@ -334,7 +339,7 @@ void CardGui::Render() if (icon.get()) { icon->SetColor(ARGB(static_cast(actA),255,255,255)); - renderer->RenderQuad(icon.get(), actX, actY, actT); + renderer->RenderQuad(icon.get(), actX, (actY-yy), actT); icon->SetColor(ARGB(255,255,255,255)); //Putting color back as this quad is shared } @@ -346,7 +351,7 @@ void CardGui::Render() if (mor && mor->mTex) { mor->SetHotSpot(static_cast (mor->mTex->mWidth / 2), static_cast (mor->mTex->mHeight / 2)); mor->SetColor(ARGB(255,255,255,255)); - renderer->RenderQuad(mor.get(), actX, actY, actT,scale, scale); + renderer->RenderQuad(mor.get(), actX, (actY-yy), actT,scale, scale); } } @@ -358,24 +363,24 @@ void CardGui::Render() if(card->isTapped()) { if(mHasFocus) - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,(actY-yy) - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); else - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,(actY-yy) - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,255,0,0)); } else - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,255,0,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,(actY-yy) - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,255,0,0)); } if (card && card->isTargetter()) { if(card->isTapped()) { if(mHasFocus) - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,actY - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-10,(actY-yy) - (scale * quad->mHeight / 2)+6.5f, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); else - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,actY - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-8,(actY-yy) - (scale * quad->mHeight / 2)+4, (scale * quad->mHeight)-0.02f, (scale * quad->mWidth)-0.02f, 1.8f,ARGB(250,0,255,0)); } else - renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,actY - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,0,255,0)); + renderer->DrawRoundRect(actX - (scale * quad->mWidth / 2)-2,(actY-yy) - (scale * quad->mHeight / 2)-2, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 1.8f,ARGB(250,0,255,0)); } } @@ -385,9 +390,9 @@ void CardGui::Render() mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); char buffer[200]; sprintf(buffer, "%i/%i", card->power, card->life); - renderer->FillRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ, + renderer->FillRect(actX - (13 * (actZ*zz)), (actY-yy) + 4 * (actZ*zz), 25.5f * (actZ*zz), 14 * (actZ*zz), ARGB(((static_cast(actA))/2),0,0,0)); - renderer->DrawRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ, + renderer->DrawRect(actX - (13 * (actZ*zz)), (actY-yy) + 4 * (actZ*zz), 25.5f * (actZ*zz), 14 * (actZ*zz), ARGB(((static_cast(actA))),20,20,20)); //damaged or buffed or powered down if(card->wasDealtDamage && card->life <= 2) @@ -400,9 +405,9 @@ void CardGui::Render() mFont->SetColor(ARGB(static_cast(actA),238,130,238));//violet legendary eldrazi else mFont->SetColor(ARGB(static_cast(actA),255,255,255));//white default - mFont->SetScale(actZ); - mFont->SetScale(actZ); - mFont->DrawString(buffer, actX - 10 * actZ, actY + 7 * actZ); + mFont->SetScale((actZ*zz)); + mFont->SetScale((actZ*zz)); + mFont->DrawString(buffer, actX - 10 * (actZ*zz), (actY-yy) + 7 * (actZ*zz)); mFont->SetScale(1); } @@ -435,7 +440,7 @@ void CardGui::Render() sprintf(buffer, "%s", buff.c_str()); mFont->SetColor(ARGB(static_cast(actA),255,215,0));//Gold indicator mFont->SetScale(0.8f); - mFont->DrawString(buffer, actX - 10 * actZ, actY - (16 * actZ)); + mFont->DrawString(buffer, actX - 10 * (actZ*zz), (actY-yy) - (16 * (actZ*zz))); mFont->SetScale(1); } @@ -454,8 +459,8 @@ void CardGui::Render() char buffer[200]; sprintf(buffer, "%i", card->counters->counters[0]->nb); mFont->SetColor(ARGB(static_cast(actA),255,255,255)); - mFont->SetScale(actZ); - mFont->DrawString(buffer, actX - 10 * actZ, actY - (12 * actZ)); + mFont->SetScale((actZ*zz)); + mFont->DrawString(buffer, actX - 10 * (actZ*zz), (actY-yy) - (12 * (actZ*zz))); mFont->SetScale(1); } } @@ -467,34 +472,38 @@ void CardGui::Render() if (shadow) { shadow->SetColor(ARGB(200,255,255,255)); - renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16); + renderer->RenderQuad(shadow.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16); } } // Render a mask over the card, if set if (mask && quad) - JRenderer::GetInstance()->FillRect(actX - (scale * quad->mWidth / 2),actY - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, mask); + JRenderer::GetInstance()->FillRect(actX - (scale * quad->mWidth / 2),(actY-yy) - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, mask); if ((tc && tc->alreadyHasTarget(card)) || (game && card == game->mLayers->actionLayer()->currentActionCard))//paint targets red. { + float xy = yy>0.0f?2.0f:1.0f; + float modx = mHasFocus?xy:0.0f; if (card->isTapped()) { - renderer->FillRect(actX - (scale * quad->mWidth / 2)-7,actY - (scale * quad->mHeight / 2)+7,scale* quad->mHeight,scale * quad->mWidth, ARGB(128,255,0,0)); + renderer->FillRect(actX - (scale * quad->mWidth / 2)-(7+modx),(actY-yy) - (scale * quad->mHeight / 2)+(7+modx),scale* quad->mHeight,scale * quad->mWidth, ARGB(128,255,0,0)); } else { - renderer->FillRect(actX - (scale * quad->mWidth / 2),actY - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, ARGB(128,255,0,0)); + renderer->FillRect(actX - (scale * quad->mWidth / 2),(actY-yy) - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, ARGB(128,255,0,0)); } } - if(tc && tc->source && tc->source->view && tc->source->view->actZ >= 1.3 && card == tc->source)//paint the source green while infocus. + if(tc && tc->source && tc->source->view && tc->source->view->actY >= 1.3 && card == tc->source)//paint the source green while infocus. { + float xy = yy>0.0f?2.0f:1.0f; + float modx = mHasFocus?xy:0.0f; if (tc->source->isTapped()) { - renderer->FillRect(actX - (scale * quad->mWidth / 2)-7,actY - (scale * quad->mHeight / 2)+7,scale* quad->mHeight,scale * quad->mWidth, ARGB(128,0,255,0)); + renderer->FillRect(actX - (scale * quad->mWidth / 2)-(7+modx),(actY-yy) - (scale * quad->mHeight / 2)+(7+modx),scale* quad->mHeight,scale * quad->mWidth, ARGB(128,0,255,0)); } else { - renderer->FillRect(tc->source->view->actX - (scale * quad->mWidth / 2),tc->source->view->actY - (scale * quad->mHeight / 2), scale*quad->mWidth, scale*quad->mHeight, ARGB(128,0,255,0)); + renderer->FillRect(tc->source->view->actX - (scale * quad->mWidth / 2),(tc->source->view->actY-yy) - (scale * quad->mHeight / 2), scale*quad->mWidth, scale*quad->mHeight, ARGB(128,0,255,0)); } } @@ -1114,7 +1123,7 @@ void CardGui::TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) } //Renders a big card on screen. Defaults to the "alternate" rendering if no image is found -void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder) +void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder, bool smallerscale) { JRenderer * renderer = JRenderer::GetInstance(); //GameObserver * game = GameObserver::GetInstance(); @@ -1122,10 +1131,10 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder // card = (MTGCard*)game->mLayers->actionLayer()->currentActionCard; //i want this but ai targets cards so quickly that it can crash the game. float x = pos.actX; - + //init setname + string cardsetname = setlist[card->setId].c_str(); JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB) : WResourceManager::Instance()->RetrieveCard(card); - JQuadPtr alphabeta = WResourceManager::Instance()->RetrieveTempQuad("alphabeta.png"); MTGCardInstance * kcard = dynamic_cast(card); if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name) { @@ -1140,40 +1149,15 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder } quad->SetColor(ARGB(255,255,255,255)); float scale = pos.actZ * 250.f / quad->mHeight; - //init setname - string cardsetname = setlist[card->setId].c_str(); - if(!noborder) - { - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - { - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - if(cardsetname == "LEA"||cardsetname == "LEB") - { - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(255,5,5,5)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(50,240,240,240)); - } - else - { - renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } - if(cardsetname == "LEA"||cardsetname == "LEB") - { - if(alphabeta.get()) - renderer->RenderQuad(alphabeta.get(),(pos.actX - (pos.actZ * 100.f))+12.f,(pos.actY - (pos.actZ * 142.5f))+17.5f, pos.actT, 0.88f, 0.88f); - renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.01f, scale-0.01f); - } - else - renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale); - } + //Draw border + DrawBorder(cardsetname, pos, x, noborder, smallerscale); + //force smaller scale on alpha beta + smallerscale = cardsetname=="LEA"||cardsetname=="LEB"?true:smallerscale; + //Draw card + if(smallerscale) + renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.01f, scale-0.01f); else - renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale); - + renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale); RenderCountersBig(card, pos); return; } @@ -1184,6 +1168,46 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder AlternateRender(card, pos); } +void CardGui::DrawBorder(string cardsetname, const Pos& pos, float x, bool noborder, bool smallerscale) +{ + JRenderer * renderer = JRenderer::GetInstance(); + JQuadPtr alphabeta = WResourceManager::Instance()->RetrieveTempQuad("alphabeta.png"); + + if(!noborder) + { + if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") + {//Draw white border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); + } + else + { + if(cardsetname == "LEA") + {//BETA HAS REGULAR BORDER + //Draw more rounder black border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(255,5,5,5)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.5f,(pos.actY - (pos.actZ * 119.7f))-11.5f,pos.actZ * 168.f + 0.5f,pos.actZ * 239.4f + 4.f,10.f,ARGB(50,240,240,240)); + } + else + {//draw black border + renderer->FillRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); + renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-11.5f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f + 6.5f,pos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); + } + } + } + //draw inner border + if(cardsetname == "LEA"||cardsetname == "LEB") + { + if(alphabeta.get()) + { + alphabeta->SetHotSpot(static_cast (alphabeta->mWidth / 2), static_cast (alphabeta->mHeight / 2)); + float myscale = pos.actZ * 250 / alphabeta->mHeight; + alphabeta->SetColor(ARGB((int)pos.actA,255,255,255)); + renderer->RenderQuad(alphabeta.get(), x, pos.actY, pos.actT, myscale, myscale); + } + } +} + string CardGui::FormattedData(string data, string replace, string value) { size_t found = data.find(replace.c_str()); diff --git a/projects/mtg/src/CardSelector.cpp b/projects/mtg/src/CardSelector.cpp index 0e478f288..cb698d7a6 100644 --- a/projects/mtg/src/CardSelector.cpp +++ b/projects/mtg/src/CardSelector.cpp @@ -341,28 +341,9 @@ void CardSelector::Render() { if(timer > 0) { - float modx = 0.f; - //if(card->mHasFocus && observer->isInHand(card->getCard()) && !card->getCard()->owner->isAI()) - //modx -= 1.8f;//todo small adjustment - //new npos for smaller bigquad - Pos npos = Pos(bigpos.x+7.f+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/10),bigpos.t,bigpos.alpha); - //border - if(mDrawMode < 2) - { - string cardsetname = setlist[card->getCard()->setId].c_str(); - if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,248,248,255)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(150,20,20,20)); - } - else - { - JRenderer::GetInstance()->FillRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(255,5,5,5)); - JRenderer::GetInstance()->DrawRoundRect((npos.actX - (npos.actZ * 84.f))-11.5f,(npos.actY - (npos.actZ * 119.7f))-14.f,npos.actZ * 168.f + 6.5f,npos.actZ * 239.4f + 12.f,8.f,ARGB(50,240,240,240)); - } - } + Pos npos = Pos(bigpos.x+7.f,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/10),bigpos.t,bigpos.alpha); //render card - card->DrawCard(npos, mDrawMode, false, true); + card->DrawCard(npos, mDrawMode); } } } diff --git a/projects/mtg/src/DeckView.cpp b/projects/mtg/src/DeckView.cpp index a18424a9a..9fbdb8c21 100644 --- a/projects/mtg/src/DeckView.cpp +++ b/projects/mtg/src/DeckView.cpp @@ -147,7 +147,8 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord {//NORMAL VIEW WITH IMAGES int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText; float modx = addWHborder ? 2.0f:0.0f; - //border for editor && others??? + bool smallerscale = modx > 0.0f ? true:false; + //border for editor && others since the border in cardgui:drawcard scales larger... string cardsetname = setlist[cardPosition.card->setId].c_str(); if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") { @@ -156,11 +157,19 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord } else { - JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(255,10,10,10)); - JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(50,240,240,240)); + if (cardsetname == "LEA") + { + JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 96.75f)-(7.f+modx),(cardPosition.y - cardPosition.scale * 139.25f)-(7.f+modx),cardPosition.scale * 193.5f,cardPosition.scale * 278.5f,7.f+modx,ARGB(255,10,10,10)); + JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 96.75f)-(7.f+modx),(cardPosition.y - cardPosition.scale * 139.25f)-(7.f+modx),cardPosition.scale * 193.5f,cardPosition.scale * 278.5f,7.f+modx,ARGB(50,240,240,240)); + } + else + { + JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(255,10,10,10)); + JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-(5.f+modx),(cardPosition.y - cardPosition.scale * 142.5f)-(5.f+modx),cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f+modx,ARGB(50,240,240,240)); + } } Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255); - CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true); + CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true, smallerscale); } int quadAlpha = alpha; if (!deck()->count(cardPosition.card)) quadAlpha /= 2; diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 91f5404fc..2c3775dc3 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -227,6 +227,7 @@ void MTGCardInstance::initMTGCI() myPair = NULL; shackled = NULL; miracle = false; + hasCopiedToken = false; countTrini = 0; imprintedCards.clear(); attackCost = 0;