move reducedCost and increasedCost out of cardprimitives and into MTGCardInstance
This commit is contained in:
@@ -18,8 +18,6 @@ protected:
|
||||
ManaCost manaCost;
|
||||
|
||||
public:
|
||||
ManaCost reducedCost;
|
||||
ManaCost increasedCost;
|
||||
string text;
|
||||
string name;
|
||||
int init();
|
||||
@@ -74,8 +72,6 @@ public:
|
||||
|
||||
void setManaCost(string value);
|
||||
ManaCost * getManaCost();
|
||||
ManaCost * getReducedManaCost();
|
||||
ManaCost * getIncreasedManaCost();
|
||||
bool isCreature();
|
||||
bool isLand();
|
||||
bool isSpell();
|
||||
|
||||
@@ -94,6 +94,10 @@ class MTGCardInstance: public CardPrimitive, public MTGCard, public Damageable {
|
||||
MTGCardInstance * next;
|
||||
int doDamageTest;
|
||||
int summoningSickness;
|
||||
ManaCost reducedCost;
|
||||
ManaCost increasedCost;
|
||||
ManaCost * getReducedManaCost();
|
||||
ManaCost * getIncreasedManaCost();
|
||||
|
||||
bool matchesCastFilter(int castMethod);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ CardPrimitive::CardPrimitive(CardPrimitive * source)
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; ++i)
|
||||
colors[i] = source->colors[i];
|
||||
manaCost.copy(source->getManaCost());
|
||||
reducedCost.copy(source->getReducedManaCost());
|
||||
increasedCost.copy(source->getIncreasedManaCost());
|
||||
//reducedCost.copy(source->getReducedManaCost());
|
||||
//increasedCost.copy(source->getIncreasedManaCost());
|
||||
if(source->getManaCost()->alternative)
|
||||
manaCost.alternative->alternativeName = source->getManaCost()->alternative->alternativeName;
|
||||
|
||||
@@ -276,15 +276,6 @@ ManaCost* CardPrimitive::getManaCost()
|
||||
return &manaCost;
|
||||
}
|
||||
|
||||
ManaCost* CardPrimitive::getReducedManaCost()
|
||||
{
|
||||
return &reducedCost;
|
||||
}
|
||||
ManaCost* CardPrimitive::getIncreasedManaCost()
|
||||
{
|
||||
return &increasedCost;
|
||||
}
|
||||
|
||||
bool CardPrimitive::hasType(int _type)
|
||||
{
|
||||
for (size_t i = 0; i < types.size(); i++)
|
||||
|
||||
@@ -333,6 +333,15 @@ int MTGCardInstance::has(int basicAbility)
|
||||
return basicAbilities[basicAbility];
|
||||
}
|
||||
|
||||
ManaCost* MTGCardInstance::getReducedManaCost()
|
||||
{
|
||||
return &reducedCost;
|
||||
}
|
||||
ManaCost* MTGCardInstance::getIncreasedManaCost()
|
||||
{
|
||||
return &increasedCost;
|
||||
}
|
||||
|
||||
//sets card as attacked and sends events
|
||||
void MTGCardInstance::eventattacked()
|
||||
{
|
||||
|
||||
@@ -539,7 +539,11 @@ int ManaCost::remove(ManaCost * _cost)
|
||||
return 0;
|
||||
for (unsigned int i = 0; i < Constants::MTG_NB_COLORS; i++)
|
||||
{
|
||||
cost[i] -= _cost->getCost(i);
|
||||
for(int c = 0;c < _cost->getCost(i);c++)
|
||||
{
|
||||
if(cost[i])//remove 1 at a time to avoid dipping into negitive cost.
|
||||
cost[i] -= 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user