Revert my Graphic changes

I think it's the one who cause those crashes
This commit is contained in:
Anthony Calosa
2016-08-13 16:45:46 +08:00
parent f1bc268f58
commit 8530292fef
32 changed files with 233 additions and 453 deletions

View File

@@ -1429,7 +1429,6 @@ public:
if (!e) return 0;
MTGCardInstance * check = e->cardAfter;
MTGGameZone * oldZone = e->cardAfter->currentZone;
//MTGGameZone * currZone = check->currentZone;
check->currentZone = check->previousZone;
if (check->next && (check->next->currentZone|| check->isToken))
{
@@ -1948,8 +1947,8 @@ public:
class AACopier: public ActivatedAbility
{
public:
MTGAbility * andAbility;
vector<MTGAbility *> currentAbilities;
MTGAbility * andAbility;
AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const string getMenuText();
@@ -2270,12 +2269,7 @@ public:
assert(modifier < 2);
((MTGCardInstance *) target)->basicAbilities.set(ability, modifier > 0);
//---add or subtract so we can keep track - for future use
((MTGCardInstance *) target)->modbasicAbilities[ability] += modifier;
//---make sure no negative values
if(((MTGCardInstance *) target)->modbasicAbilities[ability] < 0)
((MTGCardInstance *) target)->modbasicAbilities[ability] = 0;
//---end add or subtract abilities
return MTGAbility::addToGame();
}

View File

@@ -33,10 +33,10 @@ 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, bool smallerscale = false, bool ingame = false);
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos, bool noborder = false, bool smallerscale = false);
static void AlternateRender(MTGCard * card, const Pos& pos);
static void TinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad);
static string FormattedData (string data, string replace, string value);
static bool FilterCard (MTGCard * card,string filter);
@@ -54,10 +54,10 @@ public:
CardGui(MTGCardInstance* card, const Pos& ref);
virtual void Render();
virtual void Update(float dt);
bool isBlackBorder(string set);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool smallscale = false, bool ingame = false);
static void DrawBorder(string setname, const Pos& inPosition, float x, bool noborder = false, bool smallscale = false);
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);
static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const;
};

View File

@@ -57,7 +57,6 @@ public:
uint8_t colors;
typedef std::bitset<Constants::NB_BASIC_ABILITIES> BasicAbilitiesSet;
vector<int> modbasicAbilities;
BasicAbilitiesSet basicAbilities;
BasicAbilitiesSet LKIbasicAbilities;

View File

@@ -23,7 +23,7 @@ public:
void renderCard(int index)
{
int alpha = (int) (255 * (mCards[index].scale + 1.0 - max_scale));
DeckView::renderCard(index, alpha, false, true);
DeckView::renderCard(index, alpha);
}
void Render();

View File

