Fixed "Jolrael, Mwonvuli Recluse", fixed "Corrosive Ooze", added new keyword "all(myeqp)" in order to target all the equipments attached to a creature (e.g. Corrosive Ooze).

This commit is contained in:
Vittorio Alfieri
2021-08-07 13:42:28 +02:00
parent b97bd275e4
commit a82636b099
3 changed files with 70 additions and 3 deletions
+46
View File
@@ -54,6 +54,13 @@ TargetChooser * TargetChooserFactory::createTargetChooser(string s, MTGCardInsta
return NEW TotemChooser(observer, card, maxtargets);
};
found = s.find("myeqp");
if (found != string::npos)
{
int maxtargets = 1;
return NEW EqpChooser(observer, card, maxtargets);
};
found = s.find("mytgt");
if (found == 0)
{
@@ -2305,3 +2312,42 @@ bool TotemChooser::equals(TargetChooser * tc)
TotemChooser::~TotemChooser()
{
}
//equipment chooser
bool EqpChooser::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->parentCards.size())
{
if((card->parentCards.at(0)) == source && (card->hasType(Subtypes::TYPE_EQUIPMENT)))
return true;
}
return false;
}
return false;
}
EqpChooser* EqpChooser::clone() const
{
EqpChooser * a = NEW EqpChooser(*this);
return a;
}
bool EqpChooser::equals(TargetChooser * tc)
{
EqpChooser * dtc = dynamic_cast<EqpChooser *> (tc);
if (!dtc)
return false;
return TypeTargetChooser::equals(tc);
}
EqpChooser::~EqpChooser()
{
}