cleaned up resetting cost for altercost code, its *almost* where i want it to be, removed the need to have "resetcost" coding on card code. removed "resetcost" keyword.
i was not 100% successful in getting the correct cost on altercost which reduced the amounts. however altercost which increased the amounts are now clean code. so the reducers are still using a dirty method of putting the card from the hand back into the hand to get the correct amounts.
the issue i ran into is how to get the correct amount in this situation.
target cost {5}
have 3 reducers that - {2}
thats {1} of overkill reduce...
heres the issue. now remove all the reducers from play. the cost returns to {6} instead of 5.
you would think, will have it track the over kill. which leads to another. have the 3rd card which would contain the overkill removed first, i factor the overkill and increase the amount by what was reduced, but that would not be correct. since the reduce was {2} the increase of removing the overkill card should increase the targets cost by {2} not the amount it actually reduced. as you can see, it is extremely complex. so for now im leaving it dirty, but removing the resetcost code.
This commit is contained in:
@@ -2131,6 +2131,7 @@ GenericTargetAbility::~GenericTargetAbility()
|
||||
AAlterCost::AAlterCost(int id, MTGCardInstance * source, MTGCardInstance * target, int amount, int type) :
|
||||
MTGAbility(id, source, target), amount(amount), type(type)
|
||||
{
|
||||
manaReducer = source;
|
||||
}
|
||||
|
||||
int AAlterCost::addToGame()
|
||||
@@ -2138,19 +2139,19 @@ int AAlterCost::addToGame()
|
||||
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||
if (amount < 0)
|
||||
{
|
||||
amount = abs(amount);
|
||||
tempAmount = abs(amount);
|
||||
if (_target->getManaCost()->hasColor(type))
|
||||
{
|
||||
if (_target->getManaCost()->getConvertedCost() >= 1)
|
||||
{
|
||||
_target->getManaCost()->remove(type, amount);
|
||||
_target->getManaCost()->remove(type, tempAmount);
|
||||
if (_target->getManaCost()->alternative > 0)
|
||||
{
|
||||
_target->getManaCost()->alternative->remove(type, amount);
|
||||
_target->getManaCost()->alternative->remove(type, tempAmount);
|
||||
}
|
||||
if (_target->getManaCost()->BuyBack > 0)
|
||||
{
|
||||
_target->getManaCost()->BuyBack->remove(type, amount);
|
||||
_target->getManaCost()->BuyBack->remove(type, tempAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2170,6 +2171,32 @@ int AAlterCost::addToGame()
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
|
||||
int AAlterCost::testDestroy()
|
||||
{
|
||||
MTGCardInstance * _target = (MTGCardInstance *)target;
|
||||
if(!this->manaReducer->isInPlay())
|
||||
{
|
||||
if (amount > 0)
|
||||
{
|
||||
_target->getManaCost()->remove(type, amount);
|
||||
if (_target->getManaCost()->alternative)
|
||||
{
|
||||
_target->getManaCost()->alternative->remove(type, amount);
|
||||
}
|
||||
if (_target->getManaCost()->BuyBack)
|
||||
{
|
||||
_target->getManaCost()->BuyBack->remove(type, amount);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_target->controller()->game->putInHand(_target);
|
||||
}
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
AAlterCost * AAlterCost::clone() const
|
||||
{
|
||||
AAlterCost * a = NEW AAlterCost(*this);
|
||||
|
||||
Reference in New Issue
Block a user