@@ -207,7 +207,7 @@ protected:
*
* \see mCards
*/
void renderCard(int index, int alpha, bool asThumbnail = false, bool addWHborder = false);
void renderCard(int index, int alpha, bool asThumbnail = false);
/*! \brief Returns the index in mCards of the card that is nearest to the given point
*

View File

@@ -125,10 +125,7 @@ class GameObserver{
void enchantmentStatus();
void Affinity();
bool AffinityNeedsUpdate;
bool legendNeedUpdate;
void addObserver(MTGAbility * observer);
void checkLegendary(MTGCardInstance * card);
map<MTGCardInstance *,bool> cards;
bool removeObserver(ActionElement * observer);
void startGame(GameType, Rules * rules);
void untapPhase();

View File

@@ -25,8 +25,8 @@ struct GuiAvatar: public GuiStatic
BOTTOM_RIGHT
} Corner;
static const unsigned Width = 32;//35
static const unsigned Height = 45;//50
static const unsigned Width = 35;
static const unsigned Height = 50;
protected:
int avatarRed;

View File

@@ -61,6 +61,14 @@ class ThisControllerlife:public ThisDescriptor{
ThisControllerlife * clone() const;
};
class ThisCreatureSpells:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);
ThisCreatureSpells(int count);
ThisCreatureSpells * clone() const;
};
class ThisOpponentlife:public ThisDescriptor{
public:
virtual int match(MTGCardInstance * card);

View File

@@ -184,8 +184,7 @@ struct WEventCardBlocked : public WEventCardUpdate {
//event when card is sacrificed.
struct WEventCardSacrifice : public WEventCardUpdate {
MTGCardInstance * cardAfter;
bool istoken;
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard, bool token = false);
WEventCardSacrifice(MTGCardInstance * card,MTGCardInstance * afterCard);
virtual Targetable * getTarget(int target);
};

View File

@@ -80,7 +80,6 @@ public:
}
};
virtual JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0) = 0;
virtual JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL) = 0;
virtual JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL, int id = 0) = 0;

View File

@@ -141,7 +141,6 @@ public:
bool IsThreaded();
JQuadPtr RetrieveCard(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL);
JQuadPtr RetrieveCardToken(MTGCard * card, int style = RETRIEVE_NORMAL,int submode = CACHE_NORMAL, int tId = 0);
JSample * RetrieveSample(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JTexture * RetrieveTexture(const string& filename, int style = RETRIEVE_NORMAL, int submode = CACHE_NORMAL);
JQuadPtr RetrieveQuad(const string& filename, float offX=0.0f, float offY=0.0f, float width=0.0f, float height=0.0f, string resname="", int style = RETRIEVE_LOCK, int submode = CACHE_NORMAL, int id = 0);

View File

@@ -130,10 +130,8 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
if (bigQuad)
{
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
pos.actY = 142;//adjust y a little bit
bool ingame = observer?true:false;
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode(),false,false,false,ingame);
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
}
if (targetQuad)

View File

@@ -401,8 +401,8 @@ void MTGRevealingCards::Render()
{
if (!revealDisplay)
return;
CheckUserInput(mEngine->ReadButton());
revealDisplay->CheckUserInput(mEngine->ReadButton());
CheckUserInput(mEngine->ReadButton());
revealDisplay->CheckUserInput(mEngine->ReadButton());
revealDisplay->Render();
return;
}
@@ -1459,23 +1459,28 @@ AACopier::AACopier(GameObserver* observer, int _id, MTGCardInstance * _source, M
int AACopier::resolve()
{
bool tokencopied = false;
AbilityFactory af(game);
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
//MTGCard* clone;
//AbilityFactory af(game);
if(_target->isToken || (_target->isACopier && _target->hasCopiedToken))
{//fix crash when copying token
//clone = _target;
tokencopied = true;
}
//else
//clone = MTGCollection()->getCardById(_target->copiedID);
///////////////////////////////////////////////////////////////////////
//MTGCardInstance * myClone = NEW MTGCardInstance(clone, source->controller()->game);
if(tokencopied)
source->copy(_target->clone());
//SAFE_DELETE(myClone);
///////////////////////////////////////////////////////////////////////
else
{
if(!_target->isACopier)
source->copy(_target);
else
{
source->copy(_target);
source->power -= _target->pbonus;
source->toughness -= _target->tbonus;
source->life = source->toughness;
}
}
source->isACopier = true;
source->hasCopiedToken = tokencopied;
source->copiedID = _target->copiedID;
@@ -1643,10 +1648,8 @@ AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, M
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if(_target->isFlipped && _target->hasType(Subtypes::TYPE_PLANESWALKER))//is flipping pw
{
this->forceDestroy = 1;
return 0;
}
AbilityFactory af(game);
if(counterstring.size())
{
@@ -2763,12 +2766,10 @@ int AASacrificeCard::resolve()
{
Player * p = _target->controller();
MTGCardInstance * beforeCard = _target;
WEvent * e;
p->game->putInGraveyard(_target);
while(_target->next)
_target = _target->next;
bool cardIsToken = _target->isToken ? true : false;
e = NEW WEventCardSacrifice(beforeCard, _target, cardIsToken);
WEvent * e = NEW WEventCardSacrifice(beforeCard,_target);
game->receiveEvent(e);
if(andAbility)
{
@@ -3209,20 +3210,9 @@ int AAFlip::resolve()
game->removeObserver(this);
return 0;
}
//701.25a Only permanents represented by double-faced cards can transform.
//(See rule 711, “Double-Faced Cards.”) If a spell or ability instructs a player
//to transform any permanent that isnt represented by a double-faced card, nothing happens.
//***Copier and Tokens cannot transform but can be flip since flip cards are single sided***
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
if((_target->isACopier||_target->isToken||_target->has(Constants::CANTTRANSFORM)) && !isflipcard && !forcedcopy)
{
game->removeObserver(this);
return 0;
}
while (_target->next)
_target = _target->next;
@@ -3250,10 +3240,9 @@ int AAFlip::resolve()
_target->text = myFlip->text;
_target->formattedText = myFlip->formattedText;
_target->basicAbilities = myFlip->model->data->basicAbilities;
_target->modbasicAbilities = myFlip->modbasicAbilities;
cdaDamage = _target->damageCount;
_target->copiedID = myFlip->getMTGId();//for copier
if(forcedcopy && _target->owner->playMode != Player::MODE_TEST_SUITE)
if(_target->owner->playMode != Player::MODE_TEST_SUITE)
{
_target->setMTGId(myFlip->getMTGId());
_target->setId = myFlip->setId;
@@ -3980,10 +3969,10 @@ int AACloner::resolve()
}
}
list<int>::iterator it;
/*for (it = awith.begin(); it != awith.end(); it++)
for (it = awith.begin(); it != awith.end(); it++)
{//there must be a layer of temporary abilities and original abilities
spell->source->basicAbilities[*it] = 1;
}*/
}
for (it = colors.begin(); it != colors.end(); it++)
{
spell->source->setColor(*it);
@@ -3992,11 +3981,6 @@ int AACloner::resolve()
{
spell->source->addType(*it);
}
for(int k = 0; k < Constants::NB_BASIC_ABILITIES; k++)
{
if(_target->model->data->basicAbilities[k])
spell->source->basicAbilities[k] = _target->model->data->basicAbilities[k];
}
if(_target->TokenAndAbility)
{//the source copied a token with andAbility
MTGAbility * andAbilityClone = _target->TokenAndAbility->clone();
@@ -7720,24 +7704,12 @@ int AACastCard::resolveSpell()
if (game->targetChooser)
{
game->targetChooser->Owner = source->controller();
if(putinplay)
{
spell = NEW Spell(game, 0,copy,game->targetChooser,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
spell = game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL, 1, 0);
game->targetChooser = NULL;
}
else
{
if(putinplay)
{
spell = NEW Spell(game, 0,copy,NULL,NULL, 1);
spell->resolve();
}
else
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
spell = game->mLayers->stackLayer()->addSpell(copy, NULL, NULL, 1, 0);
}
if (copy->has(Constants::STORM))

View File

@@ -263,16 +263,16 @@ void CardDisplay::Render()
{
mObjects[mCurr]->Render();
CardGui * cardg = ((CardGui *) mObjects[mCurr]);
Pos pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
int drawMode = DrawMode::kNormal;//scale card display from 1.0f to 0.80f
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
int drawMode = DrawMode::kNormal;
if (observer)
{
pos.actY = 142;//reduce y a little
pos.actY = 145;
if (x < (CardGui::BigWidth / 2)) pos.actX = SCREEN_WIDTH - 10 - CardGui::BigWidth / 2;
drawMode = observer->getCardSelector()->GetDrawMode();
}
bool ingame = observer?true:false;
cardg->DrawCard(pos, drawMode, false, false, false,ingame);
cardg->DrawCard(pos, drawMode);
}
}

View File

@@ -111,20 +111,20 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(dt);
}
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
void CardGui::DrawCard(const Pos& inPosition, int inMode, bool thumb, bool noborder)
{
DrawCard(card, inPosition, inMode, thumb, noborder, smallerscale, ingame);
DrawCard(card, inPosition, inMode, thumb, noborder);
}
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder, bool smallerscale, bool ingame)
void CardGui::DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode, bool thumb, bool noborder)
{
switch (inMode)
{
case DrawMode::kNormal:
RenderBig(inCard, inPosition, thumb, noborder, smallerscale, ingame);
RenderBig(inCard, inPosition, thumb, noborder);
break;
case DrawMode::kText:
AlternateRender(inCard, inPosition, noborder, smallerscale);
AlternateRender(inCard, inPosition);
break;
default:
break;
@@ -137,10 +137,6 @@ void CardGui::Render()
WFont * mFont = game?game->getResourceManager()->GetWFont(Fonts::MAIN_FONT):WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
JRenderer * renderer = JRenderer::GetInstance();
TargetChooser * tc = NULL;
//fake border and mask...
JQuadPtr fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
JQuadPtr highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
JQuadPtr fakemask = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if (game)
tc = game->getCurrentTargetChooser();
@@ -152,28 +148,18 @@ void CardGui::Render()
MTGCard * fcard = MTGCollection()->getCardByName(card->name);
quad = game->getResourceManager()->RetrieveCard(fcard, CACHE_THUMB);
}
if (card->hasCopiedToken && !quad.get())
{
MTGCard * tcard = MTGCollection()->getCardById(abs(card->copiedID));
quad = game->getResourceManager()->RetrieveCardToken(tcard, CACHE_THUMB, 1, abs(card->copiedID));
}
if (quad.get())
alternate = false;
else
quad = AlternateThumbQuad(card);
float cardScale = quad ? 37.f / quad->mHeight : 1;
float cardScale = quad ? 40 / quad->mHeight : 1;
//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.
float zz = 0.99f;
float yy = 0.0f;
if (card->MeldedFrom.size())
{
zz = 1.10f;
yy = 2.0f;
}
float scale = (actZ*zz) * cardScale;
/* if (card->MeldedFrom.size())
cardScale = cardScale + (10 / quad->mHeight);*/
float scale = actZ * cardScale;
JQuadPtr shadow;
if (actZ > 1)
@@ -182,7 +168,7 @@ void CardGui::Render()
if (shadow)
{
shadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,255,255,255));
renderer->RenderQuad(shadow.get(), actX + ((actZ*zz) - 1) * 15, (actY-yy) + ((actZ*zz) - 1) * 15, actT, 27 * (actZ*zz) / 16, 39 * (actZ*zz) / 16);
renderer->RenderQuad(shadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
}
}
@@ -193,7 +179,7 @@ void CardGui::Render()
if (extracostshadow)
{
extracostshadow->SetColor(ARGB(static_cast<unsigned char>(actA)/2,100,0,0));
renderer->RenderQuad(extracostshadow.get(), actX + ((actZ*zz) - 1) * 15, (actY-yy) + ((actZ*zz) - 1) * 15, actT, 27 * (actZ*zz) / 16, 39 * (actZ*zz) / 16);
renderer->RenderQuad(extracostshadow.get(), actX + (actZ - 1) * 15, actY + (actZ - 1) * 15, actT, 28 * actZ / 16, 40 * actZ / 16);
}
}
@@ -222,7 +208,7 @@ void CardGui::Render()
if(white)
{
white->SetColor(ARGB(255,230,50,50));
renderer->RenderQuad(white.get(), actX, (actY-yy), actT, 28 * (actZ*zz) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16);
}
}
@@ -249,22 +235,25 @@ void CardGui::Render()
if(white)
{
white->SetColor(ARGB(255,0,0,255));
renderer->RenderQuad(white.get(), actX, (actY-yy), actT, 28 * (actZ*zz) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(white.get(), actX, actY, actT, 30 * actZ / 16, 42 * actZ / 16);
}
}
}
if (quad)
{
quad->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
//fake border...
JQuadPtr fakeborder;
JQuadPtr highlightborder;
fakeborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
if(fakeborder)
{
int rgb = isBlackBorder(setlist[card->setId].c_str())?15:240;
if(card->has(Constants::CANPLAYFROMGRAVEYARD)||card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
else
fakeborder->SetColor(ARGB((int)(actA),rgb,rgb,rgb));
renderer->RenderQuad(fakeborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
//renderer->DrawRect(actX, (actY-yy),((28 * (actZ*zz) + 1) / 16),(40 * (actZ*zz) / 16),ARGB((int)(actA),240,240,240));
fakeborder->SetColor(ARGB((int)(actA),15,15,15));
renderer->RenderQuad(fakeborder.get(), actX, actY, actT, (29 * actZ + 1) / 16, 42 * actZ / 16);
}
//draw border for highlighting
if (game)
@@ -272,26 +261,26 @@ void CardGui::Render()
if (card && card->isTargetted() && highlightborder)
{
highlightborder->SetColor(ARGB(95,255,0,0));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
if (card && card->isTargetter() && highlightborder)
{
highlightborder->SetColor(ARGB(95,0,245,0));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
if(card->myPair && card->myPair->isInPlay(game) && highlightborder)
{
if(mHasFocus)
{
highlightborder->SetColor(ARGB(200,7,98,248));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
if(CardView* cv = dynamic_cast<CardView*>(card->myPair->view))
{
if(cv->mHasFocus)
{
highlightborder->SetColor(ARGB(200,57,28,248));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
}
}
@@ -304,7 +293,7 @@ void CardGui::Render()
else
highlightborder->SetColor(ARGB(200,57,28,248));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
if(CardView* cv = dynamic_cast<CardView*>(card->shackled->view))
{
@@ -315,20 +304,20 @@ void CardGui::Render()
else
highlightborder->SetColor(ARGB(200,57,28,248));
renderer->RenderQuad(highlightborder.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
}
}
}
}
//draw the card image
renderer->RenderQuad(quad.get(), actX, (actY-yy), actT, scale, scale);
renderer->RenderQuad(quad.get(), actX, actY, actT, scale, scale);
}
if (alternate)
{
mFont->SetColor(ARGB(static_cast<unsigned char>(actA), 0, 0, 0));
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 * 0.5f * actZ);
mFont->DrawString(_(card->getName()), actX - actZ * Width / 2 + 1, actY - actZ * Height / 2 + 1);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
JQuadPtr icon;
@@ -345,7 +334,7 @@ void CardGui::Render()
if (icon.get())
{
icon->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
renderer->RenderQuad(icon.get(), actX, (actY-yy), actT);
renderer->RenderQuad(icon.get(), actX, actY, actT);
icon->SetColor(ARGB(255,255,255,255)); //Putting color back as this quad is shared
}
@@ -357,7 +346,7 @@ void CardGui::Render()
if (mor && mor->mTex) {
mor->SetHotSpot(static_cast<float> (mor->mTex->mWidth / 2), static_cast<float> (mor->mTex->mHeight / 2));
mor->SetColor(ARGB(255,255,255,255));
renderer->RenderQuad(mor.get(), actX, (actY-yy), actT,scale, scale);
renderer->RenderQuad(mor.get(), actX, actY, actT,scale, scale);
}
}
@@ -369,24 +358,24 @@ void CardGui::Render()
if(card->isTapped())
{
if(mHasFocus)
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));
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));
else
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));
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));
}
else
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));
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));
}
if (card && card->isTargetter())
{
if(card->isTapped())
{
if(mHasFocus)
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));
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));
else
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));
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));
}
else
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));
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));
}
}
@@ -396,12 +385,9 @@ void CardGui::Render()
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "%i/%i", card->power, card->life);
//move up the p/t box by increasing ymody
float ymody = (card->isAttacker()||card->isDefenser())&&card->isTapped()?-5.0f:0.0f;
//float ymody = (card->getObserver()->getView()->getRenderedPlayer() == card->controller() ? - mody: +mody);
renderer->FillRect(actX - (13 * (actZ*zz)), (actY-yy+ymody) + 4 * (actZ*zz), 25.5f * (actZ*zz), 14 * (actZ*zz),
renderer->FillRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ,
ARGB(((static_cast<unsigned char>(actA))/2),0,0,0));
renderer->DrawRect(actX - (13 * (actZ*zz)), (actY-yy+ymody) + 4 * (actZ*zz), 25.5f * (actZ*zz), 14 * (actZ*zz),
renderer->DrawRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ,
ARGB(((static_cast<unsigned char>(actA))),20,20,20));
//damaged or buffed or powered down
if(card->wasDealtDamage && card->life <= 2)
@@ -414,11 +400,9 @@ void CardGui::Render()
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),238,130,238));//violet legendary eldrazi
else
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default
mFont->SetScale((actZ*zz));
mFont->SetScale((actZ*zz));
//try to center p/t inside the p/t box
float halfbufferW = (mFont->GetStringWidth(buffer))/2;
mFont->DrawString(buffer, actX - (halfbufferW), (actY-yy+ymody) + 5 * (actZ*zz));
mFont->SetScale(actZ);
mFont->SetScale(actZ);
mFont->DrawString(buffer, actX - 10 * actZ, actY + 7 * actZ);
mFont->SetScale(1);
}
@@ -444,15 +428,14 @@ void CardGui::Render()
else if(card->chooseacolor == 5)
buff += "\n-White";
}
if(buff != "")//enable indicator at all modes
if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm...
{
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
char buffer[200];
sprintf(buffer, "%s", buff.c_str());
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,215,0));//Gold indicator
mFont->SetScale(0.8f);
mFont->DrawString(buffer, actX - 10 * (actZ*zz), (actY-yy) - (16 * (actZ*zz)));
mFont->DrawString(buffer, actX - 10 * actZ, actY - (16 * actZ));
mFont->SetScale(1);
}
@@ -471,8 +454,8 @@ void CardGui::Render()
char buffer[200];
sprintf(buffer, "%i", card->counters->counters[0]->nb);
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
mFont->SetScale((actZ*zz));
mFont->DrawString(buffer, actX - 10 * (actZ*zz), (actY-yy) - (12 * (actZ*zz)));
mFont->SetScale(actZ);
mFont->DrawString(buffer, actX - 10 * actZ, actY - (12 * actZ));
mFont->SetScale(1);
}
}
@@ -484,28 +467,34 @@ void CardGui::Render()
if (shadow)
{
shadow->SetColor(ARGB(200,255,255,255));
renderer->RenderQuad(shadow.get(), actX, (actY-yy), actT, (28 * (actZ*zz) + 1) / 16, 40 * (actZ*zz) / 16);
renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
}
}
// Render a mask over the card, if set
if (mask && quad)
JRenderer::GetInstance()->FillRect(actX - (scale * quad->mWidth / 2),(actY-yy) - (scale * quad->mHeight / 2), scale * quad->mWidth, scale* quad->mHeight, mask);
JRenderer::GetInstance()->FillRect(actX - (scale * quad->mWidth / 2),actY - (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.
{
if(fakemask)
if (card->isTapped())
{
fakemask->SetColor(ARGB(150,255,0,0));
renderer->RenderQuad(fakemask.get(), actX, (actY-yy), actT, (26 * (actZ*zz) + 1) / 16, 38 * (actZ*zz) / 16);
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));
}
else
{
renderer->FillRect(actX - (scale * quad->mWidth / 2),actY - (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(fakemask)
if (tc->source->isTapped())
{
fakemask->SetColor(ARGB(150,0,255,0));
renderer->RenderQuad(fakemask.get(), actX, (actY-yy), actT, (26 * (actZ*zz) + 1) / 16, 38 * (actZ*zz) / 16);
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));
}
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));
}
}
@@ -535,13 +524,12 @@ JQuadPtr CardGui::AlternateThumbQuad(MTGCard * card)
return q;
}
void CardGui::AlternateRender(MTGCard * card, const Pos& pos, bool noborder, bool smallerscale)
void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
{
// Draw the "unknown" card model
JRenderer * renderer = JRenderer::GetInstance();
JQuadPtr q;
//set id
string cardsetname = setlist[card->setId].c_str();
float x = pos.actX;
vector<ModRulesBackGroundCardGuiItem *>items = gModRules.cardgui.background;
@@ -565,10 +553,6 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos, bool noborder, boo
float scale = pos.actZ * 250 / q->mHeight;
q->SetColor(ARGB((int)pos.actA,255,255,255));
//Draw border
DrawBorder(cardsetname, pos, x, noborder, smallerscale);
//render alternate
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
}
@@ -1130,7 +1114,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, bool smallerscale, bool ingame)
void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder)
{
JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance();
@@ -1138,8 +1122,7 @@ 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);
MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
@@ -1148,15 +1131,6 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
MTGCard * fcard = MTGCollection()->getCardByName(kcard->name);
quad = WResourceManager::Instance()->RetrieveCard(fcard);
}
if(ingame)
{
if (kcard->hasCopiedToken && kcard->getObserver() && !quad.get())
{
MTGCard * tcard = MTGCollection()->getCardById(abs(kcard->copiedID));
quad = thumb ? WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_THUMB, 1, abs(kcard->copiedID))
: WResourceManager::Instance()->RetrieveCardToken(tcard, RETRIEVE_NORMAL, 1, abs(kcard->copiedID));
}
}
if (quad.get())
{
if (quad->mHeight < quad->mWidth)
@@ -1165,23 +1139,30 @@ 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;
//Draw border
DrawBorder(cardsetname, pos, x, noborder, smallerscale);
//force smaller scale on alpha beta
smallerscale = cardsetname=="LEA"||cardsetname=="LEB"?true:smallerscale;
float modxscale = (cardsetname =="UNH")?0.02f:0.008f;
float modyscale = (cardsetname =="UNH")?0.015f:0.0075f;
bool unh = (cardsetname =="UNH")?true:false;
//Draw card
if(smallerscale && !unh)
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale-0.001f, scale-0.001f);
else
//init setname
string cardsetname = setlist[card->setId].c_str();
if(!noborder)
{
if(ingame)
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale+modxscale, scale+modyscale);
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
{
//like white border
renderer->FillRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,248,248,255));
//black thin line to simulate card edge
renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(150,20,20,20));
}
else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale+0.002f, scale+0.0015f);
{
//like black border
renderer->FillRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(255,10,10,10));
//white thin line to simulate card edge
renderer->DrawRoundRect(x-92,pos.actY-130, (scale * quad->mWidth)-10, (scale * quad->mHeight)-11, 9.0f,ARGB(50,240,240,240));
}
//render card image
renderer->RenderQuad(quad.get(), x, pos.actY-2, pos.actT, scale-0.02f, scale-0.02f);
}
else
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
RenderCountersBig(card, pos);
return;
}
@@ -1189,63 +1170,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
//DebugTrace("Unable to fetch image: " << card->getImageName());
// If we come here, we do not have the picture.
AlternateRender(card, pos, noborder, smallerscale);
}
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.f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f - 0.5f,pos.actZ * 239.4f + 8.f,10.f,ARGB(255,5,5,5));
renderer->DrawRoundRect((pos.actX - (pos.actZ * 84.f))-10.f,(pos.actY - (pos.actZ * 119.7f))-14.f,pos.actZ * 168.f - 0.5f,pos.actZ * 239.4f + 8.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<float> (alphabeta->mWidth / 2), static_cast<float> (alphabeta->mHeight / 2));
float myscale = pos.actZ * 254 / alphabeta->mHeight;
alphabeta->SetColor(ARGB((int)pos.actA,255,255,255));
renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale);
}
}
}
bool CardGui::isBlackBorder(string cardsetname)
{
if(cardsetname == "2ED"||
cardsetname == "RV"||
cardsetname == "4ED"||
cardsetname == "5ED"||
cardsetname == "6ED"||
cardsetname == "7ED"||
cardsetname == "8ED"||
cardsetname == "9ED"||
cardsetname == "CHR"||
cardsetname == "DM")
return false;
return true;
AlternateRender(card, pos);
}
string CardGui::FormattedData(string data, string replace, string value)

