corrected some logic with computenewcost.

there is a bug im working on with newaffinity and cards that contain targetchoosers with CD tcs. 

experimental change also added with lords. im making the abilities grants by lord forcedalive until the lord is removed from game.
some instances of forcedalive in master primitives did not contain abilities which resolved, meaning they would contenue even though the source had left play.
This commit is contained in:
zethfoxster
2016-07-09 00:11:21 -04:00
parent 242c7b623f
commit ee91e0698d
3 changed files with 20 additions and 2 deletions

View File

@@ -3256,6 +3256,7 @@ public:
}
else
{
a->forcedAlive = 1;
a->addToGame();
abilities[d] = a;
}
@@ -3278,6 +3279,7 @@ public:
if (abilities.find(card) != abilities.end()
&& !(forceDestroy == -1 && forcedAlive == 1)) //only embelms have forcedestroy = -1 and forcedalive = 1
{
abilities[card]->forcedAlive = 0;
game->removeObserver(abilities[card]);
abilities.erase(card);
}

View File

@@ -1079,7 +1079,8 @@ void GameObserver::Affinity()
}
}
}
////////////////////////////
///////////////////////
bool NewAffinityFound = false;
for (unsigned int na = 0; na < card->cardsAbilities.size(); na++)
{
@@ -1114,7 +1115,7 @@ void GameObserver::Affinity()
//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();
ManaCost *newCost = NEW ManaCost();
newCost->copy(card->computeNewCost(card, card->getManaCost(), card->model->data->getManaCost()));
card->getManaCost()->copy(newCost);
SAFE_DELETE(newCost);

View File

@@ -970,6 +970,14 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
string type = "";
ManaCost * original = 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())
{//start1
if (card->getIncreasedManaCost()->getConvertedCost())
@@ -1076,6 +1084,13 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
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))
{