From c4eb93119284b2d04c372c79ec44c77952cf2011 Mon Sep 17 00:00:00 2001 From: valfieri Date: Fri, 9 Oct 2020 19:16:03 +0200 Subject: [PATCH] Fixed primitives and planeswalkers, fixed a bug on counter comparison criteria when cards are changing zone (eg. @movedto(creature[counter{1/1}]|mygraveyard) from(mybattlefiled) now it's working fine). --- .../mtg/bin/Res/sets/primitives/borderline.txt | 2 +- .../bin/Res/sets/primitives/planeswalkers.txt | 12 ++++++++++++ projects/mtg/src/MTGGameZones.cpp | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/projects/mtg/bin/Res/sets/primitives/borderline.txt b/projects/mtg/bin/Res/sets/primitives/borderline.txt index 1340dd1b1..af0258d19 100644 --- a/projects/mtg/bin/Res/sets/primitives/borderline.txt +++ b/projects/mtg/bin/Res/sets/primitives/borderline.txt @@ -42657,7 +42657,7 @@ type=Enchantment name=Trove Warden abilities=vigilance auto=@movedto(land|myBattlefield):moveto(exile) target(*[manacost<=3]|mygraveyard) -auto=@movedTo(this|graveyard) from(battlefield):moveto(mybattlefield) target(*|myexile) +auto=@movedTo(this|graveyard) from(battlefield):moveto(ownerbattlefield) target(*[manacost<=3]|myexile) text=Vigilance -- Landfall — Whenever a land enters the battlefield under your control, exile target permanent card with converted mana cost 3 or less from your graveyard. -- When Trove Warden dies, put each permanent card exiled with it onto the battlefield under the control of that card's owner. mana={2}{W}{W} type=Creature diff --git a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt index 2055a8345..e5f5a6d56 100644 --- a/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt +++ b/projects/mtg/bin/Res/sets/primitives/planeswalkers.txt @@ -1761,6 +1761,18 @@ type=Legendary Planeswalker subtype=Nissa [/card] [card] +name=Nissa of Shadowed Boughs +auto=counter(0/0,4,Loyalty) +auto=_LANDFALL_counter(0/0,1,Loyalty) all(this) +auto={C(0/0,1,Loyalty)}:name(+1: Untap a land) target(land|myBattlefield) untap +auto={C(0/0,1,Loyalty)}:name(+1: Untap a land and becomes creature) target(land|myBattlefield) transforms((Creature Elemental,setpower=3,settoughness=3,newability[untap],newability[haste],newability[menace])) ueot +auto={C(0/0,-5,Loyalty)}:name(-5: May put a creature from hand or graveyard) target(creature[manacost<=type:land:myBattlefield]|myGraveyard,myHand) moveTo(myBattlefield) and!(counter(1/1,2))! +text=Landfall — Whenever a land enters the battlefield under your control, put a loyalty counter on Nissa of Shadowed Boughs. -- +1: Untap target land you control. You may have it become a 3/3 Elemental creature with haste and menace until end of turn. It's still a land. -- -5: You may put a creature card with converted mana cost less than or equal to the number of lands you control onto the battlefield from your hand or graveyard with two +1/+1 counters on it. +mana={2}{B}{G} +type=Legendary Planeswalker +subtype=Nissa +[/card] +[card] name=Nissa Revane auto=counter(0/0,2,loyalty) aicode=activate moveTo(mybattlefield) target(creature[elf]|mylibrary) diff --git a/projects/mtg/src/MTGGameZones.cpp b/projects/mtg/src/MTGGameZones.cpp index 3786e611e..33e7d0fdd 100644 --- a/projects/mtg/src/MTGGameZones.cpp +++ b/projects/mtg/src/MTGGameZones.cpp @@ -421,6 +421,15 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone if (!(copy = from->removeCard(card, doCopy))) return NULL; //ERROR + // Copy all the counters of the original card... (solving the bug on comparison cards with counter before zone changing events) + if(card->counters && doCopy && !asCopy && !inplaytoinplay){ + for (unsigned int i = 0; i < card->counters->counters.size(); i++){ + Counter * counter = card->counters->counters[i]; + for(int j = 0; j < counter->nb; j++) + copy->counters->addCounter(counter->name.c_str(), counter->power, counter->toughness, true); + } + } + if (card->miracle) { copy->miracle = true; @@ -571,6 +580,15 @@ MTGCardInstance * MTGPlayerCards::putInZone(MTGCardInstance * card, MTGGameZone WEvent * e = NEW WEventZoneChange(copy, from, to); g->receiveEvent(e); + + // Erasing counters from copy after the event has been triggered (no counter can survive to a zone changing) + if(doCopy && copy->counters && copy->counters->mCount > 0){ + for (unsigned int i = 0; i < copy->counters->counters.size(); i++){ + Counter * counter = copy->counters->counters[i]; + for(int j = counter->nb; j > 0; j--) + copy->counters->removeCounter(counter->name.c_str(), counter->power, counter->toughness, true); + } + } } if(inplaytoinplay) {