Partial fix for Cards with Bestow
missing was to seperate the mode as aura enchantment or enchantment creature when cast and update the cost
This commit is contained in:
@@ -4044,6 +4044,80 @@ AALifer * AALifer::clone() const
|
||||
return NEW AALifer(*this);
|
||||
}
|
||||
|
||||
//Extra for Bestow ... partial fix since there's no update when react to click for bestow cards...
|
||||
//There should be no problem if the bestow cards has chosen mode then update its bestow code on react to click but
|
||||
//I cant find alternate way... This Ability is general for enchantments since aura is an enchantment type however
|
||||
//it can't target card specific attributes... This one adds on the players side...
|
||||
AAuraIncreaseReduce::AAuraIncreaseReduce(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, int amount, int color, int who) :
|
||||
AbilityTP(observer, _id, _source, _target, who), amount(amount), color(color)
|
||||
{
|
||||
manaReducer = source;
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::addToGame()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
Player * p = getPlayerFromDamageable(_target);
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
p->AuraIncreased->add(color,amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->AuraReduced->add(color,abs(amount));
|
||||
}
|
||||
|
||||
return MTGAbility::addToGame();
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::destroy()
|
||||
{
|
||||
Damageable * _target = (Damageable *) getTarget();
|
||||
Player * p = getPlayerFromDamageable(_target);
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
if(!this->manaReducer->isInPlay(game))
|
||||
{
|
||||
if (amount > 0)
|
||||
{
|
||||
p->AuraIncreased->remove(color,amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->AuraReduced->remove(color,abs(amount));
|
||||
}
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AAuraIncreaseReduce::testDestroy()
|
||||
{
|
||||
if(!this->manaReducer->isInPlay(game))
|
||||
{
|
||||
return MTGAbility::testDestroy();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const string AAuraIncreaseReduce::getMenuText()
|
||||
{
|
||||
return "Aura Increaser/Reducer";
|
||||
}
|
||||
|
||||
AAuraIncreaseReduce * AAuraIncreaseReduce::clone() const
|
||||
{
|
||||
return NEW AAuraIncreaseReduce(*this);
|
||||
}
|
||||
|
||||
//players modify hand size
|
||||
AModifyHand::AModifyHand(GameObserver* observer, int _id, MTGCardInstance * _source, Targetable * _target, string hand, int who) :
|
||||
AbilityTP(observer, _id, _source, _target, who), hand(hand)
|
||||
|
||||
@@ -1244,6 +1244,8 @@ void GameObserver::Affinity()
|
||||
card->has(Constants::AFFINITYPLAINS) ||
|
||||
card->has(Constants::AFFINITYSWAMP) ||
|
||||
card->has(Constants::CONDUITED) ||
|
||||
card->controller()->AuraIncreased->getConvertedCost() ||
|
||||
card->controller()->AuraReduced->getConvertedCost() ||
|
||||
card->getIncreasedManaCost()->getConvertedCost() ||
|
||||
card->getReducedManaCost()->getConvertedCost() ||
|
||||
NewAffinityFound)
|
||||
@@ -1272,10 +1274,10 @@ void GameObserver::Affinity()
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
if (card->getManaCost()->getBestow())
|
||||
{
|
||||
{//NOTE: there should be a limitation when the spell is cast with bestow its not both creature and aura...
|
||||
card->getManaCost()->getBestow()->resetCosts();
|
||||
ManaCost * newCost = NEW ManaCost();
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow()));
|
||||
newCost->changeCostTo(card->computeNewCost(card, card->getManaCost()->getBestow(), card->model->data->getManaCost()->getBestow(), false, true));
|
||||
card->getManaCost()->getBestow()->changeCostTo(newCost);
|
||||
SAFE_DELETE(newCost);
|
||||
}
|
||||
|
||||
@@ -3196,6 +3196,26 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
||||
return a;
|
||||
}
|
||||
|
||||
//Extra for Bestow
|
||||
vector<string> splitAuraIncreaseReduce = parseBetween(s, "modbenchant(", ")", true);
|
||||
if(splitAuraIncreaseReduce.size())
|
||||
{
|
||||
if(splitAuraIncreaseReduce[1].size())
|
||||
{
|
||||
Damageable * t = spell ? spell->getNextDamageableTarget() : NULL;
|
||||
vector<string> ccParameters = split( splitAuraIncreaseReduce[1], ':');
|
||||
int amount = atoi(ccParameters[1].c_str());
|
||||
int color = Constants::GetColorStringIndex(ccParameters[0]);
|
||||
if(ccParameters[0] == "colorless")
|
||||
color = 0;
|
||||
if(ccParameters[0].size() && ccParameters[1].size())
|
||||
{
|
||||
MTGAbility * a = NEW AAuraIncreaseReduce(observer, id, card, t, amount, color, who);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set hand size
|
||||
vector<string> splitSetHand = parseBetween(s, "sethand:", " ", false);
|
||||
if (splitSetHand.size())
|
||||
|
||||
@@ -1059,7 +1059,7 @@ JQuadPtr MTGCardInstance::getIcon()
|
||||
return WResourceManager::Instance()->RetrieveCard(this, CACHE_THUMB);
|
||||
}
|
||||
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cost, ManaCost * Data, bool noTrinisphere)
|
||||
ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cost, ManaCost * Data, bool noTrinisphere, bool bestow)
|
||||
{
|
||||
int color = 0;
|
||||
string type = "";
|
||||
@@ -1074,10 +1074,13 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
|
||||
Cost->extraCosts->costs[i]->setSource(card);
|
||||
}
|
||||
}
|
||||
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost())
|
||||
if (card->getIncreasedManaCost()->getConvertedCost() || card->getReducedManaCost()->getConvertedCost()
|
||||
|| card->controller()->AuraReduced->getConvertedCost() || card->controller()->AuraIncreased->getConvertedCost())
|
||||
{//start1
|
||||
if (card->getIncreasedManaCost()->getConvertedCost())
|
||||
original->add(card->getIncreasedManaCost());
|
||||
if(bestow && card->controller()->AuraIncreased->getConvertedCost())
|
||||
original->add(card->controller()->AuraIncreased);
|
||||
//before removing get the diff for excess
|
||||
if(card->getReducedManaCost()->getConvertedCost())
|
||||
{
|
||||
@@ -1093,6 +1096,8 @@ ManaCost * MTGCardInstance::computeNewCost(MTGCardInstance * card,ManaCost * Cos
|
||||
//apply reduced
|
||||
if (card->getReducedManaCost()->getConvertedCost())
|
||||
original->remove(card->getReducedManaCost());
|
||||
if(bestow && card->controller()->AuraReduced->getConvertedCost())
|
||||
original->remove(card->controller()->AuraReduced);
|
||||
//try to reduce hybrid
|
||||
if (excess->getConvertedCost())
|
||||
{
|
||||
|
||||
@@ -939,7 +939,11 @@ int MTGAlternativeCostRule::reactToClick(MTGCardInstance * card, ManaCost *alter
|
||||
copy->alternateCostPaid[alternateCostType] = 1;
|
||||
game->mLayers->stackLayer()->addSpell(copy, game->targetChooser, spellCost, alternateCostType, 0);
|
||||
game->targetChooser = NULL;
|
||||
|
||||
if(alternateCostType == ManaCost::MANA_PAID_WITH_BESTOW)
|
||||
{
|
||||
copy->removeType("creature");
|
||||
copy->addType("aura");
|
||||
}
|
||||
if (card->has(Constants::STORM))
|
||||
{
|
||||
int storm = player->game->stack->seenThisTurn("*", Constants::CAST_ALL) + player->opponent()->game->stack->seenThisTurn("*", Constants::CAST_ALL);
|
||||
|
||||
@@ -49,6 +49,8 @@ Player::Player(GameObserver *observer, string file, string fileSmall, MTGDeck *
|
||||
prowledTypes.clear();
|
||||
doesntEmpty = NEW ManaCost();
|
||||
poolDoesntEmpty = NEW ManaCost();
|
||||
AuraIncreased = NEW ManaCost();
|
||||
AuraReduced = NEW ManaCost();
|
||||
if (deck != NULL)
|
||||
{
|
||||
game = NEW MTGPlayerCards(deck);
|
||||
@@ -82,6 +84,8 @@ Player::~Player()
|
||||
SAFE_DELETE(manaPool);
|
||||
SAFE_DELETE(doesntEmpty);
|
||||
SAFE_DELETE(poolDoesntEmpty);
|
||||
SAFE_DELETE(AuraIncreased);
|
||||
SAFE_DELETE(AuraReduced);
|
||||
SAFE_DELETE(game);
|
||||
if(mAvatarTex && observer->getResourceManager())
|
||||
observer->getResourceManager()->Release(mAvatarTex);
|
||||
|
||||
Reference in New Issue
Block a user