added new functionality to AAMover...

you can now do 
moveto(targetzone) and((ability)) 
moveto(mybatlefield) and((transforms((zombie,black)) forever))
This commit is contained in:
omegablast2002@yahoo.com
2011-09-21 14:06:32 +00:00
parent ab7eb1b93e
commit 11095f3339
3 changed files with 48 additions and 2 deletions

View File

@@ -984,13 +984,14 @@ class AAMover: public ActivatedAbility
{
public:
string destination;
MTGAbility * andAbility;
AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest, ManaCost * _cost = NULL);
MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve();
const char * getMenuText();
const char * getMenuText(TargetChooser * fromTc);
AAMover * clone() const;
~AAMover();
};
//-----------------------------------------------------------------------------------------------

View File

@@ -1781,6 +1781,7 @@ AAMover::AAMover(int _id, MTGCardInstance * _source, MTGCardInstance * _target,
{
if (_target)
target = _target;
andAbility = NULL;
}
MTGGameZone * AAMover::destinationZone(Targetable * target)
@@ -1810,11 +1811,39 @@ int AAMover::resolve()
MTGCardInstance * copy = g->players[i]->game->putInZone(_target, fromZone, g->players[i]->game->temp);
Spell * spell = NEW Spell(copy);
spell->resolve();
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = spell->source;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
delete spell;
return 1;
}
}
p->game->putInZone(_target, fromZone, destZone);
if(andAbility)
{
MTGAbility * andAbilityClone = andAbility->clone();
andAbilityClone->target = _target;
if(andAbility->oneShot)
{
andAbilityClone->resolve();
SAFE_DELETE(andAbilityClone);
}
else
{
andAbilityClone->addToGame();
}
}
return 1;
}
}
@@ -1889,7 +1918,15 @@ const char * AAMover::getMenuText(TargetChooser * tc)
AAMover * AAMover::clone() const
{
return NEW AAMover(*this);
AAMover * a = NEW AAMover(*this);
if(andAbility)
a->andAbility = andAbility->clone();
return a;
}
AAMover::~AAMover()
{
SAFE_DELETE(andAbility);
}
//Random Discard

View File

@@ -1542,6 +1542,14 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
MTGAbility * a = NEW AAMover(id, card, target, splitMove[1]);
a->oneShot = 1;
if(s.find("and(") != string::npos)
{
vector<string> splitAnd = parseBetween(s, "and((", "))");
if(splitAnd.size())
{
((AAMover*)a)->andAbility = parseMagicLine(splitAnd[1], id, spell, card);
}
}
return a;
}