Merge pull request #942 from kevlahnota/master

Crash fix and some card update
This commit is contained in:
Anthony Calosa
2017-02-27 00:34:16 +08:00
committed by GitHub
7 changed files with 308 additions and 170 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -235,6 +235,7 @@ void GameStateDeckViewer::End()
void GameStateDeckViewer::addRemove(MTGCard * card)
{
if (!card) return;
if ((card->getRarity() == Constants::RARITY_T) || (card->getId() < 1)) return;
if (mView->deck()->Remove(card, 1, (mView->deck() == myDeck)))
{
if (mView->deck() == myCollection)

View File

@@ -271,7 +271,7 @@ 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];
@@ -487,7 +487,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());
}
@@ -860,7 +860,7 @@ void GameStateShop::ButtonPressed(int controllerId, int controlId)
beginFilters();
break;
case -2:
playerdata->credits += 1000;
playerdata->credits += 2000;
default:
mStage = STAGE_SHOP_SHOP;
}

View File

@@ -5931,6 +5931,19 @@ int TriggeredAbility::receiveEvent(WEvent * e)
resolve();
return 1;
}
WEventCardCycle * cycleCheck = dynamic_cast<WEventCardCycle*>(e);
if(cycleCheck && cycleCheck->card == source)
{
resolve();
return 1;
//When you cycle this card, first the cycling ability goes on the stack,
//then the triggered ability goes on the stack on top of it.
//The triggered ability will resolve before you draw a card from the cycling ability.
//
//The cycling ability and the triggered ability are separate.
//If the triggered ability is countered (with Stifle, for example, or if all its targets have become illegal),
//the cycling ability will still resolve and you'll draw a card.
}
WEventZoneChange * stackCheck = dynamic_cast<WEventZoneChange*>(e);
if(stackCheck && (stackCheck->to == game->currentPlayer->game->stack||stackCheck->to == game->currentPlayer->opponent()->game->stack))
{

View File

@@ -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)
{

View File

@@ -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);

View File

@@ -1770,12 +1770,14 @@ 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("Search"), -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);
//WGuiSplit * sub = NEW WGuiSplit(mid, r);
//WGuiSplit * wgs = NEW WGuiSplit(l, sub);
WGuiSplit * wgs = NEW WGuiSplit(mid, r);
subMenu = NULL;
list->Add(NEW WGuiHeader(displayValue));
list->Add(l);
list->Add(wgs);
list->Entering(JGE_BTN_NONE);
}