Imprint Class

This commit is contained in:
Anthony Calosa
2016-06-16 07:15:24 +08:00
parent b38275123a
commit 9d79a85b96
3 changed files with 51 additions and 11 deletions
+11 -3
View File
@@ -1665,7 +1665,7 @@ public:
const string getMenuText(); const string getMenuText();
AACopier * clone() const; AACopier * clone() const;
}; };
//imprint //phaseout
class AAPhaseOut: public ActivatedAbility class AAPhaseOut: public ActivatedAbility
{ {
public: public:
@@ -1674,6 +1674,15 @@ public:
const string getMenuText(); const string getMenuText();
AAPhaseOut * clone() const; AAPhaseOut * clone() const;
}; };
//AAImprint
class AAImprint: public ActivatedAbility
{
public:
AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target = NULL, ManaCost * _cost = NULL);
int resolve();
const string getMenuText();
AAImprint * clone() const;
};
//cloning...this makes a token thats a copy of the target. //cloning...this makes a token thats a copy of the target.
class AACloner: public ActivatedAbility class AACloner: public ActivatedAbility
{ {
@@ -1703,8 +1712,7 @@ public:
string named; string named;
bool undying; bool undying;
bool persist; bool persist;
bool imprint; AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false);
AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string _name, ManaCost * _cost = NULL, bool undying = false, bool persist = false, bool imprint = false);
MTGGameZone * destinationZone(Targetable * target = NULL); MTGGameZone * destinationZone(Targetable * target = NULL);
int resolve(); int resolve();
const string getMenuText(); const string getMenuText();
+39 -7
View File
@@ -511,7 +511,7 @@ AACopier * AACopier::clone() const
return NEW AACopier(*this); return NEW AACopier(*this);
} }
//phaser //phaseout
AAPhaseOut::AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) : AAPhaseOut::AAPhaseOut(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, _source, _cost, 0) ActivatedAbility(observer, _id, _source, _cost, 0)
{ {
@@ -544,6 +544,42 @@ AAPhaseOut * AAPhaseOut::clone() const
return NEW AAPhaseOut(*this); return NEW AAPhaseOut(*this);
} }
//AAImprint
AAImprint::AAImprint(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, ManaCost * _cost) :
ActivatedAbility(observer, _id, _source, _cost, 0)
{
target = _target;
}
int AAImprint::resolve()
{
MTGCardInstance * _target = (MTGCardInstance *) target;
if (_target)
{
Player * p = _target->controller();
if(p)
p->game->putInExile(_target);
while(_target->next)
_target = _target->next;
source->imprintedCards.push_back(_target);
return 1;
}
return 0;
}
const string AAImprint::getMenuText()
{
return "Imprint";
}
AAImprint * AAImprint::clone() const
{
return NEW AAImprint(*this);
}
//Counters //Counters
AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness, AACounter::AACounter(GameObserver* observer, int id, MTGCardInstance * source, MTGCardInstance * target,string counterstring, const char * _name, int power, int toughness,
int nb,int maxNb, ManaCost * cost) : int nb,int maxNb, ManaCost * cost) :
@@ -2928,8 +2964,8 @@ AInstantCastRestrictionUEOT::~AInstantCastRestrictionUEOT()
//AAMover //AAMover
AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost, bool undying, bool persist, bool imprint) : AAMover::AAMover(GameObserver* observer, int _id, MTGCardInstance * _source, MTGCardInstance * _target, string dest,string newName, ManaCost * _cost, bool undying, bool persist) :
ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName),undying(undying),persist(persist),imprint(imprint) ActivatedAbility(observer, _id, _source, _cost, 0), destination(dest),named(newName),undying(undying),persist(persist)
{ {
if (_target) if (_target)
target = _target; target = _target;
@@ -2987,8 +3023,6 @@ int AAMover::resolve()
p->game->putInZone(_target, fromZone, destZone); p->game->putInZone(_target, fromZone, destZone);
while(_target->next) while(_target->next)
_target = _target->next; _target = _target->next;
if (imprint)
source->imprintedCards.push_back(_target);
if(andAbility) if(andAbility)
{ {
MTGAbility * andAbilityClone = andAbility->clone(); MTGAbility * andAbilityClone = andAbility->clone();
@@ -3065,8 +3099,6 @@ const char* AAMover::getMenuText(TargetChooser * tc)
// move card into exile // move card into exile
else if (dest == game->players[i]->game->exile) else if (dest == game->players[i]->game->exile)
{ {
if(imprint)
return "Imprint";
return "Exile"; return "Exile";
} }
+1 -1
View File
@@ -2378,7 +2378,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
found = s.find("imprint"); found = s.find("imprint");
if (found != string::npos) if (found != string::npos)
{ {
MTGAbility * a = NEW AAMover(observer, id, card, target, "exile",newName,NULL,false,false,true); MTGAbility * a = NEW AAImprint(observer, id, card, target);
a->oneShot = 1; a->oneShot = 1;
return a; return a;
} }