Merge branch 'master' of https://github.com/WagicProject/wagic into cmake
This commit is contained in:
@@ -19,23 +19,27 @@ int AIPlayer::totalAIDecks = -1;
|
||||
AIAction::AIAction(AIPlayer * owner, MTGCardInstance * c, MTGCardInstance * t)
|
||||
: owner(owner), ability(NULL), player(NULL), click(c), target(t)
|
||||
{
|
||||
// useability tweak - assume that the user is probably going to want to see the full res card,
|
||||
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
|
||||
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
|
||||
// This is a good intercept point, as the AI has committed to using this card.
|
||||
|
||||
// if we're not in text mode, always get the thumb
|
||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
|
||||
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||
{
|
||||
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
|
||||
if(owner->getObserver()->getResourceManager())
|
||||
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
|
||||
|
||||
// also cache the large image if we're using kNormal mode
|
||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||
// useability tweak - assume that the user is probably going to want to see the full res card,
|
||||
// so prefetch it. The idea is that we do it here as we want to start the prefetch before it's time to render,
|
||||
// and waiting for it to actually go into play is too late, as we start drawing the card during the interrupt window.
|
||||
// This is a good intercept point, as the AI has committed to using this card.
|
||||
|
||||
// if we're not in text mode, always get the thumb
|
||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText)
|
||||
{
|
||||
//DebugTrace("Prefetching AI card going into play: " << c->getImageName());
|
||||
if(owner->getObserver()->getResourceManager())
|
||||
owner->getObserver()->getResourceManager()->RetrieveCard(c);
|
||||
owner->getObserver()->getResourceManager()->RetrieveCard(c, RETRIEVE_THUMB);
|
||||
|
||||
// also cache the large image if we're using kNormal mode
|
||||
if (owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||
{
|
||||
if(owner->getObserver()->getResourceManager())
|
||||
owner->getObserver()->getResourceManager()->RetrieveCard(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -105,6 +105,11 @@ bool ActionLayer::CheckUserInput(JButton key)
|
||||
//being cancelled. currently only menuability and paidability will care.
|
||||
}
|
||||
}
|
||||
if (observer->mExtraPayment->costs.size() && observer->mExtraPayment->costs[0]->tc)
|
||||
{
|
||||
//if we cancel, clear the targets list so that when you try again you dont already have targets from before.
|
||||
observer->mExtraPayment->costs[0]->tc->initTargets();
|
||||
}
|
||||
observer->mExtraPayment = NULL;
|
||||
return 1;
|
||||
}
|
||||
@@ -186,11 +191,11 @@ void ActionLayer::Update(float dt)
|
||||
without this, the game locks into a freeze state while you try to select the targets and dont have enough to
|
||||
fill the maxtargets list.
|
||||
*/
|
||||
if (int(ae->getActionTc()->getNbTargets()) == countTargets)//if the amount of targets is equal the all we can target
|
||||
{
|
||||
ae->getActionTc()->done = true;//were done
|
||||
ae->getActionTc()->source->getObserver()->cardClick(ae->getActionTc()->source, 0, false);//click source.
|
||||
}
|
||||
if (int(ae->getActionTc()->getNbTargets()) == countTargets)//if the amount of targets is equal the all we can target
|
||||
{
|
||||
ae->getActionTc()->done = true;//were done
|
||||
ae->getActionTc()->source->getObserver()->cardClick(ae->getActionTc()->source, 0, false);//click source.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -462,6 +467,10 @@ void ActionLayer::doReactTo(int menuIndex)
|
||||
{
|
||||
int controlid = abilitiesMenu->mObjects[menuIndex]->GetId();
|
||||
DebugTrace("ActionLayer::doReactTo " << controlid);
|
||||
if (abilitiesMenu && abilitiesMenu->isMultipleChoice)
|
||||
{
|
||||
return ButtonPressedOnMultipleChoice(menuIndex);
|
||||
}
|
||||
ButtonPressed(0, controlid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,14 +88,15 @@ float Interruptible::GetVerticalTextOffset() const
|
||||
}
|
||||
|
||||
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action,
|
||||
bool bigQuad)
|
||||
bool bigQuad, int aType, vector<JQuadPtr> mytargetsQuad)
|
||||
{
|
||||
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)
|
||||
bool hiddenview = aType == MTGAbility::HIDDENVIEW?true:false;
|
||||
|
||||
if (!targetQuad && !mytargetsQuad.size())
|
||||
{
|
||||
/*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);
|
||||
@@ -105,22 +106,58 @@ void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string
|
||||
}
|
||||
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);
|
||||
float xnadj = 0;
|
||||
int count = 1;
|
||||
if(mytargetsQuad.size())
|
||||
{
|
||||
count = mytargetsQuad.size();
|
||||
for(unsigned int k = 0; k < mytargetsQuad.size(); k++)
|
||||
{
|
||||
if(k > 10)
|
||||
break;
|
||||
xnadj+=4;
|
||||
}
|
||||
}
|
||||
|
||||
ostringstream aa;
|
||||
aa << action << " " << "(" << count << ")";
|
||||
|
||||
if(count > 1)
|
||||
xnadj -= 4;
|
||||
|
||||
if(!hiddenview)
|
||||
{
|
||||
mFont->DrawString(">", x + 32, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
||||
if(count > 1)
|
||||
{
|
||||
mFont->DrawString(_(aa.str()).c_str(), x + 75 + xnadj, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
||||
}
|
||||
else
|
||||
mFont->DrawString(_(action).c_str(), x + 75 + xnadj, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
||||
}
|
||||
else
|
||||
mFont->DrawString(_(action).c_str(), x + 35, y + GetVerticalTextOffset(), JGETEXT_LEFT);
|
||||
|
||||
}
|
||||
|
||||
JQuadPtr quad = observer->getResourceManager()->RetrieveCard(source, CACHE_THUMB);
|
||||
JQuadPtr fakeborder = observer->getResourceManager()->GetQuad("white");
|
||||
if (!quad.get())
|
||||
quad = CardGui::AlternateThumbQuad(source);
|
||||
if (quad.get())
|
||||
{
|
||||
quad->SetColor(ARGB(255,255,255,255));
|
||||
float scale = mHeight / quad->mHeight;
|
||||
if (fakeborder.get())
|
||||
{
|
||||
fakeborder->SetColor(ARGB(255,15,15,15));
|
||||
renderer->RenderQuad(fakeborder.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, (29 * actZ + 1) / 16, 42 * actZ / 16);
|
||||
}
|
||||
|
||||
renderer->RenderQuad(quad.get(), x + (quad->mWidth * scale / 2), y + (quad->mHeight * scale / 2), 0, scale, scale);
|
||||
}
|
||||
else if (alt1.size())
|
||||
@@ -130,23 +167,66 @@ 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);
|
||||
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
|
||||
/*Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
|
||||
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());*/
|
||||
if(observer->gameType() == GAME_TYPE_MOMIR && aType == MTGAbility::FORCED_TOKEN_CREATOR)
|
||||
{
|
||||
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
|
||||
pos.actY = 142;//adjust y a little bit
|
||||
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
|
||||
}
|
||||
else if (observer->gameType() != GAME_TYPE_MOMIR)
|
||||
{
|
||||
Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
|
||||
pos.actY = 142;//adjust y a little bit
|
||||
CardGui::DrawCard(source, pos, observer->getCardSelector()->GetDrawMode());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (targetQuad)
|
||||
if(mytargetsQuad.size() && !hiddenview)
|
||||
{
|
||||
float backupX = targetQuad->mHotSpotX;
|
||||
float backupY = targetQuad->mHotSpotY;
|
||||
targetQuad->SetColor(ARGB(255,255,255,255));
|
||||
targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2);
|
||||
float scale = mHeight / targetQuad->mHeight;
|
||||
renderer->RenderQuad(targetQuad, x + 55, y + ((mHeight - targetQuad->mHeight) / 2) + targetQuad->mHotSpotY, 0, scale, scale);
|
||||
targetQuad->SetHotSpot(backupX, backupY);
|
||||
float xadj = 0;
|
||||
for(unsigned int k = 0; k < mytargetsQuad.size(); k++)
|
||||
{
|
||||
if(k > 10)
|
||||
break;
|
||||
|
||||
JQuadPtr multiQ = mytargetsQuad[k];
|
||||
if(multiQ.get())
|
||||
{
|
||||
float backupX = multiQ->mHotSpotX;
|
||||
float backupY = multiQ->mHotSpotY;
|
||||
multiQ->SetColor(ARGB(255,255,255,255));
|
||||
multiQ->SetHotSpot(multiQ->mWidth / 2, multiQ->mHeight / 2);
|
||||
float scale = mHeight / multiQ->mHeight;
|
||||
if (fakeborder.get())
|
||||
{
|
||||
fakeborder->SetColor(ARGB(255,15,15,15));
|
||||
renderer->RenderQuad(fakeborder.get(), x + 55 + xadj, y + ((mHeight - multiQ->mHeight) / 2) + multiQ->mHotSpotY, 0, (29 * actZ + 1) / 16, 42 * actZ / 16);
|
||||
}
|
||||
renderer->RenderQuad(multiQ.get(), x + 55 + xadj, y + ((mHeight - multiQ->mHeight) / 2) + multiQ->mHotSpotY, 0, scale, scale);
|
||||
multiQ->SetHotSpot(backupX, backupY);
|
||||
xadj+=4;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alt2.size())
|
||||
else if(!hiddenview)
|
||||
{
|
||||
mFont->DrawString(_(alt2).c_str(), x + 35, y+15 + GetVerticalTextOffset());
|
||||
if (targetQuad)
|
||||
{
|
||||
float backupX = targetQuad->mHotSpotX;
|
||||
float backupY = targetQuad->mHotSpotY;
|
||||
targetQuad->SetColor(ARGB(255,255,255,255));
|
||||
targetQuad->SetHotSpot(targetQuad->mWidth / 2, targetQuad->mHeight / 2);
|
||||
float scale = mHeight / targetQuad->mHeight;
|
||||
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 + 35, y+15 + GetVerticalTextOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +240,11 @@ void StackAbility::Render()
|
||||
string action = ability->getMenuText();
|
||||
MTGCardInstance * source = ability->source;
|
||||
string alt1 = source->getName();
|
||||
vector<JQuadPtr> mytargetQuads;
|
||||
vector<MTGCardInstance*> myClones;
|
||||
|
||||
int fmLibrary = 0;
|
||||
int force = 0;
|
||||
|
||||
Targetable * _target = ability->target;
|
||||
if (ability->getActionTc())
|
||||
@@ -167,6 +252,34 @@ void StackAbility::Render()
|
||||
Targetable * t = ability->getActionTc()->getNextTarget();
|
||||
if (t)
|
||||
_target = t;
|
||||
|
||||
|
||||
//test vector quads
|
||||
if(ability->getActionTc()->getTargetsFrom().size())
|
||||
{
|
||||
for(size_t i = 0; i < ability->getActionTc()->getTargetsFrom().size(); i++)
|
||||
{
|
||||
Targetable * tt = ability->getActionTc()->getTargetsFrom()[i];
|
||||
if(tt)
|
||||
{
|
||||
if( ((Damageable *)(tt))->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE )
|
||||
{
|
||||
//fill vector
|
||||
myClones.push_back(((MTGCardInstance*)(tt)));
|
||||
|
||||
if( source->has(Constants::HIDDENFACE) && !observer->isInLibrary(((MTGCardInstance *)(tt))) )
|
||||
mytargetQuads.push_back( ((Damageable *)(tt))->getIcon() );
|
||||
else if ( !source->has(Constants::HIDDENFACE) )
|
||||
mytargetQuads.push_back( ((Damageable *)(tt))->getIcon() );
|
||||
else
|
||||
fmLibrary++;
|
||||
}
|
||||
else
|
||||
mytargetQuads.push_back( ((Damageable *)(tt))->getIcon() );
|
||||
}
|
||||
}
|
||||
}
|
||||
//end
|
||||
}
|
||||
Damageable * target = NULL;
|
||||
if (_target != ability->source && (dynamic_cast<MTGCardInstance *>(_target) || dynamic_cast<Player *>(_target)))
|
||||
@@ -185,7 +298,27 @@ void StackAbility::Render()
|
||||
}
|
||||
}
|
||||
|
||||
Interruptible::Render(source, quad.get(), alt1, alt2, action);
|
||||
//setborder test
|
||||
if(myClones.size())
|
||||
{
|
||||
source->forcedBorderB = 1;
|
||||
for(unsigned int kk = 0; kk < myClones.size(); kk++)
|
||||
{
|
||||
if(myClones[kk])
|
||||
{
|
||||
myClones[kk]->forcedBorderA = 1;
|
||||
//JRenderer::GetInstance()->DrawLine(myClones[kk]->view->actX,myClones[kk]->view->actY,source->view->actX,source->view->actY,0.5f,ARGB(120, 255, 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(source->has(Constants::HIDDENFACE) && fmLibrary)
|
||||
force = MTGAbility::HIDDENVIEW;
|
||||
|
||||
if(observer->gameType() == GAME_TYPE_MOMIR)
|
||||
Interruptible::Render(source, quad.get(), alt1, alt2, action, true, ability->aType, mytargetQuads);
|
||||
else
|
||||
Interruptible::Render(source, quad.get(), alt1, alt2, action, false, force, mytargetQuads);
|
||||
}
|
||||
StackAbility::StackAbility(GameObserver* observer, int id, MTGAbility * _ability) :
|
||||
Interruptible(observer, id), ability(_ability)
|
||||
@@ -453,12 +586,12 @@ int PutInGraveyard::resolve()
|
||||
MTGGameZone * zone = card->getCurrentZone();
|
||||
if (card->basicAbilities[(int)Constants::EXILEDEATH])
|
||||
{
|
||||
card->owner->game->putInZone(card, zone, card->owner->game->exile);
|
||||
card->controller()->game->putInZone(card, zone, card->owner->game->exile);
|
||||
return 1;
|
||||
}
|
||||
if (zone == observer->players[0]->game->inPlay || zone == observer->players[1]->game->inPlay)
|
||||
{
|
||||
card->owner->game->putInZone(card, zone, card->owner->game->graveyard);
|
||||
card->controller()->game->putInZone(card, zone, card->owner->game->graveyard);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -577,11 +710,17 @@ int ActionStack::addAbility(MTGAbility * ability)
|
||||
int result = addAction(stackAbility);
|
||||
if (!observer->players[0]->isAI() && ability->source->controller() == observer->players[0] && 0
|
||||
== options[Options::INTERRUPTMYABILITIES].number)
|
||||
{
|
||||
if((observer->gameType() == GAME_TYPE_MOMIR && ability->aType == MTGAbility::FORCED_TOKEN_CREATOR)||
|
||||
(dynamic_cast<GenericTargetAbility *>(ability) && ability->canBeInterrupted && !observer->OpenedDisplay && !observer->players[0]->game->reveal->cards.size()))//test interrupt...
|
||||
interruptDecision[0] = NOT_DECIDED;
|
||||
else
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
}
|
||||
if (observer->OpenedDisplay && observer->players[0]->game->reveal->cards.size())
|
||||
{
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
if (observer->OpenedDisplay && observer->players[0]->game->reveal->cards.size())
|
||||
{
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -670,7 +809,7 @@ int ActionStack::addAction(Interruptible * action)
|
||||
}
|
||||
|
||||
Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, ManaCost * mana, int payResult,
|
||||
int storm)
|
||||
int storm, bool forcedinterrupt)
|
||||
{
|
||||
DebugTrace("ACTIONSTACK Add spell");
|
||||
if (storm > 0)
|
||||
@@ -680,7 +819,12 @@ Spell * ActionStack::addSpell(MTGCardInstance * _source, TargetChooser * tc, Man
|
||||
Spell * spell = NEW Spell(observer, mObjects.size(), _source, tc, mana, payResult);
|
||||
addAction(spell);
|
||||
if (!observer->players[0]->isAI() && _source->controller() == observer->players[0] && 0 == options[Options::INTERRUPTMYSPELLS].number)
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
{
|
||||
if(forcedinterrupt)
|
||||
interruptDecision[0] = INTERRUPT;
|
||||
else
|
||||
interruptDecision[0] = DONT_INTERRUPT;
|
||||
}
|
||||
return spell;
|
||||
}
|
||||
|
||||
@@ -897,6 +1041,10 @@ void ActionStack::Update(float dt)
|
||||
if (getCurrentTutorial() && (observer->players[0]->isHuman() || observer->players[1]->isHuman() ) )
|
||||
return;
|
||||
|
||||
if (observer->mLayers->actionLayer()->menuObject)// || observer->LPWeffect) //test fix for hang for both legendary with action/reveal
|
||||
if(observer->players[0]->isHuman() || observer->players[1]->isHuman())
|
||||
return;//dont do any of this if a menuobject exist.
|
||||
|
||||
askIfWishesToInterrupt = NULL;
|
||||
//modal = 0;
|
||||
|
||||
@@ -1251,10 +1399,12 @@ void ActionStack::Render()
|
||||
//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(225,5,5,5));
|
||||
//top stack fill
|
||||
renderer->FillRect(x0 - 6, y0+37, width + 15, 40.5f, ARGB(20,135,206,235));
|
||||
//stack highlight
|
||||
renderer->FillRect(x0 - 6, y0+3, width + 15, 30, ARGB(255,89,89,89));
|
||||
renderer->FillRect(x0 - 6, y0+3, width + 15, 31.f, ARGB(255,89,89,89));
|
||||
//another border
|
||||
renderer->DrawRect(x0 - 6, y0+33, width + 15, height - 18, ARGB(255,89,89,89));
|
||||
renderer->DrawRect(x0 - 6, y0+34.5f, width + 15, height - 19.5f, ARGB(255,89,89,89));
|
||||
//stack border
|
||||
renderer->DrawRect(x0 - 7, y0+2, width + 17, height + 14, ARGB(255,240,240,240));
|
||||
|
||||
@@ -1310,15 +1460,32 @@ void ActionStack::Render()
|
||||
|
||||
currenty += kIconVerticalOffset + kSpacer;
|
||||
|
||||
float totalmHeight = 0.f;
|
||||
for (size_t i = 0; i < mObjects.size(); i++)
|
||||
{
|
||||
Interruptible * current = (Interruptible *) mObjects[i];
|
||||
if (current && current->state == NOT_RESOLVED)
|
||||
totalmHeight += current->mHeight;
|
||||
}
|
||||
int sC = 0;//stack Count
|
||||
for (size_t i = 0; i < mObjects.size(); i++)
|
||||
{
|
||||
Interruptible * current = (Interruptible *) mObjects[i];
|
||||
if (current && current->state == NOT_RESOLVED)
|
||||
{
|
||||
/*
|
||||
current->x = x0;
|
||||
current->y = currenty;
|
||||
current->Render();
|
||||
|
||||
currenty += current->mHeight;*/
|
||||
sC+=1;
|
||||
float cH = current->mHeight*sC;
|
||||
current->x = x0;
|
||||
current->y = (5+kIconVerticalOffset + kSpacer) + (totalmHeight - cH);
|
||||
//render the stack object
|
||||
current->Render();
|
||||
|
||||
currenty += current->mHeight;
|
||||
}
|
||||
}
|
||||
@@ -1356,6 +1523,7 @@ void ActionStack::Render()
|
||||
((Interruptible *) mObjects[i])->y = currenty + 40;
|
||||
currenty += ((Interruptible *) mObjects[i])->mHeight + 40;
|
||||
}
|
||||
current->mHasFocus = false;//fix stack display
|
||||
mObjects[i]->Render();
|
||||
}
|
||||
}
|
||||
|
||||
+2045
-826
File diff suppressed because it is too large
Load Diff
@@ -18,12 +18,23 @@ CardDescriptor::CardDescriptor()
|
||||
manacostComparisonMode = COMPARISON_NONE;
|
||||
counterComparisonMode = COMPARISON_NONE;
|
||||
convertedManacost = -1;
|
||||
zposComparisonMode = COMPARISON_NONE;
|
||||
zposition = -1;
|
||||
compareName ="";
|
||||
nameComparisonMode = COMPARISON_NONE;
|
||||
colorComparisonMode = COMPARISON_NONE;
|
||||
CDopponentDamaged = 0;
|
||||
CDcontrollerDamaged = 0;
|
||||
CDdamager = 0;
|
||||
CDgeared = 0;
|
||||
CDblocked = 0;
|
||||
CDcanProduceC = 0;
|
||||
CDcanProduceG = 0;
|
||||
CDcanProduceU = 0;
|
||||
CDcanProduceR = 0;
|
||||
CDcanProduceB = 0;
|
||||
CDcanProduceW = 0;
|
||||
CDnocolor = 0;
|
||||
}
|
||||
|
||||
int CardDescriptor::init()
|
||||
@@ -49,11 +60,16 @@ void CardDescriptor::unsecuresetfresh(int k)
|
||||
fresh = k;
|
||||
}
|
||||
|
||||
void CardDescriptor::unsecuresetrecent(int j)
|
||||
{
|
||||
entersBattlefield = j;
|
||||
}
|
||||
|
||||
void CardDescriptor::setisMultiColored(int w)
|
||||
{
|
||||
isMultiColored = w;
|
||||
}
|
||||
|
||||
|
||||
void CardDescriptor::setNegativeSubtype(string value)
|
||||
{
|
||||
int id = MTGAllCards::findType(value);
|
||||
@@ -131,6 +147,8 @@ MTGCardInstance * CardDescriptor::match_or(MTGCardInstance * card)
|
||||
return NULL;
|
||||
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
||||
return NULL;
|
||||
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
||||
return NULL;
|
||||
if (nameComparisonMode && compareName != card->name)
|
||||
return NULL;
|
||||
return card;
|
||||
@@ -172,6 +190,8 @@ MTGCardInstance * CardDescriptor::match_and(MTGCardInstance * card)
|
||||
match = NULL;
|
||||
if (manacostComparisonMode && !valueInRange(manacostComparisonMode, card->myconvertedcost, convertedManacost))
|
||||
match = NULL;
|
||||
if (zposComparisonMode && !valueInRange(zposComparisonMode, card->zpos, zposition))
|
||||
match = NULL;
|
||||
if(nameComparisonMode && compareName != card->name)
|
||||
match = NULL;
|
||||
|
||||
@@ -211,6 +231,87 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((entersBattlefield == -1 && card->entersBattlefield) || (entersBattlefield == 1 && !card->entersBattlefield))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDgeared == -1 && card->equipment > 0) || (CDgeared == 1 && card->equipment < 1))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if (CDblocked == -1)
|
||||
{
|
||||
if(!card->isAttacker())
|
||||
match = NULL;
|
||||
else
|
||||
{
|
||||
if(card->isBlocked())
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (CDblocked == 1)
|
||||
{
|
||||
if(!card->isAttacker())
|
||||
match = NULL;
|
||||
else
|
||||
{
|
||||
if(!card->isBlocked())
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (CDcanProduceC == -1)
|
||||
{
|
||||
int count = card->canproduceMana(Constants::MTG_COLOR_ARTIFACT) + card->canproduceMana(Constants::MTG_COLOR_WASTE);
|
||||
if (count)
|
||||
match = NULL;
|
||||
}
|
||||
if (CDcanProduceC == 1)
|
||||
{
|
||||
int count = card->canproduceMana(Constants::MTG_COLOR_ARTIFACT) + card->canproduceMana(Constants::MTG_COLOR_WASTE);
|
||||
if (!count)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDcanProduceG == -1 && card->canproduceMana(Constants::MTG_COLOR_GREEN) == 1) || (CDcanProduceG == 1 && card->canproduceMana(Constants::MTG_COLOR_GREEN) == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDcanProduceU == -1 && card->canproduceMana(Constants::MTG_COLOR_BLUE) == 1) || (CDcanProduceU == 1 && card->canproduceMana(Constants::MTG_COLOR_BLUE) == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDcanProduceR == -1 && card->canproduceMana(Constants::MTG_COLOR_RED) == 1) || (CDcanProduceR == 1 && card->canproduceMana(Constants::MTG_COLOR_RED) == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDcanProduceB == -1 && card->canproduceMana(Constants::MTG_COLOR_BLACK) == 1) || (CDcanProduceB == 1 && card->canproduceMana(Constants::MTG_COLOR_BLACK) == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDcanProduceW == -1 && card->canproduceMana(Constants::MTG_COLOR_WHITE) == 1) || (CDcanProduceW == 1 && card->canproduceMana(Constants::MTG_COLOR_WHITE) == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((CDnocolor == -1 && card->getColor() == 0))
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
else if(CDnocolor == 1)
|
||||
{
|
||||
if(!card->has(Constants::DEVOID))
|
||||
if(card->getColor()>0)
|
||||
match = NULL;
|
||||
}
|
||||
|
||||
if ((isMultiColored == -1 && card->isMultiColored) || (isMultiColored == 1 && !card->isMultiColored))
|
||||
{
|
||||
match = NULL;
|
||||
@@ -301,7 +402,14 @@ MTGCardInstance * CardDescriptor::match(MTGCardInstance * card)
|
||||
}
|
||||
|
||||
//Counters
|
||||
if (anyCounter)
|
||||
if (anyCounter == -1)
|
||||
{
|
||||
if (card->counters->mCount)
|
||||
{
|
||||
match = NULL;
|
||||
}
|
||||
}
|
||||
else if (anyCounter)
|
||||
{
|
||||
if (!(card->counters->mCount))
|
||||
{
|
||||
|
||||
@@ -44,9 +44,11 @@ void CardDisplay::init(MTGGameZone * zone)
|
||||
resetObjects();
|
||||
if (!zone) return;
|
||||
start_item = 0;
|
||||
for (int i = 0; i < zone->nb_cards; i++)
|
||||
vector<MTGCardInstance*> newCD (zone->cards.rbegin(), zone->cards.rend());
|
||||
for (int i = 0; i < zone->nb_cards; i++)//invert display so the top will always be the first one to show
|
||||
{
|
||||
AddCard(zone->cards[i]);
|
||||
//AddCard(zone->cards[i]);
|
||||
AddCard(newCD[i]);
|
||||
}
|
||||
if (mObjects.size()) mObjects[0]->Entering();
|
||||
}
|
||||
@@ -78,7 +80,8 @@ void CardDisplay::Update(float dt)
|
||||
bool update = false;
|
||||
|
||||
if (zone)
|
||||
{
|
||||
{//invert display so the top will always be the first one to show
|
||||
vector<MTGCardInstance*> newCD (zone->cards.rbegin(), zone->cards.rend());
|
||||
int size = zone->cards.size();
|
||||
for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++)
|
||||
{
|
||||
@@ -88,7 +91,7 @@ void CardDisplay::Update(float dt)
|
||||
break;
|
||||
}
|
||||
CardGui * cardg = (CardGui *) mObjects[i];
|
||||
if (cardg->card != zone->cards[i]) update = true;
|
||||
if (cardg->card != newCD[i]) update = true;
|
||||
}
|
||||
}
|
||||
PlayGuiObjectController::Update(dt);
|
||||
@@ -231,11 +234,34 @@ bool CardDisplay::CheckUserInput(JButton key)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CardDisplay::Render()
|
||||
void CardDisplay::Render(bool norect)
|
||||
{
|
||||
|
||||
//norect - code shop
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
//if(norect)
|
||||
// r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(180,5,5,5));
|
||||
|
||||
if(norect)
|
||||
{
|
||||
//info
|
||||
r->FillRect(static_cast<float> (x), static_cast<float> (10), static_cast<float> (nb_displayed_items * 30 + 20), 192,
|
||||
ARGB(200,5,5,5));
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (10), static_cast<float> (nb_displayed_items * 30 + 20), 192,
|
||||
ARGB(255,240,240,240));
|
||||
r->DrawRect(static_cast<float> (x)+1, static_cast<float> (10)+1, static_cast<float> (nb_displayed_items * 30 + 20)-2, 192-2,
|
||||
ARGB(255,89,89,89));
|
||||
|
||||
//navi
|
||||
r->FillRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
ARGB(200,5,5,5));
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
ARGB(255,240,240,240));
|
||||
r->DrawRect(static_cast<float> (x)+1, static_cast<float> (y)+1, static_cast<float> (nb_displayed_items * 30 + 20)-2, 50-2,
|
||||
ARGB(255,89,89,89));
|
||||
}
|
||||
else
|
||||
r->DrawRect(static_cast<float> (x), static_cast<float> (y), static_cast<float> (nb_displayed_items * 30 + 20), 50,
|
||||
ARGB(255,255,255,255));
|
||||
if (!mObjects.size()) return;
|
||||
for (int i = start_item; i < start_item + nb_displayed_items && i < (int)(mObjects.size()); i++)
|
||||
@@ -263,15 +289,37 @@ 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);
|
||||
//Pos pos = Pos(CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 10, 1.0, 0.0, 220);
|
||||
Pos pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 10, 0.80f, 0.0, 220);
|
||||
|
||||
if(norect)
|
||||
pos = Pos((CardGui::BigWidth / 2), CardGui::BigHeight / 2 - 7, 1.0, 0.0, 220);
|
||||
|
||||
int drawMode = DrawMode::kNormal;
|
||||
if (observer)
|
||||
{
|
||||
pos.actY = 145;
|
||||
//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();
|
||||
}
|
||||
if(norect)
|
||||
{
|
||||
mFont->SetColor(ARGB(255,240,230,140));
|
||||
mFont->SetScale(1.5f);
|
||||
mFont->DrawString(cardg->card->data->name.c_str(),SCREEN_WIDTH_F/2,20);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->SetScale(1.0f);
|
||||
string details = "";
|
||||
std::vector<string> txt = cardg->card->data->getFormattedText(true);
|
||||
|
||||
for (std::vector<string>::const_iterator it = txt.begin(); it != txt.end(); ++it)
|
||||
{
|
||||
details.append("\n");
|
||||
details.append(it->c_str());
|
||||
}
|
||||
mFont->DrawString(details.c_str(),SCREEN_WIDTH_F/2,25);
|
||||
}
|
||||
cardg->DrawCard(pos, drawMode);
|
||||
}
|
||||
}
|
||||
|
||||
+286
-70
@@ -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 gdv)
|
||||
{
|
||||
DrawCard(card, inPosition, inMode, thumb, noborder);
|
||||
DrawCard(card, inPosition, inMode, thumb, noborder, gdv);
|
||||
}
|
||||
|
||||
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 gdv)
|
||||
{
|
||||
switch (inMode)
|
||||
{
|
||||
case DrawMode::kNormal:
|
||||
RenderBig(inCard, inPosition, thumb, noborder);
|
||||
RenderBig(inCard, inPosition, thumb, noborder, gdv);
|
||||
break;
|
||||
case DrawMode::kText:
|
||||
AlternateRender(inCard, inPosition);
|
||||
@@ -148,12 +148,22 @@ void CardGui::Render()
|
||||
MTGCard * fcard = MTGCollection()->getCardByName(card->name);
|
||||
quad = game->getResourceManager()->RetrieveCard(fcard, CACHE_THUMB);
|
||||
}
|
||||
if (game && 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 ? 40 / quad->mHeight : 1;
|
||||
float cardScale = quad ? 38 / 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.
|
||||
/* if (card->MeldedFrom.size())
|
||||
cardScale = cardScale + (10 / quad->mHeight);*/
|
||||
float scale = actZ * cardScale;
|
||||
|
||||
JQuadPtr shadow;
|
||||
@@ -244,21 +254,28 @@ void CardGui::Render()
|
||||
highlightborder = game? game->getResourceManager()->GetQuad("white"):WResourceManager::Instance()->GetQuad("white");
|
||||
if(fakeborder)
|
||||
{
|
||||
if(card->has(Constants::CANPLAYFROMGRAVEYARD)||card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))
|
||||
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
|
||||
if(game)
|
||||
{
|
||||
if((card->has(Constants::CANPLAYFROMEXILE)||card->has(Constants::PAYZERO))||
|
||||
((card->has(Constants::CANPLAYFROMGRAVEYARD) || card->has(Constants::TEMPFLASHBACK) || card->getManaCost()->getFlashback()) && game->isInGrave(card)))
|
||||
fakeborder->SetColor(ARGB((int)(actA),7,235,7));//green border
|
||||
else
|
||||
fakeborder->SetColor(ARGB((int)(actA),15,15,15));
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
if (card && card->isTargetted() && highlightborder)
|
||||
if (card && card->forcedBorderA && highlightborder)
|
||||
{
|
||||
highlightborder->SetColor(ARGB(95,255,0,0));
|
||||
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
|
||||
}
|
||||
if (card && card->isTargetter() && highlightborder)
|
||||
if (card && card->forcedBorderB && highlightborder)
|
||||
{
|
||||
highlightborder->SetColor(ARGB(95,0,245,0));
|
||||
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
|
||||
@@ -274,8 +291,32 @@ void CardGui::Render()
|
||||
{
|
||||
if(cv->mHasFocus)
|
||||
{
|
||||
highlightborder->SetColor(ARGB(200,57,28,248));
|
||||
highlightborder->SetColor(ARGB(200,57,28,248));
|
||||
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(card->shackled && card->shackled->isInPlay(game) && highlightborder)
|
||||
{
|
||||
if(mHasFocus)
|
||||
{
|
||||
if(card->has(Constants::SHACKLER))
|
||||
highlightborder->SetColor(ARGB(200,7,98,248));
|
||||
else
|
||||
highlightborder->SetColor(ARGB(200,57,28,248));
|
||||
|
||||
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
|
||||
}
|
||||
if(CardView* cv = dynamic_cast<CardView*>(card->shackled->view))
|
||||
{
|
||||
if(cv->mHasFocus)
|
||||
{
|
||||
if(!card->shackled->has(Constants::SHACKLER))
|
||||
highlightborder->SetColor(ARGB(200,7,98,248));
|
||||
else
|
||||
highlightborder->SetColor(ARGB(200,57,28,248));
|
||||
|
||||
renderer->RenderQuad(highlightborder.get(), actX, actY, actT, (30 * actZ + 1) / 16, 43 * actZ / 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,7 +365,29 @@ void CardGui::Render()
|
||||
//draw line
|
||||
if (game)
|
||||
{
|
||||
if (card && card->isTargetted())
|
||||
JQuadPtr ssMask = card->getObserver()->getResourceManager()->GetQuad("white");
|
||||
|
||||
//choose attacker mask
|
||||
if(game->currentPlayer->hasPossibleAttackers())
|
||||
{
|
||||
if(card->isInPlay(game) && card->isCreature()
|
||||
&& ((!card->canAttack() || (card->attackCost > 0)) && (!card->canAttack(true) || (card->attackPlaneswalkerCost > 0)))
|
||||
&& !card->isPhased && !card->didattacked )
|
||||
{
|
||||
if(game->getCurrentGamePhase() > MTG_PHASE_FIRSTMAIN
|
||||
&& game->getCurrentGamePhase() < MTG_PHASE_SECONDMAIN
|
||||
&& card->controller() == game->currentPlayer )
|
||||
{
|
||||
if(card->controller()->isHuman() && ssMask)
|
||||
{
|
||||
ssMask->SetColor(ARGB(170,64,64,64));
|
||||
renderer->RenderQuad(ssMask.get(), actX, actY, actT, (27 * actZ + 1) / 16, 40 * actZ / 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (card && card->forcedBorderA)
|
||||
{
|
||||
if(card->isTapped())
|
||||
{
|
||||
@@ -336,7 +399,7 @@ void CardGui::Render()
|
||||
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));
|
||||
}
|
||||
if (card && card->isTargetter())
|
||||
if (card && card->forcedBorderB)
|
||||
{
|
||||
if(card->isTapped())
|
||||
{
|
||||
@@ -350,15 +413,34 @@ void CardGui::Render()
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if ((tc && tc->alreadyHasTarget(card)) || (game && card == game->mLayers->actionLayer()->currentActionCard))//paint targets red.
|
||||
{
|
||||
JQuadPtr rMask = card->getObserver()->getResourceManager()->GetQuad("white");
|
||||
rMask->SetColor(ARGB(128,255,0,0));//red
|
||||
renderer->RenderQuad(rMask.get(), actX, actY, actT, (27 * actZ + 1) / 16, 40 * actZ / 16);
|
||||
}
|
||||
if(tc && tc->source && tc->source->view && tc->source->view->actZ >= 1.3 && card == tc->source)//paint the source green while infocus.
|
||||
{
|
||||
JQuadPtr gMask = card->getObserver()->getResourceManager()->GetQuad("white");
|
||||
gMask->SetColor(ARGB(128,0,255,0));//green
|
||||
renderer->RenderQuad(gMask.get(), actX, actY, actT, (27 * actZ + 1) / 16, 40 * actZ / 16);
|
||||
}
|
||||
|
||||
//draws the numbers power/toughness
|
||||
if (card->isCreature())
|
||||
{
|
||||
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,
|
||||
//move up the p/t box by increasing ymody
|
||||
float ymody = ((card->isAttacker()||card->isDefenser())&&card->isTapped())?-6.0f:0.0f;
|
||||
renderer->FillRect(actX - (13 * actZ), actY + ymody + 4 * actZ, 25.5f * actZ, 14 * actZ,
|
||||
ARGB(((static_cast<unsigned char>(actA))/2),0,0,0));
|
||||
renderer->DrawRect(actX - (13 * actZ), actY + 4 * actZ, 25.5f * actZ, 14 * actZ,
|
||||
renderer->DrawRect(actX - (13 * actZ), actY + ymody + 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)
|
||||
@@ -373,43 +455,96 @@ void CardGui::Render()
|
||||
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));//white default
|
||||
mFont->SetScale(actZ);
|
||||
mFont->SetScale(actZ);
|
||||
mFont->DrawString(buffer, actX - 10 * actZ, actY + 7 * actZ);
|
||||
float halfbufferW = (mFont->GetStringWidth(buffer))/2;
|
||||
mFont->DrawString(buffer, actX - halfbufferW, actY + ymody + 7 * actZ);
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
|
||||
string buff = "";
|
||||
string starMark = "";
|
||||
if(card->exerted)
|
||||
starMark += "*";
|
||||
if(card->isToken && !card->isACopier)
|
||||
buff = "T";
|
||||
if(card->isToken && card->isACopier)
|
||||
buff = "CT";
|
||||
if(!card->isToken && card->isACopier)
|
||||
buff = "C";
|
||||
buff = starMark + buff;
|
||||
//if(card->has(Constants::PAYZERO))
|
||||
//buff += "Z";
|
||||
if(card->alias == 1000)
|
||||
if(card->chooseacolor >= 1)
|
||||
{
|
||||
if(card->chooseacolor == 1)
|
||||
buff += "\n-Green";
|
||||
{
|
||||
renderer->FillRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(255,0,255,0));
|
||||
renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,10,10,10));
|
||||
}
|
||||
else if(card->chooseacolor == 2)
|
||||
buff += "\n-Blue";
|
||||
{
|
||||
renderer->FillRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(255,0,206,209));
|
||||
renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,10,10,10));
|
||||
}
|
||||
else if(card->chooseacolor == 3)
|
||||
buff += "\n-Red";
|
||||
{
|
||||
renderer->FillRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(255,255,0,0));
|
||||
renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,10,10,10));
|
||||
}
|
||||
else if(card->chooseacolor == 4)
|
||||
buff += "\n-Black";
|
||||
{
|
||||
renderer->FillRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(255,20,20,20));
|
||||
renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,210,210,210));
|
||||
}
|
||||
else if(card->chooseacolor == 5)
|
||||
buff += "\n-White";
|
||||
{
|
||||
renderer->FillRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(255,250,235,215));
|
||||
renderer->DrawRect(actX - 10 * actZ, actY - (1 * actZ), 6.f,6.f,ARGB(180,10,10,10));
|
||||
}
|
||||
}
|
||||
if(!alternate && buff != "" && game->gameType() == GAME_TYPE_CLASSIC)//it seems that other game modes makes cards as tokens!!! hmmm...
|
||||
if(card->chooseasubtype.size() && !alternate && game)
|
||||
{
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
sprintf(buffer, "%s", card->chooseasubtype.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, actY - (25.3f * actZ));
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
if(!alternate && buff != "" && game)
|
||||
{
|
||||
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, actY - (16 * actZ));
|
||||
mFont->SetScale(actZ);
|
||||
mFont->DrawString(buffer, actX - 10 * actZ, actY - (18.3f * actZ));
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
|
||||
#if !defined (PSP)
|
||||
if(game && game->gameType() == GAME_TYPE_MOMIR)
|
||||
{
|
||||
if(game->isInHand(card) && !card->controller()->isAI())
|
||||
{
|
||||
if ((game->currentPlayer != card->controller()) || (card->controller()->game->playRestrictions->canPutIntoZone(card, card->controller()->game->inPlay) == PlayRestriction::CANT_PLAY))
|
||||
{
|
||||
mFont->SetScale(0.4f);
|
||||
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,0,0));
|
||||
mFont->SetScale(actZ);
|
||||
mFont->DrawString("+", actX - 12 * actZ, actY - (18.8f * actZ));
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFont->SetScale(0.4f);
|
||||
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),0,255,0));
|
||||
mFont->SetScale(actZ);
|
||||
mFont->DrawString("+", actX - 12 * actZ, actY - (18.8f * actZ));
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (card->counters->mCount > 0)
|
||||
{
|
||||
unsigned c = -1;
|
||||
@@ -426,46 +561,39 @@ void CardGui::Render()
|
||||
sprintf(buffer, "%i", card->counters->counters[0]->nb);
|
||||
mFont->SetColor(ARGB(static_cast<unsigned char>(actA),255,255,255));
|
||||
mFont->SetScale(actZ);
|
||||
mFont->DrawString(buffer, actX - 10 * actZ, actY - (12 * actZ));
|
||||
mFont->DrawString(buffer, actX - 10 * actZ, actY - (10.8f * actZ));
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
}
|
||||
|
||||
//shadow that covers the whole card for targetchooser...
|
||||
if (tc && !tc->canTarget(card))
|
||||
{
|
||||
if (!shadow)
|
||||
shadow = card->getObserver()->getResourceManager()->GetQuad("shadow");
|
||||
if (shadow)
|
||||
{
|
||||
shadow->SetColor(ARGB(200,255,255,255));
|
||||
shadow->SetColor(ARGB(190,255,255,255));
|
||||
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 - (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.
|
||||
|
||||
//for necro
|
||||
if(game)
|
||||
{
|
||||
if (card->isTapped())
|
||||
if (!shadow)
|
||||
shadow = card->getObserver()->getResourceManager()->GetQuad("shadow");
|
||||
if (shadow)
|
||||
{
|
||||
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 (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));
|
||||
}
|
||||
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));
|
||||
int myA = 0;
|
||||
if(game && card->has(Constants::NECROED))//no peeking...
|
||||
myA = 255;
|
||||
else
|
||||
myA = 0;
|
||||
|
||||
shadow->SetColor(ARGB(myA,255,255,255));
|
||||
if(myA > 0)
|
||||
renderer->RenderQuad(shadow.get(), actX, actY, actT, (28 * actZ + 1) / 16, 40 * actZ / 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +628,8 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
||||
// Draw the "unknown" card model
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
JQuadPtr q;
|
||||
|
||||
MTGCardInstance * thiscard = dynamic_cast<MTGCardInstance*> (card);
|
||||
int zpos = 0;
|
||||
float x = pos.actX;
|
||||
|
||||
vector<ModRulesBackGroundCardGuiItem *>items = gModRules.cardgui.background;
|
||||
@@ -520,10 +649,19 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
||||
items.clear();
|
||||
if (q.get() && q->mTex)
|
||||
{
|
||||
if(thiscard && thiscard->getObserver())
|
||||
{
|
||||
zpos = thiscard->zpos;
|
||||
}
|
||||
|
||||
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
|
||||
|
||||
float scale = pos.actZ * 250 / q->mHeight;
|
||||
q->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
//new border
|
||||
renderer->FillRoundRect(pos.actX - (scale * q->mWidth / 2)-5.8f,pos.actY - (scale * q->mHeight / 2)-5.8f, (scale * q->mWidth)-0.02f, (scale * q->mHeight)-0.02f, 5.8f,ARGB(255,5,5,5));
|
||||
renderer->DrawRoundRect(pos.actX - (scale * q->mWidth / 2)-5.8f,pos.actY - (scale * q->mHeight / 2)-5.8f, (scale * q->mWidth)-0.02f, (scale * q->mHeight)-0.02f, 5.8f,ARGB(50,240,240,240));
|
||||
//end
|
||||
renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
|
||||
}
|
||||
|
||||
@@ -679,7 +817,7 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
|
||||
if (found != string::npos)
|
||||
{
|
||||
stringstream st;
|
||||
st << card->getMTGId();
|
||||
st << "id:" << card->getMTGId() << " zpos:" << zpos;
|
||||
formattedfield = FormattedData(formattedfield, "mtgid", st.str());
|
||||
}
|
||||
|
||||
@@ -1085,7 +1223,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 gdv)
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
//GameObserver * game = GameObserver::GetInstance();
|
||||
@@ -1093,16 +1231,36 @@ 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;
|
||||
|
||||
JQuadPtr alphabeta = WResourceManager::Instance()->RetrieveTempQuad("alphabeta.png");
|
||||
JQuadPtr quad = thumb ? WResourceManager::Instance()->RetrieveCard(card, RETRIEVE_THUMB)
|
||||
: WResourceManager::Instance()->RetrieveCard(card);
|
||||
MTGCardInstance * kcard = dynamic_cast<MTGCardInstance*>(card);
|
||||
GameObserver * game = NULL;
|
||||
//TargetChooser * tc = NULL;
|
||||
bool myA = true;
|
||||
if(kcard)
|
||||
{
|
||||
game = kcard->getObserver();
|
||||
if(game)
|
||||
{
|
||||
if(kcard->has(Constants::NECROED))
|
||||
myA = false;
|
||||
else
|
||||
myA = true;
|
||||
}
|
||||
}
|
||||
if(kcard && !kcard->isToken && kcard->name != kcard->model->data->name)
|
||||
{
|
||||
MTGCard * fcard = MTGCollection()->getCardByName(kcard->name);
|
||||
quad = WResourceManager::Instance()->RetrieveCard(fcard);
|
||||
}
|
||||
if (quad.get())
|
||||
if (kcard && kcard->hasCopiedToken && !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() && myA)
|
||||
{
|
||||
if (quad->mHeight < quad->mWidth)
|
||||
{
|
||||
@@ -1112,27 +1270,56 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
|
||||
float scale = pos.actZ * 250.f / quad->mHeight;
|
||||
//init setname
|
||||
string cardsetname = setlist[card->setId].c_str();
|
||||
if(!noborder)
|
||||
/*if(!noborder)
|
||||
{
|
||||
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR")
|
||||
{
|
||||
//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));
|
||||
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
|
||||
{
|
||||
//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));
|
||||
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));
|
||||
}
|
||||
}
|
||||
//render card image
|
||||
renderer->RenderQuad(quad.get(), x, pos.actY-2, pos.actT, scale-0.02f, scale-0.02f);
|
||||
}*///disabled this for universal border across game, deck editor, etc...
|
||||
//universal border
|
||||
if((cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
|
||||
&& !options[Options::BLKBORDER].number)
|
||||
{//white border
|
||||
renderer->FillRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(255,248,248,255));
|
||||
renderer->DrawRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(150,20,20,20));
|
||||
}
|
||||
else
|
||||
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale, scale);
|
||||
{//black border
|
||||
renderer->FillRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(255,5,5,5));
|
||||
renderer->DrawRoundRect(pos.actX - (scale * quad->mWidth / 2)-6.f,pos.actY - (scale * quad->mHeight / 2)-5.8f, (scale * quad->mWidth)-0.02f, (scale * quad->mHeight)-0.02f, 5.8f,ARGB(50,240,240,240));
|
||||
}
|
||||
//end new border
|
||||
//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 * 255 / alphabeta->mHeight;
|
||||
alphabeta->SetColor(ARGB((int)pos.actA,255,255,255));
|
||||
renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale);
|
||||
}
|
||||
}
|
||||
float modxscale = (cardsetname =="UNH")?0.015f:0.0f;
|
||||
float modyscale = (cardsetname =="UNH")?0.010f:0.0f;
|
||||
float gdvadd = gdv?0.008f:0.0f;//scale add grid deck view
|
||||
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, (scale-0.005f)+modxscale+gdvadd, (scale-0.005f)+modyscale+gdvadd);
|
||||
|
||||
RenderCountersBig(card, pos);
|
||||
return;
|
||||
@@ -1141,7 +1328,8 @@ 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);
|
||||
if(myA)
|
||||
AlternateRender(card, pos);
|
||||
}
|
||||
|
||||
string CardGui::FormattedData(string data, string replace, string value)
|
||||
@@ -1314,6 +1502,28 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
cd.unsecuresetfresh(1);
|
||||
}
|
||||
}
|
||||
else if (attribute.find("recent") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.unsecuresetrecent(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.unsecuresetrecent(1);
|
||||
}
|
||||
}
|
||||
else if (attribute.find("geared") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd.CDgeared = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd.CDgeared = 1;
|
||||
}
|
||||
}
|
||||
//creature is a level up creature
|
||||
else if (attribute.find("leveler") != string::npos)
|
||||
{
|
||||
@@ -1413,6 +1623,12 @@ bool CardGui::FilterCard(MTGCard * _card,string filter)
|
||||
{
|
||||
cd.setToughness(comparisonCriterion);
|
||||
cd.toughnessComparisonMode = comparisonMode;
|
||||
//zpos restrictions
|
||||
}
|
||||
else if (attribute.find("zpos") != string::npos)
|
||||
{//using > or < don't have effect unless like this: >= or <= or =
|
||||
cd.zposition = comparisonCriterion;
|
||||
cd.zposComparisonMode = comparisonMode;
|
||||
//Manacost restrictions
|
||||
}
|
||||
else if (attribute.find("manacost") != string::npos)
|
||||
|
||||
@@ -41,12 +41,11 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
|
||||
if(!source)
|
||||
return;
|
||||
basicAbilities = source->basicAbilities;
|
||||
origbasicAbilities = source->basicAbilities;
|
||||
LKIbasicAbilities = source->basicAbilities;
|
||||
|
||||
for (size_t i = 0; i < source->types.size(); ++i)
|
||||
types.push_back(source->types[i]);
|
||||
colors = source->colors;
|
||||
colors = source->colors;
|
||||
manaCost.copy(source->getManaCost());
|
||||
//reducedCost.copy(source->getReducedManaCost());
|
||||
//increasedCost.copy(source->getIncreasedManaCost());
|
||||
@@ -57,6 +56,11 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
|
||||
formattedText = source->formattedText;
|
||||
setName(source->name);
|
||||
|
||||
setdoubleFaced(source->doubleFaced);
|
||||
setAICustomCode(source->AICustomCode);
|
||||
setCrewAbility(source->CrewAbility);
|
||||
setPhasedOutAbility(source->PhasedOutAbility);
|
||||
setModularValue(source->ModularValue);
|
||||
power = source->power;
|
||||
toughness = source->toughness;
|
||||
restrictions = source->restrictions ? source->restrictions->clone() : NULL;
|
||||
@@ -78,7 +82,6 @@ CardPrimitive::~CardPrimitive()
|
||||
int CardPrimitive::init()
|
||||
{
|
||||
basicAbilities.reset();
|
||||
origbasicAbilities.reset();
|
||||
|
||||
types.clear();
|
||||
|
||||
@@ -109,6 +112,18 @@ bool CardPrimitive::isSpell()
|
||||
return (!isCreature() && !isLand());
|
||||
}
|
||||
|
||||
bool CardPrimitive::isPermanent()
|
||||
{
|
||||
return (!isSorceryorInstant());
|
||||
}
|
||||
|
||||
bool CardPrimitive::isSorceryorInstant()
|
||||
{
|
||||
if(hasSubtype(Subtypes::TYPE_SORCERY)||hasSubtype(Subtypes::TYPE_INSTANT))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int CardPrimitive::dredge()
|
||||
{
|
||||
return dredgeAmount;
|
||||
@@ -284,19 +299,23 @@ void CardPrimitive::setText(const string& value)
|
||||
* Instead, we format when requested, but only once, and cache the result.
|
||||
* To avoid memory to blow up, in exchange of the cached result, we erase the original string
|
||||
*/
|
||||
const vector<string>& CardPrimitive::getFormattedText()
|
||||
const vector<string>& CardPrimitive::getFormattedText(bool noremove)
|
||||
{
|
||||
if (!text.size())
|
||||
return formattedText;
|
||||
|
||||
std::string::size_type found = text.find_first_of("{}");
|
||||
while (found != string::npos)
|
||||
if(!noremove)
|
||||
{
|
||||
text[found] = '/';
|
||||
found = text.find_first_of("{}", found + 1);
|
||||
while (found != string::npos)
|
||||
{
|
||||
text[found] = '/';
|
||||
found = text.find_first_of("{}", found + 1);
|
||||
}
|
||||
}
|
||||
int defL = noremove?44:0;
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
|
||||
mFont->FormatText(text, formattedText);
|
||||
mFont->FormatText(text, formattedText, defL);
|
||||
|
||||
text = "";
|
||||
|
||||
@@ -319,6 +338,61 @@ void CardPrimitive::addMagicText(string value, string key)
|
||||
magicTexts[key].append(value);
|
||||
}
|
||||
|
||||
void CardPrimitive::setdoubleFaced(const string& value)
|
||||
{
|
||||
doubleFaced = value;
|
||||
std::transform(doubleFaced.begin(), doubleFaced.end(), doubleFaced.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const string& CardPrimitive::getdoubleFaced() const
|
||||
{
|
||||
return doubleFaced;
|
||||
}
|
||||
|
||||
void CardPrimitive::setAICustomCode(const string& value)
|
||||
{
|
||||
AICustomCode = value;
|
||||
std::transform(AICustomCode.begin(), AICustomCode.end(), AICustomCode.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const string& CardPrimitive::getAICustomCode() const
|
||||
{
|
||||
return AICustomCode;
|
||||
}
|
||||
|
||||
void CardPrimitive::setCrewAbility(const string& value)
|
||||
{
|
||||
CrewAbility = value;
|
||||
std::transform(CrewAbility.begin(), CrewAbility.end(), CrewAbility.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const string& CardPrimitive::getCrewAbility() const
|
||||
{
|
||||
return CrewAbility;
|
||||
}
|
||||
|
||||
void CardPrimitive::setPhasedOutAbility(const string& value)
|
||||
{
|
||||
PhasedOutAbility = value;
|
||||
std::transform(PhasedOutAbility.begin(), PhasedOutAbility.end(), PhasedOutAbility.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const string& CardPrimitive::getPhasedOutAbility() const
|
||||
{
|
||||
return PhasedOutAbility;
|
||||
}
|
||||
|
||||
void CardPrimitive::setModularValue(const string& value)
|
||||
{
|
||||
ModularValue = value;
|
||||
std::transform(ModularValue.begin(), ModularValue.end(), ModularValue.begin(), ::tolower);
|
||||
}
|
||||
|
||||
const string& CardPrimitive::getModularValue() const
|
||||
{
|
||||
return ModularValue;
|
||||
}
|
||||
|
||||
void CardPrimitive::setName(const string& value)
|
||||
{
|
||||
name = value;
|
||||
@@ -426,6 +500,9 @@ uint8_t CardPrimitive::ConvertColorToBitMask(int inColor)
|
||||
case Constants::MTG_COLOR_LAND:
|
||||
value = kColorBitMask_Land;
|
||||
break;
|
||||
case Constants::MTG_COLOR_WASTE://the true colorless mana shares the kbitmask of land. kbitmask dictates the color of the quad(no image boarder), and the symbol. nothing more.
|
||||
value = kColorBitMask_Land;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -339,8 +339,14 @@ void CardSelector::Render()
|
||||
active->Render();
|
||||
if (CardView* card = dynamic_cast<CardView*>(active) )
|
||||
{
|
||||
//if(timer > 0)
|
||||
//card->DrawCard(bigpos, mDrawMode);
|
||||
if(timer > 0)
|
||||
card->DrawCard(bigpos, mDrawMode);
|
||||
{
|
||||
float modx = 0.f;
|
||||
Pos npos = Pos(bigpos.x+modx,bigpos.y-4.f,bigpos.zoom-(bigpos.zoom/5),bigpos.t,bigpos.alpha);
|
||||
card->DrawCard(npos, mDrawMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "CarouselDeckView.h"
|
||||
|
||||
const float CarouselDeckView::max_scale = 0.96f;
|
||||
const float CarouselDeckView::max_scale = 0.82f;
|
||||
const float CarouselDeckView::x_center = 180;
|
||||
const float CarouselDeckView::right_border = SCREEN_WIDTH + 180;
|
||||
const float CarouselDeckView::slide_animation_duration = 0.6f;
|
||||
@@ -70,7 +71,7 @@ void CarouselDeckView::UpdateCardPosition(int index)
|
||||
rep.x = x_center + cos((rotation) * M_PI / 12) * (right_border - x_center);
|
||||
rep.scale = max_scale / 1.12f * cos((rep.x - x_center) * 1.5f / (right_border - x_center)) + 0.2f * max_scale * cos(
|
||||
cos((rep.x - x_center) * 0.15f / (right_border - x_center)));
|
||||
rep.y = (SCREEN_HEIGHT_F) / 2.0f + SCREEN_HEIGHT_F * mSlideOffset * (rep.scale + 0.2f);
|
||||
rep.y = (SCREEN_HEIGHT_F) / 2.1f + SCREEN_HEIGHT_F * mSlideOffset * (rep.scale + 0.2f);
|
||||
}
|
||||
|
||||
void CarouselDeckView::Reset()
|
||||
@@ -85,7 +86,8 @@ void CarouselDeckView::Render()
|
||||
{
|
||||
// even though we want to draw the cards in a particular z order for layering, we want to prefetch them
|
||||
// in a different order, ie the center card should appear first, then the adjacent ones
|
||||
if (WResourceManager::Instance()->IsThreaded())
|
||||
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||
{
|
||||
WResourceManager::Instance()->RetrieveCard(mCards[0].card);
|
||||
WResourceManager::Instance()->RetrieveCard(mCards[3].card);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Counters.h"
|
||||
#include "MTGCardInstance.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
Counter::Counter(MTGCardInstance * _target, int _power, int _toughness)
|
||||
{
|
||||
@@ -128,8 +129,9 @@ int Counters::addCounter(const char * _name, int _power, int _toughness, bool _n
|
||||
g->receiveEvent(w);
|
||||
}
|
||||
mCount++;
|
||||
this->target->doDamageTest = 1;
|
||||
this->target->afterDamage();
|
||||
/*the damage test should be handled on game state based effect i think*/
|
||||
//this->target->doDamageTest = 1;
|
||||
//this->target->afterDamage();
|
||||
}
|
||||
delete(e);
|
||||
return mCount;
|
||||
@@ -187,10 +189,13 @@ int Counters::removeCounter(const char * _name, int _power, int _toughness)
|
||||
if (target->suspended && !target->counters->hasCounter("time",0,0))
|
||||
{
|
||||
GameObserver * game = target->getObserver();
|
||||
MTGCardInstance * copy = target->controller()->game->putInZone(target, target->currentZone, target->controller()->game->stack);
|
||||
|
||||
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, NULL,1, 0);
|
||||
game->targetChooser = NULL;
|
||||
MTGAbility *ac = NEW AACastCard(game, game->mLayers->actionLayer()->getMaxId(), target, target, false, false, true, "", "", false, false);
|
||||
MayAbility *ma1 = NEW MayAbility(game, game->mLayers->actionLayer()->getMaxId(), ac->clone(), target, true);
|
||||
MTGAbility *ga1 = NEW GenericAddToGame(game, game->mLayers->actionLayer()->getMaxId(), target, NULL, ma1->clone());
|
||||
SAFE_DELETE(ac);
|
||||
SAFE_DELETE(ma1);
|
||||
ga1->resolve();
|
||||
SAFE_DELETE(ga1);
|
||||
}
|
||||
return mCount;
|
||||
}
|
||||
|
||||
@@ -183,9 +183,9 @@ void Credits::compute(GameObserver* g, GameApp * _app)
|
||||
if (p2->isAI() && g->didWin(p1))
|
||||
{
|
||||
gameLength = time(0) - g->startedAt;
|
||||
value = 400;
|
||||
if (app->gameType != GAME_TYPE_CLASSIC)
|
||||
value = 200;
|
||||
value = 500;
|
||||
if (app->gameType == GAME_TYPE_MOMIR)
|
||||
value = 800;//800 credits for momir
|
||||
int difficulty = options[Options::DIFFICULTY].number;
|
||||
if (options[Options::DIFFICULTY_MODE_UNLOCKED].number && difficulty)
|
||||
{
|
||||
@@ -315,6 +315,7 @@ void Credits::compute(GameObserver* g, GameApp * _app)
|
||||
}
|
||||
|
||||
playerdata->credits += value;
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
PriceList::updateKey();
|
||||
playerdata->taskList->passOneDay();
|
||||
if (playerdata->taskList->getTaskCount() < 6)
|
||||
@@ -360,9 +361,9 @@ void Credits::computeTournament(GameObserver* g, GameApp * _app,bool tournament,
|
||||
PlayerData * playerdata = NEW PlayerData(MTGCollection());
|
||||
if (p2->isAI() && mPlayerWin)
|
||||
{
|
||||
value = 400;
|
||||
if (app->gameType != GAME_TYPE_CLASSIC)
|
||||
value = 200;
|
||||
value = 500;
|
||||
if (app->gameType == GAME_TYPE_MOMIR)
|
||||
value = 800;
|
||||
int difficulty = options[Options::DIFFICULTY].number;
|
||||
if (options[Options::DIFFICULTY_MODE_UNLOCKED].number && difficulty)
|
||||
{
|
||||
@@ -464,6 +465,7 @@ void Credits::computeTournament(GameObserver* g, GameApp * _app,bool tournament,
|
||||
}
|
||||
|
||||
playerdata->credits += value;
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
PriceList::updateKey();
|
||||
playerdata->taskList->passOneDay();
|
||||
if (playerdata->taskList->getTaskCount() < 6)
|
||||
@@ -505,6 +507,14 @@ void Credits::Render()
|
||||
if (!p1)
|
||||
return;
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
#if !defined (PSP)
|
||||
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
|
||||
if (wpTex)
|
||||
{
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
|
||||
r->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
}
|
||||
#endif
|
||||
WFont * f = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
WFont * f2 = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
||||
WFont * f3 = WResourceManager::Instance()->GetWFont(Fonts::MAGIC_FONT);
|
||||
@@ -531,7 +541,8 @@ void Credits::Render()
|
||||
if (unlockedQuad)
|
||||
{
|
||||
showMsg = 0;
|
||||
r->RenderQuad(unlockedQuad.get(), 20, 20);
|
||||
unlockedQuad->SetHotSpot(unlockedQuad->mWidth/2,0);
|
||||
r->RenderQuad(unlockedQuad.get(), SCREEN_WIDTH_F/2, 20, 0, 400.f / unlockedQuad->mWidth, 100.f / unlockedQuad->mHeight);
|
||||
}
|
||||
if (unlockedString.size())
|
||||
{
|
||||
@@ -666,6 +677,7 @@ int Credits::addCreditBonus(int value)
|
||||
{
|
||||
PlayerData * playerdata = NEW PlayerData();
|
||||
playerdata->credits += value;
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
playerdata->save();
|
||||
SAFE_DELETE(playerdata);
|
||||
return value;
|
||||
|
||||
@@ -52,7 +52,10 @@ int Damage::resolve()
|
||||
damage = ev->damage->damage;
|
||||
target = ev->damage->target;
|
||||
if (!damage)
|
||||
{
|
||||
delete (e);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//asorbing effects for cards controller-----------
|
||||
|
||||
@@ -181,6 +184,8 @@ int Damage::resolve()
|
||||
if(!_target->inPlay()->hasAbility(Constants::POISONSHROUD))
|
||||
_target->poisonCount += damage;//this will be changed to poison counters.
|
||||
_target->damageCount += damage;
|
||||
if(typeOfDamage == 2)
|
||||
_target->nonCombatDamage += damage;
|
||||
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
|
||||
{
|
||||
vector<string> values = MTGAllCards::getCreatureValuesById();
|
||||
@@ -199,6 +204,8 @@ int Damage::resolve()
|
||||
if(!_target->inPlay()->hasAbility(Constants::CANTCHANGELIFE))
|
||||
a = target->dealDamage(damage);
|
||||
target->damageCount += damage;
|
||||
if(typeOfDamage == 2)
|
||||
target->nonCombatDamage += damage;
|
||||
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
|
||||
{
|
||||
vector<string> values = MTGAllCards::getCreatureValuesById();
|
||||
@@ -234,6 +241,8 @@ int Damage::resolve()
|
||||
else
|
||||
a = target->dealDamage(damage);
|
||||
target->damageCount += damage;//the amount must be the actual damage so i changed this from 1 to damage, this fixes pdcount and odcount
|
||||
if(typeOfDamage == 2)
|
||||
target->nonCombatDamage += damage;
|
||||
if (target->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE){
|
||||
((MTGCardInstance*)target)->wasDealtDamage = true;
|
||||
((MTGCardInstance*)source)->damageToCreature = true;
|
||||
@@ -251,7 +260,9 @@ int Damage::resolve()
|
||||
target->lifeLostThisTurn += damage;
|
||||
if ( typeOfDamage == 1 && target == source->controller()->opponent() )//add vector prowledtypes.
|
||||
{
|
||||
vector<string> values = MTGAllCards::getCreatureValuesById();
|
||||
source->controller()->dealsdamagebycombat = 1; // for restriction check
|
||||
((MTGCardInstance*)source)->combatdamageToOpponent = true; //check
|
||||
vector<string> values = MTGAllCards::getCreatureValuesById();//getting a weird crash here. rarely.
|
||||
for (size_t i = 0; i < values.size(); ++i)
|
||||
{
|
||||
if ( source->hasSubtype( values[i] ) && find(source->controller()->prowledTypes.begin(), source->controller()->prowledTypes.end(), values[i])==source->controller()->prowledTypes.end() )
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const string& _title, DeckDataWrapper *_selectedDeck, StatsWrapper *stats) :
|
||||
DeckMenu(id, listener, fontId, _title), selectedDeck(_selectedDeck), stw(stats)
|
||||
{
|
||||
backgroundName = "DeckEditorMenuBackdrop";
|
||||
backgroundName = "menubgdeckeditor";
|
||||
mShowDetailsScreen = false;
|
||||
deckTitle = selectedDeck ? selectedDeck->parent->meta_name : "";
|
||||
|
||||
@@ -18,8 +18,17 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
||||
mY = 70;
|
||||
starsOffsetX = 50;
|
||||
|
||||
titleX = 110; // center point in title box
|
||||
titleY = 25;
|
||||
//titleX = 110; // center point in title box
|
||||
if(selectedDeck)
|
||||
{
|
||||
titleX = (SCREEN_WIDTH_F/2.f);
|
||||
titleY = 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
titleX = SCREEN_WIDTH_F/6.5f; // center point in title box
|
||||
titleY = 25;
|
||||
}
|
||||
titleWidth = 180; // width of inner box of title
|
||||
|
||||
descX = 275;
|
||||
@@ -44,15 +53,16 @@ DeckEditorMenu::DeckEditorMenu(int id, JGuiListener* listener, int fontId, const
|
||||
void DeckEditorMenu::Render()
|
||||
{
|
||||
JRenderer *r = JRenderer::GetInstance();
|
||||
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));
|
||||
r->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(200,0,0,0));//bg??
|
||||
|
||||
DeckMenu::Render();
|
||||
if (deckTitle.size() > 0)
|
||||
{
|
||||
float modt = (float)deckTitle.size()/2;
|
||||
WFont *mainFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||
DWORD currentColor = mainFont->GetColor();
|
||||
mainFont->SetColor(ARGB(255,255,255,255));
|
||||
mainFont->DrawString(deckTitle.c_str(), statsX + (statsWidth / 2), statsHeight / 2, JGETEXT_CENTER);
|
||||
mainFont->DrawString(deckTitle.c_str(), (SCREEN_WIDTH_F / 2)-modt, (statsHeight / 2)+4, JGETEXT_CENTER);
|
||||
mainFont->SetColor(currentColor);
|
||||
}
|
||||
|
||||
@@ -66,7 +76,7 @@ void DeckEditorMenu::drawDeckStatistics()
|
||||
|
||||
deckStatsString
|
||||
<< _("------- Deck Summary -----") << endl
|
||||
<< _("Cards: ") << stw->cardCount << endl
|
||||
<< _("Cards: ") << stw->cardCount << " Sideboard: " << selectedDeck->parent->Sideboard.size() << endl
|
||||
<< _("Creatures: ") << setw(2) << stw->countCreatures
|
||||
<< _(" Enchantments: ") << stw->countEnchantments << endl
|
||||
<< _("Instants: ") << setw(4) << stw->countInstants
|
||||
|
||||
@@ -97,13 +97,13 @@ JGuiController(JGE::GetInstance(), id, listener), fontId(fontId), mShowDetailsSc
|
||||
stars = NEW hgeParticleSystem(WResourceManager::Instance()->RetrievePSI("stars.psi", WResourceManager::Instance()->GetQuad("stars").get()));
|
||||
stars->FireAt(mX, mY);
|
||||
|
||||
const string detailedInfoString = _("Detailed Info");
|
||||
const string detailedInfoString = _("info");
|
||||
WFont *descriptionFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
float stringWidth = descriptionFont->GetStringWidth(detailedInfoString.c_str());
|
||||
float boxStartX = detailedInfoBoxX - stringWidth / 2 + 20;
|
||||
|
||||
dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX, detailedInfoBoxY, JGE_BTN_CANCEL);
|
||||
//dismiss button?
|
||||
dismissButton = NEW InteractiveButton( this, DeckMenuConst::kDetailedInfoButtonId, Fonts::MAIN_FONT, detailedInfoString, boxStartX+30, detailedInfoBoxY+4.5f, JGE_BTN_CANCEL);
|
||||
JGuiController::Add(dismissButton, true);
|
||||
|
||||
updateScroller();
|
||||
@@ -117,20 +117,23 @@ void DeckMenu::RenderDeckManaColors()
|
||||
bool displayDeckMana = backgroundName.find("DeckMenuBackdrop") != string::npos;
|
||||
// current set of coordinates puts the mana symbols to the right of the last stat info in the upper right
|
||||
// box of the deck selection screen.
|
||||
float manaIconX = 398;
|
||||
float manaIconY = 55;
|
||||
//float manaIconX = 398;
|
||||
//float manaIconY = 55;
|
||||
float manaIconX = 288;
|
||||
float manaIconY = 248;
|
||||
if (mSelectedDeck &&displayDeckMana)
|
||||
{
|
||||
string deckManaColors = mSelectedDeck->getColorIndex().c_str();
|
||||
if (deckManaColors.size() == 6)
|
||||
if (deckManaColors.size() >= 6)
|
||||
{
|
||||
// due to space constraints don't display icons for colorless mana.
|
||||
for( int colorIdx = Constants::MTG_COLOR_GREEN; colorIdx < Constants::MTG_COLOR_WASTE; ++colorIdx )
|
||||
for( int colorIdx = Constants::MTG_COLOR_ARTIFACT; colorIdx < Constants::MTG_COLOR_WASTE; ++colorIdx )
|
||||
{
|
||||
if ( (deckManaColors.at(colorIdx) == '1') != 0)
|
||||
{
|
||||
JRenderer::GetInstance()->RenderQuad(manaIcons[colorIdx].get(), manaIconX, manaIconY, 0, 0.5f, 0.5f);
|
||||
manaIconX += 15;
|
||||
//JRenderer::GetInstance()->FillCircle(manaIconX,manaIconY,8.5f,ARGB(240,255,255,5));
|
||||
JRenderer::GetInstance()->RenderQuad(manaIcons[colorIdx].get(), manaIconX, manaIconY, 0, 0.6f, 0.6f);
|
||||
manaIconX += 26;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,7 +145,17 @@ void DeckMenu::RenderDeckManaColors()
|
||||
void DeckMenu::RenderBackground()
|
||||
{
|
||||
ostringstream bgFilename;
|
||||
bgFilename << backgroundName << ".png";
|
||||
if(backgroundName == "menubgdeckeditor")
|
||||
bgFilename << backgroundName << ".jpg";
|
||||
else
|
||||
bgFilename << backgroundName << ".png";
|
||||
|
||||
#if defined (PSP)
|
||||
if(backgroundName == "menubgdeckeditor")
|
||||
bgFilename << "pspmenubgdeckeditor.jpg";
|
||||
else
|
||||
bgFilename << "pspdeckmenu.png";
|
||||
#endif
|
||||
|
||||
static bool loadBackground = true;
|
||||
if (loadBackground)
|
||||
@@ -230,7 +243,26 @@ void DeckMenu::Render()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
float height = mHeight;
|
||||
JQuadPtr avatarholder;
|
||||
JQuadPtr menupanel;
|
||||
JQuadPtr menuholder;
|
||||
avatarholder = WResourceManager::Instance()->RetrieveTempQuad("avatarholder.png");//new graphics avatarholder
|
||||
menupanel = WResourceManager::Instance()->RetrieveTempQuad("menupanel.jpg");//new graphics menupanel
|
||||
menuholder = WResourceManager::Instance()->RetrieveTempQuad("menuholder.png");//new graphics menuholder
|
||||
bool inDeckMenu = backgroundName.find("DeckMenuBackdrop") != string::npos;
|
||||
float modAvatarX = 0.f;
|
||||
float modAvatarY = 0.f;
|
||||
|
||||
if(inDeckMenu)
|
||||
{
|
||||
modAvatarX =26.f;
|
||||
modAvatarY =1.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
modAvatarX =-76.f;
|
||||
modAvatarY =-1.5f;
|
||||
}
|
||||
if (!menuInitialized)
|
||||
{
|
||||
initMenuItems();
|
||||
@@ -238,7 +270,16 @@ void DeckMenu::Render()
|
||||
timeOpen = 0;
|
||||
menuInitialized = true;
|
||||
}
|
||||
|
||||
#if !defined (PSP)
|
||||
if (avatarholder.get() && menupanel.get() && inDeckMenu)//bg panel
|
||||
renderer->RenderQuad(menupanel.get(), 225.f, 0, 0 ,SCREEN_WIDTH_F / avatarholder.get()->mWidth, SCREEN_HEIGHT_F / avatarholder.get()->mHeight);
|
||||
|
||||
RenderBackground();//background deck menu
|
||||
mScroller->Render();
|
||||
|
||||
if (menuholder.get() && inDeckMenu)//menuholder
|
||||
renderer->RenderQuad(menuholder.get(), 0, 0, 0 ,SCREEN_WIDTH_F / menuholder.get()->mWidth, SCREEN_HEIGHT_F / menuholder.get()->mHeight);
|
||||
#endif
|
||||
if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen;
|
||||
|
||||
for (int i = startId; i < startId + maxItems; i++)
|
||||
@@ -268,7 +309,7 @@ void DeckMenu::Render()
|
||||
else
|
||||
{
|
||||
dismissButton->setIsSelectionValid(false);
|
||||
}
|
||||
}//detailed info???
|
||||
// display the avatar image
|
||||
string currentAvatarImageName = currentMenuItem->getImageFilename();
|
||||
if (currentAvatarImageName.size() > 0)
|
||||
@@ -276,17 +317,29 @@ void DeckMenu::Render()
|
||||
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad(currentAvatarImageName, TEXTURE_SUB_AVATAR);
|
||||
if(quad.get())
|
||||
{
|
||||
quad->mWidth = 35.f;
|
||||
quad->mHeight = 50.f;
|
||||
float xscale = 37.f / quad->mWidth;//orig 35.f
|
||||
float yscale = 50.f / quad->mHeight;
|
||||
if (currentMenuItem->getText() == "Evil Twin")
|
||||
{
|
||||
JQuad * evil = quad.get();
|
||||
evil->SetHFlip(true);
|
||||
renderer->RenderQuad(quad.get(), avatarX, avatarY);
|
||||
#if !defined (PSP)
|
||||
if (avatarholder.get() && inDeckMenu)
|
||||
renderer->RenderQuad(avatarholder.get(), 0, 0, 0 ,SCREEN_WIDTH_F / avatarholder.get()->mWidth, SCREEN_HEIGHT_F / avatarholder.get()->mHeight);
|
||||
#endif
|
||||
renderer->RenderQuad(quad.get(), avatarX+modAvatarX, avatarY+modAvatarY, 0, xscale, yscale);
|
||||
renderer->DrawRect(avatarX+modAvatarX, avatarY+modAvatarY,37.f,50.f,ARGB(200,3,3,3));
|
||||
evil = NULL;
|
||||
}
|
||||
else
|
||||
renderer->RenderQuad(quad.get(), avatarX, avatarY);
|
||||
{
|
||||
#if !defined (PSP)
|
||||
if (avatarholder.get() && inDeckMenu)
|
||||
renderer->RenderQuad(avatarholder.get(), 0, 0, 0 ,SCREEN_WIDTH_F / avatarholder.get()->mWidth, SCREEN_HEIGHT_F / avatarholder.get()->mHeight);
|
||||
#endif
|
||||
renderer->RenderQuad(quad.get(), avatarX+modAvatarX, avatarY+modAvatarY, 0, xscale, yscale);
|
||||
renderer->DrawRect(avatarX+modAvatarX, avatarY+modAvatarY,37.f,50.f,ARGB(200,3,3,3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +355,10 @@ void DeckMenu::Render()
|
||||
oss << _("Deck: ") << currentMenuItem->getDeckName() << endl;
|
||||
oss << currentMenuItem->getDeckStatsSummary();
|
||||
descriptionFont->SetColor(ARGB(255,255,255,255));
|
||||
descriptionFont->DrawString(oss.str(), statsX, statsY);
|
||||
if(inDeckMenu)
|
||||
descriptionFont->DrawString(oss.str(), statsX+2, statsY-2);
|
||||
else
|
||||
descriptionFont->DrawString(oss.str(), statsX-86, statsY-4);
|
||||
}
|
||||
|
||||
// change the font color of the current menu item
|
||||
@@ -313,16 +369,18 @@ void DeckMenu::Render()
|
||||
currentMenuItem->RenderWithOffset(-DeckMenuConst::kLineHeight * startId);
|
||||
}
|
||||
}
|
||||
|
||||
//psp
|
||||
#if defined (PSP)
|
||||
mScroller->Render();
|
||||
RenderBackground();//background deck menu
|
||||
#endif
|
||||
RenderDeckManaColors();
|
||||
|
||||
if (!title.empty())
|
||||
{
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(title.c_str(), titleX, titleY, JGETEXT_CENTER);
|
||||
}
|
||||
|
||||
mScroller->Render();
|
||||
RenderBackground();
|
||||
RenderDeckManaColors();
|
||||
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
stars->Render();
|
||||
|
||||
@@ -112,10 +112,10 @@ void DeckMenuItem::RenderWithOffset(float yOffset)
|
||||
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("new.png");
|
||||
if (tex)
|
||||
{
|
||||
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 4.0f, tex->mHeight - 4.0f); //avoids weird rectangle aroudn the texture because of bilinear filtering
|
||||
JQuadPtr quad = WResourceManager::Instance()->RetrieveQuad("new.png", 2.0f, 2.0f, tex->mWidth - 0.0f, tex->mHeight - 0.0f); //avoids weird rectangle aroudn the texture because of bilinear filtering
|
||||
quad->SetHotSpot(quad->mWidth/2.0f, quad->mHeight/2.0f);
|
||||
float x = mX + min(ITEM_PX_WIDTH - quad->mWidth, getWidth() )/2 + quad->mWidth/2;
|
||||
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0.5);
|
||||
if (quad) JRenderer::GetInstance()->RenderQuad(quad.get(), x , mY + yOffset + quad->mHeight/2, 0, 16.f / quad->mWidth, 12.f / quad->mHeight);
|
||||
}
|
||||
}
|
||||
mFont->SetScale(SCALE_NORMAL);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "GameOptions.h"
|
||||
#include "CardGui.h"
|
||||
#include "CardDescriptor.h"
|
||||
|
||||
const float DeckView::no_user_activity_show_card_delay = 0.1f;
|
||||
|
||||
@@ -92,7 +93,7 @@ void DeckView::reloadIndexes()
|
||||
}
|
||||
}
|
||||
|
||||
void DeckView::renderCard(int index, int alpha, bool asThumbnail)
|
||||
void DeckView::renderCard(int index, int alpha, bool asThumbnail, bool griddeckview)
|
||||
{
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
@@ -143,14 +144,11 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{//NORMAL VIEW WITH IMAGES
|
||||
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
|
||||
|
||||
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, griddeckview);
|
||||
}
|
||||
//the three DrawCard function above, I intentionally disabled the rendered border when in Deck Editor since the border must be dynamically resized
|
||||
//we can pass variables so the DrawCard method knows what to do to the border but... there must be a better way to do it...
|
||||
int quadAlpha = alpha;
|
||||
if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
|
||||
quadAlpha = 255 - quadAlpha;
|
||||
@@ -167,12 +165,15 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
|
||||
char buffer[4096];
|
||||
sprintf(buffer, "x%i", deck()->count(cardPosition.card));
|
||||
WFont * font = mFont;
|
||||
font->SetScale(1.4f);
|
||||
font->SetColor(ARGB(fontAlpha/2,0,0,0));
|
||||
JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 16, ARGB(fontAlpha/2,0,0,0));
|
||||
font->DrawString(buffer, qtX + 4, qtY + 4);
|
||||
JRenderer::GetInstance()->FillRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,0,0,0));
|
||||
JRenderer::GetInstance()->DrawRect(qtX, qtY, font->GetStringWidth(buffer) + 6, 18, ARGB(fontAlpha/2,240,240,240));
|
||||
font->DrawString(buffer, qtX + 5, qtY + 3);
|
||||
font->SetColor(ARGB(fontAlpha,255,255,255));
|
||||
font->DrawString(buffer, qtX + 2, qtY + 2);
|
||||
font->DrawString(buffer, qtX + 4, qtY + 2);
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
font->SetScale(1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+520
-34
@@ -65,7 +65,7 @@ void ExtraCost::Render()
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(mCostRenderString, 20, 20, JGETEXT_LEFT);
|
||||
mFont->DrawString(mCostRenderString, 40, 20, JGETEXT_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ int ExtraCost::setPayment(MTGCardInstance * card)
|
||||
if (tc)
|
||||
{
|
||||
result = tc->addTarget(card);
|
||||
//this is flawed logic, we need to fix. if there is a target in list
|
||||
//we return targetready instead, the card is not pushed back into list
|
||||
//how ever, it is made the target becuase the result is 1 even if we couldnt
|
||||
//target it with the targetchooser.
|
||||
if (result)
|
||||
{
|
||||
target = card;
|
||||
@@ -94,7 +98,7 @@ ExtraManaCost * ExtraManaCost::clone() const
|
||||
}
|
||||
|
||||
ExtraManaCost::ExtraManaCost(ManaCost * costToPay)
|
||||
: ExtraCost("Pay The Cost",NULL, costToPay)
|
||||
: ExtraCost("\nCost:",NULL, costToPay)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -165,7 +169,7 @@ int SnowCost::isPaymentSet()
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -231,6 +235,37 @@ int SnowCost::doPay()
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Energy Cost
|
||||
EnergyCost * EnergyCost::clone() const
|
||||
{
|
||||
EnergyCost * ec = NEW EnergyCost(*this);
|
||||
return ec;
|
||||
}
|
||||
|
||||
EnergyCost::EnergyCost(int enc) :
|
||||
ExtraCost("Energy"),enc(enc)
|
||||
{
|
||||
}
|
||||
|
||||
int EnergyCost::canPay()
|
||||
{
|
||||
if(source->controller()->energyCount >= enc)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EnergyCost::doPay()
|
||||
{
|
||||
if(source->controller()->energyCount)
|
||||
{
|
||||
source->controller()->energyCount -= enc;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//life cost
|
||||
LifeCost * LifeCost::clone() const
|
||||
{
|
||||
@@ -248,6 +283,8 @@ LifeCost::LifeCost(TargetChooser *_tc)
|
||||
int LifeCost::canPay()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (!_target)
|
||||
return 0;
|
||||
if (_target->controller()->life <= 0 || _target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) ||
|
||||
_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) ||
|
||||
_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
|
||||
@@ -287,13 +324,19 @@ SpecificLifeCost::SpecificLifeCost(TargetChooser *_tc, int slc)
|
||||
|
||||
int SpecificLifeCost::canPay()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if(source->controller()->life >= slc && !source->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
|
||||
!source->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
|
||||
!source->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
/*MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if(_target->controller()->life >= slc && !_target->controller()->inPlay()->hasAbility(Constants::CANTCHANGELIFE) &&
|
||||
!_target->controller()->opponent()->game->battlefield->hasAbility(Constants::CANTPAYLIFE) &&
|
||||
!_target->controller()->game->battlefield->hasAbility(Constants::CANTPAYLIFE))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -425,7 +468,7 @@ DiscardCost * DiscardCost::clone() const
|
||||
}
|
||||
|
||||
DiscardCost::DiscardCost(TargetChooser *_tc) :
|
||||
ExtraCost("Choose card to Discard", _tc)
|
||||
ExtraCost("Discard", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -489,7 +532,7 @@ ToLibraryCost * ToLibraryCost::clone() const
|
||||
}
|
||||
|
||||
ToLibraryCost::ToLibraryCost(TargetChooser *_tc)
|
||||
: ExtraCost("Put a card on top of Library", _tc)
|
||||
: ExtraCost("Move to Library", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -518,7 +561,7 @@ ToGraveCost * ToGraveCost::clone() const
|
||||
}
|
||||
|
||||
ToGraveCost::ToGraveCost(TargetChooser *_tc)
|
||||
: ExtraCost("Move a card to Graveyard", _tc)
|
||||
: ExtraCost("Move to Graveyard", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -601,6 +644,43 @@ int MillExileCost::doPay()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//sac all lands cost
|
||||
SacLandsCost * SacLandsCost::clone() const
|
||||
{
|
||||
SacLandsCost * ec = NEW SacLandsCost(*this);
|
||||
if (tc)
|
||||
ec->tc = tc->clone();
|
||||
return ec;
|
||||
}
|
||||
|
||||
SacLandsCost::SacLandsCost(TargetChooser *_tc)
|
||||
: ExtraCost("Sacrifice All Lands", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
int SacLandsCost::doPay()
|
||||
{
|
||||
MTGGameZone * zone = source->controller()->game->inPlay;
|
||||
for (int j = zone->nb_cards - 1; j >= 0; j--)
|
||||
{
|
||||
MTGCardInstance * card = zone->cards[j];
|
||||
if(card->isLand() && !card->has(Constants::CANTBESACRIFIED))
|
||||
{
|
||||
if (card)
|
||||
{
|
||||
MTGCardInstance * beforeCard = card;
|
||||
source->storedCard = card->createSnapShot();
|
||||
card->controller()->game->putInGraveyard(card);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,card);
|
||||
GameObserver * game = card->owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//unattach cost
|
||||
|
||||
UnattachCost * UnattachCost::clone() const
|
||||
@@ -694,7 +774,7 @@ UnTapCost * UnTapCost::clone() const
|
||||
}
|
||||
|
||||
UnTapCost::UnTapCost() :
|
||||
ExtraCost("UnTap")
|
||||
ExtraCost("Untap")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -737,8 +817,8 @@ TapTargetCost * TapTargetCost::clone() const
|
||||
return ec;
|
||||
}
|
||||
|
||||
TapTargetCost::TapTargetCost(TargetChooser *_tc)
|
||||
: ExtraCost("Tap Target", _tc)
|
||||
TapTargetCost::TapTargetCost(TargetChooser *_tc, bool crew)
|
||||
: ExtraCost("Tap Target", _tc), crew(crew)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -751,6 +831,13 @@ int TapTargetCost::isPaymentSet()
|
||||
target = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (crew && target && target->has(Constants::CANTCREW))
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target->isExtraCostTarget = false;
|
||||
target = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (target)
|
||||
return 1;
|
||||
return 0;
|
||||
@@ -762,8 +849,25 @@ int TapTargetCost::doPay()
|
||||
|
||||
if (target)
|
||||
{
|
||||
source->storedCard = target->createSnapShot();
|
||||
source->storedCard = target->createSnapShot();
|
||||
_target->tap();
|
||||
//crew ability
|
||||
if(crew)
|
||||
{
|
||||
if(_target->getCrewAbility().size())
|
||||
{
|
||||
AbilityFactory af(_target->getObserver());
|
||||
MTGAbility * a = af.parseMagicLine(_target->getCrewAbility(), -1, NULL, source,false,true);
|
||||
MTGAbility * crewAbility = a->clone();
|
||||
SAFE_DELETE(a);
|
||||
crewAbility->oneShot = true;
|
||||
crewAbility->canBeInterrupted = false;
|
||||
crewAbility->target = source;
|
||||
crewAbility->resolve();
|
||||
SAFE_DELETE(crewAbility);
|
||||
}
|
||||
}
|
||||
//end
|
||||
target = NULL;
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
@@ -806,7 +910,7 @@ int UnTapTargetCost::doPay()
|
||||
|
||||
if (target)
|
||||
{
|
||||
source->storedCard = target->createSnapShot();
|
||||
source->storedCard = target->createSnapShot();
|
||||
_target->untap();
|
||||
target = NULL;
|
||||
if (tc)
|
||||
@@ -855,7 +959,7 @@ BounceTargetCost * BounceTargetCost::clone() const
|
||||
}
|
||||
|
||||
BounceTargetCost::BounceTargetCost(TargetChooser *_tc)
|
||||
: ExtraCost("Return Target to Hand", _tc)
|
||||
: ExtraCost("Move to Hand", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -884,7 +988,7 @@ Ninja * Ninja::clone() const
|
||||
}
|
||||
|
||||
Ninja::Ninja(TargetChooser *_tc) :
|
||||
ExtraCost("Select unblocked attacker", _tc)
|
||||
ExtraCost("Choose Unblocked Card", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -925,6 +1029,265 @@ int Ninja::doPay()
|
||||
|
||||
//endbouncetargetcostforninja
|
||||
|
||||
//Convoke
|
||||
Convoke * Convoke::clone() const
|
||||
{
|
||||
Convoke * ec = NEW Convoke(*this);
|
||||
if (tc)
|
||||
ec->tc = tc->clone();
|
||||
return ec;
|
||||
}
|
||||
|
||||
Convoke::Convoke(TargetChooser *_tc) :
|
||||
ExtraCost("Choose Cards To Tap", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
int Convoke::canPay()
|
||||
{
|
||||
return isPaymentSet();
|
||||
}
|
||||
|
||||
int Convoke::isPaymentSet()
|
||||
{
|
||||
if (target && target->isTapped())
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target->isExtraCostTarget = false;
|
||||
target = NULL;
|
||||
return 0;
|
||||
}
|
||||
ManaCost * toReduce = getReduction();
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
target = NULL;
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
SAFE_DELETE(toReduce);
|
||||
return 1;
|
||||
}
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ManaCost * Convoke::getReduction()
|
||||
{
|
||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||
tc->maxtargets = source->getManaCost()->getConvertedCost();
|
||||
if (tc->getNbTargets())
|
||||
{
|
||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
bool next = false;
|
||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
||||
{
|
||||
if (next == true)
|
||||
break;
|
||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
||||
{
|
||||
toReduce->remove(i, 1);
|
||||
next = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
next = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if we didnt find it payable one way, lets try again backwards.
|
||||
if (!source->controller()->getManaPool()->canAfford(toReduce))
|
||||
{
|
||||
SAFE_DELETE(toReduce);
|
||||
toReduce = NEW ManaCost(source->getManaCost());
|
||||
for (vector<Targetable*>::reverse_iterator it = targetlist.rbegin(); it != targetlist.rend(); it++)
|
||||
{
|
||||
bool next = false;
|
||||
for (int i = Constants::MTG_COLOR_GREEN; i <= Constants::MTG_COLOR_WHITE; ++i)
|
||||
{
|
||||
if (next == true)
|
||||
break;
|
||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||
if ((targetCard->getManaCost()->hasColor(i) || targetCard->hasColor(i)) && toReduce->hasColor(i))
|
||||
{
|
||||
toReduce->remove(i, 1);
|
||||
next = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
next = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return toReduce;
|
||||
}
|
||||
|
||||
int Convoke::doPay()
|
||||
{
|
||||
if (target && tc->getNbTargets())
|
||||
{
|
||||
ManaCost * toReduce = getReduction();
|
||||
target->controller()->getManaPool()->pay(toReduce);
|
||||
SAFE_DELETE(toReduce);
|
||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||
source->storedCard = targetCard->createSnapShot();
|
||||
targetCard->tap();
|
||||
}
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//DELVE
|
||||
Delve * Delve::clone() const
|
||||
{
|
||||
Delve * ec = NEW Delve(*this);
|
||||
if (tc)
|
||||
ec->tc = tc->clone();
|
||||
return ec;
|
||||
}
|
||||
|
||||
Delve::Delve(TargetChooser *_tc) :
|
||||
ExtraCost("Choose Cards To Exile", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
int Delve::canPay()
|
||||
{
|
||||
return isPaymentSet();
|
||||
}
|
||||
|
||||
int Delve::isPaymentSet()
|
||||
{
|
||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||
tc->maxtargets = source->getManaCost()->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||
if (tc->getNbTargets())
|
||||
{
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||
}
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
target = NULL;
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
if (target->getObserver()->guiOpenDisplay)
|
||||
target->getObserver()->ButtonPressed(target->getObserver()->guiOpenDisplay);
|
||||
SAFE_DELETE(toReduce);
|
||||
return 1;
|
||||
}
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Delve::doPay()
|
||||
{
|
||||
if (target && tc->getNbTargets())
|
||||
{
|
||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||
|
||||
target->controller()->getManaPool()->pay(toReduce);
|
||||
SAFE_DELETE(toReduce);
|
||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||
source->storedCard = targetCard->createSnapShot();
|
||||
targetCard->controller()->game->putInExile(targetCard);
|
||||
}
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//IMPROVISE
|
||||
Improvise * Improvise::clone() const
|
||||
{
|
||||
Improvise * ec = NEW Improvise(*this);
|
||||
if (tc)
|
||||
ec->tc = tc->clone();
|
||||
return ec;
|
||||
}
|
||||
|
||||
Improvise::Improvise(TargetChooser *_tc) :
|
||||
ExtraCost("Choose Artifacts to Tap", _tc)
|
||||
{
|
||||
}
|
||||
|
||||
int Improvise::canPay()
|
||||
{
|
||||
return isPaymentSet();
|
||||
}
|
||||
|
||||
int Improvise::isPaymentSet()
|
||||
{
|
||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||
tc->maxtargets = source->getManaCost()->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||
if (tc->getNbTargets())
|
||||
{
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||
}
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
target = NULL;
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(toReduce)))
|
||||
{
|
||||
/*if (target->getObserver()->guiOpenDisplay)
|
||||
target->getObserver()->ButtonPressed(target->getObserver()->guiOpenDisplay);*/
|
||||
SAFE_DELETE(toReduce);
|
||||
return 1;
|
||||
}
|
||||
SAFE_DELETE(toReduce);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Improvise::doPay()
|
||||
{
|
||||
if (target && tc->getNbTargets())
|
||||
{
|
||||
ManaCost * toReduce = NEW ManaCost(source->getManaCost());
|
||||
|
||||
toReduce->remove(Constants::MTG_COLOR_ARTIFACT, tc->getNbTargets());
|
||||
|
||||
target->controller()->getManaPool()->pay(toReduce);
|
||||
SAFE_DELETE(toReduce);
|
||||
vector<Targetable*>targetlist = tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
MTGCardInstance * targetCard = dynamic_cast<MTGCardInstance*>(*it);
|
||||
source->storedCard = targetCard->createSnapShot();
|
||||
targetCard->tap();
|
||||
}
|
||||
if (tc)
|
||||
tc->initTargets();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
///////////////
|
||||
//Sacrifice target as cost for Offering
|
||||
Offering * Offering::clone() const
|
||||
{
|
||||
@@ -934,8 +1297,8 @@ Offering * Offering::clone() const
|
||||
return ec;
|
||||
}
|
||||
|
||||
Offering::Offering(TargetChooser *_tc) :
|
||||
ExtraCost("Select creature to offer", _tc)
|
||||
Offering::Offering(TargetChooser *_tc,bool emerge) :
|
||||
ExtraCost("Choose Creature to Offer", _tc), emerge(emerge)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -943,28 +1306,95 @@ int Offering::canPay()
|
||||
{
|
||||
if (target && target->has(Constants::CANTBESACRIFIED))
|
||||
return 0;
|
||||
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
if (emerge)
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
return 0;
|
||||
if (target)
|
||||
{
|
||||
ManaCost * reduced = NEW ManaCost(source->getManaCost()->getAlternative());
|
||||
reduced->extraCosts = NULL;
|
||||
reduced->remove(Constants::MTG_COLOR_ARTIFACT, target->getManaCost()->getConvertedCost());
|
||||
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(reduced)))
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
SAFE_DELETE(reduced);
|
||||
return 0;
|
||||
}
|
||||
if (target && source->controller()->getManaPool()->canAfford(reduced))
|
||||
{
|
||||
SAFE_DELETE(reduced);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
ManaCost * diff = source->getManaCost()->Diff(target->getManaCost());
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
{
|
||||
SAFE_DELETE(diff);
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
{
|
||||
SAFE_DELETE(diff);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Offering::isPaymentSet()
|
||||
{
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
if (emerge)
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
return 0;
|
||||
if (target)
|
||||
{
|
||||
ManaCost * reduced = NEW ManaCost(source->getManaCost()->getAlternative());
|
||||
reduced->extraCosts = NULL;
|
||||
reduced->remove(Constants::MTG_COLOR_ARTIFACT, target->getManaCost()->getConvertedCost());
|
||||
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(reduced)))
|
||||
{
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
SAFE_DELETE(reduced);
|
||||
return 0;
|
||||
}
|
||||
if (target && source->controller()->getManaPool()->canAfford(reduced))
|
||||
{
|
||||
SAFE_DELETE(reduced);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
ManaCost * diff = source->getManaCost()->Diff(target->getManaCost());
|
||||
if (target && (!source->controller()->getManaPool()->canAfford(diff)))
|
||||
{
|
||||
SAFE_DELETE(diff);
|
||||
tc->removeTarget(target);
|
||||
target = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(diff)))
|
||||
{
|
||||
SAFE_DELETE(diff);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target && (source->controller()->getManaPool()->canAfford(source->getManaCost()->Diff(target->getManaCost()))))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -972,7 +1402,20 @@ int Offering::doPay()
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
target->controller()->getManaPool()->pay(source->getManaCost()->Diff(target->getManaCost()));
|
||||
if (emerge)
|
||||
{
|
||||
ManaCost * reduced = NEW ManaCost(source->getManaCost()->getAlternative());
|
||||
reduced->extraCosts = NULL;
|
||||
reduced->remove(Constants::MTG_COLOR_ARTIFACT, target->getManaCost()->getConvertedCost());
|
||||
target->controller()->getManaPool()->pay(reduced);
|
||||
SAFE_DELETE(reduced);
|
||||
}
|
||||
else
|
||||
{
|
||||
ManaCost * diff = source->getManaCost()->Diff(target->getManaCost());
|
||||
target->controller()->getManaPool()->pay(diff);
|
||||
SAFE_DELETE(diff);
|
||||
}
|
||||
MTGCardInstance * beforeCard = target;
|
||||
source->storedCard = target->createSnapShot();
|
||||
target->controller()->game->putInGraveyard(target);
|
||||
@@ -1212,12 +1655,45 @@ int ExtraCosts::tryToSetPayment(MTGCardInstance * card)
|
||||
{
|
||||
for(size_t k = 0; k < costs.size(); k++)
|
||||
{
|
||||
if(card == costs[k]->target)
|
||||
if (card == costs[k]->target)
|
||||
{
|
||||
//tapping or sacrificing a target to pay for its own cost
|
||||
//is allowed, unless the source is already being tapped and contains a tap target
|
||||
//or sacced and contains a sactarget
|
||||
//cost like {t}{s(creature)} the source is allowed to be targeted for this
|
||||
//if it is a creature. these cases below should be added whenever we a need
|
||||
//for extra cost that have both a source and target version used on cards.
|
||||
if (dynamic_cast<TapCost*>(costs[k]))
|
||||
{
|
||||
for (size_t tapCheck = 0; tapCheck < costs.size(); tapCheck++)
|
||||
{
|
||||
if (dynamic_cast<TapTargetCost*>(costs[tapCheck]))
|
||||
{
|
||||
return 0;//{t}{t(creature)}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (SacrificeCost * checking = dynamic_cast<SacrificeCost*>(costs[k]))
|
||||
{
|
||||
for (size_t sacCheck = 0; sacCheck < costs.size(); sacCheck++)
|
||||
{
|
||||
SacrificeCost * checking2 = dynamic_cast<SacrificeCost*>(costs[sacCheck]);
|
||||
if (checking2)
|
||||
if ((checking->tc != NULL && checking2->tc == NULL)
|
||||
|| (checking->tc == NULL && checking2->tc != NULL))
|
||||
{
|
||||
return 0; //{s}{s(creature)}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (int result = costs[i]->setPayment(card))
|
||||
{
|
||||
card->isExtraCostTarget = true;
|
||||
//card->isExtraCostTarget = true;//moved to gameobserver, flawed logic was setting this to true even when it wasnt really a target
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1254,10 +1730,20 @@ int ExtraCosts::doPay()
|
||||
int result = 0;
|
||||
for (size_t i = 0; i < costs.size(); i++)
|
||||
{
|
||||
if(costs[i]->target)
|
||||
if(costs[i]->target)//todo deprecate this let gameobserver control this.
|
||||
{
|
||||
costs[i]->target->isExtraCostTarget = false;
|
||||
}
|
||||
if (costs[i]->tc)
|
||||
{
|
||||
vector<Targetable*>targetlist = costs[i]->tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
costs[i]->target = dynamic_cast<MTGCardInstance*>(*it);
|
||||
costs[i]->doPay();
|
||||
}
|
||||
}
|
||||
else
|
||||
result += costs[i]->doPay();
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -40,6 +40,7 @@ JMusic * GameApp::music = NULL;
|
||||
string GameApp::currentMusicFile = "";
|
||||
string GameApp::systemError = "";
|
||||
char GameApp::mynbcardsStr[512] = {0};
|
||||
int GameApp::mycredits = 0;
|
||||
|
||||
vector<JQuadPtr > manaIcons;
|
||||
|
||||
@@ -228,10 +229,15 @@ void GameApp::Create()
|
||||
LOG("--Loading various textures");
|
||||
// Load in this function only textures that are used frequently throughout the game. These textures will constantly stay in Ram, so be frugal
|
||||
WResourceManager::Instance()->RetrieveTexture("phasebar.png", RETRIEVE_MANAGE);
|
||||
WResourceManager::Instance()->RetrieveTexture("wood.png", RETRIEVE_MANAGE);
|
||||
WResourceManager::Instance()->RetrieveTexture("gold.png", RETRIEVE_MANAGE);
|
||||
WResourceManager::Instance()->RetrieveTexture("goldglow.png", RETRIEVE_MANAGE);
|
||||
//WResourceManager::Instance()->RetrieveTexture("wood.png", RETRIEVE_MANAGE);
|
||||
//WResourceManager::Instance()->RetrieveTexture("gold.png", RETRIEVE_MANAGE);
|
||||
//WResourceManager::Instance()->RetrieveTexture("goldglow.png", RETRIEVE_MANAGE);
|
||||
#if !defined (PSP)
|
||||
WResourceManager::Instance()->RetrieveTexture("backdrop.jpg", RETRIEVE_MANAGE);
|
||||
WResourceManager::Instance()->RetrieveTexture("backdropframe.png", RETRIEVE_MANAGE);
|
||||
#else
|
||||
WResourceManager::Instance()->RetrieveTexture("pspbackdrop.jpg", RETRIEVE_MANAGE);
|
||||
#endif
|
||||
WResourceManager::Instance()->RetrieveTexture("handback.png", RETRIEVE_MANAGE);
|
||||
WResourceManager::Instance()->RetrieveTexture("shadows.png", RETRIEVE_MANAGE);
|
||||
|
||||
|
||||
+339
-252
@@ -50,9 +50,11 @@ void GameObserver::cleanup()
|
||||
replacementEffects = NEW ReplacementEffects();
|
||||
combatStep = BLOCKERS;
|
||||
connectRule = false;
|
||||
LPWeffect = false;
|
||||
actionsList.clear();
|
||||
gameTurn.clear();
|
||||
OpenedDisplay = NULL;
|
||||
OpenedDisplay = NULL;
|
||||
AffinityNeedsUpdate = false;
|
||||
}
|
||||
|
||||
GameObserver::~GameObserver()
|
||||
@@ -97,13 +99,15 @@ GameObserver::GameObserver(WResourceManager *output, JGE* input)
|
||||
targetChooser = NULL;
|
||||
cardWaitingForTargets = NULL;
|
||||
mExtraPayment = NULL;
|
||||
OpenedDisplay = NULL;
|
||||
OpenedDisplay = NULL;
|
||||
guiOpenDisplay = NULL;
|
||||
gameOver = NULL;
|
||||
phaseRing = NULL;
|
||||
replacementEffects = NEW ReplacementEffects();
|
||||
combatStep = BLOCKERS;
|
||||
mRules = NULL;
|
||||
connectRule = false;
|
||||
LPWeffect = false;
|
||||
mLoading = false;
|
||||
mLayers = NULL;
|
||||
mTrash = new Trash();
|
||||
@@ -208,11 +212,14 @@ void GameObserver::nextGamePhase()
|
||||
{
|
||||
cleanupPhase();
|
||||
currentPlayer->damageCount = 0;
|
||||
currentPlayer->nonCombatDamage = 0;
|
||||
currentPlayer->drawCounter = 0;
|
||||
currentPlayer->raidcount = 0;
|
||||
currentPlayer->dealsdamagebycombat = 0; //clear check for restriction
|
||||
currentPlayer->opponent()->raidcount = 0;
|
||||
currentPlayer->prowledTypes.clear();
|
||||
currentPlayer->opponent()->damageCount = 0; //added to clear odcount
|
||||
currentPlayer->opponent()->nonCombatDamage = 0;
|
||||
currentPlayer->preventable = 0;
|
||||
mLayers->actionLayer()->cleanGarbage(); //clean abilities history for this turn;
|
||||
mLayers->stackLayer()->garbageCollect(); //clean stack history for this turn;
|
||||
@@ -246,6 +253,8 @@ void GameObserver::nextGamePhase()
|
||||
currentPlayer->prowledTypes.clear();
|
||||
currentPlayer->lifeLostThisTurn = 0;
|
||||
currentPlayer->opponent()->lifeLostThisTurn = 0;
|
||||
currentPlayer->lifeGainedThisTurn = 0;
|
||||
currentPlayer->opponent()->lifeGainedThisTurn = 0;
|
||||
currentPlayer->doesntEmpty->remove(currentPlayer->doesntEmpty);
|
||||
currentPlayer->opponent()->doesntEmpty->remove(currentPlayer->opponent()->doesntEmpty);
|
||||
nextPlayer();
|
||||
@@ -327,11 +336,11 @@ void GameObserver::userRequestNextGamePhase(bool allowInterrupt, bool log)
|
||||
// Here's what I find weird - if the extra cost is something like a sacrifice, doesn't that imply a TargetChooser?
|
||||
if (WaitForExtraPayment(NULL))
|
||||
return;
|
||||
/*if (OpenedDisplay)//dont let us fly through all the phases with grave and library box still open.
|
||||
{
|
||||
return;//I want this here, but it locks up on opponents turn, we need to come up with a clever way to close opened
|
||||
//displays, it makes no sense that you travel through 4 or 5 phases with library or grave still open.
|
||||
}*/
|
||||
/*if (OpenedDisplay)//dont let us fly through all the phases with grave and library box still open.
|
||||
{
|
||||
return;//I want this here, but it locks up on opponents turn, we need to come up with a clever way to close opened
|
||||
//displays, it makes no sense that you travel through 4 or 5 phases with library or grave still open.
|
||||
}*/
|
||||
Phase * cPhaseOld = phaseRing->getCurrentPhase();
|
||||
if (allowInterrupt && ((cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == ORDER)
|
||||
|| (cPhaseOld->id == MTG_PHASE_COMBATBLOCKERS && combatStep == TRIGGERS)
|
||||
@@ -635,16 +644,16 @@ void GameObserver::gameStateBasedEffects()
|
||||
if (players[d]->snowManaW < 0)
|
||||
players[d]->snowManaW = 0;
|
||||
|
||||
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile };
|
||||
for (int k = 0; k < 5; k++)
|
||||
MTGGameZone * dzones[] = { players[d]->game->inPlay, players[d]->game->graveyard, players[d]->game->hand, players[d]->game->library, players[d]->game->exile, players[d]->game->stack };
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
MTGGameZone * zone = dzones[k];
|
||||
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0)
|
||||
{
|
||||
for (int c = zone->nb_cards - 1; c >= 0; c--)
|
||||
{
|
||||
zone->cards[c]->cardistargetted = 0;
|
||||
zone->cards[c]->cardistargetter = 0;
|
||||
zone->cards[c]->forcedBorderA = 0;
|
||||
zone->cards[c]->forcedBorderB = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,6 +668,25 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->removeColor(i);
|
||||
}
|
||||
}
|
||||
//reset alternate paid
|
||||
if(card && (isInGrave(card)||isInHand(card)||isInExile(card)))
|
||||
{
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++)
|
||||
card->alternateCostPaid[i] = 0;
|
||||
}
|
||||
//test zone position
|
||||
if(card && (isInGrave(card)||isInHand(card)||isInExile(card)))
|
||||
{
|
||||
card->zpos = w+1;
|
||||
}
|
||||
else if(card && (isInLibrary(card)))
|
||||
{//invert so we get the top one...
|
||||
int onum = w+1;
|
||||
card->zpos = abs(onum - zone->nb_cards)+1;
|
||||
}
|
||||
//last controller override
|
||||
if(card && zone->owner)
|
||||
card->lastController = zone->owner;
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +694,10 @@ void GameObserver::gameStateBasedEffects()
|
||||
players[d]->DeadLifeState();
|
||||
}
|
||||
////////////////////////////////////
|
||||
|
||||
//i think this must be limited to reveal display only but we can make an auto close like on android after a targetchooser...
|
||||
//lets see so far... adding this fixes some cards that rely on card count in hand or library or any zone the needs constant card count...
|
||||
if (OpenedDisplay && (players[0]->game->reveal->cards.size() || players[1]->game->reveal->cards.size()))
|
||||
return;
|
||||
if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
|
||||
return;
|
||||
if (mLayers->actionLayer()->menuObject)
|
||||
@@ -684,6 +715,7 @@ void GameObserver::gameStateBasedEffects()
|
||||
for (int j = zone->nb_cards - 1; j >= 0; j--)
|
||||
{
|
||||
MTGCardInstance * card = zone->cards[j];
|
||||
card->entersBattlefield = 0;
|
||||
card->LKIpower = card->power;
|
||||
card->LKItoughness = card->toughness;
|
||||
card->LKIbasicAbilities = card->basicAbilities;
|
||||
@@ -715,12 +747,33 @@ void GameObserver::gameStateBasedEffects()
|
||||
}
|
||||
}
|
||||
card->bypassTC = false; //turn off bypass
|
||||
///////////////////////////
|
||||
//reset extracost shadows//
|
||||
///////////////////////////
|
||||
card->isExtraCostTarget = false;
|
||||
if (mExtraPayment != NULL)
|
||||
{
|
||||
for (unsigned int ec = 0; ec < mExtraPayment->costs.size(); ec++)
|
||||
{
|
||||
|
||||
if (mExtraPayment->costs[ec]->tc)
|
||||
{
|
||||
vector<Targetable*>targetlist = mExtraPayment->costs[ec]->tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
Targetable * cardMasked = *it;
|
||||
dynamic_cast<MTGCardInstance*>(cardMasked)->isExtraCostTarget = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//Unattach Equipments that dont have valid targets//
|
||||
////////////////////////////////////////////////////
|
||||
if ((card->target) && card->hasType(Subtypes::TYPE_EQUIPMENT))
|
||||
if (card->hasType(Subtypes::TYPE_EQUIPMENT)||card->hasType("fortification"))
|
||||
{
|
||||
if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card))//protection from quality
|
||||
if(isInPlay(card))
|
||||
{
|
||||
for (size_t i = 1; i < mLayers->actionLayer()->mObjects.size(); i++)
|
||||
{
|
||||
@@ -728,41 +781,36 @@ void GameObserver::gameStateBasedEffects()
|
||||
AEquip * eq = dynamic_cast<AEquip*> (a);
|
||||
if (eq && eq->source == card)
|
||||
{
|
||||
((AEquip*)a)->unequip();
|
||||
if(card->target)//unattach equipments from cards that has protection from quality ex. protection from artifacts
|
||||
{
|
||||
if((card->target)->protectedAgainst(card)||card->isCreature()||(!card->target->isCreature()))
|
||||
((AEquip*)a)->unequip();
|
||||
else if((!card->target->isLand() && card->hasType("fortification")))
|
||||
((AEquip*)a)->unequip();
|
||||
}
|
||||
if(card->controller())
|
||||
((AEquip*)a)->getActionTc()->Owner = card->controller();
|
||||
//fix for equip ability when the equipment changed controller...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//Remove auras that don't have a valid target anymore//
|
||||
///////////////////////////////////////////////////////
|
||||
if (card->target && !isInPlay(card->target) && card->isBestowed && card->hasType("aura"))
|
||||
{
|
||||
card->removeType("aura");
|
||||
card->addType("creature");
|
||||
card->target = NULL;
|
||||
card->isBestowed = false;
|
||||
}
|
||||
if (card->target && !isInPlay(card->target) && card->isBestowed && card->hasType("aura"))
|
||||
{
|
||||
card->removeType("aura");
|
||||
card->addType("creature");
|
||||
card->target = NULL;
|
||||
card->isBestowed = false;
|
||||
}
|
||||
|
||||
if ((card->target||card->playerTarget) && !card->hasType(Subtypes::TYPE_EQUIPMENT))
|
||||
{
|
||||
if(card->target && !isInPlay(card->target))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->target && isInPlay(card->target))
|
||||
{//what exactly does this section do?
|
||||
if(card->spellTargetType.find("creature") != string::npos && !card->target->hasType("creature"))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->spellTargetType.find("artifact") != string::npos && !card->target->hasType("artifact"))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->spellTargetType.find("enchantment") != string::npos && !card->target->hasType("enchantment"))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->spellTargetType.find("land") != string::npos && !card->target->hasType("land"))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
if(card->spellTargetType.find("planeswalker") != string::npos && !card->target->hasType("planeswalker"))
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
if(card->target && isInPlay(card->target) && (card->target)->protectedAgainst(card) && !card->has(Constants::AURAWARD))//protection from quality except aura cards like flickering ward
|
||||
players[i]->game->putInGraveyard(card);
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
card->enchanted = false;
|
||||
if (card->target && isInPlay(card->target) && !card->hasType(Subtypes::TYPE_EQUIPMENT) && card->hasSubtype(Subtypes::TYPE_AURA))
|
||||
@@ -773,17 +821,41 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
card->playerTarget->curses.push_back(card);
|
||||
}
|
||||
///////////////////////////
|
||||
//reset extracost shadows//
|
||||
///////////////////////////
|
||||
card->isExtraCostTarget = false;
|
||||
if(mExtraPayment != NULL)
|
||||
|
||||
//704.5n If an Aura is attached to an illegal object or player,
|
||||
//or is not attached to an object or player, that Aura is put into its owner’s graveyard.
|
||||
if (card->target && isInPlay(card->target) && !card->hasType(Subtypes::TYPE_EQUIPMENT) && card->hasSubtype(Subtypes::TYPE_AURA))
|
||||
{
|
||||
for(unsigned int ec = 0;ec < mExtraPayment->costs.size();ec++)
|
||||
bool unattachB = (!card->target->isCreature() && card->isBestowed)?true:false;
|
||||
bool protectionfromQ = ((card->target)->protectedAgainst(card) && !card->has(Constants::AURAWARD))?true:false;
|
||||
int found = 0;
|
||||
string stypes = card->spellTargetType;
|
||||
if(stypes.size() && !card->hasType("curse"))
|
||||
{
|
||||
if( mExtraPayment->costs[ec]->target)
|
||||
mExtraPayment->costs[ec]->target->isExtraCostTarget = true;
|
||||
if(stypes.find("artifact") != string::npos && card->target->hasType("artifact"))
|
||||
found++;
|
||||
if(stypes.find("creature") != string::npos && card->target->hasType("creature"))
|
||||
found++;
|
||||
if(stypes.find("enchantment") != string::npos && card->target->hasType("enchantment"))
|
||||
found++;
|
||||
if(stypes.find("land") != string::npos && card->target->hasType("land"))
|
||||
found++;
|
||||
if(stypes.find("planeswalker") != string::npos && card->target->hasType("planeswalker"))
|
||||
found++;
|
||||
}
|
||||
|
||||
if((!found || protectionfromQ) && !card->isBestowed)
|
||||
{
|
||||
players[i]->game->putInGraveyard(card);
|
||||
}
|
||||
else if(card->isBestowed && (protectionfromQ || unattachB))
|
||||
{
|
||||
card->removeType("aura");
|
||||
card->addType("creature");
|
||||
card->target = NULL;
|
||||
card->isBestowed = false;
|
||||
}
|
||||
|
||||
}
|
||||
//////////////////////
|
||||
//reset morph hiding//
|
||||
@@ -808,6 +880,9 @@ void GameObserver::gameStateBasedEffects()
|
||||
if(card->view)
|
||||
card->view->alpha = 50;
|
||||
card->initAttackersDefensers();
|
||||
//add event phases out here
|
||||
WEvent * evphaseout = NEW WEventCardPhasesOut(card, turn);
|
||||
receiveEvent(evphaseout);
|
||||
}
|
||||
else if((card->has(Constants::PHASING) || card->isPhased)&& mCurrentGamePhase == MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn)
|
||||
{
|
||||
@@ -815,6 +890,9 @@ void GameObserver::gameStateBasedEffects()
|
||||
card->phasedTurn = turn;
|
||||
if(card->view)
|
||||
card->view->alpha = 255;
|
||||
//add event phases in here
|
||||
WEvent * evphasein = NEW WEventCardPhasesIn(card);
|
||||
receiveEvent(evphasein);
|
||||
}
|
||||
if (card->target && isInPlay(card->target) && (card->hasSubtype(Subtypes::TYPE_EQUIPMENT) || card->hasSubtype(Subtypes::TYPE_AURA)))
|
||||
{
|
||||
@@ -830,6 +908,12 @@ void GameObserver::gameStateBasedEffects()
|
||||
{
|
||||
card->graveEffects = false;
|
||||
card->exileEffects = false;
|
||||
|
||||
if(card->isCreature())
|
||||
{
|
||||
if(card->life < 1 && !card->has(Constants::INDESTRUCTIBLE))
|
||||
card->destroy();//manor gargoyle... recheck
|
||||
}
|
||||
}
|
||||
|
||||
if(card->childrenCards.size())
|
||||
@@ -879,16 +963,46 @@ void GameObserver::gameStateBasedEffects()
|
||||
//checks if a player has a card which has the stated ability in play.
|
||||
Player * p = players[i];
|
||||
MTGGameZone * z = players[i]->game->inPlay;
|
||||
int nbcards = z->nb_cards;
|
||||
//------------------------------
|
||||
p->nomaxhandsize = (z->hasAbility(Constants::NOMAXHAND));
|
||||
|
||||
if(z->hasAbility(Constants::NOMAXHAND)||p->opponent()->inPlay()->hasAbility(Constants::OPPNOMAXHAND))
|
||||
p->nomaxhandsize = true;
|
||||
else
|
||||
p->nomaxhandsize = false;
|
||||
//////////////////////////////////
|
||||
//clear will attack player or pw//
|
||||
//////////////////////////////////
|
||||
if (mCurrentGamePhase == MTG_PHASE_COMBATBLOCKERS)
|
||||
{
|
||||
for (int l = z->nb_cards - 1; l >= 0; l--)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[l];
|
||||
if(c)
|
||||
{
|
||||
c->willattackplayer = 0;
|
||||
c->willattackpw = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
///provoke clear///
|
||||
if (mCurrentGamePhase == MTG_PHASE_COMBATEND)
|
||||
{
|
||||
for (int l = z->nb_cards - 1; l >= 0; l--)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[l];
|
||||
if(c)
|
||||
{
|
||||
c->isProvoked = false;
|
||||
c->ProvokeTarget = NULL;
|
||||
c->Provoker = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////
|
||||
//handle end of turn effects while we're at it.//
|
||||
/////////////////////////////////////////////////
|
||||
if (mCurrentGamePhase == MTG_PHASE_ENDOFTURN+1)
|
||||
{
|
||||
for (int j = 0; j < nbcards; ++j)
|
||||
for (int j = z->nb_cards - 1; j >= 0; j--)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
|
||||
@@ -907,38 +1021,12 @@ void GameObserver::gameStateBasedEffects()
|
||||
c->wasDealtDamage = false;
|
||||
c->damageToController = false;
|
||||
c->damageToOpponent = false;
|
||||
c->combatdamageToOpponent = false;
|
||||
c->damageToCreature = false;
|
||||
c->isAttacking = NULL;
|
||||
}
|
||||
for (int t = 0; t < nbcards; t++)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[t];
|
||||
|
||||
if(!c->isPhased)
|
||||
{
|
||||
if (c->has(Constants::TREASON))
|
||||
{
|
||||
MTGCardInstance * beforeCard = c;
|
||||
p->game->putInGraveyard(c);
|
||||
WEvent * e = NEW WEventCardSacrifice(beforeCard,c);
|
||||
receiveEvent(e);
|
||||
}
|
||||
if (c->has(Constants::UNEARTH))
|
||||
{
|
||||
p->game->putInExile(c);
|
||||
|
||||
}
|
||||
}
|
||||
if(c->modifiedbAbi > 0)
|
||||
{
|
||||
c->modifiedbAbi = 0;
|
||||
c->basicAbilities = c->origbasicAbilities;
|
||||
}
|
||||
if(nbcards > z->nb_cards)
|
||||
{
|
||||
t = 0;
|
||||
nbcards = z->nb_cards;
|
||||
}
|
||||
c->isProvoked = false;
|
||||
c->ProvokeTarget = NULL;
|
||||
c->Provoker = NULL;
|
||||
}
|
||||
|
||||
MTGGameZone * f = p->game->graveyard;
|
||||
@@ -988,13 +1076,16 @@ void GameObserver::gameStateBasedEffects()
|
||||
//Auto skip Phases
|
||||
int skipLevel = (currentPlayer->playMode == Player::MODE_TEST_SUITE || mLoading) ? Constants::ASKIP_NONE
|
||||
: options[Options::ASPHASES].number;
|
||||
|
||||
bool noattackers = currentPlayer->noPossibleAttackers();
|
||||
bool nodiaochan = (currentPlayer->game->battlefield->countByAlias(10544)<1)?true:false;
|
||||
if (skipLevel == Constants::ASKIP_SAFE || skipLevel == Constants::ASKIP_FULL)
|
||||
{
|
||||
if ((opponent()->isAI() && !(isInterrupting)) && ((mCurrentGamePhase == MTG_PHASE_UNTAP)
|
||||
|| (mCurrentGamePhase == MTG_PHASE_DRAW) || (mCurrentGamePhase == MTG_PHASE_COMBATBEGIN)
|
||||
|| ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (currentPlayer->noPossibleAttackers()))
|
||||
|| mCurrentGamePhase == MTG_PHASE_COMBATEND || mCurrentGamePhase == MTG_PHASE_ENDOFTURN
|
||||
|| (mCurrentGamePhase == MTG_PHASE_DRAW)
|
||||
|| ((mCurrentGamePhase == MTG_PHASE_COMBATBEGIN) && (nodiaochan))
|
||||
|| ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (noattackers))
|
||||
|| (mCurrentGamePhase == MTG_PHASE_COMBATEND)
|
||||
|| (mCurrentGamePhase == MTG_PHASE_ENDOFTURN)
|
||||
|| ((mCurrentGamePhase == MTG_PHASE_CLEANUP) && (currentPlayer->game->hand->nb_cards < 8))))
|
||||
userRequestNextGamePhase();
|
||||
}
|
||||
@@ -1004,6 +1095,10 @@ void GameObserver::gameStateBasedEffects()
|
||||
|| mCurrentGamePhase == MTG_PHASE_COMBATDAMAGE))
|
||||
userRequestNextGamePhase();
|
||||
}
|
||||
|
||||
this->LPWeffect = false;
|
||||
//WEventGameStateBasedChecked event checked
|
||||
receiveEvent(NEW WEventGameStateBasedChecked());
|
||||
}
|
||||
|
||||
void GameObserver::enchantmentStatus()
|
||||
@@ -1027,6 +1122,7 @@ void GameObserver::enchantmentStatus()
|
||||
{
|
||||
card->target->enchanted = true;
|
||||
card->target->auras += 1;
|
||||
card->auraParent = card->target;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1038,7 +1134,7 @@ void GameObserver::Affinity()
|
||||
{
|
||||
MTGGameZone * dzones[] = { players[dd]->game->graveyard, players[dd]->game->hand, players[dd]->game->library, players[dd]->game->exile };
|
||||
for (int kk = 0; kk < 4; kk++)
|
||||
{
|
||||
{
|
||||
MTGGameZone * zone = dzones[kk];
|
||||
for (int cc = zone->nb_cards - 1; cc >= 0; cc--)
|
||||
{//start
|
||||
@@ -1046,189 +1142,158 @@ void GameObserver::Affinity()
|
||||
if (!card)
|
||||
continue;
|
||||
|
||||
bool NewAffinityFound = false;
|
||||
for (unsigned int na = 0; na < card->cardsAbilities.size(); na++)
|
||||
{
|
||||
if (!card->cardsAbilities[na])
|
||||
break;
|
||||
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
|
||||
if (newAff)
|
||||
{
|
||||
NewAffinityFound = true;
|
||||
}
|
||||
}
|
||||
bool DoReduceIncrease = false;
|
||||
if (card->has(Constants::AFFINITYARTIFACTS) ||
|
||||
card->has(Constants::AFFINITYFOREST) ||
|
||||
card->has(Constants::AFFINITYGREENCREATURES) ||
|
||||
card->has(Constants::AFFINITYISLAND) ||
|
||||
card->has(Constants::AFFINITYMOUNTAIN) ||
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::TRINISPHERE) ||
|
||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||
card->getReducedManaCost()->getConvertedCost() ||
|
||||
NewAffinityFound)
|
||||
DoReduceIncrease = true;
|
||||
if (!DoReduceIncrease)
|
||||
continue;
|
||||
//above we check if there are even any cards that effect cards manacost
|
||||
//if there are none, leave this function. manacost->copy( is a very expensive funtion
|
||||
//1mb a sec to run at all time even when no known reducers or increasers are in play.
|
||||
//memory snapshot shots pointed to this as such a heavy load that games with many cards inplay
|
||||
//would slow to a crawl.
|
||||
//only do any of the following if a card with the stated ability is in your hand.
|
||||
int color = 0;
|
||||
string type = "";
|
||||
|
||||
ManaCost * original = NEW ManaCost();
|
||||
original->copy(card->model->data->getManaCost());
|
||||
if(card->getIncreasedManaCost()->getConvertedCost()||card->getReducedManaCost()->getConvertedCost())
|
||||
{//start1
|
||||
if(card->getIncreasedManaCost()->getConvertedCost())
|
||||
original->add(card->getIncreasedManaCost());
|
||||
if(card->getReducedManaCost()->getConvertedCost())
|
||||
original->remove(card->getReducedManaCost());
|
||||
if(card->getManaCost())
|
||||
card->getManaCost()->copy(original);
|
||||
if(card->getManaCost()->extraCosts)
|
||||
bool checkAuraP = false;
|
||||
///////////////////////////
|
||||
//reset extracost shadows//
|
||||
///////////////////////////
|
||||
card->isExtraCostTarget = false;
|
||||
if (mExtraPayment != NULL)
|
||||
{
|
||||
for (unsigned int ec = 0; ec < mExtraPayment->costs.size(); ec++)
|
||||
{
|
||||
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
|
||||
{
|
||||
card->getManaCost()->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
}//end1
|
||||
int reducem = 0;
|
||||
bool resetCost = false;
|
||||
for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
|
||||
{//start2
|
||||
if (!card->cardsAbilities[na])
|
||||
break;
|
||||
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
|
||||
if(newAff)
|
||||
{
|
||||
if(!resetCost)
|
||||
{
|
||||
resetCost = true;
|
||||
card->getManaCost()->copy(original);
|
||||
if(card->getManaCost()->extraCosts)
|
||||
{
|
||||
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
|
||||
{
|
||||
card->getManaCost()->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
TargetChooserFactory tf(this);
|
||||
TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL);
|
||||
|
||||
for (int w = 0; w < 2; ++w)
|
||||
if (mExtraPayment->costs[ec]->tc)
|
||||
{
|
||||
Player *p = this->players[w];
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
|
||||
for (int k = 0; k < 6; k++)
|
||||
vector<Targetable*>targetlist = mExtraPayment->costs[ec]->tc->getTargetsFrom();
|
||||
for (vector<Targetable*>::iterator it = targetlist.begin(); it != targetlist.end(); it++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (tcn->targetsZone(z))
|
||||
{
|
||||
reducem += z->countByCanTarget(tcn);
|
||||
}
|
||||
Targetable * cardMasked = *it;
|
||||
dynamic_cast<MTGCardInstance*>(cardMasked)->isExtraCostTarget = true;
|
||||
}
|
||||
|
||||
}
|
||||
SAFE_DELETE(tcn);
|
||||
ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
|
||||
for(int j = 0; j < reducem; j++)
|
||||
card->getManaCost()->remove(removingCost);
|
||||
SAFE_DELETE(removingCost);
|
||||
}
|
||||
}//end2
|
||||
if(card->has(Constants::AFFINITYARTIFACTS)||
|
||||
card->has(Constants::AFFINITYFOREST)||
|
||||
card->has(Constants::AFFINITYGREENCREATURES)||
|
||||
card->has(Constants::AFFINITYISLAND)||
|
||||
card->has(Constants::AFFINITYMOUNTAIN)||
|
||||
card->has(Constants::AFFINITYPLAINS)||
|
||||
card->has(Constants::AFFINITYSWAMP))
|
||||
{//start3
|
||||
if (card->has(Constants::AFFINITYARTIFACTS))
|
||||
{
|
||||
type = "artifact";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYSWAMP))
|
||||
{
|
||||
type = "swamp";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYMOUNTAIN))
|
||||
{
|
||||
type = "mountain";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYPLAINS))
|
||||
{
|
||||
type = "plains";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYISLAND))
|
||||
{
|
||||
type = "island";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYFOREST))
|
||||
{
|
||||
type = "forest";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
color = 1;
|
||||
type = "creature";
|
||||
}
|
||||
card->getManaCost()->copy(original);
|
||||
if(card->getManaCost()->extraCosts)
|
||||
{
|
||||
for(unsigned int i = 0; i < card->getManaCost()->extraCosts->costs.size();i++)
|
||||
{
|
||||
card->getManaCost()->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
int reduce = 0;
|
||||
if(card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
TargetChooserFactory tf(this);
|
||||
TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
|
||||
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
else
|
||||
{
|
||||
reduce = card->controller()->game->battlefield->countByType(type);
|
||||
}
|
||||
for(int i = 0; i < reduce;i++)
|
||||
{
|
||||
if(card->getManaCost()->getCost(color) > 0)
|
||||
card->getManaCost()->remove(color,1);
|
||||
}
|
||||
}//end3
|
||||
//trinisphere... now how to implement kicker recomputation
|
||||
|
||||
if(card->has(Constants::TRINISPHERE))
|
||||
{
|
||||
for(int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)
|
||||
{
|
||||
card->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
card->countTrini++;
|
||||
}
|
||||
}
|
||||
else
|
||||
///we handle trisnisphere seperately because its a desaster.
|
||||
if(card->getManaCost())//make sure we check, abiliy$!/token dont have a mancost object.
|
||||
{
|
||||
if(card->countTrini)
|
||||
if (card->controller()->AuraIncreased->getConvertedCost() || card->controller()->AuraReduced->getConvertedCost())
|
||||
if(card->model->data->getManaCost()->getBestow())
|
||||
checkAuraP = true;
|
||||
|
||||
//change cost to colorless for anytypeofmana ability
|
||||
if(card->has(Constants::ANYTYPEOFMANA))
|
||||
{
|
||||
card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini);
|
||||
card->countTrini=0;
|
||||
card->anymanareplacement = true;
|
||||
int convertedC = card->getManaCost()->getConvertedCost();
|
||||
card->getManaCost()->changeCostTo( NEW ManaCost(ManaCost::parseManaCost("{0}", NULL, card)) );
|
||||
for (int jj = 0; jj < convertedC; jj++)
|
||||
{
|
||||
card->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (card->anymanareplacement)
|
||||
{
|
||||
card->getManaCost()->changeCostTo( card->model->data->getManaCost() );
|
||||
card->anymanareplacement = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (card->has(Constants::TRINISPHERE))
|
||||
{
|
||||
for (int jj = card->getManaCost()->getConvertedCost(); jj < 3; jj++)
|
||||
{
|
||||
card->getManaCost()->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
card->countTrini++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (card->countTrini)
|
||||
{
|
||||
card->getManaCost()->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini);
|
||||
card->countTrini = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
///////////////////////
|
||||
bool NewAffinityFound = false;
|
||||
for (unsigned int na = 0; na < card->cardsAbilities.size(); na++)
|
||||
{
|
||||
if (!card->cardsAbilities[na])
|
||||
break;
|
||||
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
|
||||
if (newAff)
|
||||
{
|
||||
NewAffinityFound = true;
|
||||
}
|
||||
}
|
||||
bool DoReduceIncrease = false;
|
||||
if (
|
||||
(card->has(Constants::AFFINITYARTIFACTS) ||
|
||||
card->has(Constants::AFFINITYFOREST) ||
|
||||
card->has(Constants::AFFINITYGREENCREATURES) ||
|
||||
card->has(Constants::AFFINITYISLAND) ||
|
||||
card->has(Constants::AFFINITYMOUNTAIN) ||
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::CONDUITED) ||
|
||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||
card->getReducedManaCost()->getConvertedCost() ||
|
||||
NewAffinityFound || checkAuraP)
|
||||
&&
|
||||
AffinityNeedsUpdate
|
||||
)
|
||||
DoReduceIncrease = true;
|
||||
if (!DoReduceIncrease)
|
||||
continue;
|
||||
|
||||
//above we check if there are even any cards that effect cards manacost
|
||||
//only do any of the following if a card with the stated ability is in your hand.
|
||||
//kicker is an addon to normal cost, suspend is not casting. add cost as needed EXACTLY as seen below.
|
||||
card->getManaCost()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
|
||||
card->getManaCost()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
if (card->getManaCost()->getAlternative())
|
||||
{
|
||||
card->getManaCost()->getAlternative()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getAlternative(), card->model->data->getManaCost()->getAlternative()));
|
||||
card->getManaCost()->getAlternative()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBestow())
|
||||
{
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(),false,true));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBuyback())
|
||||
{
|
||||
card->getManaCost()->getBuyback()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getBuyback(), card->model->data->getManaCost()->getBuyback()));
|
||||
card->getManaCost()->getBuyback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getFlashback())
|
||||
{
|
||||
card->getManaCost()->getFlashback()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getFlashback(), card->model->data->getManaCost()->getFlashback()));
|
||||
card->getManaCost()->getFlashback()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getMorph())
|
||||
{
|
||||
card->getManaCost()->getMorph()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getMorph(), card->model->data->getManaCost()->getMorph()));
|
||||
card->getManaCost()->getMorph()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getRetrace())
|
||||
{
|
||||
card->getManaCost()->getRetrace()->resetCosts();
|
||||
ManaCost *newCost = NEW ManaCost(card->computeNewCost(card, card->getManaCost()->getRetrace(), card->model->data->getManaCost()->getRetrace()));
|
||||
card->getManaCost()->getRetrace()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
SAFE_DELETE(original);
|
||||
}//end
|
||||
}
|
||||
}
|
||||
AffinityNeedsUpdate = false;
|
||||
}
|
||||
|
||||
void GameObserver::Render()
|
||||
@@ -1607,7 +1672,28 @@ int GameObserver::isInExile(MTGCardInstance * card)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int GameObserver::isInHand(MTGCardInstance * card)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
MTGGameZone * hand = players[i]->game->hand;
|
||||
if (players[i]->game->isInZone(card, hand))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int GameObserver::isInLibrary(MTGCardInstance * card)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
MTGGameZone * library = players[i]->game->library;
|
||||
if (players[i]->game->isInZone(card, library))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void GameObserver::cleanupPhase()
|
||||
{
|
||||
currentPlayer->cleanupPhase();
|
||||
@@ -1638,6 +1724,7 @@ int GameObserver::receiveEvent(WEvent * e)
|
||||
SAFE_DELETE(ev);
|
||||
eventsQueue.pop();
|
||||
}
|
||||
AffinityNeedsUpdate = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ const string Options::optionNames[] = {
|
||||
"cheatmode",
|
||||
"optimizedhand",
|
||||
"cheatmodedecks",
|
||||
"BlackBorder",
|
||||
"ShowTokens",
|
||||
"GDVLargeImages",
|
||||
"CardPrefetching",
|
||||
"displayOSD",
|
||||
"closed_hand",
|
||||
"hand_direction",
|
||||
|
||||
@@ -109,7 +109,11 @@ void GameStateAwards::Start()
|
||||
if (!si->author.size())
|
||||
sprintf(buf, _("%i cards.").c_str(), si->totalCards());
|
||||
else if (si->year > 0 && si->total > 0)
|
||||
sprintf(buf, _("%s (%i): %i/%i cards").c_str(), si->author.c_str(), si->year, si->totalCards(), si->total);
|
||||
{
|
||||
int pr = 0;
|
||||
pr = (si->totalCards()*100)/si->total;
|
||||
sprintf(buf, _("%s (%i): %i%s : %i/%i cards").c_str(), si->author.c_str(), si->year, pr,"%", si->totalCards(), si->total);
|
||||
}
|
||||
else if (si->year > 0)
|
||||
sprintf(buf, _("%s (%i): %i cards").c_str(), si->author.c_str(), si->year, si->totalCards());
|
||||
else
|
||||
@@ -148,7 +152,7 @@ void GameStateAwards::Render()
|
||||
|
||||
JQuadPtr background = WResourceManager::Instance()->RetrieveTempQuad("awardback.jpg", TEXTURE_SUB_5551);
|
||||
if (background.get())
|
||||
r->RenderQuad(background.get(), 0, 0);
|
||||
r->RenderQuad(background.get(), 0, 0, 0, SCREEN_WIDTH_F / background->mWidth, SCREEN_HEIGHT_F / background->mHeight);
|
||||
|
||||
switch (mState)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1037,7 +1037,14 @@ void GameStateDuel::Render()
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
#if !defined (PSP)
|
||||
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
|
||||
if (wpTex)
|
||||
{
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
|
||||
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
}
|
||||
#endif
|
||||
//render the game until someone did win the game (otherwise it crashes sometimes under linux)
|
||||
if (game && !game->didWin())
|
||||
game->Render();
|
||||
@@ -1165,7 +1172,7 @@ void GameStateDuel::Render()
|
||||
opponentMenu->Render();
|
||||
// display the selected player deck name too
|
||||
string selectedPlayerDeckName = _("Player Deck: ").c_str() + game->players[0]->deckName;
|
||||
mFont->DrawString( selectedPlayerDeckName.c_str(), 30, 40);
|
||||
mFont->DrawString( selectedPlayerDeckName.c_str(), (SCREEN_WIDTH / 4) - (mFont->GetStringWidth(selectedPlayerDeckName.c_str())/2)-3, 32);
|
||||
}
|
||||
else if (deckmenu && !deckmenu->isClosed()) deckmenu->Render();
|
||||
|
||||
@@ -1719,6 +1726,13 @@ void GameStateDuel::OnScroll(int inXVelocity, int inYVelocity)
|
||||
JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_PREV : JGE_BTN_NEXT);
|
||||
mEngine->HoldKey_NoRepeat(trigger);
|
||||
}
|
||||
else if(flickLeft && OptionClosedHand::VISIBLE == options[Options::CLOSEDHAND].number)
|
||||
{
|
||||
#if defined (ANDROID)
|
||||
//JButton trigger = (options[Options::REVERSETRIGGERS].number ? JGE_BTN_UP : JGE_BTN_DOWN);
|
||||
mEngine->HoldKey_NoRepeat(JGE_BTN_DOWN);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void GameStateMenu::Create()
|
||||
{
|
||||
currentState = MENU_STATE_MAJOR_LANG | MENU_STATE_MINOR_NONE;
|
||||
}
|
||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 - 90, SCREEN_HEIGHT - 17, 180);
|
||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH / 2 + 65, 5, 180);
|
||||
scrollerSet = 0;
|
||||
splashTex = NULL;
|
||||
|
||||
@@ -153,7 +153,7 @@ void GameStateMenu::Start()
|
||||
mBg = WResourceManager::Instance()->RetrieveQuad("menutitle.png", 0, 0, 0, 0); // Create background quad for rendering.
|
||||
|
||||
if (mBg)
|
||||
mBg->SetHotSpot(0, 0);
|
||||
mBg->SetHotSpot(mBg->mWidth/2, 0);
|
||||
|
||||
if (MENU_STATE_MAJOR_MAINMENU == currentState)
|
||||
currentState = currentState | MENU_STATE_MINOR_FADEIN;
|
||||
@@ -187,6 +187,12 @@ void GameStateMenu::genNbCardsStr()
|
||||
sprintf(GameApp::mynbcardsStr, _("%i cards").c_str(),totalPrints);
|
||||
}
|
||||
|
||||
if(playerdata)
|
||||
{
|
||||
if(playerdata->credits > 0)
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
}
|
||||
|
||||
SAFE_DELETE(playerdata);
|
||||
}
|
||||
|
||||
@@ -445,9 +451,11 @@ void GameStateMenu::ensureMGuiController()
|
||||
(i == 0)));
|
||||
}
|
||||
|
||||
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");
|
||||
JQuadPtr jq = WResourceManager::Instance()->RetrieveTempQuad("button_shoulder.png");//I set this transparent, don't remove button_shoulder.png
|
||||
if (!jq.get()) return;
|
||||
jq->SetHFlip(false);
|
||||
jq->mWidth = 64.f;
|
||||
jq->mHeight = 32.f;
|
||||
jq->SetColor(ARGB(abs(255),255,255,255));
|
||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||
vector<ModRulesOtherMenuItem *>otherItems = gModRules.menu.other;
|
||||
@@ -455,7 +463,7 @@ void GameStateMenu::ensureMGuiController()
|
||||
mGuiController->Add(NEW OtherMenuItem(
|
||||
otherItems[0]->mActionId,
|
||||
mFont, otherItems[0]->mDisplayName,
|
||||
SCREEN_WIDTH - 64, 2,
|
||||
SCREEN_WIDTH - 64, SCREEN_HEIGHT_F-26.f,
|
||||
jq.get(), jq.get(), otherItems[0]->mKey, false
|
||||
));
|
||||
}
|
||||
@@ -733,8 +741,21 @@ void GameStateMenu::RenderTopMenu()
|
||||
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(128,255,255,255));
|
||||
mFont->DrawString(GAME_VERSION, rightTextPos, 5, JGETEXT_RIGHT);
|
||||
//mFont->SetColor(ARGB(128,255,255,255));
|
||||
mFont->SetColor(ARGB(220,255,255,255));
|
||||
/*//tooltip
|
||||
JQuadPtr tooltips;
|
||||
tooltips = WResourceManager::Instance()->RetrieveTempQuad("tooltips.png");//new graphics tooltips
|
||||
if (tooltips.get())
|
||||
{
|
||||
float xscale = (mFont->GetStringWidth(GAME_VERSION)+(mFont->GetStringWidth(GAME_VERSION)/18)) / tooltips->mWidth;
|
||||
float yscale = mFont->GetHeight() / tooltips->mHeight;
|
||||
tooltips->SetHotSpot(tooltips->mWidth / 2,0);
|
||||
JRenderer::GetInstance()->RenderQuad(tooltips.get(), SCREEN_WIDTH_F/2, SCREEN_HEIGHT_F-17,0,xscale,yscale);
|
||||
}
|
||||
//end tooltip*/
|
||||
mFont->DrawString(GAME_VERSION, (SCREEN_WIDTH_F/2) - (mFont->GetStringWidth(GAME_VERSION))/2, SCREEN_HEIGHT_F-17, JGETEXT_LEFT);
|
||||
mFont->SetColor(ARGB(128,255,255,255));//reset color
|
||||
mFont->DrawString(GameApp::mynbcardsStr, leftTextPos, 5);
|
||||
renderer->FillRect(leftTextPos, 26, 104, 8, ARGB(255, 100, 90, 60));
|
||||
renderer->FillRect(leftTextPos + 2, 28, (float)(gamePercentComplete()), 4, ARGB(255,220,200, 125));
|
||||
@@ -780,6 +801,24 @@ void GameStateMenu::Render()
|
||||
else
|
||||
sprintf(text, "%s", _("LOADING...").c_str());
|
||||
}
|
||||
#if !defined (PSP)
|
||||
//tooltip & overlay
|
||||
JQuadPtr menubar;
|
||||
menubar = WResourceManager::Instance()->RetrieveTempQuad("menubar.png");//new graphics menubar
|
||||
if (menubar.get())
|
||||
{
|
||||
float xscale = SCREEN_WIDTH / menubar->mWidth;
|
||||
float yscale = mFont->GetHeight() / menubar->mHeight;
|
||||
renderer->RenderQuad(menubar.get(), 0, (SCREEN_HEIGHT - menubar->mHeight) - 18,0,xscale,yscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
//rectangle
|
||||
renderer->FillRect(0, SCREEN_HEIGHT - 50, SCREEN_WIDTH + 1.5f, mFont->GetHeight(),ARGB(225,5,5,5));;
|
||||
renderer->DrawRect(0, SCREEN_HEIGHT - 50, SCREEN_WIDTH + 1.5f, mFont->GetHeight(),ARGB(200, 204, 153, 0));
|
||||
//end
|
||||
}
|
||||
#endif
|
||||
mFont->SetColor(ARGB(170,0,0,0));
|
||||
mFont->DrawString(text, SCREEN_WIDTH / 2 + 2, SCREEN_HEIGHT - 50 + 2, JGETEXT_CENTER);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
@@ -799,10 +838,22 @@ void GameStateMenu::Render()
|
||||
scroller->Render();
|
||||
|
||||
if (mBg.get())
|
||||
renderer->RenderQuad(mBg.get(), (SCREEN_WIDTH/4)-6, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight);
|
||||
renderer->RenderQuad(mBg.get(), SCREEN_WIDTH_F/2, 2, 0, 256 / mBg->mWidth, 166 / mBg->mHeight);
|
||||
|
||||
RenderTopMenu();
|
||||
|
||||
|
||||
//credits on lower left if available
|
||||
std::ostringstream streamC;
|
||||
streamC << "Credits: " << GameApp::mycredits;
|
||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(0.9f);
|
||||
mFont->SetColor(ARGB(150,248,248,255));
|
||||
mFont->DrawString(streamC.str(), 12, SCREEN_HEIGHT - 16);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::MENU_FONT);
|
||||
//end
|
||||
|
||||
}
|
||||
if (subMenuController)
|
||||
{
|
||||
|
||||
@@ -49,11 +49,27 @@ void GameStateOptions::Start()
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1));
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells"));
|
||||
// optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities"));
|
||||
//this is a dev option, not meant for standard play. uncomment if you need to see abilities you own hitting the stack.
|
||||
//this is a dev option, not meant for standard play. uncomment if you need to see abilities you own hitting the stack.
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDMAIN, "Interrupt opponent's end of turn"));
|
||||
optionsTabs = NEW WGuiTabMenu();
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsList = NEW WGuiList("Misc");
|
||||
optionsList->Add(NEW WGuiHeader("Card Display Options"));
|
||||
//black border
|
||||
optionsList->Add(NEW OptionInteger(Options::BLKBORDER, "All Black Border"));
|
||||
//show tokens in editor
|
||||
optionsList->Add(NEW OptionInteger(Options::SHOWTOKENS, "Show Tokens in Editor"));
|
||||
WDecoStyled * wMisc = NEW WDecoStyled(NEW WGuiHeader("Warning!!!"));
|
||||
wMisc->mStyle = WDecoStyled::DS_STYLE_ALERT;
|
||||
optionsList->Add(wMisc);
|
||||
//show large images
|
||||
optionsList->Add(NEW OptionInteger(Options::GDVLARGEIMAGE, "Show Large Images in Grid Deck View"));
|
||||
//prefetch
|
||||
if(WResourceManager::Instance()->IsThreaded())
|
||||
optionsList->Add(NEW OptionInteger(Options::CARDPREFETCHING, "Enable Prefetching"));
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsList = NEW WGuiList("Game");
|
||||
optionsList->Add(NEW WGuiHeader("Interface Options"));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND, "Closed hand", 1, 1, 0)));
|
||||
@@ -80,10 +96,9 @@ void GameStateOptions::Start()
|
||||
optionsList->Add(NEW WGuiSplit(cPrf, cThm));
|
||||
optionsList->Add(cStyle);
|
||||
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"), -102, GameStateOptionsConst::kNewProfileID, this));
|
||||
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODE, "Enable Cheat Mode")));
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks")));
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::OPTIMIZE_HAND, "Optimize Starting Hand")));
|
||||
optionsList->Add(NEW WDecoCheat(NEW OptionInteger(Options::CHEATMODEAIDECK, "Unlock All Ai Decks")));
|
||||
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
@@ -214,7 +229,14 @@ void GameStateOptions::Render()
|
||||
{
|
||||
//Erase
|
||||
JRenderer::GetInstance()->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
#if !defined (PSP)
|
||||
JTexture * wpTex = WResourceManager::Instance()->RetrieveTexture("bgdeckeditor.jpg");
|
||||
if (wpTex)
|
||||
{
|
||||
JQuadPtr wpQuad = WResourceManager::Instance()->RetrieveTempQuad("bgdeckeditor.jpg");
|
||||
JRenderer::GetInstance()->RenderQuad(wpQuad.get(), 0, 0, 0, SCREEN_WIDTH_F / wpQuad->mWidth, SCREEN_HEIGHT_F / wpQuad->mHeight);
|
||||
}
|
||||
#endif
|
||||
const char * const CreditsText[] = {
|
||||
"Wagic, The Homebrew?! by Wololo",
|
||||
"",
|
||||
|
||||
@@ -271,12 +271,13 @@ void GameStateShop::cancelBooster(int)
|
||||
void GameStateShop::purchaseCard(int controlId)
|
||||
{
|
||||
MTGCard * c = srcCards->getCard(controlId - BOOSTER_SLOTS);
|
||||
if (!c || !c->data || playerdata->credits - mPrices[controlId] < 0)
|
||||
if (!c || !c->data || playerdata->credits - mPrices[controlId] < 0 || (c && c->getRarity() == Constants::RARITY_T))//cant buy tokens....
|
||||
return;
|
||||
myCollection->Add(c);
|
||||
int price = mPrices[controlId];
|
||||
pricelist->setPrice(c->getMTGId(), price); // In case they changed their minds after cancelling.
|
||||
playerdata->credits -= price;
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
//Update prices
|
||||
int rnd;
|
||||
switch (options[Options::ECON_DIFFICULTY].number)
|
||||
@@ -304,11 +305,12 @@ void GameStateShop::purchaseBooster(int controlId)
|
||||
if (playerdata->credits - mPrices[controlId] < 0)
|
||||
return;
|
||||
playerdata->credits -= mPrices[controlId];
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
mInventory[controlId]--;
|
||||
SAFE_DELETE(booster);
|
||||
deleteDisplay();
|
||||
booster = NEW MTGDeck(MTGCollection());
|
||||
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 200, SCREEN_HEIGHT / 2, this, NULL, 5);
|
||||
boosterDisplay = NEW BoosterDisplay(12, NULL, SCREEN_WIDTH - 255, SCREEN_HEIGHT-65, this, NULL, 7);
|
||||
mBooster[controlId].addToDeck(booster, srcCards);
|
||||
|
||||
string sort = mBooster[controlId].getSort();
|
||||
@@ -487,7 +489,7 @@ void GameStateShop::Update(float dt)
|
||||
menu->Add(22, _("Ask about...").c_str());
|
||||
menu->Add(14, _("Check task board").c_str());
|
||||
if (options[Options::CHEATMODE].number)
|
||||
menu->Add(-2, _("Steal 1,000 credits").c_str());
|
||||
menu->Add(-2, _("Steal 2,000 credits").c_str());
|
||||
menu->Add(12, _("Save And Exit").c_str());
|
||||
menu->Add(kCancelMenuID, _("Cancel").c_str());
|
||||
}
|
||||
@@ -704,7 +706,7 @@ void GameStateShop::Render()
|
||||
|
||||
JQuadPtr mBg = WResourceManager::Instance()->RetrieveTempQuad("shop.jpg", TEXTURE_SUB_5551);
|
||||
if (mBg.get())
|
||||
r->RenderQuad(mBg.get(), 0, 0);
|
||||
r->RenderQuad(mBg.get(), 0, 0, 0, SCREEN_WIDTH_F / mBg->mWidth, SCREEN_HEIGHT_F / mBg->mHeight);
|
||||
|
||||
JQuadPtr quad = WResourceManager::Instance()->RetrieveTempQuad("shop_light.jpg", TEXTURE_SUB_5551);
|
||||
if (quad.get())
|
||||
@@ -712,7 +714,8 @@ void GameStateShop::Render()
|
||||
r->EnableTextureFilter(false);
|
||||
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
quad->SetColor(ARGB(lightAlpha,255,255,255));
|
||||
r->RenderQuad(quad.get(), 0, 0);
|
||||
quad->SetHotSpot(0,quad->mHeight);
|
||||
r->RenderQuad(quad.get(), 0, SCREEN_HEIGHT, 0, 255.f / quad->mWidth, 272.f / quad->mHeight);
|
||||
r->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
r->EnableTextureFilter(true);
|
||||
}
|
||||
@@ -725,7 +728,7 @@ void GameStateShop::Render()
|
||||
else
|
||||
{
|
||||
if (boosterDisplay)
|
||||
boosterDisplay->Render();
|
||||
boosterDisplay->Render(true);
|
||||
else if (bigDisplay)
|
||||
{
|
||||
if (bigDisplay->mOffset.getPos() >= 0)
|
||||
@@ -742,7 +745,9 @@ void GameStateShop::Render()
|
||||
{
|
||||
alpha = static_cast<int> (800 * (elp - LIST_FADEIN));
|
||||
}
|
||||
r->FillRoundRect(300, 10, 160, SHOP_SLOTS * 20 + 15, 5, ARGB(alpha,0,0,0));
|
||||
//r->FillRoundRect(300, 10, 160, SHOP_SLOTS * 20 + 15, 5, ARGB(alpha,0,0,0));
|
||||
r->FillRect(297, 9.5f, 175, SHOP_SLOTS * 20 + 31, ARGB(alpha,0,0,0));
|
||||
r->DrawRect(297, 9.5f, 175, SHOP_SLOTS * 20 + 31, ARGB(alpha,20,20,20));
|
||||
alpha += 55;
|
||||
for (int i = 0; i < SHOP_SLOTS; i++)
|
||||
{
|
||||
@@ -787,7 +792,7 @@ void GameStateShop::Render()
|
||||
if (menu)
|
||||
menu->Render();
|
||||
|
||||
if (!filterMenu || (filterMenu && filterMenu->isFinished()))
|
||||
if ((!filterMenu || (filterMenu && filterMenu->isFinished()))&&!boosterDisplay)
|
||||
renderButtons();
|
||||
}
|
||||
|
||||
@@ -816,7 +821,10 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId)
|
||||
if (sel > -1 && sel < SHOP_ITEMS)
|
||||
{
|
||||
if (controlId == -2)
|
||||
{
|
||||
playerdata->credits += mPrices[sel]; //We stole it.
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
}
|
||||
if (sel < BOOSTER_SLOTS) //Clicked a booster.
|
||||
purchaseBooster(sel);
|
||||
else
|
||||
@@ -857,7 +865,10 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId)
|
||||
beginFilters();
|
||||
break;
|
||||
case -2:
|
||||
playerdata->credits += 1000;
|
||||
{
|
||||
playerdata->credits += 2000;
|
||||
GameApp::mycredits = playerdata->credits;
|
||||
}
|
||||
default:
|
||||
mStage = STAGE_SHOP_SHOP;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "GridDeckView.h"
|
||||
|
||||
const float GridDeckView::scroll_animation_duration = 0.3f;
|
||||
const float GridDeckView::slide_animation_duration = 0.6f;
|
||||
const float GridDeckView::card_scale_small = 0.48f;
|
||||
const float GridDeckView::card_scale_big = 0.7f;
|
||||
//const float GridDeckView::card_scale_small = 0.47f;
|
||||
//const float GridDeckView::card_scale_big = 0.6f;
|
||||
const float GridDeckView::card_scale_small = 0.42f;
|
||||
const float GridDeckView::card_scale_big = 0.52f;
|
||||
|
||||
GridDeckView::GridDeckView()
|
||||
: DeckView(16), mCols(8), mRows(2), mScrollOffset(0), mSlideOffset(0),
|
||||
@@ -104,6 +107,8 @@ void GridDeckView::Render()
|
||||
{
|
||||
int firstVisibleCard = 2;
|
||||
int lastVisibleCard = mCards.size() - 2;
|
||||
bool mode = options[Options::GDVLARGEIMAGE].number?false:true;
|
||||
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||
|
||||
if(!mScrollEasing.finished())
|
||||
{
|
||||
@@ -118,27 +123,15 @@ void GridDeckView::Render()
|
||||
|
||||
for(int i = firstVisibleCard; i < lastVisibleCard; ++i)
|
||||
{
|
||||
if(prefetch && WResourceManager::Instance()->IsThreaded())
|
||||
WResourceManager::Instance()->RetrieveCard(mCards[i].card);
|
||||
|
||||
if(mCurrentSelection != i)
|
||||
{
|
||||
if (WResourceManager::Instance()->IsThreaded())
|
||||
{
|
||||
WResourceManager::Instance()->RetrieveCard(mCards[i].card, RETRIEVE_THUMB);
|
||||
}
|
||||
renderCard(i, 255, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WResourceManager::Instance()->IsThreaded())
|
||||
{
|
||||
WResourceManager::Instance()->RetrieveCard(mCards[i].card);
|
||||
}
|
||||
}
|
||||
renderCard(i, 255, mode,true);//the last value is to resize scale in drawcard so we don't have large borders on grid deck view
|
||||
}
|
||||
|
||||
if(2 <= mCurrentSelection && mCurrentSelection < 12)
|
||||
{
|
||||
renderCard(mCurrentSelection, 255, false);
|
||||
renderCard(mCurrentSelection, 255, false,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,17 +20,17 @@ GuiAvatars::GuiAvatars(DuelLayers* duelLayers) :
|
||||
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.2 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10,
|
||||
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
|
||||
Add(opponentExile = NEW GuiExile(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
|
||||
mpDuelLayers->getRenderedPlayerOpponent(), this));
|
||||
//opponentGraveyard
|
||||
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.4 - GuiGameZone::Width / 2, 35 + GuiGameZone::Height - 10, false,
|
||||
Add(opponentHand = NEW GuiOpponentHand(-15 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10, false,
|
||||
mpDuelLayers->getRenderedPlayerOpponent(), this));
|
||||
//opponentLibrary
|
||||
Add(opponentLibrary = NEW GuiLibrary(5 + GuiAvatar::Width * 1.4 - GuiGameZone::Width / 2, 5 + GuiGameZone::Height + 5, false,
|
||||
mpDuelLayers->getRenderedPlayerOpponent(), this));
|
||||
Add(opponentLibrary = NEW GuiLibrary(-30 + GuiAvatar::Width * 1.2 - GuiGameZone::Width / 2, 43 + GuiGameZone::Height - 10,
|
||||
false, mpDuelLayers->getRenderedPlayerOpponent(), this));
|
||||
|
||||
observer->getCardSelector()->Add(self);
|
||||
observer->getCardSelector()->Add(selfGraveyard);
|
||||
@@ -149,7 +149,7 @@ void GuiAvatars::Render()
|
||||
float h = 54;
|
||||
if (opponent == active)
|
||||
{
|
||||
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+20 * opponent->actZ, ARGB(200,0,0,0));
|
||||
r->FillRect(opponent->actX, opponent->actY, 40 * opponent->actZ, h+25 * 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)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "Rules.h"
|
||||
|
||||
const std::string kBackdropFile = "backdrop.jpg";
|
||||
const std::string kBackdropFrameFile = "backdropframe.png";
|
||||
const std::string kPspBackdropFile = "pspbackdrop.jpg";
|
||||
|
||||
GuiBackground::GuiBackground(GameObserver* observer)
|
||||
: GuiLayer(observer)
|
||||
@@ -20,18 +22,27 @@ void GuiBackground::Render()
|
||||
{
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
JQuadPtr quad;
|
||||
JQuadPtr quadframe = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFrameFile);
|
||||
if (observer && observer->mRules && observer->mRules->bg.size())
|
||||
{
|
||||
quad = WResourceManager::Instance()->RetrieveTempQuad(observer->mRules->bg);
|
||||
}
|
||||
if (!quad.get())
|
||||
{
|
||||
#if !defined (PSP)
|
||||
quad = WResourceManager::Instance()->RetrieveTempQuad(kBackdropFile);
|
||||
#else
|
||||
quad = WResourceManager::Instance()->RetrieveTempQuad(kPspBackdropFile);
|
||||
#endif
|
||||
}
|
||||
if (quad.get())
|
||||
{
|
||||
quad->mWidth = 480.f;
|
||||
quad->mHeight = 272.f;
|
||||
renderer->RenderQuad(quad.get(), 0, 0);
|
||||
renderer->RenderQuad(quad.get(), 0, 0, 0, SCREEN_WIDTH_F / quad->mWidth, SCREEN_HEIGHT_F / quad->mHeight);
|
||||
}
|
||||
#if !defined (PSP)
|
||||
if (quadframe.get())
|
||||
{
|
||||
renderer->RenderQuad(quadframe.get(), 0, 0, 0, SCREEN_WIDTH_F / quadframe->mWidth, SCREEN_HEIGHT_F / quadframe->mHeight);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -500,8 +500,10 @@ void GuiCombat::Render()
|
||||
}
|
||||
if (ok_tex)
|
||||
{
|
||||
JQuadPtr ok_quad = WResourceManager::Instance()->RetrieveTempQuad("Ok.png");
|
||||
ok_quad->SetHotSpot(28, 22);
|
||||
JQuadPtr ok_quad = WResourceManager::Instance()->RetrieveQuad("Ok.png", 0.0f, 0.0f, ok_tex->mWidth - 4.5f, ok_tex->mHeight - 4.5f);
|
||||
ok_quad->mWidth = 56.f;
|
||||
ok_quad->mHeight = 45.f;
|
||||
ok_quad->SetHotSpot(ok_quad->mWidth/2, ok_quad->mHeight/2);
|
||||
ok.Render(ok_quad.get());
|
||||
}
|
||||
renderer->DrawLine(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2, ARGB(255, 255, 64, 0));
|
||||
|
||||
@@ -86,7 +86,10 @@ void GuiHandOpponent::Render()
|
||||
(*it)->y = 2;
|
||||
(*it)->zoom = 0.3f;
|
||||
(*it)->Render(quad.get());
|
||||
x += 18;
|
||||
if(cards.size() > 12)
|
||||
x += 240/cards.size();
|
||||
else
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,8 +305,8 @@ void GuiMana::Render()
|
||||
for (vector<ManaIcon*>::iterator it = manas.begin(); it != manas.end(); ++it)
|
||||
(*it)->Render();
|
||||
|
||||
if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number )
|
||||
RenderStatic();
|
||||
if (OptionManaDisplay::DYNAMIC != options[Options::MANADISPLAY].number && OptionManaDisplay::NOSTARSDYNAMIC != options[Options::MANADISPLAY].number )
|
||||
RenderStatic();
|
||||
}
|
||||
|
||||
bool remove_dead(ManaIcon* m)
|
||||
|
||||
@@ -95,6 +95,7 @@ bool GuiPhaseBar::Leaving(JButton)
|
||||
void GuiPhaseBar::Render()
|
||||
{
|
||||
JQuadPtr quad = WResourceManager::Instance()->GetQuad("phasebar");
|
||||
JQuadPtr phaseinfo = WResourceManager::Instance()->RetrieveTempQuad("fakebar.png"); //new fakebar graphics
|
||||
//uncomment to draw a hideous line across hires screens.
|
||||
// JRenderer::GetInstance()->DrawLine(0, CENTER, SCREEN_WIDTH, CENTER, ARGB(255, 255, 255, 255));
|
||||
|
||||
@@ -145,9 +146,18 @@ void GuiPhaseBar::Render()
|
||||
//running this string through translate returns gibberish even though we defined the variables in the lang.txt
|
||||
//the conversion from phase bar phases to mtg phases is x%kPhases + 1
|
||||
//todo: just to this when the displayedPhaseId updates
|
||||
string phaseNameToTranslate = observer->phaseRing->phaseName(displayedPhaseId%kPhases + 1);
|
||||
//string phaseNameToTranslate = observer->phaseRing->phaseName(displayedPhaseId%kPhases + 1);
|
||||
string phaseNameToTranslate = observer->phaseRing->phaseName(observer->phaseRing->getCurrentPhase()->id);
|
||||
phaseNameToTranslate = _(phaseNameToTranslate);
|
||||
sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
|
||||
#if !defined (PSP)
|
||||
if(phaseinfo.get())
|
||||
{//fix phaseinfo graphics... should look nice now...
|
||||
float testW = ((font->GetStringWidth(buf))*2) - SCREEN_WIDTH_F;
|
||||
phaseinfo->SetHotSpot(testW+40.f, 0);
|
||||
JRenderer::GetInstance()->RenderQuad(phaseinfo.get(),0,0,0,SCREEN_WIDTH_F / phaseinfo->mWidth, SCREEN_HEIGHT_F / phaseinfo->mHeight);
|
||||
}
|
||||
#endif
|
||||
font->DrawString(buf, SCREEN_WIDTH - 5, 2, JGETEXT_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,13 +123,25 @@ void GuiPlay::BattleField::reset(float x, float y)
|
||||
}
|
||||
void GuiPlay::BattleField::EnstackAttacker(CardView* card)
|
||||
{
|
||||
card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1));
|
||||
if(card->card->getObserver() && ((card->card->getObserver()->getCurrentGamePhase() >= MTG_PHASE_COMBATDAMAGE) && (card->card->getObserver()->getCurrentGamePhase() < MTG_PHASE_ENDOFTURN)))
|
||||
return;
|
||||
//card->x = CARD_WIDTH + 20 + (currentAttacker * (HORZWIDTH) / (attackers+1));
|
||||
card->x = x + (CARD_WIDTH/2.5f) + baseX;
|
||||
if (attackers+1 < 8)
|
||||
x += CARD_WIDTH;
|
||||
else if (attackers+1 < 24)
|
||||
x += (SCREEN_WIDTH - 200 - baseX) / attackers+1;
|
||||
else
|
||||
x += (HORZWIDTH - baseX) / attackers+1;
|
||||
|
||||
card->y = baseY + (card->card->getObserver()->getView()->getRenderedPlayer() == card->card->controller() ? 20 + y : -20 - y);
|
||||
++currentAttacker;
|
||||
// JRenderer::GetInstance()->RenderQuad(WResourceManager::Instance()->GetQuad("BattleIcon"), card->actX, card->actY, 0, 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime()), 0.5 + 0.1 * sinf(JGE::GetInstance()->GetTime()));
|
||||
}
|
||||
void GuiPlay::BattleField::EnstackBlocker(CardView* card)
|
||||
{
|
||||
if(card->card->getObserver() && ((card->card->getObserver()->getCurrentGamePhase() >= MTG_PHASE_COMBATDAMAGE) && (card->card->getObserver()->getCurrentGamePhase() < MTG_PHASE_ENDOFTURN)))
|
||||
return;
|
||||
MTGCardInstance * c = card->card;
|
||||
if (!c)
|
||||
return;
|
||||
@@ -170,6 +182,7 @@ void GuiPlay::BattleField::Render()
|
||||
GuiPlay::GuiPlay(DuelLayers* view) :
|
||||
GuiLayer(view)
|
||||
{
|
||||
wave = 0;
|
||||
end_spells = cards.end();
|
||||
}
|
||||
|
||||
@@ -290,6 +303,20 @@ void GuiPlay::Render()
|
||||
|
||||
for (iterator it = cards.begin(); it != cards.end(); ++it)
|
||||
{
|
||||
//draw line when attacking planeswalker
|
||||
if((*it)->card && (*it)->card->isAttacker())
|
||||
{
|
||||
Damageable * dtarget = ((Damageable *)(*it)->card->isAttacking);
|
||||
if(dtarget && dtarget->type_as_damageable == Damageable::DAMAGEABLE_MTGCARDINSTANCE)
|
||||
{
|
||||
MTGCardInstance * ctarget = ((MTGCardInstance *)(*it)->card->isAttacking);
|
||||
if(ctarget->hasType(Subtypes::TYPE_PLANESWALKER) && observer->isInPlay(ctarget) && observer->getCurrentGamePhase() < MTG_PHASE_COMBATEND)
|
||||
{
|
||||
JRenderer::GetInstance()->DrawLine((*it)->actX,(*it)->actY,ctarget->view->actX,ctarget->view->actY,0.5f,ARGB(128 - wave, 255, 20, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((*it)->card->isLand())
|
||||
{
|
||||
if (mpDuelLayers->getRenderedPlayer() == (*it)->card->controller())
|
||||
@@ -330,7 +357,11 @@ void GuiPlay::Update(float dt)
|
||||
{
|
||||
battleField.Update(dt);
|
||||
for (iterator it = cards.begin(); it != cards.end(); ++it)
|
||||
(*it)->Update(dt);
|
||||
{
|
||||
if((*it))
|
||||
(*it)->Update(dt);
|
||||
}
|
||||
wave = (wave + 2 * (int) (100 * dt)) % 255;
|
||||
}
|
||||
|
||||
int GuiPlay::receiveEventPlus(WEvent * e)
|
||||
@@ -416,6 +447,12 @@ int GuiPlay::receiveEventPlus(WEvent * e)
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardControllerChange*> (e))
|
||||
Replace();
|
||||
/*else if (dynamic_cast<WEventCardTransforms*> (e))
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardCopiedACard*> (e))
|
||||
Replace();
|
||||
else if (dynamic_cast<WEventCardFaceUp*> (e))
|
||||
Replace();*/
|
||||
Replace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
+180
-15
@@ -28,11 +28,18 @@ GuiAvatar::GuiAvatar(float x, float y, bool hasFocus, Player * player, Corner co
|
||||
|
||||
void GuiAvatar::Render()
|
||||
{
|
||||
GameObserver * game = player->getObserver();
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
int life = player->life;
|
||||
int poisonCount = player->poisonCount;
|
||||
int energyCount = player->energyCount;
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
TargetChooser * tc = NULL;
|
||||
|
||||
if (game)
|
||||
tc = game->getCurrentTargetChooser();
|
||||
|
||||
//Avatar
|
||||
int lifeDiff = life - currentLife;
|
||||
if (lifeDiff < 0 && currentLife > 0)
|
||||
@@ -73,6 +80,10 @@ void GuiAvatar::Render()
|
||||
break;
|
||||
}
|
||||
player->getIcon()->SetColor(ARGB((int)actA, 255, avatarRed, avatarRed));
|
||||
if (tc && !tc->canTarget(player))
|
||||
{
|
||||
player->getIcon()->SetColor(ARGB((int)actA, 50, 50, 50));
|
||||
}
|
||||
r->RenderQuad(player->getIcon().get(), actX, actY, actT, Width/player->getIcon()->mWidth*actZ, Height/player->getIcon()->mHeight*actZ);
|
||||
if (mHasFocus)
|
||||
{
|
||||
@@ -108,10 +119,10 @@ void GuiAvatar::Render()
|
||||
{
|
||||
case TOP_LEFT:
|
||||
mFont->SetColor(ARGB((int)actA / 4, 0, 0, 0));
|
||||
mFont->DrawString(buffer, actX + 2, actY + 2);
|
||||
mFont->DrawString(buffer, actX + 2, actY - 2);
|
||||
mFont->SetScale(1.3f);
|
||||
mFont->SetColor(ARGB((int)actA, lx, ly, lz));
|
||||
mFont->DrawString(buffer, actX + 1, actY + 1);
|
||||
mFont->DrawString(buffer, actX + 1, actY - 1);
|
||||
mFont->SetScale(1);
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
@@ -122,7 +133,7 @@ void GuiAvatar::Render()
|
||||
break;
|
||||
}
|
||||
//poison
|
||||
char poison[5];
|
||||
char poison[10];
|
||||
if (poisonCount > 0)
|
||||
{
|
||||
sprintf(poison, "%i", poisonCount);
|
||||
@@ -138,6 +149,23 @@ void GuiAvatar::Render()
|
||||
break;
|
||||
}
|
||||
}
|
||||
//energy
|
||||
char energy[15];
|
||||
if (energyCount > 0)
|
||||
{
|
||||
sprintf(energy, "%i", energyCount);
|
||||
switch (corner)
|
||||
{
|
||||
case TOP_LEFT:
|
||||
mFont->SetColor(ARGB((int)actA / 1, 255, 255, 0));
|
||||
mFont->DrawString(energy, actX + 2, actY + 17);
|
||||
break;
|
||||
case BOTTOM_RIGHT:
|
||||
mFont->SetColor(ARGB((int)actA / 1 ,255, 255, 0));
|
||||
mFont->DrawString(energy, actX, actY - 27, JGETEXT_RIGHT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
PlayGuiObject::Render();
|
||||
}
|
||||
|
||||
@@ -149,16 +177,18 @@ ostream& GuiAvatar::toString(ostream& out) const
|
||||
|
||||
void GuiGameZone::toggleDisplay()
|
||||
{
|
||||
if (showCards)
|
||||
{
|
||||
showCards = 0;
|
||||
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
||||
}
|
||||
if (showCards)
|
||||
{
|
||||
cd->zone->owner->getObserver()->guiOpenDisplay = NULL;
|
||||
showCards = 0;
|
||||
cd->zone->owner->getObserver()->OpenedDisplay = NULL;
|
||||
}
|
||||
else if(!cd->zone->owner->getObserver()->OpenedDisplay)//one display at a time please.
|
||||
{
|
||||
cd->zone->owner->getObserver()->guiOpenDisplay = this;
|
||||
showCards = 1;
|
||||
cd->init(zone);
|
||||
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
||||
cd->zone->owner->getObserver()->OpenedDisplay = cd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,13 +196,106 @@ void GuiGameZone::Render()
|
||||
{
|
||||
//Texture
|
||||
JQuadPtr quad = WResourceManager::Instance()->GetQuad(kGenericCardThumbnailID);
|
||||
JQuadPtr overlay;
|
||||
float scale = defaultHeight / quad->mHeight;
|
||||
float scale2 = scale;
|
||||
float modx = 0;
|
||||
float mody = 0;
|
||||
|
||||
bool replaced = false;
|
||||
bool showtop = (zone && zone->owner->game->battlefield->nb_cards && zone->owner->game->battlefield->hasAbility(Constants::SHOWFROMTOPLIBRARY))?true:false;
|
||||
bool showopponenttop = (zone && zone->owner->opponent()->game->battlefield->nb_cards && zone->owner->opponent()->game->battlefield->hasAbility(Constants::SHOWOPPONENTTOPLIBRARY))?true:false;
|
||||
|
||||
quad->SetColor(ARGB((int)(actA),255,255,255));
|
||||
if(type == GUI_EXILE)
|
||||
{
|
||||
quad->SetColor(ARGB((int)(actA),255,240,255));
|
||||
}
|
||||
JRenderer::GetInstance()->RenderQuad(quad.get(), actX, actY, 0.0, scale * actZ, scale * actZ);
|
||||
|
||||
//overlay
|
||||
JQuadPtr iconcard = WResourceManager::Instance()->RetrieveTempQuad("iconcard.png");
|
||||
JQuadPtr iconhand = WResourceManager::Instance()->RetrieveTempQuad("iconhand.png");
|
||||
JQuadPtr iconlibrary = WResourceManager::Instance()->RetrieveTempQuad("iconlibrary.png");
|
||||
JQuadPtr iconexile = WResourceManager::Instance()->RetrieveTempQuad("iconexile.png");
|
||||
|
||||
if(iconlibrary && type == GUI_LIBRARY)
|
||||
{
|
||||
scale2 = defaultHeight / iconlibrary->mHeight;
|
||||
modx = -0.f;
|
||||
mody = -2.f;
|
||||
iconlibrary->SetColor(ARGB((int)(actA),255,255,255));
|
||||
quad = iconlibrary;
|
||||
}
|
||||
if(iconhand && type == GUI_OPPONENTHAND)
|
||||
{
|
||||
scale2 = defaultHeight / iconhand->mHeight;
|
||||
modx = -0.f;
|
||||
mody = -2.f;
|
||||
iconhand->SetColor(ARGB((int)(actA),255,255,255));
|
||||
quad = iconhand;
|
||||
}
|
||||
if(iconcard && type == GUI_GRAVEYARD)
|
||||
{
|
||||
scale2 = defaultHeight / iconcard->mHeight;
|
||||
modx = -0.f;
|
||||
mody = -2.f;
|
||||
iconcard->SetColor(ARGB((int)(actA),255,255,255));
|
||||
quad = iconcard;
|
||||
}
|
||||
if(iconexile && type == GUI_EXILE)
|
||||
{
|
||||
scale2 = defaultHeight / iconexile->mHeight;
|
||||
modx = -0.f;
|
||||
mody = -2.f;
|
||||
iconexile->SetColor(ARGB((int)(actA),255,255,255));
|
||||
quad = iconexile;
|
||||
}
|
||||
//
|
||||
|
||||
if(type == GUI_LIBRARY && zone->nb_cards && !showCards)
|
||||
{
|
||||
int top = zone->nb_cards - 1;
|
||||
if(zone->cards[top] && (zone->cards[top]->canPlayFromLibrary()||showtop||showopponenttop))
|
||||
{
|
||||
MTGCardInstance * card = zone->cards[top];
|
||||
if(card && card->getObserver())
|
||||
{
|
||||
replaced = true;
|
||||
/*TargetChooser * tc = card->getObserver()->getCurrentTargetChooser();
|
||||
if(tc && tc->canTarget(card) && !tc->done)
|
||||
replaced = false;
|
||||
else
|
||||
{*/
|
||||
JQuadPtr kquad = WResourceManager::Instance()->RetrieveCard(card, CACHE_THUMB);
|
||||
if(kquad)
|
||||
{
|
||||
kquad->SetColor(ARGB((int)(actA),255,255,255));
|
||||
scale2 = defaultHeight / kquad->mHeight;
|
||||
modx = (35/4)+1;
|
||||
mody = (50/4)+1;
|
||||
quad = kquad;
|
||||
}
|
||||
else
|
||||
{
|
||||
quad = CardGui::AlternateThumbQuad(card);
|
||||
if(quad)
|
||||
{
|
||||
quad->SetColor(ARGB((int)(actA),255,255,255));
|
||||
scale2 = defaultHeight / quad->mHeight;
|
||||
modx = (35/4)+1;
|
||||
mody = (50/4)+1;
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//render small card quad
|
||||
if(quad)
|
||||
JRenderer::GetInstance()->RenderQuad(quad.get(), actX+modx, actY+mody, 0.0, scale2 * actZ, scale2 * actZ);
|
||||
/*if(overlay)
|
||||
JRenderer::GetInstance()->RenderQuad(overlay.get(), actX, actY, 0.0, scale2 * actZ, scale2 * actZ);*/
|
||||
|
||||
float x0 = actX;
|
||||
if (x0 < SCREEN_WIDTH / 2)
|
||||
@@ -181,8 +304,11 @@ void GuiGameZone::Render()
|
||||
}
|
||||
|
||||
if (mHasFocus)
|
||||
JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale * actZ, quad->mHeight * scale * actZ,
|
||||
{
|
||||
if(!replaced)
|
||||
JRenderer::GetInstance()->FillRect(actX, actY, quad->mWidth * scale2 * actZ, quad->mHeight * scale2 * actZ,
|
||||
ARGB(abs(128 - wave),255,255,255));
|
||||
}
|
||||
|
||||
//Number of cards
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
@@ -198,18 +324,32 @@ void GuiGameZone::Render()
|
||||
else if(type == GUI_EXILE)
|
||||
sprintf(buffer, "%i\ne", zone->nb_cards);
|
||||
else*/
|
||||
sprintf(buffer, "%i", zone->nb_cards);
|
||||
sprintf(buffer, "%i", zone->nb_cards);
|
||||
mFont->SetColor(ARGB(mAlpha,0,0,0));
|
||||
mFont->DrawString(buffer, x0 + 1, actY + 1);
|
||||
if (actA > 120)
|
||||
mAlpha = 255;
|
||||
mFont->SetColor(ARGB(mAlpha,255,255,255));
|
||||
mFont->DrawString(buffer, x0, actY);
|
||||
|
||||
//show top library - big card display
|
||||
if(type == GUI_LIBRARY && mHasFocus && zone->nb_cards && !showCards && replaced)
|
||||
{
|
||||
int top = zone->nb_cards - 1;
|
||||
if(zone->cards[top])
|
||||
{
|
||||
Pos pos = Pos(SCREEN_WIDTH - 35 - CardGui::BigWidth / 2, CardGui::BigHeight / 2 - 15, 0.80f, 0.0, 220);
|
||||
pos.actY = 165;
|
||||
if (x < (CardGui::BigWidth / 2)) pos.actX = CardGui::BigWidth / 2;
|
||||
CardGui::DrawCard(zone->cards[top], pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (showCards)
|
||||
cd->Render();
|
||||
for (vector<CardView*>::iterator it = cards.begin(); it != cards.end(); ++it)
|
||||
(*it)->Render();
|
||||
|
||||
PlayGuiObject::Render();
|
||||
}
|
||||
|
||||
@@ -222,6 +362,26 @@ bool GuiGameZone::CheckUserInput(JButton key)
|
||||
{
|
||||
if (showCards)
|
||||
return cd->CheckUserInput(key);
|
||||
else if(type == GUI_LIBRARY && zone->nb_cards && !showCards && key == JGE_BTN_OK && mHasFocus)
|
||||
{
|
||||
bool activateclick = true;
|
||||
|
||||
int top = zone->nb_cards - 1;
|
||||
MTGCardInstance * card = zone->cards[top];
|
||||
GameObserver * game = card->getObserver();
|
||||
if(game)
|
||||
{
|
||||
TargetChooser * tc = game->getCurrentTargetChooser();
|
||||
if(tc && (tc->canTarget(card) || !tc->done || tc->Owner->isHuman()))
|
||||
activateclick = false;
|
||||
}
|
||||
|
||||
if(card && activateclick)
|
||||
{
|
||||
card->getObserver()->cardClick(card);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -377,9 +537,14 @@ int GuiOpponentHand::receiveEventPlus(WEvent* e)
|
||||
t = NEW CardView(CardView::nullZone, event->card, *(event->card->view));
|
||||
else
|
||||
t = NEW CardView(CardView::nullZone, event->card, x, y);
|
||||
t->x = x + Width / 2;
|
||||
t->y = y + Height / 2;
|
||||
t->zoom = 0.6f;
|
||||
//t->x = x + Width / 2;
|
||||
//t->y = y + Height / 2;
|
||||
//t->zoom = 0.6f;
|
||||
//I set to negative so we don't see the face when the cards move...
|
||||
t->x = -400.f;
|
||||
t->y = -400.f;
|
||||
t->mask = ARGB(0,0,0,0);
|
||||
t->zoom = -0.6f;
|
||||
t->alpha = 0;
|
||||
cards.push_back(t);
|
||||
return 1;
|
||||
|
||||
@@ -68,15 +68,16 @@ void InteractiveButton::Render()
|
||||
float stringWidth = mainFont->GetStringWidth(detailedInfoString.c_str());
|
||||
float pspIconsSize = 0.5;
|
||||
float mainFontHeight = mainFont->GetHeight();
|
||||
float boxStartX = getX() - 5;
|
||||
float boxStartX = getX() - 4;
|
||||
mXOffset = 0;
|
||||
mYOffset = 0;
|
||||
|
||||
#ifndef TOUCH_ENABLED
|
||||
renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 9, 5, ARGB(0, 0, 0, 0));
|
||||
#else
|
||||
renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 192, 172, 119));
|
||||
renderer->DrawRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 5, 5, ARGB(255, 255, 255, 255));
|
||||
renderer->FillRoundRect(boxStartX+1, getY()+1, stringWidth - 3, mainFontHeight - 4, 5, ARGB(220, 5, 5, 5));
|
||||
renderer->FillRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 4, 5, ARGB(255, 140, 23, 23));
|
||||
renderer->DrawRoundRect(boxStartX, getY(), stringWidth - 3, mainFontHeight - 4, 5, ARGB(255, 5, 5, 5));
|
||||
mYOffset += 2;
|
||||
#endif
|
||||
|
||||
@@ -86,7 +87,7 @@ void InteractiveButton::Render()
|
||||
{
|
||||
renderer->RenderQuad(buttonImage.get(), buttonXOffset - buttonImage.get()->mWidth/2, buttonYOffset + mainFontHeight/2, 0, pspIconsSize, pspIconsSize);
|
||||
}
|
||||
mainFont->SetColor(ARGB(255, 0, 0, 0));
|
||||
//mainFont->SetColor(ARGB(255, 0, 0, 0));
|
||||
mainFont->DrawString(detailedInfoString, buttonXOffset, buttonYOffset);
|
||||
}
|
||||
|
||||
|
||||
+965
-187
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,8 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
initMTGCI();
|
||||
model = card;
|
||||
attacker = 0;
|
||||
willattackplayer = 0;
|
||||
willattackpw = 0;
|
||||
lifeOrig = life;
|
||||
origpower = power;
|
||||
basepower = origpower;
|
||||
@@ -49,6 +51,7 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
if (arg_belongs_to)
|
||||
owner = arg_belongs_to->library->owner;
|
||||
lastController = owner;
|
||||
previousController = owner;
|
||||
defenser = NULL;
|
||||
banding = NULL;
|
||||
life = toughness;
|
||||
@@ -63,33 +66,68 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
|
||||
bypassTC = false;
|
||||
discarded = false;
|
||||
copiedID = getId();
|
||||
modifiedbAbi = 0;
|
||||
copiedSetID = 0;
|
||||
LKIpower = power;
|
||||
LKItoughness = toughness;
|
||||
cardistargetted = 0;
|
||||
cardistargetter = 0;
|
||||
forcedBorderA = 0;
|
||||
forcedBorderB = 0;
|
||||
myconvertedcost = getManaCost()->getConvertedCost();
|
||||
revealedLast = NULL;
|
||||
MadnessPlay = false;
|
||||
revealedLast = NULL;
|
||||
MadnessPlay = false;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGCardInstance::createSnapShot()
|
||||
{
|
||||
MTGCardInstance * snapShot = NEW MTGCardInstance(*this);
|
||||
snapShot->previous = NULL;
|
||||
snapShot->counters = NEW Counters(snapShot);
|
||||
controller()->game->garbage->addCard(snapShot);
|
||||
//the below section of code was changed without all possible side effects checked
|
||||
//the reason was becuase while NEW MTGCardInstance(*this); does indeed return an exact copy
|
||||
//the lower layer cardprimitive data is pointed to from the original source.
|
||||
//this would cause cards like lotus bloom, which contain a restriction, to already has deleted the restriction
|
||||
//which belonged to the original card before getting to the safe_delete,
|
||||
//it was leaving a dangling pointer which leads to
|
||||
//a total crash on "cleanup()" calls from garbage zone.
|
||||
//snapshots are created for extra cost, they are used for abilities contained after the cost through storecard variable.
|
||||
//TODO:fix this correctly. I want this to use an exact copy of the card in its current state for stored.
|
||||
//making it safe_delete these "copies" leads to the same crash, as they are still pointing to the original data.
|
||||
MTGCardInstance * snapShot = this;
|
||||
//below is how we used to handle this.
|
||||
// MTGCardInstance * snapShot = NEW MTGCardInstance(*this);
|
||||
//snapShot->previous = NULL;
|
||||
// snapShot->counters = NEW Counters(snapShot);
|
||||
//controller()->game->garbage->addCard(snapShot);
|
||||
return snapShot;
|
||||
}
|
||||
|
||||
void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
{
|
||||
MTGCard * source = card->model;
|
||||
CardPrimitive * data = source->data;
|
||||
MTGCard * source = NULL;
|
||||
if(card->isACopier && card->copiedID)
|
||||
{
|
||||
source = MTGCollection()->getCardById(card->copiedID);
|
||||
}
|
||||
else if(card->isToken || card->hasCopiedToken)
|
||||
{
|
||||
if(card->getMTGId() > 0)//not generated token
|
||||
source = MTGCollection()->getCardById(card->getMTGId());
|
||||
else
|
||||
{
|
||||
source = card->tokCard;
|
||||
source->data = card->tokCard;//?wtf
|
||||
}
|
||||
}
|
||||
else
|
||||
source = MTGCollection()->getCardById(card->copiedID);
|
||||
|
||||
basicAbilities = card->basicAbilities;
|
||||
origbasicAbilities = card->origbasicAbilities;
|
||||
modifiedbAbi = card->modifiedbAbi;
|
||||
if(!source)
|
||||
source = card;
|
||||
|
||||
CardPrimitive * data = source->data;
|
||||
//basicAbilities = data->basicAbilities;
|
||||
for(unsigned int j = 0; j < data->basicAbilities.size(); j++)
|
||||
{
|
||||
if(data->basicAbilities[j])
|
||||
basicAbilities[j] = data->basicAbilities[j];
|
||||
}
|
||||
types.clear();//reset types.. fix copying man lands... the copier becomes an unanimated land...
|
||||
for (size_t i = 0; i < data->types.size(); i++)
|
||||
{
|
||||
types.push_back(data->types[i]);
|
||||
@@ -99,7 +137,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
|
||||
manaCost.copy(data->getManaCost());
|
||||
|
||||
setText(""); //The text is retrieved from the data anyways
|
||||
setText(data->text); //The text is retrieved from the data anyways
|
||||
setName(data->name);
|
||||
|
||||
power = data->power;//layer 7a
|
||||
@@ -111,29 +149,35 @@ void MTGCardInstance::copy(MTGCardInstance * card)
|
||||
magicText = data->magicText;
|
||||
spellTargetType = data->spellTargetType;
|
||||
alias = data->alias;
|
||||
copiedID = card->copiedID;
|
||||
copiedSetID = card->setId;
|
||||
doubleFaced = data->doubleFaced;
|
||||
AICustomCode = data->AICustomCode;
|
||||
CrewAbility = data->CrewAbility;
|
||||
ModularValue = data->ModularValue;
|
||||
PhasedOutAbility = data->PhasedOutAbility;
|
||||
origpower = card->origpower;//for flip
|
||||
origtoughness = card->origtoughness;//for flip
|
||||
TokenAndAbility = card->TokenAndAbility;//token andAbility
|
||||
tokCard = card->tokCard;
|
||||
|
||||
//Now this is dirty...
|
||||
int backupid = mtgid;
|
||||
int castMethodBackUP = this->castMethod;
|
||||
mtgid = source->getId();
|
||||
MTGCardInstance * oldStored = this->storedSourceCard;
|
||||
Spell * spell = NEW Spell(observer, this);
|
||||
observer = card->observer;
|
||||
AbilityFactory af(observer);
|
||||
af.addAbilities(observer->mLayers->actionLayer()->getMaxId(), spell);
|
||||
delete spell;
|
||||
if(observer->players[1]->playMode == Player::MODE_TEST_SUITE)
|
||||
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 = backupid; // found a way :)
|
||||
|
||||
castMethod = castMethodBackUP;
|
||||
backupTargets = this->backupTargets;
|
||||
storedCard = oldStored;
|
||||
miracle = false;
|
||||
|
||||
|
||||
//add event here copied a card...
|
||||
WEvent * e = NEW WEventCardCopiedACard(this);
|
||||
getObserver()->receiveEvent(e);
|
||||
}
|
||||
|
||||
MTGCardInstance::~MTGCardInstance()
|
||||
@@ -153,12 +197,14 @@ int MTGCardInstance::init()
|
||||
data = this;
|
||||
X = 0;
|
||||
castX = 0;
|
||||
setX = -1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void MTGCardInstance::initMTGCI()
|
||||
{
|
||||
X = 0;
|
||||
setX = -1;
|
||||
sample = "";
|
||||
model = NULL;
|
||||
isToken = false;
|
||||
@@ -178,8 +224,10 @@ void MTGCardInstance::initMTGCI()
|
||||
blinked = false;
|
||||
isExtraCostTarget = false;
|
||||
morphed = false;
|
||||
exerted = false;
|
||||
turningOver = false;
|
||||
isMorphed = false;
|
||||
MeldedFrom = "";
|
||||
isFlipped = false;
|
||||
isPhased = false;
|
||||
isCascaded = false;
|
||||
@@ -190,18 +238,24 @@ void MTGCardInstance::initMTGCI()
|
||||
sunburst = 0;
|
||||
equipment = 0;
|
||||
auras = 0;
|
||||
combatdamageToOpponent = false;
|
||||
damageToOpponent = false;
|
||||
damageToController = false;
|
||||
damageToCreature = false;
|
||||
isProvoked = false;
|
||||
ProvokeTarget = NULL;
|
||||
Provoker = NULL;
|
||||
wasDealtDamage = false;
|
||||
isDualWielding = false;
|
||||
suspended = false;
|
||||
isBestowed = false;
|
||||
isBestowed = false;
|
||||
isFacedown = false;
|
||||
castMethod = Constants::NOT_CAST;
|
||||
mPropertiesChangedSinceLastUpdate = false;
|
||||
stillNeeded = true;
|
||||
kicked = 0;
|
||||
dredge = 0;
|
||||
zpos = 0;
|
||||
chooseacolor = -1;
|
||||
chooseasubtype = "";
|
||||
coinSide = -1;
|
||||
@@ -209,8 +263,12 @@ void MTGCardInstance::initMTGCI()
|
||||
storedCard = NULL;
|
||||
storedSourceCard = NULL;
|
||||
myPair = NULL;
|
||||
shackled = NULL;
|
||||
seized = NULL;
|
||||
miracle = false;
|
||||
hasCopiedToken = false;
|
||||
countTrini = 0;
|
||||
anymanareplacement = false;
|
||||
imprintedCards.clear();
|
||||
attackCost = 0;
|
||||
attackCostBackup = 0;
|
||||
@@ -223,9 +281,13 @@ void MTGCardInstance::initMTGCI()
|
||||
imprintR = 0;
|
||||
imprintB = 0;
|
||||
imprintW = 0;
|
||||
bushidoPoints = 0;
|
||||
modularPoints = 0;
|
||||
entersBattlefield = 0;
|
||||
currentimprintName = "";
|
||||
imprintedNames.clear();
|
||||
CountedObjects = 0;
|
||||
CountedObjects = 0;
|
||||
CountedObjectsB = 0;
|
||||
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_SUSPEND +1; i++)
|
||||
alternateCostPaid[i] = 0;
|
||||
@@ -243,8 +305,13 @@ void MTGCardInstance::initMTGCI()
|
||||
owner = NULL;
|
||||
counters = NEW Counters(this);
|
||||
previousZone = NULL;
|
||||
tokCard = NULL;
|
||||
previous = NULL;
|
||||
next = NULL;
|
||||
auraParent = NULL;
|
||||
TokenAndAbility = NULL;
|
||||
GrantedAndAbility = NULL;
|
||||
discarderOwner = NULL;
|
||||
lastController = NULL;
|
||||
regenerateTokens = 0;
|
||||
blocked = false;
|
||||
@@ -252,6 +319,7 @@ void MTGCardInstance::initMTGCI()
|
||||
exileEffects = false;
|
||||
currentZone = NULL;
|
||||
cardsAbilities = vector<MTGAbility *>();
|
||||
//cardsAbilitiesFilter = vector<MTGAbility *>();
|
||||
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item
|
||||
|
||||
if (observer && basicAbilities[(int)Constants::CHANGELING])
|
||||
@@ -383,7 +451,51 @@ int MTGCardInstance::afterDamage()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MTGCardInstance::bury()
|
||||
int MTGCardInstance::totem(bool noregen)
|
||||
{
|
||||
int testToughness = toughness;
|
||||
testToughness += tbonus;
|
||||
if(testToughness < 1)
|
||||
{
|
||||
if(noregen)
|
||||
return toGrave();
|
||||
else if (!triggerRegenerate())
|
||||
return toGrave();
|
||||
return 0;
|
||||
}
|
||||
bool canregen = (regenerateTokens && !has(Constants::CANTREGEN) && !noregen);
|
||||
vector<MTGAbility*>selection;
|
||||
TargetChooserFactory tf(getObserver());
|
||||
TargetChooser * tcb = tf.createTargetChooser("mytotem",this);
|
||||
tcb->targetter = NULL;
|
||||
tcb->maxtargets = 1;
|
||||
MTGAbility * destroyTotem = NEW ATriggerTotem(getObserver(), getObserver()->mLayers->actionLayer()->getMaxId(),this,NULL);
|
||||
destroyTotem->oneShot = true;
|
||||
destroyTotem->canBeInterrupted = false;
|
||||
MTGAbility * dtTarget = NEW GenericTargetAbility(getObserver(), "","",getObserver()->mLayers->actionLayer()->getMaxId(), this,tcb->clone(), destroyTotem->clone());
|
||||
SAFE_DELETE(destroyTotem);
|
||||
dtTarget->oneShot = true;
|
||||
dtTarget->canBeInterrupted = false;
|
||||
MTGAbility * addTotemtoGame = NEW GenericAddToGame(getObserver(), getObserver()->mLayers->actionLayer()->getMaxId(), this,NULL,dtTarget->clone());
|
||||
SAFE_DELETE(dtTarget);
|
||||
addTotemtoGame->oneShot = true;
|
||||
addTotemtoGame->canBeInterrupted = false;
|
||||
selection.push_back(addTotemtoGame->clone());
|
||||
SAFE_DELETE(addTotemtoGame);
|
||||
SAFE_DELETE(tcb);
|
||||
if(canregen)
|
||||
{
|
||||
MTGAbility * triggerRegen = NEW ATriggerRegen(getObserver(), getObserver()->mLayers->actionLayer()->getMaxId(), this, this);
|
||||
triggerRegen->oneShot = true;
|
||||
triggerRegen->canBeInterrupted = false;
|
||||
selection.push_back(triggerRegen->clone());
|
||||
SAFE_DELETE(triggerRegen);
|
||||
}
|
||||
MTGAbility * menuChoice = NEW MenuAbility(getObserver(), getObserver()->mLayers->actionLayer()->getMaxId(), NULL, this,true,selection,this->controller(),"");
|
||||
menuChoice->addToGame();
|
||||
return 1;
|
||||
}
|
||||
int MTGCardInstance::toGrave( bool forced )
|
||||
{
|
||||
Player * p = controller();
|
||||
if (basicAbilities[(int)Constants::EXILEDEATH])
|
||||
@@ -396,15 +508,29 @@ int MTGCardInstance::bury()
|
||||
p->game->putInZone(this, p->game->inPlay, owner->game->graveyard);
|
||||
return 1;
|
||||
}
|
||||
if (forced)
|
||||
{
|
||||
p->game->putInZone(this, p->game->inPlay, owner->game->graveyard);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int MTGCardInstance::destroy()
|
||||
{
|
||||
if (!triggerRegenerate())
|
||||
return bury();
|
||||
if (hasTotemArmor())
|
||||
return totem();
|
||||
else if (!triggerRegenerate())
|
||||
return toGrave();
|
||||
return 0;
|
||||
}
|
||||
int MTGCardInstance::destroyNoRegen()
|
||||
{
|
||||
if (hasTotemArmor())
|
||||
return totem(true);
|
||||
else
|
||||
return toGrave();
|
||||
return 0;
|
||||
}
|
||||
|
||||
MTGGameZone * MTGCardInstance::getCurrentZone()
|
||||
{
|
||||
return currentZone;
|
||||
@@ -464,12 +590,14 @@ void MTGCardInstance::eventblocked(MTGCardInstance * opponent)
|
||||
}
|
||||
|
||||
//Taps the card
|
||||
void MTGCardInstance::tap()
|
||||
void MTGCardInstance::tap(bool sendNoEvent)
|
||||
{
|
||||
if (tapped)
|
||||
return;
|
||||
tapped = 1;
|
||||
WEvent * e = NEW WEventCardTap(this, 0, 1);
|
||||
if (sendNoEvent)
|
||||
dynamic_cast<WEventCardTap*>(e)->noTrigger = true;
|
||||
observer->receiveEvent(e);
|
||||
}
|
||||
|
||||
@@ -589,7 +717,7 @@ int MTGCardInstance::hasSummoningSickness()
|
||||
{
|
||||
if (!summoningSickness)
|
||||
return 0;
|
||||
if (basicAbilities[(int)Constants::HASTE])
|
||||
if (has(Constants::HASTE))
|
||||
return 0;
|
||||
if (!isCreature())
|
||||
return 0;
|
||||
@@ -614,15 +742,25 @@ Player * MTGCardInstance::controller()
|
||||
return lastController;
|
||||
}
|
||||
|
||||
int MTGCardInstance::canAttack()
|
||||
int MTGCardInstance::canAttack( bool pwcheck )
|
||||
{
|
||||
if (basicAbilities[(int)Constants::CANTATTACK])
|
||||
return 0;
|
||||
if(!pwcheck)
|
||||
{
|
||||
if (has(Constants::CANTATTACK))
|
||||
return 0;
|
||||
if (has(Constants::FLYERSONLY) && !has(Constants::FLYING))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (has(Constants::CANTPWATTACK))
|
||||
return 0;
|
||||
}
|
||||
if (tapped)
|
||||
return 0;
|
||||
if (hasSummoningSickness())
|
||||
return 0;
|
||||
if (basicAbilities[(int)Constants::DEFENSER] && !basicAbilities[(int)Constants::CANATTACK])
|
||||
if (has(Constants::DEFENSER) && !has(Constants::CANATTACK))
|
||||
return 0;
|
||||
if (!isCreature())
|
||||
return 0;
|
||||
@@ -764,91 +902,121 @@ void MTGCardInstance::switchPT(bool apply)
|
||||
|
||||
int MTGCardInstance::getCurrentPower()
|
||||
{
|
||||
if(!isInPlay(observer))
|
||||
if(observer && !isCreature())
|
||||
return 0;
|
||||
if(observer && !isInPlay(observer))
|
||||
return LKIpower;
|
||||
return power;
|
||||
}
|
||||
|
||||
int MTGCardInstance::getCurrentToughness()
|
||||
{
|
||||
if(!isInPlay(observer))
|
||||
if(observer && !isCreature())
|
||||
return 0;
|
||||
if(observer && !isInPlay(observer))
|
||||
return LKItoughness;
|
||||
return toughness;
|
||||
}
|
||||
|
||||
int MTGCardInstance::countDuplicateCardNames()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if(observer)
|
||||
{
|
||||
int nb_cards = controller()->game->battlefield->nb_cards;
|
||||
for(int x = 0; x < nb_cards; x++)
|
||||
{
|
||||
if(controller()->game->battlefield->cards[x]->name == this->name)
|
||||
count+=1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
int MTGCardInstance::countDuplicateCardTypes()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if(observer)
|
||||
{
|
||||
int nb_cards = controller()->game->battlefield->nb_cards;
|
||||
for(int x = 0; x < nb_cards; x++)
|
||||
{
|
||||
if(controller()->game->battlefield->cards[x] != this && controller()->game->battlefield->cards[x]->types == this->types)
|
||||
count+=1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//check can produce mana
|
||||
int MTGCardInstance::canproduceMana(int color)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if(cardsAbilities.size())
|
||||
{
|
||||
for(unsigned int j = 0; j < cardsAbilities.size(); j++)
|
||||
{
|
||||
AbilityFactory af(observer);
|
||||
MTGAbility * toCheck = af.getCoreAbility(cardsAbilities[j]);
|
||||
if(dynamic_cast<AManaProducer*> (toCheck) && dynamic_cast<AManaProducer*> (toCheck)->output->hasColor(color))
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if(count)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//check can be played from library top
|
||||
bool MTGCardInstance::canPlayFromLibrary()
|
||||
{
|
||||
int found = 0;
|
||||
if(has(Constants::CANPLAYFROMLIBRARYTOP)
|
||||
|| (controller()->game->inPlay->nb_cards && controller()->game->inPlay->hasAbility(Constants::CANPLAYFROMLIBRARYTOP)))
|
||||
found++;
|
||||
if(isLand() && (has(Constants::CANPLAYLANDTOPLIBRARY)
|
||||
|| (controller()->game->inPlay->nb_cards && controller()->game->inPlay->hasAbility(Constants::CANPLAYLANDTOPLIBRARY))))
|
||||
found++;
|
||||
if(hasSubtype(Subtypes::TYPE_ARTIFACT) && (has(Constants::CANPLAYARTIFACTTOPLIBRARY)
|
||||
|| (controller()->game->inPlay->nb_cards && controller()->game->inPlay->hasAbility(Constants::CANPLAYARTIFACTTOPLIBRARY))))
|
||||
found++;
|
||||
if(isCreature() && (has(Constants::CANPLAYCREATURETOPLIBRARY)
|
||||
|| (controller()->game->inPlay->nb_cards && controller()->game->inPlay->hasAbility(Constants::CANPLAYCREATURETOPLIBRARY))))
|
||||
found++;
|
||||
if(isSorceryorInstant() && (has(Constants::CANPLAYINSTANTSORCERYTOPLIBRARY)
|
||||
|| (controller()->game->inPlay->nb_cards && controller()->game->inPlay->hasAbility(Constants::CANPLAYINSTANTSORCERYTOPLIBRARY))))
|
||||
found++;
|
||||
|
||||
if(found > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//check stack
|
||||
bool MTGCardInstance::StackIsEmptyandSorcerySpeed()
|
||||
{
|
||||
Player * whoInterupts = getObserver()->isInterrupting;//leave this so we can actually debug who is interupting/current.
|
||||
Player * whoCurrent = getObserver()->currentPlayer;
|
||||
if((getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) &&
|
||||
(getObserver()->getCurrentGamePhase() == MTG_PHASE_FIRSTMAIN ||
|
||||
getObserver()->getCurrentGamePhase() == MTG_PHASE_SECONDMAIN) &&
|
||||
controller() == getObserver()->currentPlayer &&
|
||||
!getObserver()->isInterrupting)
|
||||
controller() == whoCurrent &&
|
||||
(!whoInterupts || whoInterupts == whoCurrent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//check targetted?
|
||||
bool MTGCardInstance::isTargetted()
|
||||
{
|
||||
if(controller()->game->reveal->cards.size() || controller()->opponent()->game->reveal->cards.size())
|
||||
return false;
|
||||
|
||||
if(getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
|
||||
{
|
||||
ActionStack * stack = observer->mLayers->stackLayer();
|
||||
for (int i = stack->mObjects.size() - 1; i >= 0; i--)
|
||||
{
|
||||
Interruptible * current = ((Interruptible *) stack->mObjects[i]);
|
||||
if ((current->type == ACTION_SPELL || current->type == ACTION_ABILITY) && current->state == NOT_RESOLVED)
|
||||
{
|
||||
if(current->type == ACTION_SPELL)
|
||||
{
|
||||
Spell * spell = (Spell *) current;
|
||||
if(spell->getNextTarget() && spell->getNextTarget() == (Targetable*)this)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cardistargetted)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
//check targetter?
|
||||
bool MTGCardInstance::isTargetter()
|
||||
{
|
||||
if(controller()->game->reveal->cards.size() || controller()->opponent()->game->reveal->cards.size())
|
||||
return false;
|
||||
|
||||
if(getObserver()->mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
|
||||
{
|
||||
ActionStack * stack = observer->mLayers->stackLayer();
|
||||
for (int i = stack->mObjects.size() - 1; i >= 0; i--)
|
||||
{
|
||||
Interruptible * current = ((Interruptible *) stack->mObjects[i]);
|
||||
if ((current->type == ACTION_SPELL || current->type == ACTION_ABILITY) && current->state == NOT_RESOLVED)
|
||||
{
|
||||
if(current->type == ACTION_SPELL)
|
||||
{
|
||||
Spell * spell = (Spell *) current;
|
||||
if(spell && spell->source == this)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cardistargetter)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int MTGCardInstance::canBlock()
|
||||
{
|
||||
if (tapped)
|
||||
if (tapped && !has(Constants::CANBLOCKTAPPED))
|
||||
return 0;
|
||||
if (basicAbilities[(int)Constants::CANTBLOCK])
|
||||
return 0;
|
||||
@@ -956,120 +1124,204 @@ JQuadPtr MTGCardInstance::getIcon()
|
||||
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
|
||||
}
|
||||
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * newCost, ManaCost * refCost, bool noTrinisphere)
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cost, ManaCost * Data, bool noTrinisphere, bool bestow)
|
||||
{
|
||||
if(!card)
|
||||
return NULL;
|
||||
|
||||
if(card->getIncreasedManaCost()->getConvertedCost())
|
||||
newCost->add(card->getIncreasedManaCost());
|
||||
int color = 0;
|
||||
string type = "";
|
||||
ManaCost * original = NEW ManaCost();
|
||||
ManaCost * excess = NEW ManaCost();
|
||||
original->copy(Data);
|
||||
Cost->copy(original);
|
||||
if (Cost->extraCosts)
|
||||
{
|
||||
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
|
||||
{
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost()
|
||||
|| card->controller()->AuraReduced->getConvertedCost() || card->controller()->AuraIncreased->getConvertedCost())
|
||||
{//start1
|
||||
if (card->getIncreasedManaCost()->getConvertedCost())
|
||||
original->add(card->getIncreasedManaCost());
|
||||
if(bestow && card->controller()->AuraIncreased->getConvertedCost())
|
||||
original->add(card->controller()->AuraIncreased);
|
||||
//before removing get the diff for excess
|
||||
if(card->getReducedManaCost()->getConvertedCost())
|
||||
newCost->remove(card->getReducedManaCost());
|
||||
if(refCost->extraCosts)
|
||||
newCost->extraCosts = refCost->extraCosts;
|
||||
//affinity
|
||||
int color = 0;
|
||||
string type = "";
|
||||
ManaCost * original = NEW ManaCost();
|
||||
original->copy(newCost);
|
||||
int reducem = 0;
|
||||
bool resetCost = false;
|
||||
for(unsigned int na = 0; na < card->cardsAbilities.size();na++)
|
||||
{//start2
|
||||
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
|
||||
if(newAff)
|
||||
{
|
||||
if(!resetCost)
|
||||
{
|
||||
for(int xc = 0; xc < 7;xc++)
|
||||
{//if the diff is more than 0
|
||||
if(card->getReducedManaCost()->getCost(xc) > original->getCost(xc))
|
||||
{
|
||||
resetCost = true;
|
||||
newCost->copy(original);
|
||||
int count = card->getReducedManaCost()->getCost(xc) - original->getCost(xc);
|
||||
excess->add(xc,count);
|
||||
}
|
||||
TargetChooserFactory tf(observer);
|
||||
TargetChooser * tcn = tf.createTargetChooser(newAff->tcString,card,NULL);
|
||||
|
||||
for (int w = 0; w < 2; ++w)
|
||||
}
|
||||
}
|
||||
//apply reduced
|
||||
if (card->getReducedManaCost()->getConvertedCost())
|
||||
original->remove(card->getReducedManaCost());
|
||||
if(bestow && card->controller()->AuraReduced->getConvertedCost())
|
||||
original->remove(card->controller()->AuraReduced);
|
||||
//try to reduce hybrid
|
||||
if (excess->getConvertedCost())
|
||||
{
|
||||
original->removeHybrid(excess);
|
||||
}
|
||||
Cost->copy(original);
|
||||
if (Cost->extraCosts)
|
||||
{
|
||||
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
|
||||
{
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
}//end1
|
||||
int reducem = 0;
|
||||
bool resetCost = false;
|
||||
for (unsigned int na = 0; na < card->cardsAbilities.size(); na++)
|
||||
{//start2
|
||||
if (!card->cardsAbilities[na])
|
||||
break;
|
||||
ANewAffinity * newAff = dynamic_cast<ANewAffinity*>(card->cardsAbilities[na]);
|
||||
if (newAff)
|
||||
{
|
||||
if (!resetCost)
|
||||
{
|
||||
resetCost = true;
|
||||
Cost->copy(original);
|
||||
if (Cost->extraCosts)
|
||||
{
|
||||
Player *p = observer->players[w];
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
|
||||
for (int k = 0; k < 6; k++)
|
||||
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (tcn->targetsZone(z))
|
||||
reducem += z->countByCanTarget(tcn);
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
SAFE_DELETE(tcn);
|
||||
ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
|
||||
for(int j = 0; j < reducem; j++)
|
||||
newCost->remove(removingCost);
|
||||
SAFE_DELETE(removingCost);
|
||||
}
|
||||
}//end2
|
||||
if(card->has(Constants::AFFINITYARTIFACTS)||
|
||||
card->has(Constants::AFFINITYFOREST)||
|
||||
card->has(Constants::AFFINITYGREENCREATURES)||
|
||||
card->has(Constants::AFFINITYISLAND)||
|
||||
card->has(Constants::AFFINITYMOUNTAIN)||
|
||||
card->has(Constants::AFFINITYPLAINS)||
|
||||
card->has(Constants::AFFINITYSWAMP))
|
||||
{//start3
|
||||
if (card->has(Constants::AFFINITYARTIFACTS))
|
||||
type = "artifact";
|
||||
else if (card->has(Constants::AFFINITYSWAMP))
|
||||
type = "swamp";
|
||||
else if (card->has(Constants::AFFINITYMOUNTAIN))
|
||||
type = "mountain";
|
||||
else if (card->has(Constants::AFFINITYPLAINS))
|
||||
type = "plains";
|
||||
else if (card->has(Constants::AFFINITYISLAND))
|
||||
type = "island";
|
||||
else if (card->has(Constants::AFFINITYFOREST))
|
||||
type = "forest";
|
||||
else if (card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
color = 1;
|
||||
type = "creature";
|
||||
}
|
||||
newCost->copy(original);
|
||||
int reduce = 0;
|
||||
if(card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
TargetChooserFactory tf(observer);
|
||||
TargetChooser * tc = tf.createTargetChooser("creature[green]",NULL);
|
||||
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
else
|
||||
reduce = card->controller()->game->battlefield->countByType(type);
|
||||
for(int i = 0; i < reduce;i++)
|
||||
if(newCost->getCost(color) > 0)
|
||||
newCost->remove(color,1);
|
||||
}//end3
|
||||
|
||||
if(!noTrinisphere)
|
||||
{
|
||||
//trinisphere... now how to implement kicker recomputation
|
||||
if(card->has(Constants::TRINISPHERE))
|
||||
{
|
||||
for(int jj = newCost->getConvertedCost(); jj < 3; jj++)
|
||||
TargetChooserFactory tf(getObserver());
|
||||
TargetChooser * tcn = tf.createTargetChooser(newAff->tcString, card, NULL);
|
||||
|
||||
for (int w = 0; w < 2; ++w)
|
||||
{
|
||||
newCost->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
card->countTrini++;
|
||||
Player *p = getObserver()->players[w];
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->stack, p->game->exile };
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (tcn->targetsZone(z))
|
||||
{
|
||||
reducem += z->countByCanTarget(tcn);
|
||||
}
|
||||
}
|
||||
}
|
||||
SAFE_DELETE(tcn);
|
||||
ManaCost * removingCost = ManaCost::parseManaCost(newAff->manaString);
|
||||
for (int j = 0; j < reducem; j++)
|
||||
original->remove(removingCost);
|
||||
SAFE_DELETE(removingCost);
|
||||
}
|
||||
}//end2
|
||||
if (card->has(Constants::AFFINITYARTIFACTS) ||
|
||||
card->has(Constants::AFFINITYFOREST) ||
|
||||
card->has(Constants::AFFINITYGREENCREATURES) ||
|
||||
card->has(Constants::AFFINITYISLAND) ||
|
||||
card->has(Constants::AFFINITYMOUNTAIN) ||
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::CONDUITED))
|
||||
{//start3
|
||||
if (card->has(Constants::AFFINITYARTIFACTS))
|
||||
{
|
||||
type = "artifact";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYSWAMP))
|
||||
{
|
||||
type = "swamp";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYMOUNTAIN))
|
||||
{
|
||||
type = "mountain";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYPLAINS))
|
||||
{
|
||||
type = "plains";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYISLAND))
|
||||
{
|
||||
type = "island";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYFOREST))
|
||||
{
|
||||
type = "forest";
|
||||
}
|
||||
else if (card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
color = 1;
|
||||
type = "creature";
|
||||
}
|
||||
|
||||
Cost->copy(original);
|
||||
if (Cost->extraCosts)
|
||||
{
|
||||
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
|
||||
{
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
if (Cost->extraCosts)
|
||||
{
|
||||
for (unsigned int i = 0; i < Cost->extraCosts->costs.size(); i++)
|
||||
{
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
int reduce = 0;
|
||||
if (card->has(Constants::AFFINITYGREENCREATURES))
|
||||
{
|
||||
TargetChooserFactory tf(getObserver());
|
||||
TargetChooser * tc = tf.createTargetChooser("creature[green]", NULL);
|
||||
reduce = card->controller()->game->battlefield->countByCanTarget(tc);
|
||||
SAFE_DELETE(tc);
|
||||
}
|
||||
else if (card->has(Constants::CONDUITED))
|
||||
{//I had to hardcode this since it doesn't update with auto=this(creaturespells<1) lord(creature|mycastingzone) altercost(colorless,-2)
|
||||
color = 0;
|
||||
reduce = card->controller()->inPlay()->countByAlias(401847);
|
||||
reduce *= 2;
|
||||
if(card->controller()->game->stack->seenThisTurn("creature", Constants::CAST_ALL) > 0)
|
||||
reduce = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(card->countTrini)
|
||||
{
|
||||
newCost->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini);
|
||||
card->countTrini=0;
|
||||
}
|
||||
reduce = card->controller()->game->battlefield->countByType(type);
|
||||
}
|
||||
for (int i = 0; i < reduce; i++)
|
||||
{
|
||||
if (Cost->getCost(color) > 0)
|
||||
Cost->remove(color, 1);
|
||||
}
|
||||
}//end3
|
||||
//trinisphere... now how to implement kicker recomputation
|
||||
|
||||
if (card->has(Constants::TRINISPHERE))
|
||||
{
|
||||
for (int jj = Cost->getConvertedCost(); jj < 3; jj++)
|
||||
{
|
||||
Cost->add(Constants::MTG_COLOR_ARTIFACT, 1);
|
||||
card->countTrini++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (card->countTrini)
|
||||
{
|
||||
Cost->remove(Constants::MTG_COLOR_ARTIFACT, card->countTrini);
|
||||
card->countTrini = 0;
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_DELETE(original);
|
||||
|
||||
return newCost;
|
||||
SAFE_DELETE(excess);
|
||||
return Cost;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGCardInstance::getNextPartner()
|
||||
@@ -1132,17 +1384,27 @@ int MTGCardInstance::setAttacker(int value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int MTGCardInstance::toggleAttacker()
|
||||
int MTGCardInstance::toggleAttacker(bool pw)
|
||||
{
|
||||
if (!attacker)
|
||||
{
|
||||
//if (!basicAbilities[Constants::VIGILANCE]) tap();
|
||||
if(pw)
|
||||
{
|
||||
willattackpw = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
willattackplayer = 1;
|
||||
}
|
||||
setAttacker(1);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//untap();
|
||||
willattackpw = 0;
|
||||
willattackplayer = 0;
|
||||
setAttacker(0);
|
||||
isAttacking = NULL;
|
||||
return 1;
|
||||
@@ -1327,6 +1589,32 @@ bool MTGCardInstance::matchesCastFilter(int castFilter) {
|
||||
return (castFilter == castMethod);
|
||||
};
|
||||
|
||||
bool MTGCardInstance::hasTotemArmor()
|
||||
{
|
||||
int count = 0;
|
||||
if(observer)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int nb_cards = observer->players[i]->game->battlefield->nb_cards;
|
||||
for(int x = 0; x < nb_cards; x++)
|
||||
{
|
||||
if(observer->players[i]->game->battlefield->cards[x]->auraParent)
|
||||
{
|
||||
if(observer->players[i]->game->battlefield->cards[x]->auraParent == this &&
|
||||
observer->players[i]->game->battlefield->cards[x]->has(Constants::TOTEMARMOR))
|
||||
count+=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int MTGCardInstance::addProtection(TargetChooser * tc)
|
||||
{
|
||||
tc->targetter = NULL;
|
||||
|
||||
+108
-25
@@ -58,7 +58,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
switch (key[0])
|
||||
{
|
||||
case 'a':
|
||||
if (key == "auto")
|
||||
if (key == "aicode")//replacement code for AI. for reveal:number basic version only
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
primitive->setAICustomCode(val);
|
||||
}
|
||||
else if (key == "auto")
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
primitive->addMagicText(val);
|
||||
@@ -107,17 +112,17 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
|
||||
case 'b': //buyback/Bestow
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
if (key[1] == 'e' && key[2] == 's')
|
||||
{ //bestow
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
if (ManaCost * cost = primitive->getManaCost())
|
||||
{
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
cost->setBestow(ManaCost::parseManaCost(value));
|
||||
}
|
||||
}
|
||||
else//buyback
|
||||
if (key[1] == 'e' && key[2] == 's')
|
||||
{ //bestow
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
if (ManaCost * cost = primitive->getManaCost())
|
||||
{
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
cost->setBestow(ManaCost::parseManaCost(value));
|
||||
}
|
||||
}
|
||||
else//buyback
|
||||
if (ManaCost * cost = primitive->getManaCost())
|
||||
{
|
||||
string value = val;
|
||||
@@ -126,9 +131,17 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c': //color
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
case 'c': //crew ability
|
||||
if (key == "crewbonus")
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
{
|
||||
primitive->setCrewAbility(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!primitive) primitive = NEW CardPrimitive();
|
||||
{//color
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
vector<string> values = split(value, ',');
|
||||
@@ -138,10 +151,18 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
primitive->setColor(values[values_i], removeAllOthers);
|
||||
removeAllOthers = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'd'://dredge
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
case 'd'://double faced card /dredge
|
||||
if (key == "doublefaced")
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
{
|
||||
primitive->setdoubleFaced(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!primitive) primitive = NEW CardPrimitive();
|
||||
{
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
@@ -203,9 +224,16 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
case 'm': //mana
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
{
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
primitive->setManaCost(value);
|
||||
if( key == "modular")//modular
|
||||
{
|
||||
primitive->setModularValue(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = val;
|
||||
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
|
||||
primitive->setManaCost(value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -243,7 +271,15 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if (key[1] == 'r')
|
||||
if (key == "phasedoutbonus")
|
||||
{
|
||||
if (!primitive) primitive = NEW CardPrimitive();
|
||||
{
|
||||
primitive->setPhasedOutAbility(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (key[1] == 'r')
|
||||
{ // primitive
|
||||
if (!card) card = NEW MTGCard();
|
||||
map<string, CardPrimitive*>::iterator it = primitives.find(val);
|
||||
@@ -851,6 +887,12 @@ MTGDeck::MTGDeck(const string& config_file, MTGAllCards * _allcards, int meta_on
|
||||
meta_unlockRequirements = s.substr(found + 7);
|
||||
continue;
|
||||
}
|
||||
found = s.find("SB:");
|
||||
if (found != string::npos)
|
||||
{
|
||||
Sideboard.push_back(s.substr(found + 3));
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (meta_only) break;
|
||||
@@ -1072,6 +1114,16 @@ int MTGDeck::removeAll()
|
||||
return 1;
|
||||
}
|
||||
|
||||
void MTGDeck::replaceSB(vector<string> newSB)
|
||||
{
|
||||
if(newSB.size())
|
||||
{
|
||||
Sideboard.clear();
|
||||
Sideboard = newSB;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int MTGDeck::remove(int cardid)
|
||||
{
|
||||
if (cards.find(cardid) == cards.end() || cards[cardid] == 0) return 0;
|
||||
@@ -1141,6 +1193,18 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
|
||||
}
|
||||
}
|
||||
}
|
||||
//save sideboards
|
||||
if(Sideboard.size())
|
||||
{
|
||||
sort(Sideboard.begin(), Sideboard.end());
|
||||
for(unsigned int k = 0; k < Sideboard.size(); k++)
|
||||
{
|
||||
int checkID = atoi(Sideboard[k].c_str());
|
||||
if(checkID)
|
||||
file << "#SB:" << checkID << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
file.close();
|
||||
JFileSystem::GetInstance()->Rename(tmp, destFileName);
|
||||
}
|
||||
@@ -1155,6 +1219,11 @@ int MTGDeck::save(const string& destFileName, bool useExpandedDescriptions, cons
|
||||
void MTGDeck::printDetailedDeckText(std::ofstream& file )
|
||||
{
|
||||
ostringstream currentCard, creatures, lands, spells, types;
|
||||
ostringstream ss_creatures, ss_lands, ss_spells;
|
||||
int numberOfCreatures = 0;
|
||||
int numberOfSpells = 0;
|
||||
int numberOfLands = 0;
|
||||
|
||||
map<int, int>::iterator it;
|
||||
for (it = cards.begin(); it != cards.end(); it++)
|
||||
{
|
||||
@@ -1202,17 +1271,31 @@ void MTGDeck::printDetailedDeckText(std::ofstream& file )
|
||||
|
||||
currentCard <<endl;
|
||||
setInfo = NULL;
|
||||
// Add counter to know number of creatures, non-creature spells and lands present in the deck
|
||||
if ( card->data->isLand() )
|
||||
{
|
||||
lands<< currentCard.str();
|
||||
numberOfLands+=nbCards;
|
||||
}
|
||||
else if ( card->data->isCreature() )
|
||||
{
|
||||
creatures << currentCard.str();
|
||||
else
|
||||
numberOfCreatures+=nbCards;
|
||||
}
|
||||
else
|
||||
{
|
||||
spells << currentCard.str();
|
||||
numberOfSpells+=nbCards;
|
||||
}
|
||||
currentCard.str("");
|
||||
}
|
||||
file << getCardBlockText( "Creatures", creatures.str() ) << endl;
|
||||
file << getCardBlockText( "Spells", spells.str() ) << endl;
|
||||
file << getCardBlockText( "Lands", lands.str() ) << endl;
|
||||
ss_creatures << numberOfCreatures;
|
||||
ss_spells << numberOfSpells;
|
||||
ss_lands << numberOfLands;
|
||||
|
||||
file << getCardBlockText( "Creatures x " + ss_creatures.str(), creatures.str() ) << endl;
|
||||
file << getCardBlockText( "Spells x " + ss_spells.str(), spells.str() ) << endl;
|
||||
file << getCardBlockText( "Lands x " + ss_lands.str(), lands.str() ) << endl;
|
||||
creatures.str("");
|
||||
spells.str("");
|
||||
lands.str("");
|
||||
|
||||
@@ -159,10 +159,36 @@ const char* Constants::MTGBasicAbilities[] = {
|
||||
"combattoughness",
|
||||
"cantpaylife",
|
||||
"cantbesacrified",
|
||||
"skulk",
|
||||
"menace",
|
||||
"nosolo",
|
||||
"mustblock"
|
||||
"skulk",
|
||||
"menace",
|
||||
"nosolo",
|
||||
"mustblock",
|
||||
"dethrone",
|
||||
"overload",
|
||||
"shackler",
|
||||
"flyersonly",
|
||||
"tempflashback",
|
||||
"legendruleremove",
|
||||
"canttransform",
|
||||
"asflash",
|
||||
"conduited",
|
||||
"canblocktapped",
|
||||
"oppnomaxhand",
|
||||
"cantcrew",
|
||||
"hiddenface",//test for hiding card
|
||||
"anytypeofmana",
|
||||
"necroed",//hide necored
|
||||
"cantpwattack",
|
||||
"canplayfromlibrarytop",//all
|
||||
"canplaylandlibrarytop",//land
|
||||
"canplaycreaturelibrarytop",//creature
|
||||
"canplayartifactlibrarytop",//artifact
|
||||
"canplayinstantsorcerylibrarytop",//instant or sorcery
|
||||
"showfromtoplibrary",
|
||||
"showopponenttoplibrary",
|
||||
"totemarmor",
|
||||
"discardtoplaybyopponent",
|
||||
"modular"
|
||||
};
|
||||
|
||||
map<string,int> Constants::MTGBasicAbilitiesMap;
|
||||
|
||||
@@ -9,7 +9,7 @@ MTGGamePhase::MTGGamePhase(GameObserver* g, int id) :
|
||||
animation = 0;
|
||||
currentState = -1;
|
||||
mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
|
||||
if(mFont)
|
||||
if(mFont)
|
||||
mFont->SetBase(0); // using 2nd font
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,21 @@ void MTGPlayerCards::initDeck(MTGDeck * deck)
|
||||
}
|
||||
}
|
||||
}
|
||||
//sb init
|
||||
if(deck->Sideboard.size())
|
||||
{
|
||||
for(unsigned int j = 0; j < deck->Sideboard.size(); j++)
|
||||
{
|
||||
string cardID = deck->Sideboard[j];
|
||||
MTGCard * card = MTGCollection()->getCardById(atoi(cardID.c_str()));
|
||||
if(card)
|
||||
{
|
||||
MTGCardInstance * newCard = NEW MTGCardInstance(card, this);
|
||||
//sb zone
|
||||
sideboard->addCard(newCard);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MTGPlayerCards::~MTGPlayerCards()
|
||||
@@ -74,7 +89,8 @@ MTGPlayerCards::~MTGPlayerCards()
|
||||
SAFE_DELETE(stack);
|
||||
SAFE_DELETE(removedFromGame);
|
||||
SAFE_DELETE(garbage);
|
||||
SAFE_DELETE(reveal);
|
||||
SAFE_DELETE(reveal);
|
||||
SAFE_DELETE(sideboard);
|
||||
SAFE_DELETE(temp);
|
||||
SAFE_DELETE(playRestrictions);
|
||||
}
|
||||
@@ -92,7 +108,8 @@ void MTGPlayerCards::beforeBeginPhase()
|
||||
stack->beforeBeginPhase();
|
||||
removedFromGame->beforeBeginPhase();
|
||||
garbage->beforeBeginPhase();
|
||||
reveal->beforeBeginPhase();
|
||||
reveal->beforeBeginPhase();
|
||||
sideboard->beforeBeginPhase();
|
||||
temp->beforeBeginPhase();
|
||||
}
|
||||
|
||||
@@ -107,7 +124,8 @@ void MTGPlayerCards::setOwner(Player * player)
|
||||
stack->setOwner(player);
|
||||
garbage->setOwner(player);
|
||||
garbageLastTurn->setOwner(player);
|
||||
reveal->setOwner(player);
|
||||
reveal->setOwner(player);
|
||||
sideboard->setOwner(player);
|
||||
temp->setOwner(player);
|
||||
}
|
||||
|
||||
@@ -231,27 +249,31 @@ void MTGPlayerCards::drawFromLibrary()
|
||||
toMove->miracle = true;
|
||||
}
|
||||
|
||||
// useability tweak - assume that the user is probably going to want to see the new card,
|
||||
// so prefetch it.
|
||||
|
||||
// if we're not in text mode, always get the thumb
|
||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
|
||||
&& library->owner->getObserver()->getResourceManager())
|
||||
bool prefetch = options[Options::CARDPREFETCHING].number?true:false;
|
||||
if (prefetch && WResourceManager::Instance()->IsThreaded())
|
||||
{
|
||||
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
|
||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
|
||||
// useability tweak - assume that the user is probably going to want to see the new card,
|
||||
// so prefetch it.
|
||||
|
||||
// also cache the large image if we're using kNormal mode
|
||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||
// if we're not in text mode, always get the thumb
|
||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() != DrawMode::kText
|
||||
&& library->owner->getObserver()->getResourceManager())
|
||||
{
|
||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
|
||||
DebugTrace("Prefetching AI card going into play: " << toMove->getImageName());
|
||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove, RETRIEVE_THUMB);
|
||||
|
||||
// also cache the large image if we're using kNormal mode
|
||||
if (library->owner->getObserver()->getCardSelector()->GetDrawMode() == DrawMode::kNormal)
|
||||
{
|
||||
library->owner->getObserver()->getResourceManager()->RetrieveCard(toMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(putInZone(toMove, library, hand))
|
||||
{
|
||||
toMove->currentZone = hand;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MTGPlayerCards::resetLibrary()
|
||||
@@ -275,7 +297,8 @@ void MTGPlayerCards::init()
|
||||
exile = removedFromGame;
|
||||
garbage = NEW MTGGameZone();
|
||||
garbageLastTurn = garbage;
|
||||
reveal = NEW MTGGameZone();
|
||||
reveal = NEW MTGGameZone();
|
||||
sideboard = NEW MTGGameZone();
|
||||
temp = NEW MTGGameZone();
|
||||
|
||||
playRestrictions = NEW PlayRestrictions();
|
||||
@@ -320,6 +343,7 @@ MTGCardInstance * MTGPlayerCards::putInHand(MTGCardInstance * card)
|
||||
MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to,bool asCopy)
|
||||
{
|
||||
MTGCardInstance * copy = NULL;
|
||||
Player * discarderOwner = NULL;
|
||||
GameObserver *g = owner->getObserver();
|
||||
if (!from || !to)
|
||||
return card; //Error check
|
||||
@@ -328,6 +352,8 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
bool shufflelibrary = card->basicAbilities[(int)Constants::SHUFFLELIBRARYDEATH];
|
||||
bool inplaytoinplay = false;
|
||||
bool ripToken = false;
|
||||
if (card->discarderOwner)
|
||||
discarderOwner = card->discarderOwner;
|
||||
if (g->players[0]->game->battlefield->hasName("Rest in Peace")||g->players[1]->game->battlefield->hasName("Rest in Peace"))
|
||||
ripToken = true;
|
||||
//Madness or Put in Play...
|
||||
@@ -363,13 +389,24 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
if (!card->isToken)
|
||||
to = g->players[i]->game->exile;
|
||||
}
|
||||
|
||||
//close the currently open MAIN display.
|
||||
if (from == g->players[i]->game->library || from == g->players[i]->game->graveyard || from == g->players[i]->game->exile)
|
||||
{
|
||||
if (g->guiOpenDisplay)
|
||||
{
|
||||
g->ButtonPressed(g->guiOpenDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
||||
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
||||
== g->players[1]->game->hand))
|
||||
{
|
||||
card->discarded = true;
|
||||
}
|
||||
//all cards that go from the hand to the graveyard is ALWAYS a discard.
|
||||
if ((to == g->players[0]->game->graveyard || to == g->players[1]->game->graveyard) && (from == g->players[0]->game->hand || from
|
||||
== g->players[1]->game->hand))
|
||||
{
|
||||
card->discarded = true;
|
||||
}
|
||||
|
||||
//When a card is moved from inPlay to inPlay (controller change, for example), it is still the same object
|
||||
if ((to == g->players[0]->game->inPlay || to == g->players[1]->game->inPlay) && (from == g->players[0]->game->inPlay || from
|
||||
== g->players[1]->game->inPlay))
|
||||
@@ -386,6 +423,33 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
{
|
||||
copy->miracle = true;
|
||||
}
|
||||
//reset discarder Owner
|
||||
if(to == g->players[0]->game->hand || to == g->players[0]->game->stack || to == g->players[0]->game->library ||
|
||||
to == g->players[1]->game->hand || to == g->players[1]->game->stack || to == g->players[1]->game->library)
|
||||
{
|
||||
card->discarderOwner = NULL;
|
||||
copy->discarderOwner = NULL;
|
||||
}
|
||||
//copy discarderowner
|
||||
if (discarderOwner)
|
||||
{
|
||||
copy->discarderOwner = discarderOwner;
|
||||
//change to
|
||||
if(to == g->players[0]->game->graveyard)
|
||||
{
|
||||
if(card->has(Constants::DISCARDTOPLAYBYOPPONENT) && discarderOwner == card->controller()->opponent())
|
||||
{
|
||||
to = g->players[0]->game->battlefield;
|
||||
}
|
||||
}
|
||||
else if(to == g->players[1]->game->graveyard)
|
||||
{
|
||||
if(card->has(Constants::DISCARDTOPLAYBYOPPONENT) && discarderOwner == card->controller()->opponent())
|
||||
{
|
||||
to = g->players[1]->game->battlefield;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(from == g->players[0]->game->battlefield || from == g->players[1]->game->battlefield)
|
||||
if(to != g->players[0]->game->battlefield || to != g->players[1]->game->battlefield)
|
||||
{
|
||||
@@ -420,6 +484,34 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
return ret;//don't send event
|
||||
}
|
||||
}
|
||||
//before adding card to zone, if its Melded, we break it apart
|
||||
if (from == g->players[0]->game->battlefield || from == g->players[1]->game->battlefield)
|
||||
{
|
||||
if(to != g->players[0]->game->battlefield || to != g->players[1]->game->battlefield)
|
||||
if (copy->previous && copy->previous->MeldedFrom.size() && !copy->isACopier && !copy->isToken)//!copier & !token fix kiki-jiki clones crash
|
||||
{
|
||||
vector<string> names = split(copy->previous->MeldedFrom, '|');
|
||||
MTGCard * cardone = MTGCollection()->getCardByName(names[0]);
|
||||
MTGCardInstance * cardOne = NEW MTGCardInstance(cardone, copy->owner->game);
|
||||
to->addCard(cardOne);
|
||||
WEvent * e = NEW WEventZoneChange(cardOne, from, to);
|
||||
g->receiveEvent(e);
|
||||
MTGCard * cardtwo = MTGCollection()->getCardByName(names[1]);
|
||||
MTGCardInstance * cardTwo = NEW MTGCardInstance(cardtwo, copy->owner->game);
|
||||
to->addCard(cardTwo);
|
||||
WEvent * e2 = NEW WEventZoneChange(cardTwo, from, to);
|
||||
g->receiveEvent(e2);
|
||||
|
||||
if(from == g->players[0]->game->battlefield)
|
||||
g->players[0]->game->temp->addCard(copy);
|
||||
if (from == g->players[1]->game->battlefield)
|
||||
g->players[1]->game->temp->addCard(copy);
|
||||
WEvent * e3 = NEW WEventZoneChange(copy, from, to);
|
||||
g->receiveEvent(e3);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
to->addCard(copy);
|
||||
//The "Temp" zone are purely for code purposes, and we don't want the abilities engine to
|
||||
//Trigger when cards move in this zone
|
||||
@@ -447,6 +539,28 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
SAFE_DELETE(previous);
|
||||
}
|
||||
|
||||
if(to == g->players[0]->game->battlefield || to == g->players[1]->game->battlefield)
|
||||
{
|
||||
if(ret->alias == 109736 && discarderOwner)
|
||||
{
|
||||
if(discarderOwner == ret->controller()->opponent())
|
||||
{
|
||||
AbilityFactory af(g);
|
||||
MTGAbility * dodeCounter = af.parseMagicLine("counter(1/1,2)",-1,NULL,ret);
|
||||
dodeCounter->oneShot = true;
|
||||
dodeCounter->canBeInterrupted = false;
|
||||
dodeCounter->resolve();
|
||||
SAFE_DELETE(dodeCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
//remove exerted if changing controls
|
||||
if((to == g->players[0]->game->battlefield && from == g->players[1]->game->battlefield)||
|
||||
(to == g->players[1]->game->battlefield && from == g->players[0]->game->battlefield))
|
||||
{
|
||||
if(ret->exerted)
|
||||
ret->exerted = false;
|
||||
}
|
||||
}
|
||||
if(!asCopy)
|
||||
{
|
||||
@@ -465,7 +579,7 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone
|
||||
|
||||
}
|
||||
|
||||
void MTGPlayerCards::discardRandom(MTGGameZone * from, MTGCardInstance *)
|
||||
void MTGPlayerCards::discardRandom(MTGGameZone * from, MTGCardInstance * _stored)
|
||||
{
|
||||
if (!from->nb_cards)
|
||||
return;
|
||||
@@ -473,6 +587,8 @@ void MTGPlayerCards::discardRandom(MTGGameZone * from, MTGCardInstance *)
|
||||
WEvent * e = NEW WEventCardDiscard(from->cards[r]);
|
||||
GameObserver * game = owner->getObserver();
|
||||
game->receiveEvent(e);
|
||||
if(_stored)
|
||||
from->cards[r]->discarderOwner = _stored->controller();
|
||||
putInZone(from->cards[r], from, graveyard);
|
||||
}
|
||||
|
||||
@@ -506,8 +622,19 @@ MTGGameZone::~MTGGameZone()
|
||||
for (size_t i = 0; i < cards.size(); i++)
|
||||
{
|
||||
cards[i]->stillNeeded = false;
|
||||
SAFE_DELETE(cards[i]->previous);
|
||||
SAFE_DELETE( cards[i] );
|
||||
//SAFE_DELETE(cards[i]->previous);
|
||||
//SAFE_DELETE( cards[i] );
|
||||
//cause crashes for generated cards using castcard named card...??? test fix for now
|
||||
if(cards[i]->previous)
|
||||
{
|
||||
delete cards[i]->previous;
|
||||
cards[i]->previous = NULL;
|
||||
}
|
||||
if(cards[i])
|
||||
{
|
||||
delete cards[i];
|
||||
cards[i] = NULL;
|
||||
}
|
||||
}
|
||||
cards.clear();
|
||||
cardsMap.clear();
|
||||
@@ -565,7 +692,8 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
|
||||
copy->storedCard = card->storedCard;
|
||||
copy->storedSourceCard = card->storedSourceCard;
|
||||
copy->lastController = card->controller();
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_OVERLOAD +1; i++)
|
||||
copy->previousController = card->controller();
|
||||
for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++)
|
||||
copy->alternateCostPaid[i] = card->alternateCostPaid[i];
|
||||
|
||||
//stupid bug with tokens...
|
||||
@@ -603,6 +731,20 @@ size_t MTGGameZone::getIndex(MTGCardInstance * card)
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int MTGGameZone::countByAlias(int number)
|
||||
{
|
||||
if(!number)
|
||||
return 0;
|
||||
int result = 0;
|
||||
for (int i = 0; i < (nb_cards); i++)
|
||||
{
|
||||
if (cards[i]->alias == number)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
unsigned int MTGGameZone::countByType(const string &value)
|
||||
{
|
||||
@@ -931,6 +1073,43 @@ MTGCardInstance * MTGInPlay::getNextLurer(MTGCardInstance * previous)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGInPlay::getNextProvoker(MTGCardInstance * previous, MTGCardInstance * thiscard)
|
||||
{
|
||||
int foundprevious = 0;
|
||||
if (previous == NULL)
|
||||
{
|
||||
foundprevious = 1;
|
||||
}
|
||||
for (int i = 0; i < nb_cards; i++)
|
||||
{
|
||||
MTGCardInstance * current = cards[i];
|
||||
if (current == previous)
|
||||
{
|
||||
foundprevious = 1;
|
||||
}
|
||||
else if (foundprevious && current->isAttacker() && thiscard->isProvoked && current->ProvokeTarget)
|
||||
{
|
||||
if(thiscard == current->ProvokeTarget)
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGInPlay::findAProvoker(MTGCardInstance * thiscard)
|
||||
{
|
||||
for (int i = 0; i < nb_cards; i++)
|
||||
{
|
||||
MTGCardInstance * current = cards[i];
|
||||
if (current->isAttacker() && current->ProvokeTarget)
|
||||
{
|
||||
if(current->ProvokeTarget == thiscard)
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MTGCardInstance * MTGInPlay::findALurer()
|
||||
{
|
||||
for (int i = 0; i < nb_cards; i++)
|
||||
@@ -951,17 +1130,28 @@ void MTGInPlay::untapAll()
|
||||
{
|
||||
MTGCardInstance * card = cards[i];
|
||||
card->setUntapping();
|
||||
if (!card->basicAbilities[(int)Constants::DOESNOTUNTAP] && card->alias != 50120)
|
||||
if (!card->basicAbilities[(int)Constants::DOESNOTUNTAP] && !card->basicAbilities[(int)Constants::SHACKLER])
|
||||
{
|
||||
if (card->frozen < 1)
|
||||
if(card->exerted)
|
||||
{
|
||||
card->attemptUntap();
|
||||
card->exerted = false;
|
||||
if (card->frozen >= 1)
|
||||
{
|
||||
card->frozen = 0;
|
||||
}
|
||||
}
|
||||
if (card->frozen >= 1)
|
||||
else
|
||||
{
|
||||
card->frozen = 0;
|
||||
card->exerted = false;
|
||||
if (card->frozen < 1)
|
||||
{
|
||||
card->attemptUntap();
|
||||
}
|
||||
if (card->frozen >= 1)
|
||||
{
|
||||
card->frozen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -969,7 +1159,11 @@ void MTGInPlay::untapAll()
|
||||
|
||||
MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
|
||||
{
|
||||
|
||||
if (p2 != p && p2 && (p != p2->opponent()))
|
||||
{
|
||||
p = p2->opponent();
|
||||
//these cases are generally handled this is a edge case fix.
|
||||
}
|
||||
switch (zoneId)
|
||||
{
|
||||
case MY_GRAVEYARD:
|
||||
@@ -1009,12 +1203,19 @@ MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
|
||||
case STACK:
|
||||
return p->game->stack;
|
||||
|
||||
case MY_REVEAL:
|
||||
return p->game->reveal;
|
||||
case OPPONENT_REVEAL:
|
||||
return p->opponent()->game->reveal;
|
||||
case REVEAL:
|
||||
return p->game->reveal;
|
||||
case MY_REVEAL:
|
||||
return p->game->reveal;
|
||||
case OPPONENT_REVEAL:
|
||||
return p->opponent()->game->reveal;
|
||||
case REVEAL:
|
||||
return p->game->reveal;
|
||||
|
||||
case MY_SIDEBOARD:
|
||||
return p->game->sideboard;
|
||||
case OPPONENT_SIDEBOARD:
|
||||
return p->opponent()->game->sideboard;
|
||||
case SIDEBOARD:
|
||||
return p->game->sideboard;
|
||||
|
||||
}
|
||||
if (!p2) return NULL;
|
||||
@@ -1038,8 +1239,11 @@ MTGGameZone * MTGGameZone::intToZone(int zoneId, Player * p, Player * p2)
|
||||
case TARGET_CONTROLLER_STACK:
|
||||
return p2->game->stack;
|
||||
|
||||
case TARGET_CONTROLLER_REVEAL:
|
||||
return p2->game->reveal;
|
||||
case TARGET_CONTROLLER_REVEAL:
|
||||
return p2->game->reveal;
|
||||
|
||||
case TARGET_CONTROLLER_SIDEBOARD:
|
||||
return p2->game->sideboard;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
@@ -1139,16 +1343,27 @@ MTGGameZone * MTGGameZone::intToZone(GameObserver *g, int zoneId, MTGCardInstanc
|
||||
return source->playerTarget->game->stack;
|
||||
else return source->controller()->game->stack;
|
||||
|
||||
case TARGET_OWNER_REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case OWNER_REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case TARGETED_PLAYER_REVEAL:
|
||||
if (source->playerTarget)
|
||||
return source->playerTarget->game->reveal;
|
||||
else return source->controller()->game->reveal;
|
||||
case TARGET_OWNER_REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case OWNER_REVEAL:
|
||||
return target->owner->game->reveal;
|
||||
case TARGETED_PLAYER_REVEAL:
|
||||
if (source->playerTarget)
|
||||
return source->playerTarget->game->reveal;
|
||||
else return source->controller()->game->reveal;
|
||||
|
||||
case TARGET_OWNER_SIDEBOARD:
|
||||
return target->owner->game->sideboard;
|
||||
case SIDEBOARD:
|
||||
return target->owner->game->sideboard;
|
||||
case OWNER_SIDEBOARD:
|
||||
return target->owner->game->sideboard;
|
||||
case TARGETED_PLAYER_SIDEBOARD:
|
||||
if (source->playerTarget)
|
||||
return source->playerTarget->game->sideboard;
|
||||
else return source->controller()->game->sideboard;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
@@ -1177,7 +1392,9 @@ int MTGGameZone::zoneStringToId(string zoneName)
|
||||
|
||||
"mystack", "opponentstack", "targetownerstack", "targetcontrollerstack", "ownerstack", "stack","targetedpersonsstack",
|
||||
|
||||
"myreveal", "opponentreveal", "targetownerreveal", "targetcontrollerreveal", "ownerreveal", "reveal","targetedpersonsreveal",
|
||||
"myreveal", "opponentreveal", "targetownerreveal", "targetcontrollerreveal", "ownerreveal", "reveal","targetedpersonsreveal",
|
||||
|
||||
"mysideboard", "opponentsideboard", "targetownersideboard", "targetcontrollersideboard", "ownersideboard", "sideboard","targetedpersonssideboard",
|
||||
|
||||
};
|
||||
|
||||
@@ -1200,7 +1417,9 @@ int MTGGameZone::zoneStringToId(string zoneName)
|
||||
|
||||
MY_STACK, OPPONENT_STACK, TARGET_OWNER_STACK, TARGET_CONTROLLER_STACK, OWNER_STACK, STACK,TARGETED_PLAYER_STACK,
|
||||
|
||||
MY_REVEAL, OPPONENT_REVEAL, TARGET_OWNER_REVEAL, TARGET_CONTROLLER_REVEAL, OWNER_REVEAL, REVEAL,TARGETED_PLAYER_REVEAL };
|
||||
MY_REVEAL, OPPONENT_REVEAL, TARGET_OWNER_REVEAL, TARGET_CONTROLLER_REVEAL, OWNER_REVEAL, REVEAL,TARGETED_PLAYER_REVEAL,
|
||||
|
||||
MY_SIDEBOARD, OPPONENT_SIDEBOARD, TARGET_OWNER_SIDEBOARD, TARGET_CONTROLLER_SIDEBOARD, OWNER_SIDEBOARD, SIDEBOARD,TARGETED_PLAYER_SIDEBOARD };
|
||||
|
||||
int max = sizeof(values) / sizeof *(values);
|
||||
|
||||
|
||||
+898
-243
File diff suppressed because it is too large
Load Diff
+153
-40
@@ -39,6 +39,8 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
string value = s.substr(start -1,end);
|
||||
if(value == "n{")//"restrictio n{m orbid} would read the n{m as {m} millcost
|
||||
return manaCost;
|
||||
else if(value == "e{")//"variable{ test fix
|
||||
return manaCost;
|
||||
}
|
||||
if (start == string::npos)
|
||||
{
|
||||
@@ -147,13 +149,33 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
{ //Send to Graveyard Cost (move from anywhere to Graveyard)
|
||||
manaCost->addExtraCost(NEW ToGraveCost(tc));
|
||||
}
|
||||
else if (value.find("saclands") != string::npos)
|
||||
{ //Sac all lands
|
||||
manaCost->addExtraCost(NEW SacLandsCost(tc));
|
||||
}
|
||||
else
|
||||
{ //Sacrifice
|
||||
manaCost->addExtraCost(NEW SacrificeCost(tc));
|
||||
}
|
||||
break;
|
||||
case 'e':
|
||||
//Exile
|
||||
if (value == "emerge")
|
||||
{
|
||||
if (!tc)
|
||||
tc = tcf.createTargetChooser("creature|mybattlefield", c);
|
||||
manaCost->addExtraCost(NEW Offering(tc,true));
|
||||
}
|
||||
else if(value.substr(0,2) == "e:")
|
||||
{//Energy Cost
|
||||
vector<string>valSplit = parseBetween(value,"e:"," ",false);
|
||||
if (valSplit.size()) {
|
||||
WParsedInt* energytopay = NEW WParsedInt(valSplit[1], NULL, c);
|
||||
manaCost->addExtraCost(NEW EnergyCost(energytopay->getValue()));
|
||||
SAFE_DELETE(energytopay);
|
||||
}
|
||||
}
|
||||
else
|
||||
//Exile
|
||||
manaCost->addExtraCost(NEW ExileTargetCost(tc));
|
||||
break;
|
||||
case 'h': //bounce (move to Hand)
|
||||
@@ -179,7 +201,13 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
}
|
||||
break;
|
||||
case 'd': //DiscardRandom cost
|
||||
if (value == "d")
|
||||
if (value.find("delve") != string::npos)
|
||||
{
|
||||
if(!tc)
|
||||
tc = tcf.createTargetChooser("*|mygraveyard", c);
|
||||
manaCost->addExtraCost(NEW Delve(tc));
|
||||
}
|
||||
else if (value == "d")
|
||||
{
|
||||
manaCost->addExtraCost(NEW DiscardRandomCost(tc));
|
||||
}
|
||||
@@ -189,7 +217,17 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
}
|
||||
break;
|
||||
case 'm': //Mill yourself as a cost
|
||||
manaCost->addExtraCost(NEW MillCost(tc));
|
||||
{
|
||||
if (value == "mycost")
|
||||
{
|
||||
if(c && c->model)
|
||||
manaCost->add(c->model->data->getManaCost());
|
||||
else
|
||||
break;
|
||||
}
|
||||
else
|
||||
manaCost->addExtraCost(NEW MillCost(tc));
|
||||
}
|
||||
break;
|
||||
case 'n': //return unblocked attacker cost
|
||||
{
|
||||
@@ -235,12 +273,19 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
break;
|
||||
}
|
||||
case 'i' :
|
||||
if(value == "improvise")
|
||||
{
|
||||
if(!tc)
|
||||
tc = tcf.createTargetChooser("artifact[-tapped]|myBattlefield", c);
|
||||
manaCost->addExtraCost(NEW Improvise(tc));
|
||||
}
|
||||
else
|
||||
{
|
||||
SAFE_DELETE(tc);
|
||||
manaCost->add(0,1);
|
||||
manaCost->addExtraCost(NEW SnowCost);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'q':
|
||||
if(value == "q")
|
||||
{
|
||||
@@ -253,7 +298,13 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
break;
|
||||
case 'c': //Counters or cycle
|
||||
{
|
||||
if(value == "chosencolor")
|
||||
if (value.find("convoke") != string::npos)
|
||||
{
|
||||
if (!tc)
|
||||
tc = tcf.createTargetChooser("creature|mybattlefield", c);
|
||||
manaCost->addExtraCost(NEW Convoke(tc));
|
||||
}
|
||||
else if(value == "chosencolor")
|
||||
{
|
||||
if(c)
|
||||
manaCost->add(c->chooseacolor, 1);
|
||||
@@ -262,6 +313,10 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
|
||||
{
|
||||
manaCost->addExtraCost(NEW CycleCost(tc));
|
||||
}
|
||||
else if(value.substr(0,4) == "crew")
|
||||
{//tap crew
|
||||
manaCost->addExtraCost(NEW TapTargetCost(tc,true));
|
||||
}
|
||||
else if(value.find("(") != string::npos)
|
||||
{
|
||||
size_t counter_start = value.find("(");
|
||||
@@ -378,19 +433,21 @@ ManaCost::ManaCost(ManaCost * manaCost)
|
||||
cost[i] = manaCost->getCost(i);
|
||||
}
|
||||
hybrids = manaCost->hybrids;
|
||||
|
||||
kicker = NEW ManaCost( manaCost->kicker );
|
||||
if(kicker)
|
||||
kicker->isMulti = manaCost->isMulti;
|
||||
kicker = NEW ManaCost(manaCost->kicker);
|
||||
if (kicker)
|
||||
kicker->isMulti = manaCost->isMulti;
|
||||
Retrace = NEW ManaCost( manaCost->Retrace );
|
||||
BuyBack = NEW ManaCost( manaCost->BuyBack );
|
||||
alternative = NEW ManaCost( manaCost->alternative );
|
||||
FlashBack = NEW ManaCost( manaCost->FlashBack );
|
||||
morph = NEW ManaCost( manaCost->morph );
|
||||
suspend = NEW ManaCost( manaCost->suspend );
|
||||
Bestow = NEW ManaCost(manaCost->Bestow);
|
||||
|
||||
extraCosts = manaCost->extraCosts ? manaCost->extraCosts->clone() : NULL;
|
||||
Bestow = NEW ManaCost(manaCost->Bestow);
|
||||
extraCosts = NULL;
|
||||
if (manaCost->extraCosts)
|
||||
{
|
||||
extraCosts = manaCost->extraCosts->clone();
|
||||
}
|
||||
manaUsedToCast = NULL;
|
||||
xColor = manaCost->xColor;
|
||||
}
|
||||
@@ -417,9 +474,13 @@ ManaCost::ManaCost(const ManaCost& manaCost)
|
||||
FlashBack = NEW ManaCost( manaCost.FlashBack );
|
||||
morph = NEW ManaCost( manaCost.morph );
|
||||
suspend = NEW ManaCost( manaCost.suspend );
|
||||
Bestow = NEW ManaCost(manaCost.Bestow);
|
||||
Bestow = NEW ManaCost(manaCost.Bestow);
|
||||
extraCosts = NULL;
|
||||
if (manaCost.extraCosts)
|
||||
{
|
||||
extraCosts = manaCost.extraCosts->clone();
|
||||
}
|
||||
|
||||
extraCosts = manaCost.extraCosts ? manaCost.extraCosts->clone() : NULL;
|
||||
manaUsedToCast = NULL;
|
||||
xColor = manaCost.xColor;
|
||||
}
|
||||
@@ -441,7 +502,7 @@ ManaCost & ManaCost::operator= (const ManaCost & manaCost)
|
||||
FlashBack = manaCost.FlashBack;
|
||||
morph = manaCost.morph;
|
||||
suspend = manaCost.suspend;
|
||||
Bestow = manaCost.Bestow;
|
||||
Bestow = manaCost.Bestow;
|
||||
manaUsedToCast = manaCost.manaUsedToCast;
|
||||
xColor = manaCost.xColor;
|
||||
}
|
||||
@@ -458,7 +519,7 @@ ManaCost::~ManaCost()
|
||||
SAFE_DELETE(Retrace);
|
||||
SAFE_DELETE(morph);
|
||||
SAFE_DELETE(suspend);
|
||||
SAFE_DELETE(Bestow);
|
||||
SAFE_DELETE(Bestow);
|
||||
SAFE_DELETE(manaUsedToCast);
|
||||
|
||||
cost.erase(cost.begin() ,cost.end());
|
||||
@@ -468,7 +529,6 @@ void ManaCost::x()
|
||||
{
|
||||
if (cost.size() <= (size_t)Constants::NB_Colors)
|
||||
{
|
||||
DebugTrace("Seems ManaCost was not properly initialized");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -479,7 +539,6 @@ int ManaCost::hasX()
|
||||
{
|
||||
if (cost.size() <= (size_t)Constants::NB_Colors)
|
||||
{
|
||||
DebugTrace("Seems ManaCost was not properly initialized");
|
||||
return 0;
|
||||
}
|
||||
if (xColor > 0)
|
||||
@@ -492,7 +551,6 @@ void ManaCost::specificX(int color)
|
||||
{
|
||||
if (cost.size() <= (size_t)Constants::NB_Colors)
|
||||
{
|
||||
DebugTrace("Seems ManaCost was not properly initialized");
|
||||
return;
|
||||
}
|
||||
xColor = color;
|
||||
@@ -503,7 +561,6 @@ int ManaCost::hasSpecificX()
|
||||
{
|
||||
if (cost.size() <= (size_t)Constants::NB_Colors)
|
||||
{
|
||||
DebugTrace("Seems ManaCost was not properly initialized");
|
||||
return 0;
|
||||
}
|
||||
if(xColor > 0)
|
||||
@@ -544,7 +601,7 @@ void ManaCost::init()
|
||||
Retrace = NULL;
|
||||
morph = NULL;
|
||||
suspend = NULL;
|
||||
Bestow = NULL;
|
||||
Bestow = NULL;
|
||||
manaUsedToCast = NULL;
|
||||
isMulti = false;
|
||||
xColor = -1;
|
||||
@@ -569,7 +626,7 @@ void ManaCost::resetCosts()
|
||||
SAFE_DELETE(Retrace);
|
||||
SAFE_DELETE(morph);
|
||||
SAFE_DELETE(suspend);
|
||||
SAFE_DELETE(Bestow);
|
||||
SAFE_DELETE(Bestow);
|
||||
}
|
||||
|
||||
void ManaCost::copy(ManaCost * _manaCost)
|
||||
@@ -587,6 +644,7 @@ void ManaCost::copy(ManaCost * _manaCost)
|
||||
hybrids = _manaCost->hybrids;
|
||||
|
||||
SAFE_DELETE(extraCosts);
|
||||
|
||||
if (_manaCost->extraCosts)
|
||||
{
|
||||
extraCosts = _manaCost->extraCosts->clone();
|
||||
@@ -635,12 +693,36 @@ void ManaCost::copy(ManaCost * _manaCost)
|
||||
suspend = NEW ManaCost();
|
||||
suspend->copy(_manaCost->suspend);
|
||||
}
|
||||
SAFE_DELETE(Bestow);
|
||||
if (_manaCost->Bestow)
|
||||
{
|
||||
Bestow = NEW ManaCost();
|
||||
Bestow->copy(_manaCost->Bestow);
|
||||
}
|
||||
SAFE_DELETE(Bestow);
|
||||
if (_manaCost->Bestow)
|
||||
{
|
||||
Bestow = NEW ManaCost();
|
||||
Bestow->copy(_manaCost->Bestow);
|
||||
}
|
||||
xColor = _manaCost->xColor;
|
||||
}
|
||||
|
||||
void ManaCost::changeCostTo(ManaCost * _manaCost)
|
||||
{
|
||||
if (!_manaCost)
|
||||
return;
|
||||
|
||||
cost.erase(cost.begin() ,cost.end());
|
||||
|
||||
for (int i = 0; i <= Constants::NB_Colors; i++)
|
||||
{
|
||||
cost.push_back(_manaCost->getCost(i));
|
||||
}
|
||||
|
||||
hybrids = _manaCost->hybrids;
|
||||
|
||||
SAFE_DELETE(extraCosts);
|
||||
|
||||
if (_manaCost->extraCosts)
|
||||
{
|
||||
extraCosts = _manaCost->extraCosts->clone();
|
||||
}
|
||||
|
||||
xColor = _manaCost->xColor;
|
||||
}
|
||||
|
||||
@@ -704,6 +786,37 @@ int ManaCost::countHybridsNoPhyrexian()
|
||||
return result;
|
||||
}
|
||||
|
||||
void ManaCost::removeHybrid(ManaCost * _manaCost)
|
||||
{
|
||||
if (!_manaCost)
|
||||
return;
|
||||
|
||||
vector<int> colors;
|
||||
int match = 0;
|
||||
|
||||
for(int j = 0; j < 7; j++)
|
||||
{//populate colors values
|
||||
colors.push_back(_manaCost->getCost(j));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < hybrids.size(); i++)
|
||||
{
|
||||
for(int j = 0; j < 7; j++)
|
||||
{
|
||||
if(colors[j])
|
||||
{
|
||||
if(hybrids[i].hasColor(j))
|
||||
{
|
||||
hybrids[i].reduceValue(j, colors[j]);
|
||||
colors[j] -= 1;
|
||||
match++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int ManaCost::parseManaSymbol(char symbol)
|
||||
{
|
||||
switch (symbol)
|
||||
@@ -1105,7 +1218,7 @@ void ManaPool::Empty()
|
||||
SAFE_DELETE(Retrace);
|
||||
SAFE_DELETE(morph);
|
||||
SAFE_DELETE(suspend);
|
||||
SAFE_DELETE(Bestow);
|
||||
SAFE_DELETE(Bestow);
|
||||
SAFE_DELETE(manaUsedToCast);
|
||||
init();
|
||||
WEvent * e = NEW WEventEmptyManaPool(this);
|
||||
@@ -1135,8 +1248,8 @@ int ManaPool::remove(int color, int value)
|
||||
|
||||
int ManaPool::add(int color, int value, MTGCardInstance * source, bool extra)
|
||||
{
|
||||
if (color == Constants::MTG_COLOR_ARTIFACT)
|
||||
color = Constants::MTG_COLOR_WASTE;
|
||||
if (color == Constants::MTG_COLOR_ARTIFACT)
|
||||
color = Constants::MTG_COLOR_WASTE;
|
||||
int result = ManaCost::add(color, value);
|
||||
for (int i = 0; i < value; ++i)
|
||||
{
|
||||
@@ -1156,15 +1269,15 @@ int ManaPool::add(ManaCost * _cost, MTGCardInstance * source)
|
||||
{
|
||||
if (!_cost)
|
||||
return 0;
|
||||
//while colorless is still exactly the same, there are now cards that require
|
||||
//true colorless mana, ei:eldrazi. so whenever we add mana, we now replace it with the
|
||||
//new type. keeping the old type intact for payment methods {1}{c} ....
|
||||
int replaceArtifact = _cost->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||
if (replaceArtifact)
|
||||
{
|
||||
_cost->add(Constants::MTG_COLOR_WASTE, replaceArtifact);
|
||||
_cost->remove(Constants::MTG_COLOR_ARTIFACT, replaceArtifact);
|
||||
}
|
||||
//while colorless is still exactly the same, there are now cards that require
|
||||
//true colorless mana, ei:eldrazi. so whenever we add mana, we now replace it with the
|
||||
//new type. keeping the old type intact for payment methods {1}{c} ....
|
||||
int replaceArtifact = _cost->getCost(Constants::MTG_COLOR_ARTIFACT);
|
||||
if (replaceArtifact)
|
||||
{
|
||||
_cost->add(Constants::MTG_COLOR_WASTE, replaceArtifact);
|
||||
_cost->remove(Constants::MTG_COLOR_ARTIFACT, replaceArtifact);
|
||||
}
|
||||
int result = ManaCost::add(_cost);
|
||||
for (int i = 0; i < Constants::NB_Colors; i++)
|
||||
{
|
||||
|
||||
@@ -66,6 +66,24 @@ int ManaCostHybrid::getManaSymbolsHybridMerged(int color)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ManaCostHybrid::reduceValue(int color, int value)
|
||||
{
|
||||
if(((color1 == color) && value1))
|
||||
{
|
||||
if((value1 - value) < 0)
|
||||
value1 = 0;
|
||||
else
|
||||
value1 -= value;
|
||||
}
|
||||
else if(((color2 == color) && value2))
|
||||
{
|
||||
if((value2 - value) < 0)
|
||||
value2 = 0;
|
||||
else
|
||||
value2 -= value;
|
||||
}
|
||||
}
|
||||
|
||||
int ManaCostHybrid::hasColor(int color)
|
||||
{
|
||||
if (((color1 == color) && value1) || ((color2 == color) && value2))
|
||||
|
||||
@@ -41,15 +41,16 @@ void MenuItem::Render()
|
||||
if (mParticleSys)
|
||||
start = mParticleSys->info.colColorStart.GetHWColor();
|
||||
PIXEL_TYPE colors[] = { ARGB(0,0,0,0), start, ARGB(0,0,0,0), start, };
|
||||
renderer->FillRect(255, 0, SCREEN_WIDTH - 155, SCREEN_HEIGHT, colors);
|
||||
renderer->FillRect(255, 0, SCREEN_WIDTH - 165, SCREEN_HEIGHT, colors);//color on main menu right side
|
||||
// set additive blending
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
mParticleSys->Render();
|
||||
// set normal blending
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
onQuad->SetColor(ARGB(70,255,255,255));
|
||||
renderer->RenderQuad(onQuad, SCREEN_WIDTH, SCREEN_HEIGHT / 2, 0, 8, 8);
|
||||
offQuad->SetColor(ARGB(60,255,255,255));
|
||||
renderer->RenderQuad(offQuad, SCREEN_WIDTH, SCREEN_HEIGHT / 2, 0, 8, 8);//big icon main menu right side
|
||||
offQuad->SetColor(ARGB(255,255,255,255));
|
||||
onQuad->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(mText.c_str(), SCREEN_WIDTH / 2, 3 * SCREEN_HEIGHT / 4, JGETEXT_CENTER);
|
||||
renderer->RenderQuad(onQuad, mX, mY, 0, mScale, mScale);
|
||||
@@ -88,7 +89,7 @@ void MenuItem::Entering()
|
||||
if (mParticleSys)
|
||||
mParticleSys->Fire();
|
||||
mHasFocus = true;
|
||||
mTargetScale = 1.3f;
|
||||
mTargetScale = 1.2f;
|
||||
}
|
||||
|
||||
bool MenuItem::Leaving(JButton)
|
||||
@@ -138,8 +139,9 @@ void OtherMenuItem::Render()
|
||||
float olds = mFont->GetScale();
|
||||
float xPos = SCREEN_WIDTH - 64;
|
||||
float xTextPos = xPos + 54;
|
||||
float yPos = SCREEN_HEIGHT_F-26.f;
|
||||
int textAlign = JGETEXT_RIGHT;
|
||||
onQuad->SetHFlip(false);
|
||||
//onQuad->SetHFlip(false);
|
||||
|
||||
switch(mKey)
|
||||
{
|
||||
@@ -147,18 +149,30 @@ void OtherMenuItem::Render()
|
||||
xPos = 5;
|
||||
xTextPos = xPos + 10;
|
||||
textAlign = JGETEXT_LEFT;
|
||||
onQuad->SetHFlip(true);
|
||||
//onQuad->SetHFlip(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
onQuad->SetColor(ARGB(abs(alpha),255,255,255));
|
||||
mFont->SetColor(ARGB(abs(alpha),0,0,0));
|
||||
//onQuad->SetColor(ARGB(abs(alpha),255,255,255));
|
||||
mFont->SetScale(1.0f);
|
||||
mFont->SetScale(50.0f / mFont->GetStringWidth(mText.c_str()));
|
||||
JRenderer::GetInstance()->RenderQuad(onQuad, xPos, 2, 0, mScale, mScale);
|
||||
mFont->DrawString(mText, xTextPos, 9, textAlign);
|
||||
//JRenderer::GetInstance()->RenderQuad(onQuad, xPos, yPos+2, 0, mScale, mScale);
|
||||
//JRenderer::GetInstance()->FillRoundRect(xPos,yPos+2,mFont->GetStringWidth(mText.c_str()),mFont->GetHeight(),2,ARGB(abs(alpha),255,255,255));
|
||||
JRenderer::GetInstance()->FillRoundRect(xPos+1, yPos+6, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 5, 5, 5));
|
||||
if(!mHasFocus)
|
||||
{
|
||||
mFont->SetColor(ARGB(abs(alpha),255,255,255));
|
||||
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 140, 23, 23));
|
||||
}
|
||||
else
|
||||
{
|
||||
mFont->SetColor(ARGB(abs(alpha),5,5,5));
|
||||
JRenderer::GetInstance()->FillRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha), 140, 140, 140));
|
||||
}
|
||||
JRenderer::GetInstance()->DrawRoundRect(xPos, yPos+5, mFont->GetStringWidth(mText.c_str()) - 3, mFont->GetHeight() - 10, 5, ARGB(abs(alpha-20), 5, 5, 5));
|
||||
mFont->DrawString(mText, xTextPos, yPos+9, textAlign);
|
||||
mFont->SetScale(olds);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ public:
|
||||
mCurrentCard(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CardZone()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
**
|
||||
|
||||
@@ -466,6 +466,7 @@ void OptionTheme::updateValue()
|
||||
void OptionTheme::Render()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||
char buf[512];
|
||||
if (!bChecked)
|
||||
{
|
||||
@@ -493,12 +494,12 @@ void OptionTheme::Render()
|
||||
JQuadPtr q = getImage();
|
||||
if (q)
|
||||
{
|
||||
float scale = 128 / q->mHeight;
|
||||
renderer->RenderQuad(q.get(), x, y, 0, scale, scale);
|
||||
float yscale = 128 / q->mHeight;
|
||||
float xscale = 227 / q->mWidth;
|
||||
renderer->RenderQuad(q.get(), x, y, 0, xscale, yscale);
|
||||
}
|
||||
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
||||
renderer->FillRect(x+2, y+2, mFont->GetStringWidth(buf), mFont->GetHeight(),ARGB(220,5,5,5));
|
||||
mFont->DrawString(buf, x + 2, y + 2);
|
||||
if (bChecked && author.size())
|
||||
{
|
||||
@@ -506,6 +507,7 @@ void OptionTheme::Render()
|
||||
mFont->SetScale(0.8f);
|
||||
float hi = mFont->GetHeight();
|
||||
sprintf(buf, _("Artist: %s").c_str(), author.c_str());
|
||||
renderer->FillRect(x+2, y + getHeight() - hi, mFont->GetStringWidth(buf), mFont->GetHeight(),ARGB(220,5,5,5));
|
||||
mFont->DrawString(buf, x + 2, y + getHeight() - hi);
|
||||
mFont->SetScale(1);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
nomaxhandsize = false;
|
||||
poisonCount = 0;
|
||||
damageCount = 0;
|
||||
nonCombatDamage = 0;
|
||||
preventable = 0;
|
||||
mAvatarTex = NULL;
|
||||
type_as_damageable = DAMAGEABLE_PLAYER;
|
||||
@@ -33,8 +34,10 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
skippingTurn = 0;
|
||||
extraTurn = 0;
|
||||
drawCounter = 0;
|
||||
energyCount = 0;
|
||||
epic = 0;
|
||||
forcefield = 0;
|
||||
dealsdamagebycombat = 0;
|
||||
raidcount = 0;
|
||||
handmodifier = 0;
|
||||
snowManaG = 0;
|
||||
@@ -46,6 +49,8 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
prowledTypes.clear();
|
||||
doesntEmpty = NEW ManaCost();
|
||||
poolDoesntEmpty = NEW ManaCost();
|
||||
AuraIncreased = NEW ManaCost();
|
||||
AuraReduced = NEW ManaCost();
|
||||
if (deck != NULL)
|
||||
{
|
||||
game = NEW MTGPlayerCards(deck);
|
||||
@@ -79,6 +84,8 @@ Player::~Player()
|
||||
SAFE_DELETE(manaPool);
|
||||
SAFE_DELETE(doesntEmpty);
|
||||
SAFE_DELETE(poolDoesntEmpty);
|
||||
SAFE_DELETE(AuraIncreased);
|
||||
SAFE_DELETE(AuraReduced);
|
||||
SAFE_DELETE(game);
|
||||
if(mAvatarTex && observer->getResourceManager())
|
||||
observer->getResourceManager()->Release(mAvatarTex);
|
||||
@@ -166,6 +173,10 @@ int Player::gainOrLoseLife(int value)
|
||||
life+=value;
|
||||
if (value<0)
|
||||
lifeLostThisTurn += abs(value);
|
||||
else if (value > 0)
|
||||
{
|
||||
lifeGainedThisTurn += abs(value);
|
||||
}
|
||||
|
||||
//Send life event to listeners
|
||||
WEvent * lifed = NEW WEventLife(this,value);
|
||||
@@ -253,9 +264,7 @@ bool Player::hasPossibleAttackers()
|
||||
for (int j = 0; j < nbcards; ++j)
|
||||
{
|
||||
MTGCardInstance * c = z->cards[j];
|
||||
if (!c->isTapped() &&
|
||||
!c->hasSummoningSickness() &&
|
||||
c->isCreature())
|
||||
if ((c->canAttack(true) || c->canAttack()) && c->isCreature())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -87,8 +87,6 @@ WagicWrapper::~WagicWrapper()
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
int result = 0;
|
||||
WagicWrapper* wagicCore = new WagicWrapper();
|
||||
MTGCollection()->loadFolder("sets/primitives/");
|
||||
|
||||
@@ -409,17 +409,19 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
||||
p->poisonCount = initState.playerData[i].player->poisonCount;
|
||||
p->damageCount = initState.playerData[i].player->damageCount;
|
||||
p->preventable = initState.playerData[i].player->preventable;
|
||||
p->energyCount = initState.playerData[i].player->energyCount;
|
||||
if (initState.playerData[i].player->mAvatarName.size())
|
||||
{
|
||||
p->mAvatarName = initState.playerData[i].player->mAvatarName;
|
||||
}
|
||||
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile , p->game->reveal };
|
||||
MTGGameZone * playerZones[] = { p->game->graveyard, p->game->library, p->game->hand, p->game->inPlay, p->game->exile , p->game->reveal, p->game->sideboard };
|
||||
MTGGameZone * loadedPlayerZones[] = { initState.playerData[i].player->game->graveyard,
|
||||
initState.playerData[i].player->game->library,
|
||||
initState.playerData[i].player->game->hand,
|
||||
initState.playerData[i].player->game->inPlay,
|
||||
initState.playerData[i].player->game->exile,
|
||||
initState.playerData[i].player->game->reveal };
|
||||
initState.playerData[i].player->game->reveal,
|
||||
initState.playerData[i].player->game->sideboard };
|
||||
for (int j = 0; j < 5; j++)
|
||||
{
|
||||
MTGGameZone * zone = playerZones[j];
|
||||
@@ -430,7 +432,8 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
||||
{
|
||||
if (zone == p->game->inPlay)
|
||||
{
|
||||
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
|
||||
//MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
|
||||
MTGCardInstance * copy = zone->owner->game->putInZone(card, p->game->library, p->game->stack);
|
||||
Spell * spell = NEW Spell(g, copy);
|
||||
spell->resolve();
|
||||
delete spell;
|
||||
@@ -441,7 +444,8 @@ void Rules::initGame(GameObserver *g, bool currentPlayerSet)
|
||||
{
|
||||
LOG ("RULES ERROR, CARD NOT FOUND IN LIBRARY\n");
|
||||
}
|
||||
p->game->putInZone(card, p->game->library, zone);
|
||||
//p->game->putInZone(card, p->game->library, zone);
|
||||
zone->owner->game->putInZone(card, p->game->library, zone);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -309,17 +309,18 @@ static const struct { LocalKeySym keysym; JButton keycode; } gDefaultBindings[]
|
||||
{ SDLK_DOWN, JGE_BTN_DOWN },
|
||||
{ SDLK_LEFT, JGE_BTN_LEFT },
|
||||
{ SDLK_RIGHT, JGE_BTN_RIGHT },
|
||||
{ SDLK_z, JGE_BTN_UP },
|
||||
{ SDLK_d, JGE_BTN_RIGHT },
|
||||
{ SDLK_w, JGE_BTN_UP },
|
||||
{ SDLK_s, JGE_BTN_DOWN },
|
||||
{ SDLK_q, JGE_BTN_LEFT },
|
||||
{ SDLK_a, JGE_BTN_PREV },
|
||||
{ SDLK_a, JGE_BTN_LEFT },
|
||||
{ SDLK_d, JGE_BTN_RIGHT },
|
||||
{ SDLK_q, JGE_BTN_PREV },
|
||||
{ SDLK_e, JGE_BTN_NEXT },
|
||||
{ SDLK_i, JGE_BTN_CANCEL },
|
||||
{ SDLK_l, JGE_BTN_OK },
|
||||
{ SDLK_SPACE, JGE_BTN_OK },
|
||||
{ SDLK_k, JGE_BTN_SEC },
|
||||
{ SDLK_j, JGE_BTN_PRI },
|
||||
{ SDLK_b, JGE_BTN_SOUND },
|
||||
{ SDLK_f, JGE_BTN_FULLSCREEN },
|
||||
|
||||
/* old Qt ones, basically modified to comply with the N900 keyboard
|
||||
|
||||
@@ -131,6 +131,7 @@ void SimpleMenu::Render()
|
||||
WFont * titleFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||
titleFont->SetColor(ARGB(250,255,255,255));//reseting color on passes as this is a shared font now.
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||
float adjustme = 0.f;
|
||||
if (0 == mWidth)
|
||||
{
|
||||
float sY = mY + SimpleMenuConst::kVerticalMargin;
|
||||
@@ -172,14 +173,35 @@ void SimpleMenu::Render()
|
||||
if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen;
|
||||
|
||||
float heightPadding = SimpleMenuConst::kLineHeight/2; // this to reduce the bottom padding of the menu
|
||||
renderer->FillRect(mX, mY, mWidth, height - heightPadding, ARGB(180,0,0,0));
|
||||
|
||||
if(!title.empty())
|
||||
adjustme += 3.f;
|
||||
else
|
||||
adjustme += 5.f;
|
||||
|
||||
//renderer->FillRect(mX, mY, mWidth, height - heightPadding, ARGB(180,0,0,0));
|
||||
|
||||
//menu black bg fill
|
||||
renderer->FillRect(mX-3, (mY+adjustme-2)-3, mWidth+6, (height - heightPadding)+6, ARGB(225,5,5,5));
|
||||
renderer->DrawRect(mX-3, (mY+adjustme-2)-3, mWidth+6, (height - heightPadding)+6, ARGB(255,25,25,25));
|
||||
//menu border
|
||||
renderer->DrawRect(mX-1, (mY+adjustme-2)-1, mWidth+2, (height - heightPadding)+2, ARGB(255,240,240,240));
|
||||
//another border
|
||||
renderer->DrawRect(mX+1, mY+1+adjustme-2, mWidth-2, (height - heightPadding)-2, ARGB(255,89,89,89));
|
||||
|
||||
if(!title.empty())
|
||||
{//title border and fill
|
||||
renderer->FillRect(mX+1, mY+1+adjustme-2, mWidth-2, titleFont->GetHeight(), ARGB(25,205,0,0));
|
||||
renderer->DrawRect(mX+1, mY+1+adjustme-2, mWidth-2, titleFont->GetHeight(), ARGB(255,89,89,89));
|
||||
}
|
||||
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
/*
|
||||
drawVertPole(mX, mY, height - heightPadding);
|
||||
drawVertPole(mX + mWidth, mY, height - heightPadding);
|
||||
drawHorzPole(mX, mY, mWidth);
|
||||
drawHorzPole(mX, mY + height - heightPadding, mWidth);
|
||||
drawHorzPole(mX, mY + height - heightPadding, mWidth);*///horizontal and vertical disabled
|
||||
|
||||
//drawVertPole(mX, mY - 16, height + 32);
|
||||
//drawVertPole(mX + mWidth, mY - 16, height + 32);
|
||||
//drawHorzPole(mX - 16, mY, mWidth + 32);
|
||||
@@ -188,12 +210,11 @@ void SimpleMenu::Render()
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
stars->Render();
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (!title.empty())
|
||||
{
|
||||
float scaleFactor = titleFont->GetScale();
|
||||
titleFont->SetScale(SCALE_NORMAL);
|
||||
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY - 3, JGETEXT_CENTER);
|
||||
titleFont->DrawString(title.c_str(), mX + mWidth / 2, mY+adjustme-1.5f, JGETEXT_CENTER);
|
||||
titleFont->SetScale(scaleFactor);
|
||||
}
|
||||
for (int i = startId; i < startId + maxItems; i++)
|
||||
|
||||
@@ -34,12 +34,19 @@ SimplePopup::SimplePopup(int id, JGuiListener* listener, const int fontId, const
|
||||
void SimplePopup::Render()
|
||||
{
|
||||
mClosed = false;
|
||||
float modX = (SCREEN_WIDTH_F / 2)-5;
|
||||
|
||||
JRenderer *r = JRenderer::GetInstance();
|
||||
string detailedInformation = getDetailedInformation(mDeckInformation->getFilename());
|
||||
|
||||
const float textHeight = mTextFont->GetHeight() * mMaxLines;
|
||||
r->FillRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 0, 0, 0 ) );
|
||||
#if !defined (PSP)
|
||||
|
||||
JQuadPtr statsholder = WResourceManager::Instance()->RetrieveTempQuad("statsholder.png");//new graphics statsholder
|
||||
//const float textHeight = mTextFont->GetHeight() * mMaxLines;
|
||||
//r->FillRect(0,0,SCREEN_WIDTH_F,SCREEN_HEIGHT_F,ARGB(220,15,15,15));
|
||||
if(statsholder.get())
|
||||
r->RenderQuad(statsholder.get(),0,0,0,SCREEN_WIDTH_F/statsholder->mWidth,SCREEN_HEIGHT_F/statsholder->mHeight);
|
||||
#endif
|
||||
r->FillRoundRect(mX+modX+3, mY + 7, 190.f, 148.f, 0, ARGB( 240, 15, 15, 15 ) );
|
||||
|
||||
// currently causes a crash on the PSP when drawing the corners.
|
||||
// TODO: clean up the image ot make it loook cleaner. Find solution to load gfx to not crash PSP
|
||||
@@ -47,7 +54,7 @@ void SimplePopup::Render()
|
||||
r->DrawRoundRect(mX, mY + 2, mWidth + 11, textHeight - 12, 2.0f, ARGB( 255, 125, 255, 0) );
|
||||
drawBoundingBox( mX-3, mY, mWidth + 3, textHeight );
|
||||
#endif
|
||||
mTextFont->DrawString(detailedInformation.c_str(), mX + 9 , mY + 10);
|
||||
mTextFont->DrawString(detailedInformation.c_str(), modX+mX + 9 , mY + 15);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,20 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
return NEW dredgeChooser(observer,zones,nbzones, card, maxtargets);
|
||||
}
|
||||
|
||||
found = s.find("mychild");
|
||||
if (found != string::npos)
|
||||
{
|
||||
int maxtargets = 1;
|
||||
return NEW ChildrenChooser(observer, card, maxtargets);
|
||||
};
|
||||
|
||||
found = s.find("mytotem");
|
||||
if (found != string::npos)
|
||||
{
|
||||
int maxtargets = 1;
|
||||
return NEW TotemChooser(observer, card, maxtargets);
|
||||
};
|
||||
|
||||
found = s.find("mytgt");
|
||||
if (found == 0)
|
||||
{
|
||||
@@ -156,11 +170,16 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::ALL_ZONES;
|
||||
}
|
||||
else if (zoneName.compare("reveal") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_REVEAL;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_REVEAL;
|
||||
}
|
||||
else if (zoneName.compare("sideboard") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_SIDEBOARD;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_SIDEBOARD;
|
||||
}
|
||||
else if (zoneName.compare("reveal") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_REVEAL;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_REVEAL;
|
||||
}
|
||||
else if (zoneName.compare("graveyard") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
||||
@@ -202,6 +221,51 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
zones[nbzones++] = MTGGameZone::MY_EXILE;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_EXILE;
|
||||
}
|
||||
else if (zoneName.compare("mycastingzone") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::MY_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::MY_HAND;
|
||||
zones[nbzones++] = MTGGameZone::MY_EXILE;
|
||||
zones[nbzones++] = MTGGameZone::MY_SIDEBOARD;
|
||||
}
|
||||
else if (zoneName.compare("opponentcastingzone") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_HAND;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_EXILE;
|
||||
}
|
||||
else if (zoneName.compare("mynonplaynonexile") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::MY_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::MY_HAND;
|
||||
}
|
||||
else if (zoneName.compare("opponentnonplaynonexile") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_HAND;
|
||||
}
|
||||
else if (zoneName.compare("myzones") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::MY_BATTLEFIELD;
|
||||
zones[nbzones++] = MTGGameZone::MY_STACK;
|
||||
zones[nbzones++] = MTGGameZone::MY_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::MY_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::MY_HAND;
|
||||
zones[nbzones++] = MTGGameZone::MY_EXILE;
|
||||
}
|
||||
else if (zoneName.compare("opponentzones") == 0)
|
||||
{
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_BATTLEFIELD;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_STACK;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_GRAVEYARD;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_LIBRARY;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_HAND;
|
||||
zones[nbzones++] = MTGGameZone::OPPONENT_EXILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
int zone = MTGGameZone::zoneStringToId(zoneName);
|
||||
@@ -394,6 +458,18 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->defenser = &MTGCardInstance::AnyCard;
|
||||
}
|
||||
}
|
||||
//Blocked
|
||||
else if (attribute.find("blocked") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDblocked = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDblocked = 1;
|
||||
}
|
||||
}
|
||||
//Tapped, untapped
|
||||
else if (attribute.find("tapped") != string::npos)
|
||||
{
|
||||
@@ -430,6 +506,28 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->unsecuresetfresh(1);
|
||||
}
|
||||
}
|
||||
else if (attribute.find("recent") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->unsecuresetrecent(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->unsecuresetrecent(1);
|
||||
}
|
||||
}
|
||||
else if (attribute.find("geared") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDgeared = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDgeared = 1;
|
||||
}
|
||||
}
|
||||
//creature is a level up creature
|
||||
else if (attribute.find("leveler") != string::npos)
|
||||
{
|
||||
@@ -502,6 +600,79 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
cd->CDdamager = 1;
|
||||
}
|
||||
}
|
||||
//can produce mana
|
||||
else if (attribute.find("cmana") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceC = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceC = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("manag") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceG = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceG = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("manau") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceU = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceU = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("manar") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceR = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceR = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("manab") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceB = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceB = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("manaw") != string::npos)
|
||||
{
|
||||
if (minus)
|
||||
{
|
||||
cd->CDcanProduceW = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
cd->CDcanProduceW = 1;
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
else if (attribute.find("multicolor") != string::npos)
|
||||
{
|
||||
//card is multicolored?
|
||||
@@ -529,6 +700,12 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
cd->setToughness(comparisonCriterion);
|
||||
cd->toughnessComparisonMode = comparisonMode;
|
||||
//zpos restrictions
|
||||
}
|
||||
else if (attribute.find("zpos") != string::npos)
|
||||
{
|
||||
cd->zposition = comparisonCriterion;
|
||||
cd->zposComparisonMode = comparisonMode;
|
||||
//Manacost restrictions
|
||||
}
|
||||
else if (attribute.find("manacost") != string::npos)
|
||||
@@ -601,6 +778,10 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
{
|
||||
cd->anyCounter = 1;
|
||||
}
|
||||
else if (attribute.find("{notany}") != string::npos)
|
||||
{
|
||||
cd->anyCounter = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t start = attribute.find("{");
|
||||
@@ -642,15 +823,19 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
|
||||
}
|
||||
}
|
||||
|
||||
if (attribute.find("colorless") != string::npos)
|
||||
{
|
||||
attributefound = 1;
|
||||
for (int cid = 1; cid < Constants::NB_Colors; cid++)
|
||||
{
|
||||
cd->SetExclusionColor(cid);
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;
|
||||
}
|
||||
if (attribute.find("colorless") != string::npos)
|
||||
{
|
||||
attributefound = 1;
|
||||
/*for (int cid = 1; cid < Constants::NB_Colors; cid++)
|
||||
{
|
||||
cd->SetExclusionColor(cid);
|
||||
}
|
||||
cd->mode = CardDescriptor::CD_OR;*/
|
||||
if (minus)
|
||||
cd->CDnocolor = -1;
|
||||
else
|
||||
cd->CDnocolor = 1;
|
||||
}
|
||||
|
||||
if (attribute.find("chosencolor") != string::npos)
|
||||
{
|
||||
@@ -822,7 +1007,7 @@ TargetChooser::TargetChooser(GameObserver *observer, MTGCardInstance * card, int
|
||||
TargetsList(), observer(observer)
|
||||
{
|
||||
forceTargetListReady = 0;
|
||||
forceTargetListReadyByPlayer = 0;
|
||||
forceTargetListReadyByPlayer = 0;
|
||||
source = card;
|
||||
targetter = card;
|
||||
maxtargets = _maxtargets;
|
||||
@@ -888,6 +1073,11 @@ int TargetChooser::addTarget(Targetable * target)
|
||||
if (canTarget(target))
|
||||
{
|
||||
TargetsList::addTarget(target);
|
||||
#if defined (ANDROID) //auto close... we need to close gui like swipe left...
|
||||
if (target->getObserver()->guiOpenDisplay && getNbTargets() == maxtargets)
|
||||
target->getObserver()->ButtonPressed(target->getObserver()->guiOpenDisplay);
|
||||
#endif//example bug, cast Snapcaster Mage during a spell of opponent and target a Mana Leak..
|
||||
//how can you cast the Mana Leak? If you can't close the graveyard window to tap for mana???
|
||||
}
|
||||
|
||||
return targetsReadyCheck();
|
||||
@@ -905,10 +1095,10 @@ int TargetChooser::ForceTargetListReady()
|
||||
|
||||
int TargetChooser::targetsReadyCheck()
|
||||
{
|
||||
if (targetMin == false && !targets.size() && forceTargetListReadyByPlayer)
|
||||
{
|
||||
return TARGET_OK_FULL;//we have no min amount for targets and 0 targets is a valid amount player called for a forced finish.
|
||||
}
|
||||
if (targetMin == false && !targets.size() && forceTargetListReadyByPlayer)
|
||||
{
|
||||
return TARGET_OK_FULL;//we have no min amount for targets and 0 targets is a valid amount player called for a forced finish.
|
||||
}
|
||||
if (!targets.size())
|
||||
{
|
||||
return TARGET_NOK;
|
||||
@@ -941,8 +1131,8 @@ bool TargetChooser::validTargetsExist(int maxTargets)
|
||||
int maxAmount = 0;
|
||||
Player *p = observer->players[i];
|
||||
if (canTarget(p)) return true;
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile, p->game->stack, p->game->reveal };
|
||||
for (int k = 0; k < 7; k++)
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile, p->game->stack, p->game->reveal, p->game->sideboard };
|
||||
for (int k = 0; k < 8; k++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (targetsZone(z))
|
||||
@@ -975,8 +1165,8 @@ int TargetChooser::countValidTargets(bool withoutProtections)
|
||||
Player *p = observer->players[i];
|
||||
if(canTarget(p))
|
||||
result++;
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile, p->game->stack, p->game->reveal };
|
||||
for (int k = 0; k < 7; k++)
|
||||
MTGGameZone * zones[] = { p->game->inPlay, p->game->graveyard, p->game->hand, p->game->library, p->game->exile, p->game->stack, p->game->reveal, p->game->sideboard };
|
||||
for (int k = 0; k < 8; k++)
|
||||
{
|
||||
MTGGameZone * z = zones[k];
|
||||
if (targetsZone(z))
|
||||
@@ -1644,9 +1834,20 @@ bool BlockableChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
}
|
||||
if(lured && card->controller()->inPlay()->hasAbility(Constants::LURE) && !card->has(Constants::LURE))
|
||||
return false;
|
||||
//provoke
|
||||
bool provoked = false;
|
||||
MTGCardInstance * provoker = observer->currentPlayer->game->inPlay->findAProvoker(source);
|
||||
if(provoker)
|
||||
{
|
||||
provoked = true;
|
||||
}
|
||||
if(provoked && source->isProvoked && !card->ProvokeTarget)
|
||||
return false;
|
||||
if(provoked && source->isProvoked && card->ProvokeTarget && card->ProvokeTarget != source)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return TypeTargetChooser::canTarget(target,withoutProtections);
|
||||
return false;//TypeTargetChooser::canTarget(target,withoutProtections);
|
||||
}
|
||||
|
||||
BlockableChooser* BlockableChooser::clone() const
|
||||
@@ -1829,3 +2030,81 @@ ParentChildChooser::~ParentChildChooser()
|
||||
{
|
||||
SAFE_DELETE(deeperTargeting);
|
||||
}
|
||||
|
||||
//child only
|
||||
bool ChildrenChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
if (MTGCardInstance * card = dynamic_cast<MTGCardInstance*>(target))
|
||||
{
|
||||
if(card == source)
|
||||
return false;
|
||||
if(!card->isInPlay(observer))
|
||||
return false;
|
||||
if(card->auraParent)
|
||||
{
|
||||
if(card->auraParent == source)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ChildrenChooser* ChildrenChooser::clone() const
|
||||
{
|
||||
ChildrenChooser * a = NEW ChildrenChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
bool ChildrenChooser::equals(TargetChooser * tc)
|
||||
{
|
||||
|
||||
ChildrenChooser * dtc = dynamic_cast<ChildrenChooser *> (tc);
|
||||
if (!dtc)
|
||||
return false;
|
||||
|
||||
return TypeTargetChooser::equals(tc);
|
||||
}
|
||||
|
||||
ChildrenChooser::~ChildrenChooser()
|
||||
{
|
||||
}
|
||||
|
||||
//totem armor chooser
|
||||
bool TotemChooser::canTarget(Targetable * target,bool withoutProtections)
|
||||
{
|
||||
if (MTGCardInstance * card = dynamic_cast<MTGCardInstance*>(target))
|
||||
{
|
||||
if(card == source)
|
||||
return false;
|
||||
if(!card->isInPlay(observer))
|
||||
return false;
|
||||
if(card->auraParent)
|
||||
{
|
||||
if((card->auraParent) == source && (card->has(Constants::TOTEMARMOR)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
TotemChooser* TotemChooser::clone() const
|
||||
{
|
||||
TotemChooser * a = NEW TotemChooser(*this);
|
||||
return a;
|
||||
}
|
||||
|
||||
bool TotemChooser::equals(TargetChooser * tc)
|
||||
{
|
||||
|
||||
TotemChooser * dtc = dynamic_cast<TotemChooser *> (tc);
|
||||
if (!dtc)
|
||||
return false;
|
||||
|
||||
return TypeTargetChooser::equals(tc);
|
||||
}
|
||||
|
||||
TotemChooser::~TotemChooser()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,9 +20,15 @@ int TargetsList::addTarget(Targetable * target)
|
||||
{
|
||||
if (!alreadyHasTarget(target))
|
||||
{
|
||||
|
||||
TargetChooser * tc = target->getObserver()->getCurrentTargetChooser();
|
||||
if(!tc || (tc && tc->maxtargets == 1))
|
||||
{
|
||||
if (dynamic_cast<TargetChooser*>(this)->maxtargets > int(getNbTargets()))
|
||||
{
|
||||
targets.push_back(target);
|
||||
return 1;
|
||||
}
|
||||
//because this was originally coded with targets as an array
|
||||
//we have to add this conditional to insure that cards with single target effects
|
||||
//and abilities that seek the nextcardtarget still work correctly.
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
#include "Rules.h"
|
||||
#include "GameObserver.h"
|
||||
#include "GameStateShop.h"
|
||||
#ifdef QT_CONFIG
|
||||
#include <QThread>
|
||||
#endif
|
||||
|
||||
#ifdef QT_CONFIG
|
||||
#include <QThread>
|
||||
@@ -874,7 +877,8 @@ void TestSuiteGame::initGame()
|
||||
{
|
||||
if (zone == p->game->inPlay)
|
||||
{
|
||||
MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
|
||||
//MTGCardInstance * copy = p->game->putInZone(card, p->game->library, p->game->stack);
|
||||
MTGCardInstance * copy = zone->owner->game->putInZone(card, p->game->library, p->game->stack);
|
||||
Spell * spell = NEW Spell(observer, copy);
|
||||
spell->resolve();
|
||||
if (!summoningSickness && (size_t)p->game->inPlay->nb_cards > k) p->game->inPlay->cards[k]->summoningSickness = 0;
|
||||
@@ -886,7 +890,8 @@ void TestSuiteGame::initGame()
|
||||
{
|
||||
LOG ("TESTUITE ERROR, CARD NOT FOUND IN LIBRARY\n");
|
||||
}
|
||||
p->game->putInZone(card, p->game->library, zone);
|
||||
//p->game->putInZone(card, p->game->library, zone);
|
||||
zone->owner->game->putInZone(card, p->game->library, zone);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -66,7 +66,25 @@ void TextScroller::Update(float dt)
|
||||
|
||||
void TextScroller::Render()
|
||||
{
|
||||
|
||||
JQuadPtr fakebar;
|
||||
JTexture * tex = WResourceManager::Instance()->RetrieveTexture("phaseinfo.png");
|
||||
if (tex)
|
||||
{
|
||||
fakebar = WResourceManager::Instance()->RetrieveQuad("phaseinfo.png", 0.0f, 0.0f, tex->mWidth - 3.5f, tex->mHeight - 2.0f); //avoids weird rectangle around the texture because of bilinear filtering
|
||||
}
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||
mFont->SetColor(ARGB(128,255,255,255));
|
||||
if(fakebar.get())
|
||||
{
|
||||
if(mText.length() > 1)
|
||||
{
|
||||
float xscale = (SCREEN_WIDTH_F/2.6f) / fakebar->mWidth;
|
||||
float yscale = (mFont->GetHeight()+(mFont->GetHeight()/3.5f)) / fakebar->mHeight;
|
||||
fakebar->SetHotSpot(fakebar->mWidth-8.f,0);
|
||||
JRenderer::GetInstance()->RenderQuad(fakebar.get(),SCREEN_WIDTH_F, 4,0,xscale,yscale);
|
||||
}
|
||||
}
|
||||
mFont->DrawString(mText.c_str(), mX, mY, JGETEXT_LEFT, start, mWidth);
|
||||
}
|
||||
|
||||
@@ -145,5 +163,19 @@ void VerticalTextScroller::Update(float dt)
|
||||
void VerticalTextScroller::Render()
|
||||
{
|
||||
WFont * mFont = WResourceManager::Instance()->GetWFont(fontId);
|
||||
JQuadPtr textscroller;
|
||||
JQuadPtr textscrollershadow;
|
||||
#if !defined (PSP)
|
||||
textscroller = WResourceManager::Instance()->RetrieveTempQuad("textscroller.png");//new graphics textscroller
|
||||
textscrollershadow = WResourceManager::Instance()->RetrieveTempQuad("textscrollershadow.png");//new graphics textscroller shadow
|
||||
if(!mText.empty() && mText.length() > 1)
|
||||
if (textscrollershadow.get())
|
||||
JRenderer::GetInstance()->RenderQuad(textscrollershadow.get(), 0, 0, 0 ,SCREEN_WIDTH_F / textscrollershadow->mWidth, SCREEN_HEIGHT_F / textscrollershadow->mHeight);
|
||||
#endif
|
||||
mFont->DrawString(mText.c_str(), mX, mY);
|
||||
#if !defined (PSP)
|
||||
if(!mText.empty() && mText.length() > 1)
|
||||
if (textscroller.get())
|
||||
JRenderer::GetInstance()->RenderQuad(textscroller.get(), 0, 0, 0 ,SCREEN_WIDTH_F / textscroller->mWidth, SCREEN_HEIGHT_F / textscroller->mHeight);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,16 @@ Token::Token(string _name, MTGCardInstance * source, int _power, int _toughness)
|
||||
rarity = Constants::RARITY_T;
|
||||
name = _name;
|
||||
if (name.size() && name[0] >= 97 && name[0] <= 122) name[0] -= 32; //Poor man's camelcase. We assume strings we get are either Camelcased or lowercase
|
||||
setMTGId(-source->getMTGId());
|
||||
setId = source->setId;
|
||||
if(source->isACopier && source->copiedSetID)
|
||||
{
|
||||
setMTGId(-source->copiedID);
|
||||
setId = source->copiedSetID;
|
||||
}
|
||||
else
|
||||
{
|
||||
setMTGId(-source->getMTGId());
|
||||
setId = source->setId;
|
||||
}
|
||||
model = this;
|
||||
data = this;
|
||||
owner = source->owner;
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
#ifdef SDL_CONFIG
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
#ifdef QT_CONFIG
|
||||
#include <QKeySequence>
|
||||
#endif
|
||||
using std::string;
|
||||
using std::map;
|
||||
|
||||
static map<const LocalKeySym, KeyRep> fattable;
|
||||
static map<const JButton, KeyRep> slimtable;
|
||||
|
||||
#if defined(LINUX) || defined (IOS) || defined (ANDROID) || defined (SDL_CONFIG) || defined (QT_CONFIG)
|
||||
#if defined(LINUX) || defined (IOS) || defined (ANDROID) || defined (SDL_CONFIG) || defined (QT_CONFIG)
|
||||
const KeyRep& translateKey(LocalKeySym key)
|
||||
{
|
||||
{
|
||||
@@ -27,6 +30,8 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
str = XKeysymToString(key);
|
||||
#elif defined (SDL_CONFIG)
|
||||
str = (char*)SDL_GetKeyName(key);
|
||||
#elif defined (QT_CONFIG)
|
||||
str = (char*)QKeySequence(key).toString().toUtf8().constData();
|
||||
#endif
|
||||
if (!str)
|
||||
{
|
||||
@@ -135,33 +140,34 @@ const KeyRep& translateKey(LocalKeySym key)
|
||||
#endif
|
||||
|
||||
const KeyRep& translateKey(JButton key) {
|
||||
/*
|
||||
|
||||
{
|
||||
map<const JButton, KeyRep>::iterator res;
|
||||
if ((res = slimtable.find(key)) != slimtable.end())
|
||||
return res->second;
|
||||
}
|
||||
|
||||
slimtable[JGE_BTN_NONE] = make_pair(_("None"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_QUIT] = make_pair(_("Quit"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_MENU] = make_pair(_("Menu"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_CTRL] = make_pair(_("Control"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_POWER] = make_pair(_("Power"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_SOUND] = make_pair(_("Sound"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_RIGHT] = make_pair(_("Right"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_LEFT] = make_pair(_("Left"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_UP] = make_pair(_("Up"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_DOWN] = make_pair(_("Down"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_OK] = make_pair(_("Ok"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_CANCEL] = make_pair(_("Cancel"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_PRI] = make_pair(_("Primary"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_SEC] = make_pair(_("Secondary"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_PREV] = make_pair(_("Next phase/Previous item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_NEXT] = make_pair(_("Open hand/Next item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_NONE] = make_pair(_("Delete this binding"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_QUIT] = make_pair(_("Quit"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_MENU] = make_pair(_("Menu"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_CTRL] = make_pair(_("Control"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_POWER] = make_pair(_("Power"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_SOUND] = make_pair(_("Sound"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_RIGHT] = make_pair(_("Right"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_LEFT] = make_pair(_("Left"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_UP] = make_pair(_("Up"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_DOWN] = make_pair(_("Down"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_OK] = make_pair(_("Ok"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_CANCEL] = make_pair(_("Cancel"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_PRI] = make_pair(_("Primary"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_SEC] = make_pair(_("Secondary"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_PREV] = make_pair(_("Next phase/Previous item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_NEXT] = make_pair(_("Open hand/Next item"), static_cast<JQuad*>(NULL));
|
||||
slimtable[JGE_BTN_FULLSCREEN] = make_pair(_("Fullscreen"), static_cast<JQuad*>(NULL));
|
||||
|
||||
return slimtable[key];
|
||||
*/
|
||||
|
||||
/*
|
||||
map<const JButton, KeyRep>::iterator res;
|
||||
if ((res = slimtable.find(key)) == slimtable.end())
|
||||
{
|
||||
@@ -205,7 +211,8 @@ const KeyRep& translateKey(JButton key) {
|
||||
case JGE_BTN_OK : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)4*32, 0, 32, 32, "PSP_CTRL_CIRCLE", RETRIEVE_NORMAL).get(); break;
|
||||
case JGE_BTN_SEC : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)7*32, 0, 32, 32, "PSP_CTRL_CROSS", RETRIEVE_NORMAL).get(); break;
|
||||
case JGE_BTN_PRI : k.second = WResourceManager::Instance()->RetrieveQuad("iconspsp.png", (float)6*32, 0, 32, 32, "PSP_CTRL_SQUARE", RETRIEVE_NORMAL).get(); break;
|
||||
default: /* Unknown key : no icon */ ;
|
||||
default: ; // Unknown key : no icon
|
||||
}
|
||||
return k;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -296,7 +296,14 @@ void WSrcCards::validate()
|
||||
if (!filtersRoot) return;
|
||||
for (size_t t = 0; t < cards.size(); t++)
|
||||
{
|
||||
if (matchesFilters(cards[t])) validated.push_back(t);
|
||||
if(!options[Options::SHOWTOKENS].number)
|
||||
{//don't add tokens or negative id
|
||||
if (matchesFilters(cards[t]) && (cards[t]->getId() > 0) && (cards[t]->getRarity() != Constants::RARITY_T)) validated.push_back(t);
|
||||
}
|
||||
else
|
||||
{//show but you cant add
|
||||
if (matchesFilters(cards[t])) validated.push_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +399,14 @@ WSrcUnlockedCards::WSrcUnlockedCards(float delay) :
|
||||
|
||||
for (it = ac->collection.begin(); it != ac->collection.end(); it++)
|
||||
{
|
||||
if (it->second && unlocked[it->second->setId]) cards.push_back(it->second);
|
||||
if(!options[Options::SHOWTOKENS].number)
|
||||
{//dont show tokens & negative id's
|
||||
if (it->second && unlocked[it->second->setId] && (it->second->getId() > 0) && (it->second->getRarity() != Constants::RARITY_T)) cards.push_back(it->second);
|
||||
}
|
||||
else
|
||||
{//show but you cant add
|
||||
if (it->second && unlocked[it->second->setId]) cards.push_back(it->second);
|
||||
}
|
||||
}
|
||||
if (unlocked)
|
||||
{
|
||||
@@ -416,10 +430,21 @@ int WSrcDeck::loadMatches(MTGDeck * deck)
|
||||
for (it = deck->cards.begin(); it != deck->cards.end(); it++)
|
||||
{
|
||||
MTGCard * c = deck->getCardById(it->first);
|
||||
if (c && matchesFilters(c))
|
||||
{
|
||||
Add(c, it->second);
|
||||
count++;
|
||||
if(!options[Options::SHOWTOKENS].number)
|
||||
{//dont show tokens & negative id's
|
||||
if (c && matchesFilters(c) && (c->getId() > 0) && (c->getRarity() != Constants::RARITY_T))
|
||||
{
|
||||
Add(c, it->second);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{//show but you cant add
|
||||
if (c && matchesFilters(c))
|
||||
{
|
||||
Add(c, it->second);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
validate();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "MTGGameZones.h"
|
||||
#include "Damage.h"
|
||||
#include "PhaseRing.h"
|
||||
#include "AllAbilities.h"
|
||||
|
||||
WEvent::WEvent(int type) :
|
||||
type(type)
|
||||
@@ -31,6 +32,11 @@ WEventDamageStackResolved::WEventDamageStackResolved() :
|
||||
{
|
||||
}
|
||||
|
||||
WEventGameStateBasedChecked::WEventGameStateBasedChecked() :
|
||||
WEvent()
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardUpdate::WEventCardUpdate(MTGCardInstance * card) :
|
||||
WEvent(), card(card)
|
||||
{
|
||||
@@ -56,6 +62,7 @@ WEvent(CHANGE_PHASE), from(from), to(to)
|
||||
WEventCardTap::WEventCardTap(MTGCardInstance * card, bool before, bool after) :
|
||||
WEventCardUpdate(card), before(before), after(after)
|
||||
{
|
||||
noTrigger = false;
|
||||
}
|
||||
|
||||
WEventCardTappedForMana::WEventCardTappedForMana(MTGCardInstance * card, bool before, bool after) :
|
||||
@@ -114,6 +121,11 @@ WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardExerted::WEventCardExerted(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventVampire::WEventVampire(MTGCardInstance * card,MTGCardInstance * source,MTGCardInstance * victem) :
|
||||
WEventCardUpdate(card),source(source),victem(victem)
|
||||
{
|
||||
@@ -122,9 +134,6 @@ WEventVampire::WEventVampire(MTGCardInstance * card,MTGCardInstance * source,MTG
|
||||
WEventTarget::WEventTarget(MTGCardInstance * card,MTGCardInstance * source) :
|
||||
WEventCardUpdate(card),card(card),source(source)
|
||||
{
|
||||
card->cardistargetted = 1;
|
||||
if(source)
|
||||
source->cardistargetter = 1;
|
||||
}
|
||||
|
||||
WEventCardChangeType::WEventCardChangeType(MTGCardInstance * card, int type, bool before, bool after) :
|
||||
@@ -230,10 +239,53 @@ WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardPhasesOut::WEventCardPhasesOut(MTGCardInstance * card, int turn) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
if(card->getPhasedOutAbility().size())
|
||||
{
|
||||
AbilityFactory af(card->getObserver());
|
||||
MTGAbility * a = af.parseMagicLine(card->getPhasedOutAbility(), card->getObserver()->mLayers->actionLayer()->getMaxId(), NULL, card->clone());
|
||||
MTGAbility * poA = a->clone();
|
||||
SAFE_DELETE(a);
|
||||
poA->oneShot = true;
|
||||
poA->canBeInterrupted = false;
|
||||
MTGAbility *gatg = NEW GenericAddToGame(card->getObserver(), card->getObserver()->mLayers->actionLayer()->getMaxId(), card,NULL,poA->clone());
|
||||
SAFE_DELETE(poA);
|
||||
gatg->fireAbility();
|
||||
//SAFE_DELETE(gatg);
|
||||
}
|
||||
}
|
||||
|
||||
WEventCardPhasesIn::WEventCardPhasesIn(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardFaceUp::WEventCardFaceUp(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardTransforms::WEventCardTransforms(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCardCopiedACard::WEventCardCopiedACard(MTGCardInstance * card) :
|
||||
WEventCardUpdate(card)
|
||||
{
|
||||
}
|
||||
|
||||
WEventCombatStepChange::WEventCombatStepChange(CombatStep step) :
|
||||
WEvent(), step(step)
|
||||
{
|
||||
}
|
||||
|
||||
WEventplayerEnergized::WEventplayerEnergized(Player * player, int nb_count) :
|
||||
player(player), nb_count(nb_count)
|
||||
{
|
||||
}
|
||||
;
|
||||
|
||||
Targetable * WEventDamage::getTarget(int target)
|
||||
@@ -330,6 +382,12 @@ Targetable * WEventCardCycle::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardExerted::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardAttackedNotBlocked::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
@@ -396,6 +454,42 @@ Targetable * WEventCardControllerChange::getTarget(int target)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardPhasesOut::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardPhasesIn::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardFaceUp::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardTransforms::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventCardCopiedACard::getTarget(int target)
|
||||
{
|
||||
if (target) return card;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Targetable * WEventplayerEnergized::getTarget(Player * player)
|
||||
{
|
||||
if (player) return player;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::ostream& WEvent::toString(std::ostream& out) const
|
||||
{
|
||||
return out << "EVENT";
|
||||
|
||||
@@ -272,7 +272,7 @@ bool WCFilterProducesColor::isMatch(MTGCard * c)
|
||||
|
||||
//Retrieve non basic Mana abilities
|
||||
string s = c->data->magicText;
|
||||
size_t t = s.find("add");
|
||||
size_t t = s.find("add{");
|
||||
while (t != string::npos)
|
||||
{
|
||||
s = s.substr(t + 3);
|
||||
|
||||
@@ -115,10 +115,12 @@ WLBFont::WLBFont(int inFontID, const char *fontname, int lineheight, bool useVid
|
||||
it = NEW JLBFont(path.c_str(), lineheight, useVideoRAM);
|
||||
}
|
||||
|
||||
void WLBFont::FormatText(string &s, vector<string>& output)
|
||||
void WLBFont::FormatText(string &s, vector<string>& output, int customLen)
|
||||
{
|
||||
int defL = (customLen>0)?customLen:30;
|
||||
// The way of CardPrimitive::formattedText() in r2081.
|
||||
std::string::size_type len = 30;
|
||||
//std::string::size_type len = 30;
|
||||
std::string::size_type len = defL;
|
||||
while (s.length() > 0)
|
||||
{
|
||||
std::string::size_type cut = s.find_first_of("., \t)", 0);
|
||||
@@ -1055,7 +1057,7 @@ int WGBKFont::GetMana(const u8 *ch) const
|
||||
return mana;
|
||||
}
|
||||
|
||||
void WGBKFont::FormatText(string &s, vector<string>& output)
|
||||
void WGBKFont::FormatText(string &s, vector<string>& output, int customLen)
|
||||
{
|
||||
while (s.length() > 0)
|
||||
{
|
||||
@@ -1196,7 +1198,7 @@ int WUFont::GetMana(const u8 *ch) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
void WUFont::FormatText(string &s, vector<string>& output)
|
||||
void WUFont::FormatText(string &s, vector<string>& output, int customLen)
|
||||
{
|
||||
std::string::size_type limit = 22; //28
|
||||
string delim("., \t)");
|
||||
|
||||
+76
-21
@@ -253,8 +253,14 @@ void WGuiMenu::subBack(WGuiBase * item)
|
||||
if (split->right) subBack(split->right);//renderer->FillRoundRect(split->right->getX()-2,split->getY()-2,split->right->getWidth(),split->getHeight(),2,split->right->getColor(WGuiColor::BACK));
|
||||
}
|
||||
else
|
||||
renderer->FillRoundRect(item->getX(), item->getY(), item->getWidth() - 4, item->getHeight() - 2, 2, item->getColor(
|
||||
{
|
||||
renderer->FillRoundRect(item->getX(), item->getY(), item->getWidth() - 4, item->getHeight() - 2, 1, item->getColor(
|
||||
WGuiColor::BACK));
|
||||
//inner border
|
||||
renderer->DrawRoundRect(item->getX(), item->getY(), item->getWidth() - 4, item->getHeight() - 2, 1, ARGB(255,89,89,89));
|
||||
//outer border
|
||||
//renderer->DrawRect(item->getX()-1.5f, item->getY()-1, item->getWidth()+1, item->getHeight() +2, ARGB(80,240,240,240));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -408,7 +414,7 @@ void WGuiList::Render()
|
||||
float barLength = static_cast<float> ((SCREEN_HEIGHT - y) / listSelectable);
|
||||
if (barLength < 4) barLength = 4;
|
||||
renderer->FillRect(x + width - 2, y - 1, 2, SCREEN_HEIGHT - y, getColor(WGuiColor::SCROLLBAR));
|
||||
renderer->FillRoundRect(x + width - 5, barPosition, 5, barLength, 2, getColor(WGuiColor::SCROLLBUTTON));
|
||||
renderer->FillRoundRect(x + width - 5, barPosition, 5, barLength, 1, getColor(WGuiColor::SCROLLBUTTON));
|
||||
}
|
||||
|
||||
//Render current overlay.
|
||||
@@ -686,13 +692,16 @@ PIXEL_TYPE WGuiButton::getColor(int type)
|
||||
}
|
||||
;
|
||||
|
||||
WGuiSplit::WGuiSplit(WGuiBase* _left, WGuiBase* _right) :
|
||||
WGuiSplit::WGuiSplit(WGuiBase* _left, WGuiBase* _right, bool custom) :
|
||||
WGuiItem("")
|
||||
{
|
||||
right = _right;
|
||||
left = _left;
|
||||
bRight = false;
|
||||
percentRight = 0.5f;
|
||||
if(!custom)
|
||||
percentRight = 0.5f;
|
||||
else
|
||||
percentRight = 0.67f;
|
||||
if (!left->Selectable()) bRight = true;
|
||||
}
|
||||
WGuiSplit::~WGuiSplit()
|
||||
@@ -1190,7 +1199,11 @@ void WGuiTabMenu::Render()
|
||||
{
|
||||
float w = mFont->GetStringWidth(_((*it)->getDisplay()).c_str());
|
||||
mFont->SetColor((*it)->getColor(WGuiColor::TEXT_TAB));
|
||||
renderer->FillRoundRect(offset + 5, 5, w + 5, 25, 2, (*it)->getColor(WGuiColor::BACK_TAB));
|
||||
renderer->FillRoundRect(offset + 6.5f, 5, w + 6.5f, 25, 0, (*it)->getColor(WGuiColor::BACK_TAB));
|
||||
//inside border
|
||||
renderer->DrawRoundRect(offset + 6.5f, 5, w + 6.5f, 25, 0, ARGB(180,89,89,89));
|
||||
//outside border
|
||||
//renderer->DrawRoundRect(offset + 5.5f, 4, w + 8.5f, 27, 0, ARGB(180,240,240,240));
|
||||
mFont->DrawString(_((*it)->getDisplay()).c_str(), offset + 10, 10);
|
||||
offset += w + 10 + 2;
|
||||
}
|
||||
@@ -1320,7 +1333,14 @@ void WGuiAward::Underlay()
|
||||
|
||||
if (trophy.get())
|
||||
{
|
||||
JRenderer::GetInstance()->RenderQuad(trophy.get(), 0, SCREEN_HEIGHT - trophy->mHeight);
|
||||
trophy->SetHotSpot(0,trophy->mHeight);
|
||||
if(trophy->mHeight == 268.f && trophy->mWidth == 203.f)
|
||||
{
|
||||
trophy->SetHotSpot(0,0);
|
||||
JRenderer::GetInstance()->RenderQuad(trophy.get(), 0, SCREEN_HEIGHT-trophy->mHeight);
|
||||
}
|
||||
else
|
||||
JRenderer::GetInstance()->RenderQuad(trophy.get(), 0, SCREEN_HEIGHT, 0, 171.f / trophy->mWidth, 192.f / trophy->mHeight);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1753,12 +1773,18 @@ void WGuiFilters::buildList()
|
||||
{
|
||||
list = NEW WGuiList("");
|
||||
WGuiButton * l = NEW WGuiButton(NEW WGuiItem("Add Filter"), -102, -10, this);
|
||||
WGuiButton * r = NEW WGuiButton(NEW WGuiItem("Done"), -102, -11, this);
|
||||
WGuiButton * r = NEW WGuiButton(NEW WGuiItem("Return"), -102, -11, this);
|
||||
WGuiButton * mid = NEW WGuiButton(NEW WGuiItem("Clear"), -102, -66, this);
|
||||
WGuiSplit * sub = NEW WGuiSplit(mid, r);
|
||||
WGuiSplit * wgs = NEW WGuiSplit(l, sub);
|
||||
sub->setHeight(25);
|
||||
sub->setWidth(240);
|
||||
l->setHeight(25);
|
||||
l->setWidth(160);
|
||||
WGuiSplit * wgs = NEW WGuiSplit(l, sub, true);
|
||||
//WGuiSplit * wgs = NEW WGuiSplit(mid, r);
|
||||
subMenu = NULL;
|
||||
list->Add(NEW WGuiHeader(displayValue));
|
||||
//list->Add(l);
|
||||
list->Add(wgs);
|
||||
list->Entering(JGE_BTN_NONE);
|
||||
}
|
||||
@@ -2151,9 +2177,19 @@ void WGuiFilterItem::updateValue()
|
||||
else if (filterType == FILTER_BASIC)
|
||||
{
|
||||
char buf[512];
|
||||
vector<string> baString;
|
||||
for (int i = 0; i < Constants::NB_BASIC_ABILITIES; i++)
|
||||
{//remove some others
|
||||
if(i != 119 || i != 120 || i != 135 || i != 136 || i != 137 || i != 139 || i != 140 || i != 141 || i != 143
|
||||
|| i != 144 || i != 145 || i != 146 || i != 147 || i != 148 || i != 149 || i != 150
|
||||
|| i != 151 || i != 152 || i != 153 || i != 154)
|
||||
baString.push_back(Constants::MTGBasicAbilities[i]);
|
||||
}
|
||||
//sort
|
||||
sort(baString.begin(),baString.end());
|
||||
for (unsigned int i = 0; i < baString.size(); i++)
|
||||
{
|
||||
string s = Constants::MTGBasicAbilities[i];
|
||||
string s = baString[i];
|
||||
sprintf(buf, "a:%s;", s.c_str());
|
||||
s[0] = toupper(s[0]);
|
||||
mParent->addArg(s, buf);
|
||||
@@ -2259,22 +2295,17 @@ WGuiKeyBinder::WGuiKeyBinder(string name, GameStateOptions* parent) :
|
||||
WGuiList(name), parent(parent), confirmMenu(NULL), modal(false), confirmed(CONFIRM_NEED), confirmingKey(LOCAL_KEY_NONE),
|
||||
confirmingButton(JGE_BTN_NONE), confirmationString("")
|
||||
{
|
||||
JGE* j = JGE::GetInstance();
|
||||
JGE::keybindings_it start = j->KeyBindings_begin(), end = j->KeyBindings_end();
|
||||
|
||||
Add(NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
for (JGE::keybindings_it it = start; it != end; ++it)
|
||||
Add(NEW OptionKey(parent, it->first, it->second));
|
||||
populateKeyBindingList();
|
||||
}
|
||||
|
||||
void WGuiKeyBinder::Update(float dt)
|
||||
{
|
||||
OptionKey* o = dynamic_cast<OptionKey*> (items[0]);
|
||||
OptionKey* o = dynamic_cast<OptionKey*> (items[1]);
|
||||
if (!o) return;
|
||||
if (LOCAL_KEY_NONE != o->from)
|
||||
{
|
||||
items.insert(items.begin(), NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
if (0 == currentItem) ++currentItem;
|
||||
items.insert(items.begin() + 1, NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
if (1 == currentItem) ++currentItem;
|
||||
}
|
||||
for (vector<WGuiBase*>::iterator it = items.begin(); it != items.end(); ++it)
|
||||
(*it)->Update(dt);
|
||||
@@ -2399,7 +2430,11 @@ WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm()
|
||||
|
||||
void WGuiKeyBinder::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
if (2 == controlId)
|
||||
if (1 == controlId)
|
||||
{
|
||||
confirmed = CONFIRM_CANCEL;
|
||||
}
|
||||
else if (2 == controlId) {
|
||||
switch (controllerId)
|
||||
{
|
||||
case 0:
|
||||
@@ -2409,8 +2444,16 @@ void WGuiKeyBinder::ButtonPressed(int controllerId, int controlId)
|
||||
confirmedButtons.insert(confirmingButton);
|
||||
break;
|
||||
}
|
||||
else
|
||||
confirmed = CONFIRM_CANCEL;
|
||||
}
|
||||
else if (3 == controlId) {
|
||||
switch (controllerId)
|
||||
{
|
||||
case -102:
|
||||
JGE::GetInstance()->ResetBindings();
|
||||
populateKeyBindingList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
SAFE_DELETE(confirmMenu);
|
||||
confirmMenu = NULL;
|
||||
}
|
||||
@@ -2443,3 +2486,15 @@ bool WGuiKeyBinder::yieldFocus()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WGuiKeyBinder::populateKeyBindingList()
|
||||
{
|
||||
items.clear();
|
||||
Add(NEW WGuiButton(NEW WGuiItem("Load Defaults..."), -102, 3, this));
|
||||
Add(NEW OptionKey(parent, LOCAL_KEY_NONE, JGE_BTN_NONE));
|
||||
|
||||
JGE* j = JGE::GetInstance();
|
||||
JGE::keybindings_it start = j->KeyBindings_begin(), end = j->KeyBindings_end();
|
||||
for (JGE::keybindings_it it = start; it != end; ++it)
|
||||
Add(NEW OptionKey(parent, it->first, it->second));
|
||||
}
|
||||
|
||||
@@ -234,10 +234,14 @@ JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submod
|
||||
|
||||
submode = submode | TEXTURE_SUB_CARD;
|
||||
|
||||
static std::ostringstream filename;
|
||||
filename.str("");
|
||||
filename << setlist[card->setId] << "/" << card->getImageName();
|
||||
|
||||
//static std::ostringstream filename;
|
||||
//filename.str("");
|
||||
string filename;
|
||||
filename.reserve(4096);
|
||||
//filename << setlist[card->setId] << "/" << card->getImageName();
|
||||
filename.append(setlist[card->setId]);
|
||||
filename.append("/");
|
||||
filename.append(card->getImageName());
|
||||
int id = card->getMTGId();
|
||||
|
||||
//Aliases.
|
||||
@@ -247,7 +251,47 @@ JQuadPtr ResourceManagerImpl::RetrieveCard(MTGCard * card, int style, int submod
|
||||
style = RETRIEVE_NORMAL;
|
||||
}
|
||||
|
||||
JQuadPtr jq = RetrieveQuad(filename.str(), 0, 0, 0, 0, "", style, submode | TEXTURE_SUB_5551, id);
|
||||
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();
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -842,12 +886,13 @@ void ResourceManagerImpl::InitFonts(const std::string& inLang)
|
||||
LoadWFont("pspsimon", 11, Fonts::MAIN_FONT + idOffset);
|
||||
GetWFont(Fonts::MAIN_FONT)->SetTracking(-1);
|
||||
LoadWFont("pspf3", 16, Fonts::MENU_FONT + idOffset);
|
||||
LoadWFont("pspmagic", 16, Fonts::MAGIC_FONT + idOffset);
|
||||
#else
|
||||
LoadWFont("simon", 11, Fonts::MAIN_FONT + idOffset);
|
||||
GetWFont(Fonts::MAIN_FONT)->SetTracking(-1);
|
||||
LoadWFont("f3", 16, Fonts::MENU_FONT + idOffset);
|
||||
#endif
|
||||
LoadWFont("magic", 16, Fonts::MAGIC_FONT + idOffset);
|
||||
#endif
|
||||
LoadWFont("smallface", 7, Fonts::SMALLFACE_FONT + idOffset);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,9 +185,9 @@ static const int doubleBufferAttributes[] = {
|
||||
GLX_RED_SIZE, 1, /* the maximum number of bits per component */
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
None
|
||||
0L /* None */
|
||||
};
|
||||
static Bool WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
|
||||
static int WaitForNotify(Display *dpy, XEvent *event, XPointer arg)
|
||||
{
|
||||
return (event->type == MapNotify) && (event->xmap.window == (Window) arg);
|
||||
}
|
||||
@@ -387,13 +387,13 @@ int main(int argc, char* argv[])
|
||||
if (XCheckWindowEvent(gXDisplay, gXWindow, KeyPressMask | KeyReleaseMask | StructureNotifyMask, &event))
|
||||
switch (event.type)
|
||||
{
|
||||
case KeyPress:
|
||||
case 2: /* KeyPress */
|
||||
{
|
||||
const KeySym sym = XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1);
|
||||
g_engine->HoldKey_NoRepeat(sym);
|
||||
}
|
||||
break;
|
||||
case KeyRelease:
|
||||
case 3: /* KeyRelease */
|
||||
g_engine->ReleaseKey(XKeycodeToKeysym(gXDisplay, event.xkey.keycode, 1));
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
|
||||
@@ -49,9 +49,9 @@ ostream& RandomGenerator::saveUsedRandValues(ostream& out) const
|
||||
return out;
|
||||
}
|
||||
|
||||
ostream& RandomGenerator::saveLoadedRandValues(ostream& out)
|
||||
ostream& RandomGenerator::saveLoadedRandValues(ostream& out) const
|
||||
{
|
||||
list<int>::iterator ite;
|
||||
list<int>::const_iterator ite;
|
||||
for(ite=loadedRandomValues.begin(); ite != loadedRandomValues.end(); ite++)
|
||||
{
|
||||
out << *ite << ",";
|
||||
|
||||
Reference in New Issue
Block a user