View File

@@ -41,10 +41,6 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
if(!source)
return;
basicAbilities = source->basicAbilities;
for(int k=0; k < Constants::NB_BASIC_ABILITIES; k++)
{
modbasicAbilities.push_back(source->basicAbilities[k]);
}
LKIbasicAbilities = source->basicAbilities;
for (size_t i = 0; i < source->types.size(); ++i)
@@ -82,7 +78,6 @@ CardPrimitive::~CardPrimitive()
int CardPrimitive::init()
{
basicAbilities.reset();
modbasicAbilities.clear();
types.clear();

View File

@@ -340,13 +340,7 @@ void CardSelector::Render()
if (CardView* card = dynamic_cast<CardView*>(active) )
{
if(timer > 0)
{
float modx = 14.f;
Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha);
//render card
bool ingame = observer?true:false;
card->DrawCard(npos, mDrawMode, false, false, false,ingame);
}
card->DrawCard(bigpos, mDrawMode);
}
}
}

View File

@@ -185,7 +185,7 @@ int Damage::resolve()
_target->poisonCount += damage;//this will be changed to poison counters.
_target->damageCount += damage;
if(typeOfDamage == 2)
target->nonCombatDamage += damage;
_target->nonCombatDamage += damage;
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
{
vector<string> values = MTGAllCards::getCreatureValuesById();

View File

@@ -93,7 +93,7 @@ void DeckView::reloadIndexes()
}
}
void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHborder)
void DeckView::renderCard(int index, int alpha, bool asThumbnail)
{
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
@@ -146,30 +146,20 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool addWHbord
else
{//NORMAL VIEW WITH IMAGES
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
float modx = addWHborder ? 2.0f:0.0f;
bool smallerscale = modx > 0.0f ? true:false;
//border for editor && others since the border in cardgui:drawcard scales larger...
//border for editor && others???
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")
{
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,248,248,255));
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(150,20,20,20));
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,248,248,255));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(150,20,20,20));
}
else
{
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));
}
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,10,10,10));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,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, smallerscale);
CardGui::DrawCard(cardPosition.card, pos, mode, asThumbnail, true);
}
int quadAlpha = alpha;
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;

