aura parent

This commit is contained in:
Anthony Calosa
2017-03-13 18:16:22 +08:00
parent d6a0b04930
commit bef1f6d8b8
6 changed files with 93 additions and 29 deletions

View File

@@ -48,6 +48,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
return NEW CardTargetChooser(observer, target, card);
};
found = s.find("mychild");
if (found == 0)
{
int maxtargets = 1;
return NEW ChildrenChooser(observer, card, maxtargets);
};
found = s.find("targetedplayer");
if (found == 0)
{
@@ -2015,3 +2022,42 @@ ParentChildChooser::~ParentChildChooser()
{
SAFE_DELETE(deeperTargeting);
}
//child only
bool ChildrenChooser::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)
return true;
}
return false;
}
return false;
}
ChildrenChooser* ChildrenChooser::clone() const
{
ChildrenChooser * a = NEW ChildrenChooser(*this);
return a;
}
bool ChildrenChooser::equals(TargetChooser * tc)
{
ChildrenChooser * dtc = dynamic_cast<ChildrenChooser *> (tc);
if (!dtc)
return false;
return TypeTargetChooser::equals(tc);
}
ChildrenChooser::~ChildrenChooser()
{
}