passing the storedcard for use by instants and sorceries with extracost in thier manacost, also fixed a parsing oversight with stored values parsing, "-" would throw off the value of s string parsed for stored by 1, returning 0 for these....this is corrected now.

This commit is contained in:
omegablast2002@yahoo.com
2012-04-05 11:24:57 +00:00
parent 5c67985c45
commit eabbbe3f77
4 changed files with 15 additions and 5 deletions
+10 -4
View File
@@ -58,10 +58,6 @@ private:
return; return;
MTGCardInstance * target = card->target; MTGCardInstance * target = card->target;
intValue = 0; intValue = 0;
if(s.find("stored") != string::npos)
{
return init(s.substr(+6),spell,card->storedCard);
}
bool halfup = false; bool halfup = false;
bool halfdown = false; bool halfdown = false;
if (!target) target = card; if (!target) target = card;
@@ -70,12 +66,22 @@ private:
{ {
s = s.substr(1); s = s.substr(1);
multiplier = -1; multiplier = -1;
if(s.find("stored") != string::npos)
{
string altered ="-";
altered.append(s.substr(+6));
return init(altered,spell,card->storedCard);
}
} }
if(s[0] == '+') if(s[0] == '+')
{ {
//ignore "+" signs.... //ignore "+" signs....
s = s.substr(1); s = s.substr(1);
} }
if(s.find("stored") != string::npos)
{
return init(s.substr(+6),spell,card->storedCard);
}
//rounding values, the words can be written anywhere in the line, //rounding values, the words can be written anywhere in the line,
//they are erased after parsing. //they are erased after parsing.
if(s.find("halfup") != string::npos) if(s.find("halfup") != string::npos)
+2 -1
View File
@@ -292,6 +292,7 @@ Spell::~Spell()
int Spell::resolve() int Spell::resolve()
{ {
MTGCardInstance * oldStored = source->storedCard;
if (!source->hasType(Subtypes::TYPE_INSTANT) && !source->hasType(Subtypes::TYPE_SORCERY) && source->name.size()) if (!source->hasType(Subtypes::TYPE_INSTANT) && !source->hasType(Subtypes::TYPE_SORCERY) && source->name.size())
{ {
Player * p = source->controller(); Player * p = source->controller();
@@ -305,7 +306,7 @@ int Spell::resolve()
source->backupTargets = backupTgt; source->backupTargets = backupTgt;
from = p->game->battlefield; from = p->game->battlefield;
} }
source->storedCard = oldStored;
//Play SFX //Play SFX
if (options[Options::SFXVOLUME].number > 0) if (options[Options::SFXVOLUME].number > 0)
{ {
+2
View File
@@ -81,6 +81,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
int backupid = mtgid; int backupid = mtgid;
int castMethodBackUP = this->castMethod; int castMethodBackUP = this->castMethod;
mtgid = source->getId(); mtgid = source->getId();
MTGCardInstance * oldStored = this->storedCard;
Spell * spell = NEW Spell(observer, this); Spell * spell = NEW Spell(observer, this);
observer = card->observer; observer = card->observer;
AbilityFactory af(observer); AbilityFactory af(observer);
@@ -89,6 +90,7 @@ void MTGCardInstance::copy(MTGCardInstance * card)
mtgid = backupid; mtgid = backupid;
castMethod = castMethodBackUP; castMethod = castMethodBackUP;
backupTargets = this->backupTargets; backupTargets = this->backupTargets;
storedCard = oldStored;
} }
MTGCardInstance::~MTGCardInstance() MTGCardInstance::~MTGCardInstance()
+1
View File
@@ -474,6 +474,7 @@ MTGCardInstance * MTGGameZone::removeCard(MTGCardInstance * card, int createCopy
copy->X = card->X; copy->X = card->X;
copy->castX = card->castX; copy->castX = card->castX;
copy->kicked = card->kicked; copy->kicked = card->kicked;
copy->storedCard = card->storedCard;
//stupid bug with tokens... //stupid bug with tokens...
if (card->model == card) if (card->model == card)