View File

@@ -1288,11 +1288,9 @@ int SacrificeCost::doPay()
{
MTGCardInstance * beforeCard = target;
source->storedCard = target->createSnapShot();
WEvent * e;
target->controller()->game->putInGraveyard(target);
WEvent * e = NEW WEventCardSacrifice(beforeCard,target);
GameObserver * game = target->owner->getObserver();
bool cardIsToken = target->isToken ? true : false;
e = NEW WEventCardSacrifice(beforeCard, target, cardIsToken);
game->receiveEvent(e);
target = NULL;
if (tc)

View File

@@ -54,7 +54,6 @@ void GameObserver::cleanup()
gameTurn.clear();
OpenedDisplay = NULL;
AffinityNeedsUpdate = false;
legendNeedUpdate = false;
}
GameObserver::~GameObserver()
@@ -900,17 +899,7 @@ void GameObserver::gameStateBasedEffects()
int nbcards = z->nb_cards;
//------------------------------
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
//legendary
if (legendNeedUpdate)
{
for (int cl = 0; cl < nbcards; cl++)
{
MTGCardInstance * c = z->cards[cl];
if (!c->isPhased && c->hasType(Subtypes::TYPE_LEGENDARY) && !c->has(Constants::NOLEGEND))
checkLegendary(c);
}
legendNeedUpdate = false;
}
/////////////////////////////////////////////////
//handle end of turn effects while we're at it.//
/////////////////////////////////////////////////
@@ -1030,43 +1019,6 @@ void GameObserver::gameStateBasedEffects()
}
}
void GameObserver::checkLegendary(MTGCardInstance * card)
{
map<MTGCardInstance *, bool>::iterator it;
int destroy = 0;
vector<MTGCardInstance*>oldCards;
for (it = cards.begin(); it != cards.end(); it++)
{
MTGCardInstance * comparison = (*it).first;
if (comparison != card && comparison->controller() == card->controller() && !(comparison->getName().compare(card->getName())))
{
oldCards.push_back(comparison);
destroy = 1;
}
}
if(destroy)
{
vector<MTGAbility*>selection;
MultiAbility * multi = NEW MultiAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card, NULL);
for(unsigned int i = 0;i < oldCards.size();i++)
{
AAMover *a = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, oldCards[i],"ownergraveyard","Keep New");
a->oneShot = true;
multi->Add(a);
}
multi->oneShot = 1;
MTGAbility * a1 = multi;
selection.push_back(a1);
AAMover *b = NEW AAMover(this, this->mLayers->actionLayer()->getMaxId(), card, card,"ownergraveyard","Keep Old");
b->oneShot = true;
MTGAbility * b1 = b;
selection.push_back(b1);
MTGAbility * menuChoice = NEW MenuAbility(this, this->mLayers->actionLayer()->getMaxId(), card, card,true,selection,card->controller(),"Legendary Rule");
menuChoice->addToGame();
}
}
void GameObserver::enchantmentStatus()
{
for (int i = 0; i < 2; i++)

View File

@@ -1196,59 +1196,24 @@ void GameStateDuel::Render()
case DUEL_STATE_BACK_TO_MAIN_MENU:
if (game)
{
string gtype = "";
if(game->gameType() == GAME_TYPE_CLASSIC)
gtype = "Classic";
else if(game->gameType() == GAME_TYPE_MOMIR)
gtype = "Momir";
else if(game->gameType() == GAME_TYPE_RANDOM1 || game->gameType() == GAME_TYPE_RANDOM2)
gtype = "Random";
else if(game->gameType() == GAME_TYPE_STORY)
gtype = "Story";
else if(game->gameType() == GAME_TYPE_DEMO)
gtype = "Demo";
else if(game->gameType() == GAME_TYPE_STONEHEWER)
gtype = "Stone Hewer";
else if(game->gameType() == GAME_TYPE_HERMIT)
gtype = "Hermit Druid";
else
gtype = "Blitzkrieg";
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(100,0,0,0));
char buffer[4096];
sprintf(buffer, _("Turn:%i").c_str(), game->turn);
mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(buffer, SCREEN_WIDTH / 2, 0, JGETEXT_CENTER);
mFont->DrawString(gtype, SCREEN_WIDTH / 2, SCREEN_HEIGHT - 15, JGETEXT_CENTER);
}
if (menu)
{
menu->Render();
// display the player deck names in their respective corners
string p0playmode = "";
if(game->players[0]->playMode == Player::MODE_TEST_SUITE)
p0playmode = "AI Testsuite";
else if(game->players[0]->playMode == Player::MODE_HUMAN)
p0playmode = "Human";
else
p0playmode = "AI";
string playerDeckName = game->players[0]->deckName;
float playerDeckNamePixelLength = mFont->GetStringWidth(playerDeckName.c_str());
float playerModePixelLength = mFont->GetStringWidth(p0playmode.c_str());
mFont->DrawString( playerDeckName, SCREEN_WIDTH_F - playerDeckNamePixelLength, SCREEN_HEIGHT_F - 50);
mFont->DrawString( p0playmode, SCREEN_WIDTH_F - playerModePixelLength, SCREEN_HEIGHT_F - 60);
if(game->players.size()>1)
{
string p1playmode = "";
if(game->players[1]->playMode == Player::MODE_TEST_SUITE)
p1playmode = "AI Testsuite";
else if(game->players[1]->playMode == Player::MODE_HUMAN)
p1playmode = "Human";
else
p1playmode = "AI";
string opponentDeckName = game->players[1]->deckName;
mFont->DrawString( opponentDeckName, 0, 40);
mFont->DrawString( p1playmode, 0, 50);
mFont->DrawString( opponentDeckName, 0, 50);
}
}
}

