Merge pull request #936 from kevlahnota/master

update some cards
This commit is contained in:
Anthony Calosa
2017-02-19 23:23:06 +08:00
committed by GitHub
19 changed files with 408 additions and 243 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because it is too large Load Diff
+27
View File
@@ -1332,6 +1332,28 @@ public:
} }
}; };
class TrCardPhasesOut: public Trigger
{
public:
TrCardPhasesOut(GameObserver* observer, int id, MTGCardInstance * source, TargetChooser * tc, bool once = false) :
Trigger(observer, id, source, once, tc)
{
}
int triggerOnEventImpl(WEvent * event)
{
WEventCardPhasesOut * e = dynamic_cast<WEventCardPhasesOut *> (event);
if (!e) return 0;
if (!tc->canTarget(e->card)) return 0;
return 1;
}
TrCardPhasesOut * clone() const
{
return NEW TrCardPhasesOut(*this);
}
};
class TrCardPhasesIn: public Trigger class TrCardPhasesIn: public Trigger
{ {
public: public:
@@ -2867,6 +2889,11 @@ public:
{ {
if(!nonstatic) if(!nonstatic)
return; return;
if(game)
{//bypass
if(game->OpenedDisplay && (game->players[0]->game->reveal->cards.size()||game->players[1]->game->reveal->cards.size()))
return;
}
if(source->isToken && !source->isInPlay(game) && cda) if(source->isToken && !source->isInPlay(game) && cda)
{ {
this->forceDestroy = 1; this->forceDestroy = 1;
+3 -3
View File
@@ -33,7 +33,7 @@ protected:
/* /*
** Tries to render the Big version of a card picture, backups to text version in case of failure ** Tries to render the Big version of a card picture, backups to text version in case of failure
*/ */
static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false); static void RenderBig(MTGCard * card, const Pos& pos, bool thumb = false, bool noborder = false, bool gdv = false);
static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal); static void RenderCountersBig(MTGCard * card, const Pos& pos, int drawMode = DrawMode::kNormal);
static void AlternateRender(MTGCard * card, const Pos& pos); static void AlternateRender(MTGCard * card, const Pos& pos);
@@ -55,8 +55,8 @@ public:
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false); void DrawCard(const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool gdv = false);
static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false); static void DrawCard(MTGCard* inCard, const Pos& inPosition, int inMode = DrawMode::kNormal, bool thumb = false, bool noborder = false, bool gdv = false);
static JQuadPtr AlternateThumbQuad(MTGCard * card); static JQuadPtr AlternateThumbQuad(MTGCard * card);
virtual ostream& toString(ostream&) const; virtual ostream& toString(ostream&) const;
+1 -1
View File
@@ -207,7 +207,7 @@ protected:
* *
* \see mCards * \see mCards
*/ */
void renderCard(int index, int alpha, bool asThumbnail = false); void renderCard(int index, int alpha, bool asThumbnail = false, bool griddeckview = false);
/*! \brief Returns the index in mCards of the card that is nearest to the given point /*! \brief Returns the index in mCards of the card that is nearest to the given point
* *
+9
View File
@@ -183,6 +183,15 @@ public:
virtual int doPay(); virtual int doPay();
}; };
//Sacrifice all Lands cost
class SacLandsCost : public ExtraCost
{
public:
SacLandsCost(TargetChooser *_tc = NULL);
virtual int doPay();
virtual SacLandsCost * clone() const;
};
//unattach cost //unattach cost
class UnattachCost : public ExtraCost class UnattachCost : public ExtraCost
{ {
+1
View File
@@ -538,6 +538,7 @@ protected:
Player * controller; Player * controller;
public: public:
MTGAbility * andAbility;
string menutext; string menutext;
ManaCost * output; ManaCost * output;
int tap; int tap;
+7 -1
View File
@@ -305,7 +305,13 @@ struct WEventCardControllerChange : public WEventCardUpdate {
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
}; };
//event when card with phases in //event when card phases out
struct WEventCardPhasesOut : public WEventCardUpdate {
WEventCardPhasesOut(MTGCardInstance * card);
virtual Targetable * getTarget(int target);
};
//event when card phases in
struct WEventCardPhasesIn : public WEventCardUpdate { struct WEventCardPhasesIn : public WEventCardUpdate {
WEventCardPhasesIn(MTGCardInstance * card); WEventCardPhasesIn(MTGCardInstance * card);
virtual Targetable * getTarget(int target); virtual Targetable * getTarget(int target);
+3
View File
@@ -1708,6 +1708,9 @@ int AAPhaseOut::resolve()
if(_target->view) if(_target->view)
_target->view->alpha = 50; _target->view->alpha = 50;
_target->initAttackersDefensers(); _target->initAttackersDefensers();
//add event phases out here
WEvent * e = NEW WEventCardPhasesOut(_target);
game->receiveEvent(e);
return 1; return 1;
} }
return 0; return 0;
+25 -12
View File
@@ -111,17 +111,17 @@ void CardGui::Update(float dt)
PlayGuiObject::Update(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);
} }
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) switch (inMode)
{ {
case DrawMode::kNormal: case DrawMode::kNormal:
RenderBig(inCard, inPosition, thumb, noborder); RenderBig(inCard, inPosition, thumb, noborder, gdv);
break; break;
case DrawMode::kText: case DrawMode::kText:
AlternateRender(inCard, inPosition); AlternateRender(inCard, inPosition);
@@ -596,19 +596,19 @@ void CardGui::AlternateRender(MTGCard * card, const Pos& pos)
items.clear(); items.clear();
if (q.get() && q->mTex) if (q.get() && q->mTex)
{ {
//test
//draw black border ingame only
if(thiscard && thiscard->getObserver()) if(thiscard && thiscard->getObserver())
{ {
zpos = thiscard->zpos; zpos = thiscard->zpos;
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));
} }
q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2)); q->SetHotSpot(static_cast<float> (q->mTex->mWidth / 2), static_cast<float> (q->mTex->mHeight / 2));
float scale = pos.actZ * 250 / q->mHeight; float scale = pos.actZ * 250 / q->mHeight;
q->SetColor(ARGB((int)pos.actA,255,255,255)); 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); renderer->RenderQuad(q.get(), x, pos.actY, pos.actT, scale, scale);
} }
@@ -1170,7 +1170,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 //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(); JRenderer * renderer = JRenderer::GetInstance();
//GameObserver * game = GameObserver::GetInstance(); //GameObserver * game = GameObserver::GetInstance();
@@ -1217,7 +1217,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
float scale = pos.actZ * 250.f / quad->mHeight; float scale = pos.actZ * 250.f / quad->mHeight;
//init setname //init setname
string cardsetname = setlist[card->setId].c_str(); 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"||cardsetname == "DM") if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
{//Draw white border {//Draw white border
@@ -1238,7 +1238,19 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
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)); 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));
} }
} }
}*///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")
{//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
{//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 //draw inner border
if(cardsetname == "LEA"||cardsetname == "LEB") if(cardsetname == "LEA"||cardsetname == "LEB")
{ {
@@ -1250,9 +1262,10 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos, bool thumb, bool noborder
renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale); renderer->RenderQuad(alphabeta.get(), x, pos.actY+0.2f, pos.actT, myscale, myscale);
} }
} }
float modxscale = (cardsetname =="UNH")?0.02f:0.0f; float modxscale = (cardsetname =="UNH")?0.015f:0.0f;
float modyscale = (cardsetname =="UNH")?0.015f:0.0f; float modyscale = (cardsetname =="UNH")?0.010f:0.0f;
renderer->RenderQuad(quad.get(), x, pos.actY, pos.actT, scale+modxscale, scale+modyscale); 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); RenderCountersBig(card, pos);
return; return;
+4 -4
View File
@@ -93,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); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
@@ -146,7 +146,7 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
else else
{//NORMAL VIEW WITH IMAGES {//NORMAL VIEW WITH IMAGES
int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText; int mode = !options[Options::DISABLECARDS].number ? DrawMode::kNormal : DrawMode::kText;
//border for editor && others??? /*//border for editor && others???
string cardsetname = setlist[cardPosition.card->setId].c_str(); string cardsetname = setlist[cardPosition.card->setId].c_str();
if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM") if(cardsetname == "2ED"||cardsetname == "RV"||cardsetname == "4ED"||cardsetname == "5ED"||cardsetname == "6ED"||cardsetname == "7ED"||cardsetname == "8ED"||cardsetname == "9ED"||cardsetname == "CHR"||cardsetname == "DM")
{ {
@@ -157,9 +157,9 @@ void DeckView::renderCard(int index, int alpha, bool asThumbnail)
{ {
JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,10,10,10)); JRenderer::GetInstance()->FillRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(255,10,10,10));
JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(50,240,240,240)); JRenderer::GetInstance()->DrawRoundRect((cardPosition.x - cardPosition.scale * 100.0f)-5.f,(cardPosition.y - cardPosition.scale * 142.5f)-5.f,cardPosition.scale * 200.0f,cardPosition.scale * 285.0f,5.f,ARGB(50,240,240,240));
} }*///disabled this for universal border
Pos pos = Pos(cardPosition.x, cardPosition.y, cardPosition.scale * 285 / 250, 0.0, 255); 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);
} }
int quadAlpha = alpha; int quadAlpha = alpha;
if (!deck()->count(cardPosition.card)) quadAlpha /= 2; if (!deck()->count(cardPosition.card)) quadAlpha /= 2;
+50 -13
View File
@@ -62,7 +62,7 @@ void ExtraCost::Render()
WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT); WFont * mFont = WResourceManager::Instance()->GetWFont(Fonts::MAIN_FONT);
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE); mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
mFont->SetColor(ARGB(255,255,255,255)); mFont->SetColor(ARGB(255,255,255,255));
mFont->DrawString(mCostRenderString, 20, 20, JGETEXT_LEFT); mFont->DrawString(mCostRenderString, 40, 20, JGETEXT_LEFT);
} }
} }
@@ -95,7 +95,7 @@ ExtraManaCost * ExtraManaCost::clone() const
} }
ExtraManaCost::ExtraManaCost(ManaCost * costToPay) ExtraManaCost::ExtraManaCost(ManaCost * costToPay)
: ExtraCost("",NULL, costToPay) : ExtraCost("\nCost:",NULL, costToPay)
{ {
} }
@@ -240,7 +240,7 @@ EnergyCost * EnergyCost::clone() const
} }
EnergyCost::EnergyCost(int enc) : EnergyCost::EnergyCost(int enc) :
ExtraCost("Energy Cost"),enc(enc) ExtraCost("Energy"),enc(enc)
{ {
} }
@@ -465,7 +465,7 @@ DiscardCost * DiscardCost::clone() const
} }
DiscardCost::DiscardCost(TargetChooser *_tc) : DiscardCost::DiscardCost(TargetChooser *_tc) :
ExtraCost("Choose card to Discard", _tc) ExtraCost("Discard", _tc)
{ {
} }
@@ -529,7 +529,7 @@ ToLibraryCost * ToLibraryCost::clone() const
} }
ToLibraryCost::ToLibraryCost(TargetChooser *_tc) ToLibraryCost::ToLibraryCost(TargetChooser *_tc)
: ExtraCost("Put a card on top of Library", _tc) : ExtraCost("Move to Library", _tc)
{ {
} }
@@ -558,7 +558,7 @@ ToGraveCost * ToGraveCost::clone() const
} }
ToGraveCost::ToGraveCost(TargetChooser *_tc) ToGraveCost::ToGraveCost(TargetChooser *_tc)
: ExtraCost("Move a card to Graveyard", _tc) : ExtraCost("Move to Graveyard", _tc)
{ {
} }
@@ -641,6 +641,43 @@ int MillExileCost::doPay()
} }
return 0; 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 //unattach cost
UnattachCost * UnattachCost::clone() const UnattachCost * UnattachCost::clone() const
@@ -734,7 +771,7 @@ UnTapCost * UnTapCost::clone() const
} }
UnTapCost::UnTapCost() : UnTapCost::UnTapCost() :
ExtraCost("UnTap") ExtraCost("Untap")
{ {
} }
@@ -919,7 +956,7 @@ BounceTargetCost * BounceTargetCost::clone() const
} }
BounceTargetCost::BounceTargetCost(TargetChooser *_tc) BounceTargetCost::BounceTargetCost(TargetChooser *_tc)
: ExtraCost("Return Target to Hand", _tc) : ExtraCost("Move to Hand", _tc)
{ {
} }
@@ -948,7 +985,7 @@ Ninja * Ninja::clone() const
} }
Ninja::Ninja(TargetChooser *_tc) : Ninja::Ninja(TargetChooser *_tc) :
ExtraCost("Select unblocked attacker", _tc) ExtraCost("Choose Unblocked Card", _tc)
{ {
} }
@@ -999,7 +1036,7 @@ Convoke * Convoke::clone() const
} }
Convoke::Convoke(TargetChooser *_tc) : Convoke::Convoke(TargetChooser *_tc) :
ExtraCost("Select Cards To Tap", _tc) ExtraCost("Choose Cards To Tap", _tc)
{ {
} }
@@ -1121,7 +1158,7 @@ Delve * Delve::clone() const
} }
Delve::Delve(TargetChooser *_tc) : Delve::Delve(TargetChooser *_tc) :
ExtraCost("Select Cards To Exile", _tc) ExtraCost("Choose Cards To Exile", _tc)
{ {
} }
@@ -1189,7 +1226,7 @@ Improvise * Improvise::clone() const
} }
Improvise::Improvise(TargetChooser *_tc) : Improvise::Improvise(TargetChooser *_tc) :
ExtraCost("Select Artifacts To Tap", _tc) ExtraCost("Choose Artifacts to Tap", _tc)
{ {
} }
@@ -1258,7 +1295,7 @@ Offering * Offering::clone() const
} }
Offering::Offering(TargetChooser *_tc,bool emerge) : Offering::Offering(TargetChooser *_tc,bool emerge) :
ExtraCost("Select creature to offer", _tc), emerge(emerge) ExtraCost("Choose Creature to Offer", _tc), emerge(emerge)
{ {
} }
+10 -4
View File
@@ -691,7 +691,10 @@ void GameObserver::gameStateBasedEffects()
players[d]->DeadLifeState(); 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) if (mLayers->stackLayer()->count(0, NOT_RESOLVED) != 0)
return; return;
if (mLayers->actionLayer()->menuObject) if (mLayers->actionLayer()->menuObject)
@@ -852,6 +855,9 @@ void GameObserver::gameStateBasedEffects()
if(card->view) if(card->view)
card->view->alpha = 50; card->view->alpha = 50;
card->initAttackersDefensers(); card->initAttackersDefensers();
//add event phases out here
WEvent * evphaseout = NEW WEventCardPhasesOut(card);
receiveEvent(evphaseout);
} }
else if((card->has(Constants::PHASING) || card->isPhased)&& mCurrentGamePhase == MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn) else if((card->has(Constants::PHASING) || card->isPhased)&& mCurrentGamePhase == MTG_PHASE_UNTAP && currentPlayer == card->controller() && card->phasedTurn != turn)
{ {
@@ -1040,13 +1046,13 @@ void GameObserver::gameStateBasedEffects()
//Auto skip Phases //Auto skip Phases
int skipLevel = (currentPlayer->playMode == Player::MODE_TEST_SUITE || mLoading) ? Constants::ASKIP_NONE int skipLevel = (currentPlayer->playMode == Player::MODE_TEST_SUITE || mLoading) ? Constants::ASKIP_NONE
: options[Options::ASPHASES].number; : options[Options::ASPHASES].number;
bool noattackers = currentPlayer->noPossibleAttackers();
if (skipLevel == Constants::ASKIP_SAFE || skipLevel == Constants::ASKIP_FULL) if (skipLevel == Constants::ASKIP_SAFE || skipLevel == Constants::ASKIP_FULL)
{ {
if ((opponent()->isAI() && !(isInterrupting)) && ((mCurrentGamePhase == MTG_PHASE_UNTAP) if ((opponent()->isAI() && !(isInterrupting)) && ((mCurrentGamePhase == MTG_PHASE_UNTAP)
|| (mCurrentGamePhase == MTG_PHASE_DRAW) || (mCurrentGamePhase == MTG_PHASE_COMBATBEGIN) || (mCurrentGamePhase == MTG_PHASE_DRAW) || (mCurrentGamePhase == MTG_PHASE_COMBATBEGIN)
|| ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (currentPlayer->noPossibleAttackers())) || ((mCurrentGamePhase == MTG_PHASE_COMBATATTACKERS) && (noattackers))
|| mCurrentGamePhase == MTG_PHASE_COMBATEND || mCurrentGamePhase == MTG_PHASE_ENDOFTURN || (mCurrentGamePhase == MTG_PHASE_COMBATEND) || (mCurrentGamePhase == MTG_PHASE_ENDOFTURN)
|| ((mCurrentGamePhase == MTG_PHASE_CLEANUP) && (currentPlayer->game->hand->nb_cards < 8)))) || ((mCurrentGamePhase == MTG_PHASE_CLEANUP) && (currentPlayer->game->hand->nb_cards < 8))))
userRequestNextGamePhase(); userRequestNextGamePhase();
} }
+2 -2
View File
@@ -132,9 +132,9 @@ void GridDeckView::Render()
#endif #endif
} }
#if !defined (PSP) #if !defined (PSP)
renderCard(i, 255, false);//for psp, use lowres images if you can. renderCard(i, 255, false, true);//for psp, use lowres images if you can.
#else #else
renderCard(i, 255, true); renderCard(i, 255, true, true);
#endif #endif
} }
else else
+2 -1
View File
@@ -146,7 +146,8 @@ void GuiPhaseBar::Render()
//running this string through translate returns gibberish even though we defined the variables in the lang.txt //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 //the conversion from phase bar phases to mtg phases is x%kPhases + 1
//todo: just to this when the displayedPhaseId updates //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); phaseNameToTranslate = _(phaseNameToTranslate);
sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str()); sprintf(buf, _("(%s%s) %s").c_str(), currentP.c_str(), interrupt.c_str(),phaseNameToTranslate.c_str());
#if !defined (PSP) #if !defined (PSP)
+25
View File
@@ -1044,6 +1044,10 @@ TriggeredAbility * AbilityFactory::parseTrigger(string s, string, int id, Spell
if (TargetChooser *tc = parseSimpleTC(s,"phasedin", card)) if (TargetChooser *tc = parseSimpleTC(s,"phasedin", card))
return NEW TrCardPhasesIn(observer, id, card, tc,once); return NEW TrCardPhasesIn(observer, id, card, tc,once);
//Card Phases Out
if (TargetChooser *tc = parseSimpleTC(s,"phasedout", card))
return NEW TrCardPhasesOut(observer, id, card, tc,once);
//CombatTrigger //CombatTrigger
//Card card attacked and is blocked //Card card attacked and is blocked
found = s.find("combat("); found = s.find("combat(");
@@ -3828,6 +3832,12 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = 1; a->oneShot = 1;
if(newName.size()) if(newName.size())
((AManaProducer*)a)->menutext = newName; ((AManaProducer*)a)->menutext = newName;
if(storedAndAbility.size())
{
string stored = storedAndAbility;
storedAndAbility.clear();
((AManaProducer*)a)->andAbility = parseMagicLine(stored, id, spell, card);
}
return a; return a;
} }
@@ -6469,6 +6479,7 @@ AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * c
Producing = producing; Producing = producing;
menutext = ""; menutext = "";
DoesntEmpty = doesntEmpty; DoesntEmpty = doesntEmpty;
andAbility = NULL;
} }
int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana) int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana)
@@ -6508,6 +6519,20 @@ int AManaProducer::resolve()
player->getManaPool()->add(output, source); player->getManaPool()->add(output, source);
if(DoesntEmpty) if(DoesntEmpty)
player->doesntEmpty->add(output); player->doesntEmpty->add(output);
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1; return 1;
} }
+3 -12
View File
@@ -875,22 +875,13 @@ int MTGCardInstance::canproduceMana(int color)
{ {
int count = 0; int count = 0;
//start
if(hasSubtype("forest") && color == 1)
count++;
if(hasSubtype("island") && color == 2)
count++;
if(hasSubtype("mountain") && color == 3)
count++;
if(hasSubtype("swamp") && color == 4)
count++;
if(hasSubtype("plains") && color == 5)
count++;
if(cardsAbilities.size()) if(cardsAbilities.size())
{ {
for(unsigned int j = 0; j < cardsAbilities.size(); j++) for(unsigned int j = 0; j < cardsAbilities.size(); j++)
{ {
if(dynamic_cast<AManaProducer*> (cardsAbilities[j]) && dynamic_cast<AManaProducer*> (cardsAbilities[j])->output->hasColor(color)) AbilityFactory af(observer);
MTGAbility * toCheck = af.getCoreAbility(cardsAbilities[j]);
if(dynamic_cast<AManaProducer*> (toCheck) && dynamic_cast<AManaProducer*> (toCheck)->output->hasColor(color))
count++; count++;
} }
} }
+4
View File
@@ -147,6 +147,10 @@ ManaCost * ManaCost::parseManaCost(string s, ManaCost * _manaCost, MTGCardInstan
{ //Send to Graveyard Cost (move from anywhere to Graveyard) { //Send to Graveyard Cost (move from anywhere to Graveyard)
manaCost->addExtraCost(NEW ToGraveCost(tc)); manaCost->addExtraCost(NEW ToGraveCost(tc));
} }
else if (value.find("saclands") != string::npos)
{ //Sac all lands
manaCost->addExtraCost(NEW SacLandsCost(tc));
}
else else
{ //Sacrifice { //Sacrifice
manaCost->addExtraCost(NEW SacrificeCost(tc)); manaCost->addExtraCost(NEW SacrificeCost(tc));
+11
View File
@@ -236,6 +236,11 @@ WEventCardControllerChange::WEventCardControllerChange(MTGCardInstance * card) :
{ {
} }
WEventCardPhasesOut::WEventCardPhasesOut(MTGCardInstance * card) :
WEventCardUpdate(card)
{
}
WEventCardPhasesIn::WEventCardPhasesIn(MTGCardInstance * card) : WEventCardPhasesIn::WEventCardPhasesIn(MTGCardInstance * card) :
WEventCardUpdate(card) WEventCardUpdate(card)
{ {
@@ -427,6 +432,12 @@ Targetable * WEventCardControllerChange::getTarget(int target)
return NULL; return NULL;
} }
Targetable * WEventCardPhasesOut::getTarget(int target)
{
if (target) return card;
return NULL;
}
Targetable * WEventCardPhasesIn::getTarget(int target) Targetable * WEventCardPhasesIn::getTarget(int target)
{ {
if (target) return card; if (target) return card;