diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 1262e0a36..005b028c6 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -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; } } } diff --git a/projects/mtg/src/MTGCardInstance.cpp b/projects/mtg/src/MTGCardInstance.cpp index 67783aa97..3daf1646d 100644 --- a/projects/mtg/src/MTGCardInstance.cpp +++ b/projects/mtg/src/MTGCardInstance.cpp @@ -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; } diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 5e664c3f8..6ea83a866 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -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...