From a82636b0995b97584656b030b966ba444ad8cbd1 Mon Sep 17 00:00:00 2001 From: Vittorio Alfieri Date: Sat, 7 Aug 2021 13:42:28 +0200 Subject: [PATCH] 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). --- .../bin/Res/sets/primitives/borderline.txt | 7 +-- projects/mtg/include/TargetChooser.h | 20 ++++++++ projects/mtg/src/TargetChooser.cpp | 46 +++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index b8ceebf79..9fa2c87bb 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -12303,7 +12303,8 @@ toughness=4 [/card] [card] name=Corrosive Ooze -auto= +auto=emblem transforms((,newability[lord(creature[counter{0/0.1.CorrosiveEffect}]) transforms((,newability[@each combatends:name(Destroy all equipments) all(myeqp) destroy],newability[@each combatends:name(Destroy all equipments) removeallcounters(0/0.1.CorrosiveEffect)]))])) forever dontremove +auto=@combat(blocking,blocked) source(this) from(creature[equipped]):name(Destroy all equipments) all(trigger[from]) counter(0/0.1.CorrosiveEffect) text=Whenever Corrosive Ooze blocks or becomes blocked by an equipped creature, destroy all Equipment attached to that creature at end of combat. mana={1}{G} type=Creature @@ -32979,8 +32980,8 @@ type=Instant [/card] [card] name=Jolrael, Mwonvuli Recluse -auto=@drawof(player):transforms((,newability[@drawof(player) restriction{once}:token(Cat Jol)])) oneshot -auto={4}{G}{G}:all(creature|mybattlefield) transforms((,setpower=type:*:myHand,settoughness=type:*:myHand)) ueot +auto=@drawof(player) restriction{compare(pdrewcount)~equalto~2}:name(Create cat) token(Cat Jol) +auto={4}{G}{G}:name(All creatures becomes X/X) all(creature|mybattlefield) transforms((,setpower=type:*:myHand,settoughness=type:*:myHand)) ueot text=Whenever you draw your second card each turn, create a 2/2 green Cat creature token. -- {4}{G}{G}: Until end of turn, creatures you control have base power and toughness X/X, where X is the number of cards in your hand. mana={1}{G} type=Legendary Creature diff --git a/projects/mtg/include/TargetChooser.h b/projects/mtg/include/TargetChooser.h index 4583e3d25..b1f48f29e 100644 --- a/projects/mtg/include/TargetChooser.h +++ b/projects/mtg/include/TargetChooser.h @@ -397,4 +397,24 @@ public: virtual bool equals(TargetChooser * tc); ~TotemChooser(); }; + +class EqpChooser: public TypeTargetChooser +{ +public: + bool withoutProtections; + EqpChooser(GameObserver *observer, int * _zones, int _nbzones, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false, bool targetMin = false) : + TypeTargetChooser(observer, "*",_zones, _nbzones, card, _maxtargets, other, targetMin) + { + } + ; + EqpChooser(GameObserver *observer, MTGCardInstance * card = NULL, int _maxtargets = 1, bool other = false,bool targetMin = false) : + TypeTargetChooser(observer, "*", card, _maxtargets, other,targetMin) + { + } + ; + virtual bool canTarget(Targetable * target, bool withoutProtections = false); + virtual EqpChooser * clone() const; + virtual bool equals(TargetChooser * tc); + ~EqpChooser(); +}; #endif diff --git a/projects/mtg/src/TargetChooser.cpp b/projects/mtg/src/TargetChooser.cpp index fa54d847b..a76bb2cec 100644 --- a/projects/mtg/src/TargetChooser.cpp +++ b/projects/mtg/src/TargetChooser.cpp @@ -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(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 (tc); + if (!dtc) + return false; + + return TypeTargetChooser::equals(tc); +} + +EqpChooser::~EqpChooser() +{ +} \ No newline at end of file