Merge pull request #757 from zethfoxster/master

more fixes
This commit is contained in:
zethfoxster
2016-07-16 14:47:12 -04:00
committed by GitHub
3 changed files with 24 additions and 15 deletions

View File

@@ -5941,19 +5941,16 @@ int AManaProducer::isReactingToClick(MTGCardInstance * _card, ManaCost * mana)
//and far to prone to bugs.
if (_card == source)
{
if (!tap || (tap && !source->isTapped()))
if (!tap || (tap && (!source->isTapped() && !source->hasSummoningSickness())))
{
if (!source->hasSummoningSickness())
if (game->currentlyActing()->game->inPlay->hasCard(source) && (source->hasType(Subtypes::TYPE_LAND) || !tap || !source->hasSummoningSickness()))
{
if (game->currentlyActing()->game->inPlay->hasCard(source) && (source->hasType(Subtypes::TYPE_LAND) || !tap || !source->hasSummoningSickness()))
{
if (!source->isPhased)
if (!source->isPhased)
{
ManaCost * cost = getCost();
if (!cost || (mana->canAfford(cost) && (!cost->extraCosts || cost->extraCosts->canPay())))/*counter cost bypass react to click*/
{
ManaCost * cost = getCost();
if (!cost || (mana->canAfford(cost) && (!cost->extraCosts || cost->extraCosts->canPay())))/*counter cost bypass react to click*/
{
result = 1;
}
result = 1;
}
}
}

View File

@@ -76,10 +76,22 @@ MTGCardInstance::MTGCardInstance(MTGCard * card, MTGPlayerCards * arg_belongs_to
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;
}

View File

@@ -577,7 +577,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->storedSourceCard = card->storedSourceCard;
copy->lastController = card->controller();
copy->previousController = card->controller();
for (int i = 0; i < ManaCost::MANA_PAID_WITH_OVERLOAD +1; i++)
for (int i = 0; i < ManaCost::MANA_PAID_WITH_BESTOW +1; i++)
copy->alternateCostPaid[i] = card->alternateCostPaid[i];
//stupid bug with tokens...