View File

@@ -12,24 +12,24 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
{
Add(self = NEW GuiAvatar(SCREEN_WIDTH, SCREEN_HEIGHT, false, mpDuelLayers->getRenderedPlayer(), GuiAvatar::BOTTOM_RIGHT, this));
self->zoom = 0.9f;
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 7, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 10 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfGraveyard = NEW GuiGraveyard(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 1, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfLibrary = NEW GuiLibrary(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 5 + GuiGameZone::Height + 5, false, mpDuelLayers->getRenderedPlayer(), this));
//myexile
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 34, false, mpDuelLayers->getRenderedPlayer(), this));
Add(selfExile = NEW GuiExile(SCREEN_WIDTH - GuiAvatar::Width - GuiGameZone::Width / 2 - 11, SCREEN_HEIGHT - GuiAvatar::Height - 30, false, mpDuelLayers->getRenderedPlayer(), this));
Add(opponent = NEW GuiAvatar(0, 0, false, mpDuelLayers->getRenderedPlayerOpponent(), GuiAvatar::TOP_LEFT, this));
opponent->zoom = 0.9f;
//opponentExile
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2f - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
Add(opponentExile = NEW GuiExile(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentGraveyard
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 5, false,
Add(opponentGraveyard = NEW GuiGraveyard(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentHand
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
//opponentLibrary
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4f - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
mpDuelLayers->getRenderedPlayerOpponent(), this));
observer->getCardSelector()->Add(self);
@@ -145,12 +145,12 @@ void GuiAvatars::Update(float dt)
void GuiAvatars::Render()
{
JRenderer * r = JRenderer::GetInstance();
float w = 52;
float h = 52;
float w = 54;
float h = 54;
if (opponent == active)
{
r->FillRect(opponent->actX, opponent->actY, 34 * opponent->actZ, h+22 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, (w * opponent->actZ)-1, (h * opponent->actZ)+2, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+20 * opponent->actZ, ARGB(200,0,0,0));
r->FillRect(opponent->actX, opponent->actY, w * opponent->actZ, h * opponent->actZ, ARGB(200,0,0,0));
}
else if (self == active)
{

View File

@@ -122,9 +122,9 @@ void GuiHandSelf::Repos()
{
float dist = 180.0f / cards.size();
if (dist > 20)
dist = 18.0;//20.0
dist = 20.0;
else
y = 35.0;//40.0
y = 40.0;
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
{
(*it)->x = ClosedRowX;

View File

@@ -62,20 +62,12 @@ void GuiPlay::HorzStack::Enstack(CardView* card)
{
card->x = x + baseX;
card->y = y + baseY;
/*if (total < 8)
if (total < 8)
x += CARD_WIDTH;
else if (total < 16)
x += (SCREEN_WIDTH - 200 - baseX) / total;
else
x += (SCREEN_WIDTH - 50 - baseX) / total;*/
// new adjustment
if (total < 8)
x += CARD_WIDTH;
else if (total < 24)
x += (SCREEN_WIDTH - 200 - baseX) / total;
else
x += (SCREEN_WIDTH - 70 - baseX) / total;
x += (SCREEN_WIDTH - 50 - baseX) / total;
}
void GuiPlay::VertStack::Enstack(CardView* card)
@@ -91,10 +83,9 @@ void GuiPlay::VertStack::Enstack(CardView* card)
card->x = x + baseX;
card->y = y + baseY;
y += 9;
if (++count == total - 1 && y == 9)
y += 9;
//last value += 12...
y += 12;
if (++count == total - 1 && y == 12)
y += 12;
}
void GuiPlay::VertStack::Render(CardView* card, iterator begin, iterator end)

View File

@@ -88,11 +88,11 @@ void GuiAvatar::Render()
}
if (player->getObserver()->currentPlayer == player)
r->DrawRect(x0 - 1, y0 - 1, (Width+1) * actZ, (Height+1) * actZ, ARGB((int)actA, 0, 255, 0));
r->DrawRect(x0 - 1, y0 - 1, 36 * actZ, 51 * actZ, ARGB((int)actA, 0, 255, 0));
else if (player->getObserver()->currentActionPlayer == player)
r->DrawRect(x0, y0, (Width-1) * actZ, (Height-1) * actZ, ARGB((int)actA, 0, 0, 255));
r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 0, 0, 255));
if (player->getObserver()->isInterrupting == player)
r->DrawRect(x0, y0, (Width-1) * actZ, (Height-1) * actZ, ARGB((int)actA, 255, 0, 0));
r->DrawRect(x0, y0, 34 * actZ, 49 * actZ, ARGB((int)actA, 255, 0, 0));
//Life
char buffer[10];

View File

@@ -2416,7 +2416,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
string tokenDesc = splitToken[1];
vector<string> tokenParameters = split(tokenDesc, ',');
//lets try finding a token by card name.
if (splitToken[1].size() && tokenParameters.size() <3)
if (splitToken[1].size() && (tokenParameters.size() ==1||tokenParameters.size() ==2))
{
string cardName = splitToken[1];
MTGCard * safetycard = MTGCollection()->getCardByName(cardName);
@@ -3396,6 +3396,25 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return a;
}
//changecost - alternate for altercost
vector<string> splitChangeCost = parseBetween(s, "changecost(", ")", true);
if(splitChangeCost.size())
{
if(splitChangeCost[1].size())
{
vector<string> ccParameters = split( splitChangeCost[1], ':');
int amount = atoi(ccParameters[1].c_str());
int color = Constants::GetColorStringIndex(ccParameters[0]);
if(ccParameters[0] == "colorless")
color = 0;
if(ccParameters[0].size() && ccParameters[1].size())
{
MTGAbility * a = NEW AAlterCost(observer, id, card, target, amount, color);
return a;
}
}
}
//Change Power/Toughness
WParsedPT * wppt = NEW WParsedPT(s, spell, card);
bool nonstatic = false;

View File

@@ -96,10 +96,10 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
void MTGCardInstance::copy(MTGCardInstance * card)
{
MTGCard * source = card->model;
//MTGCard * source = card->model;
MTGCard * source = card;
CardPrimitive * data = source->data;
basicAbilities = card->model->data->basicAbilities;
modbasicAbilities = card->modbasicAbilities;
for (size_t i = 0; i < data->types.size(); i++)
{
types.push_back(data->types[i]);
@@ -136,9 +136,9 @@ void MTGCardInstance::copy(MTGCardInstance * card)
mtgid = backupid; // there must be a way to get the token id...
else
{
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
setId = card->setId; // Copier/Cloner cards produces the same token...//
//rarity = card->getRarity(); ///////////////////////////////////////////////////
mtgid = card->getMTGId(); ///////////////////////////////////////////////////
setId = card->setId; // Copier/Cloner cards produces the same token...//
rarity = card->getRarity(); ///////////////////////////////////////////////////
}
castMethod = castMethodBackUP;
backupTargets = this->backupTargets;
@@ -985,8 +985,8 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
string type = "";
ManaCost * original = NEW ManaCost();
ManaCost * excess = NEW ManaCost();
original->copy(Data);
Cost->copy(original);
original->changeCostTo(Data);
Cost->changeCostTo(original);
if (Cost->extraCosts)
{
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
@@ -1018,7 +1018,7 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
{
original->removeHybrid(excess);
}
Cost->copy(original);
Cost->changeCostTo(original);
if (Cost->extraCosts)
{
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
@@ -1109,7 +1109,7 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
type = "creature";
}
Cost->copy(original);
Cost->changeCostTo(original);
if (Cost->extraCosts)
{
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)

View File

@@ -3233,10 +3233,8 @@ int MTGLegendRule::added(MTGCardInstance * card)
return 1;
}
int MTGLegendRule::removed(MTGCardInstance * card)
int MTGLegendRule::removed(MTGCardInstance *)
{
if (card->has(Constants::NOLEGENDRULE))
game->legendNeedUpdate = true;
return 0;
}

View File

@@ -293,6 +293,19 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser
return NULL;
}
//controller creature spells - conduit of ruin
found = s.find("creaturespells");
if (found != string::npos)
{
ThisCreatureSpells * td = NEW ThisCreatureSpells(criterion);
if (td)
{
td->comparisonMode = mode;
return td;
}
return NULL;
}
//power
found = s.find("power");
if (found != string::npos)
@@ -470,6 +483,21 @@ ThisControllerlife* ThisControllerlife::clone() const
return NEW ThisControllerlife(*this);
}
ThisCreatureSpells::ThisCreatureSpells(int count)
{
comparisonCriterion = count;
}
int ThisCreatureSpells::match(MTGCardInstance * card)
{
return matchValue(card->controller()->game->stack->seenThisTurn("creature", Constants::CAST_ALL));
}
ThisCreatureSpells* ThisCreatureSpells::clone() const
{
return NEW ThisCreatureSpells(*this);
}
ThisPower::ThisPower(int power)
{
comparisonCriterion = power;
@@ -713,4 +741,4 @@ int ThisVariable::match(MTGCardInstance * card)
ThisVariable * ThisVariable::clone() const
{
return NEW ThisVariable(*this);
}
}

View File

@@ -99,8 +99,8 @@ player(player), nb_cards(nb_cards),drawAbility(cardDraw)
{
}
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after, bool token) :
WEventCardUpdate(card),cardAfter(after),istoken(token)
WEventCardSacrifice::WEventCardSacrifice(MTGCardInstance * card, MTGCardInstance * after) :
WEventCardUpdate(card),cardAfter(after)
{
}

View File

@@ -263,46 +263,6 @@ JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submod
return JQuadPtr();
}
JQuadPtr ResourceManagerImpl::RetrieveCardToken(MTGCard * card, int style, int submode, int tId)
{
//Cards are never, ever resource managed, so just check cache.
if (!card || options[Options::DISABLECARDS].number) return JQuadPtr();
submode = submode | TEXTURE_SUB_CARD;
//static std::ostringstream filename;
//filename.str("");
string filename;
filename.reserve(4096);
//filename << setlist[card->setId] << "/" << card->getImageName();
filename.append(setlist[card->setId]);
filename.append("/");
int id = -card->getMTGId();
if(tId)
id = -tId;
ostringstream imagename;
imagename << "-" << id << "t.jpg";
filename.append(imagename.str());
//Aliases.
if (style == RETRIEVE_THUMB)
{
submode = submode | TEXTURE_SUB_THUMB;
style = RETRIEVE_NORMAL;
}
JQuadPtr jq = RetrieveQuad(filename, 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
lastError = textureWCache.mError;
if (jq)
{
jq->SetHotSpot(static_cast<float> (jq->mTex->mWidth / 2), static_cast<float> (jq->mTex->mHeight / 2));
return jq;
}
return JQuadPtr();
}
int ResourceManagerImpl::AddQuadToManaged(const WManagedQuad& inQuad)
{
int id = mIDLookupMap.size();