Totem Armor

This commit is contained in:
Anthony Calosa
2017-03-14 03:40:29 +08:00
parent bef1f6d8b8
commit 0778b13e2b
11 changed files with 389 additions and 94 deletions

View File

@@ -55,6 +55,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
return NEW ChildrenChooser(observer, card, maxtargets);
};
found = s.find("mytotem");
if (found == 0)
{
int maxtargets = 1;
return NEW TotemChooser(observer, card, maxtargets);
};
found = s.find("targetedplayer");
if (found == 0)
{
@@ -220,6 +227,7 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
zones[nbzones++] = MTGGameZone::MY_LIBRARY;
zones[nbzones++] = MTGGameZone::MY_HAND;
zones[nbzones++] = MTGGameZone::MY_EXILE;
zones[nbzones++] = MTGGameZone::MY_SIDEBOARD;
}
else if (zoneName.compare("opponentcastingzone") == 0)
{
@@ -2061,3 +2069,42 @@ bool ChildrenChooser::equals(TargetChooser * tc)
ChildrenChooser::~ChildrenChooser()
{
}
//totem armor chooser
bool TotemChooser::canTarget(Targetable * target,bool withoutProtections)
{
if (MTGCardInstance * card = dynamic_cast<MTGCardInstance*>(target))
{
if(card == source)
return false;
if(!card->isInPlay(observer))
return false;
if(card->auraParent)
{
if((card->auraParent) == source && (card->has(Constants::TOTEMARMOR)))
return true;
}
return false;
}
return false;
}
TotemChooser* TotemChooser::clone() const
{
TotemChooser * a = NEW TotemChooser(*this);
return a;
}
bool TotemChooser::equals(TargetChooser * tc)
{
TotemChooser * dtc = dynamic_cast<TotemChooser *> (tc);
if (!dtc)
return false;
return TypeTargetChooser::equals(tc);
}
TotemChooser::~TotemChooser()
{
}