added moverandom(tc) from(zone) to(zone) ability...example
moverandom(creature[green]) from(mygraveyard) to(opponentbattlefield)
example card
[card]
name=Tariel, Reckoner of Souls
auto={t}:moverandom(creature) from(opponentgraveyard) to(mybattlefield)
mana={4}{W}{B}{R}
abilities=Flying,vigilance
type=Legendary Creature
subtype=Angel
power=4
toughness=7
text=Flying, vigilance {T}: Choose a creature card at random from target opponent's graveyard. Put that card onto the battlefield under your control.
[/card]
This commit is contained in:
@@ -1047,6 +1047,21 @@ public:
|
|||||||
~AAMover();
|
~AAMover();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// AARandomMover
|
||||||
|
class AARandomMover: public ActivatedAbility
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
string abilityTC;
|
||||||
|
string fromZone;
|
||||||
|
string toZone;
|
||||||
|
AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string tcs, string from, string to);
|
||||||
|
MTGGameZone * destinationZone(Targetable * target = NULL,string zone = "");
|
||||||
|
int resolve();
|
||||||
|
const char * getMenuText();
|
||||||
|
AARandomMover * clone() const;
|
||||||
|
~AARandomMover();
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
class AABuryCard: public ActivatedAbility
|
class AABuryCard: public ActivatedAbility
|
||||||
|
|||||||
@@ -2028,6 +2028,86 @@ AAMover::~AAMover()
|
|||||||
SAFE_DELETE(andAbility);
|
SAFE_DELETE(andAbility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//random movement of a card from zone to zone
|
||||||
|
AARandomMover::AARandomMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string _tcs, string _from, string _to) :
|
||||||
|
ActivatedAbility(observer, _id, _source, NULL, 0), abilityTC(_tcs),fromZone(_from),toZone(_to)
|
||||||
|
{
|
||||||
|
if (_target)
|
||||||
|
target = _target;
|
||||||
|
}
|
||||||
|
|
||||||
|
MTGGameZone * AARandomMover::destinationZone(Targetable * target,string zone)
|
||||||
|
{
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
|
return MTGGameZone::stringToZone(game, zone, source, _target);
|
||||||
|
}
|
||||||
|
|
||||||
|
int AARandomMover::resolve()
|
||||||
|
{
|
||||||
|
MTGCardInstance * _target = (MTGCardInstance *) target;
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
Player* p = _target->controller();
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
MTGGameZone * fromDest = destinationZone(target,fromZone);
|
||||||
|
MTGGameZone * toDest = destinationZone(target,toZone);
|
||||||
|
|
||||||
|
if (!fromDest->nb_cards)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
TargetChooserFactory tcf(game);
|
||||||
|
TargetChooser * rTc = tcf.createTargetChooser(abilityTC, source);
|
||||||
|
rTc->targetter = NULL;
|
||||||
|
rTc->setAllZones();
|
||||||
|
vector<MTGCardInstance*>selectedCards;
|
||||||
|
for(unsigned int i = 0; i < fromDest->cards.size();++i)
|
||||||
|
{
|
||||||
|
if(rTc->canTarget(fromDest->cards[i]))
|
||||||
|
selectedCards.push_back(fromDest->cards[i]);
|
||||||
|
}
|
||||||
|
SAFE_DELETE(rTc);
|
||||||
|
if(!selectedCards.size())
|
||||||
|
return 0;
|
||||||
|
int r = fromDest->owner->getObserver()->getRandomGenerator()->random() % (selectedCards.size());
|
||||||
|
MTGCardInstance * toMove = selectedCards[r];
|
||||||
|
|
||||||
|
|
||||||
|
//inplay is a special zone !
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
if (toDest == game->players[i]->game->inPlay && fromDest != game->players[i]->game->inPlay && fromDest
|
||||||
|
!= game->players[i]->opponent()->game->inPlay)
|
||||||
|
{
|
||||||
|
MTGCardInstance * copy = game->players[i]->game->putInZone(toMove, fromDest, game->players[i]->game->temp);
|
||||||
|
Spell * spell = NEW Spell(game, copy);
|
||||||
|
spell->resolve();
|
||||||
|
delete spell;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p->game->putInZone(toMove, fromDest, toDest);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * AARandomMover::getMenuText()
|
||||||
|
{
|
||||||
|
return "Dig";
|
||||||
|
}
|
||||||
|
|
||||||
|
AARandomMover * AARandomMover::clone() const
|
||||||
|
{
|
||||||
|
AARandomMover * a = NEW AARandomMover(*this);
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
AARandomMover::~AARandomMover()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//Random Discard
|
//Random Discard
|
||||||
AARandomDiscarder::AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost,
|
AARandomDiscarder::AARandomDiscarder(GameObserver* observer, int _id, MTGCardInstance * card, Targetable * _target,string nbcardsStr, ManaCost * _cost,
|
||||||
int who) :
|
int who) :
|
||||||
|
|||||||
@@ -1744,7 +1744,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
target = card;
|
target = card;
|
||||||
|
|
||||||
MTGAbility * a = NEW AAMover(observer, id, card, target, splitMove[1]);
|
MTGAbility * a = NEW AAMover(observer, id, card, target, splitMove[1]);
|
||||||
a->oneShot = 1;
|
a->oneShot = true;
|
||||||
if(s.find("and(") != string::npos)
|
if(s.find("and(") != string::npos)
|
||||||
{
|
{
|
||||||
vector<string> splitAnd = parseBetween(s, "and((", " ))",false);
|
vector<string> splitAnd = parseBetween(s, "and((", " ))",false);
|
||||||
@@ -1756,6 +1756,19 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//random mover
|
||||||
|
vector<string> splitRandomMove = parseBetween(s, "moverandom(", ")");
|
||||||
|
if (splitRandomMove.size())
|
||||||
|
{
|
||||||
|
vector<string> splitfrom = parseBetween(splitRandomMove[2], "from(", ")");
|
||||||
|
vector<string> splitto = parseBetween(splitRandomMove[2], "to(", ")");
|
||||||
|
if(!splitfrom.size() || !splitto.size())
|
||||||
|
return NULL;
|
||||||
|
MTGAbility * a = NEW AARandomMover(observer, id, card, target, splitRandomMove[1],splitfrom[1],splitto[1]);
|
||||||
|
a->oneShot = true;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
//Copy a target
|
//Copy a target
|
||||||
found = s.find("copy");
|
found = s.find("copy");
|
||||||
if (found != string::npos)
|
if (found != string::npos)
|
||||||
|
|||||||
Reference in New Issue
Block a user