fix for cumulative upcost, extra cost were not being multiplied

[card]
name=Phyrexian Soulgorger
auto=cumulativeupcost[{S(creature|myBattlefield)}] sacrifice
text=Cumulative upkeep - Sacrifice a creature. (At the beginning of your upkeep, put an age counter on this permanent, then sacrifice it unless you pay its upkeep cost for each age counter on it.)
mana={3}
type=Snow Artifact Creature
subtype=Construct
power=8
toughness=8
[/card]
was only charging you 1 sacrifice per upkeep.

added thisTargetComparison, this(cantargetcard(targetchooser))...its a thisdescriptor that compares if the card can be targeted by a target chooser...
This commit is contained in:
omegablast2002@yahoo.com
2011-12-29 19:55:45 +00:00
parent 311c280427
commit be33659081
6 changed files with 58 additions and 1 deletions

View File

@@ -77,6 +77,7 @@ public:
// Extra Costs (sacrifice,counters...)
//
int addExtraCost(ExtraCost * _cost);
int addExtraCosts(ExtraCosts *_cost);
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
int isExtraPaymentSet();
int canPayExtra();

View File

@@ -25,6 +25,15 @@ public:
ThisDescriptor * createThisDescriptor(GameObserver* observer, string s);
};
class ThisTargetCompare:public ThisDescriptor{
public:
TargetChooser * targetComp;
virtual int match(MTGCardInstance * card);
ThisTargetCompare(TargetChooser * tcc = NULL);
~ThisTargetCompare();
ThisTargetCompare * clone() const;
};
class ThisCounter:public ThisDescriptor{
public:
Counter * counter;

View File

@@ -1019,6 +1019,7 @@ InstantAbility(observer, id, card, _target),flipStats(flipStats)
int AAFlip::resolve()
{
MTGCardInstance * Flipper = (MTGCardInstance*)source;
this->oneShot = true;
if(Flipper->isFlipped)
{
game->removeObserver(this);
@@ -3569,6 +3570,7 @@ void AUpkeep::Update(float dt)
for(int age = 0;age < currentage;age++)
{
this->getCost()->add(backupMana);
this->getCost()->addExtraCosts(backupMana->extraCosts);
}
}
}

View File

@@ -2220,7 +2220,6 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
flipStats = splitFlipStat[1];
}
MTGAbility * a = NEW AAFlip(observer, id, card, target,flipStats);
a->oneShot = 1;
return a;
}

View File

@@ -600,6 +600,15 @@ int ManaCost::addExtraCost(ExtraCost * _cost)
return 1;
}
int ManaCost::addExtraCosts(ExtraCosts *_ecost)
{
if (!extraCosts)
extraCosts = NEW ExtraCosts();
for(size_t i = 0; i < _ecost->costs.size(); i++)
extraCosts->costs.push_back(_ecost->costs[i]->clone());
return 1;
}
int ManaCost::isExtraPaymentSet()
{
if (!extraCosts)

View File

@@ -4,6 +4,7 @@
#include "Counters.h"
#include "MTGCardInstance.h"
#include "CardDescriptor.h"
#include "AllAbilities.h"
ThisDescriptor::~ThisDescriptor()
{
@@ -330,10 +331,46 @@ ThisDescriptor * ThisDescriptorFactory::createThisDescriptor(GameObserver* obser
}
return NULL;
}
vector<string>splitTargetComparison = parseBetween(s,"cantargetcard(",")",false);
if (splitTargetComparison.size())
{
TargetChooserFactory tf(observer);
TargetChooser * tcc = tf.createTargetChooser(splitTargetComparison[1],NULL);
ThisTargetCompare * td = NEW ThisTargetCompare(tcc);
if (td)
{
return td;
}
return NULL;
}
return NULL;
}
ThisTargetCompare::ThisTargetCompare(TargetChooser * _tcc)
{
targetComp = _tcc;
}
int ThisTargetCompare::match(MTGCardInstance * card)
{
if(targetComp->canTarget(card))
return 1;
return 0;
}
ThisTargetCompare::~ThisTargetCompare()
{
SAFE_DELETE(targetComp);
}
ThisTargetCompare* ThisTargetCompare::clone() const
{
ThisTargetCompare * a = NEW ThisTargetCompare(*this);
return a;
}
ThisCounter::ThisCounter(Counter * _counter)
{
counter = _counter;