From 2c9c4888ccd37bf68087e5de25ee92afa623b98f Mon Sep 17 00:00:00 2001 From: fireshoes Date: Tue, 18 Apr 2017 11:39:47 -0500 Subject: [PATCH 1/5] Added Commander 2017 to known sets. --- .../src/main/resources/image.url.properties | 4 +- Mage.Sets/src/mage/sets/Commander2017.java | 50 +++++++++++++++++++ Utils/known-sets.txt | 2 + Utils/mtg-sets-data.txt | 1 + 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/Commander2017.java diff --git a/Mage.Client/src/main/resources/image.url.properties b/Mage.Client/src/main/resources/image.url.properties index 9f5e89bcde7..ef7b0ec9ff1 100644 --- a/Mage.Client/src/main/resources/image.url.properties +++ b/Mage.Client/src/main/resources/image.url.properties @@ -74,6 +74,6 @@ dd3evg=ddaevg dd3gvl=ddagvl dd3jvc=ddajvc # Remove setname as soon as the images can be downloaded -ignore.urls=TOK,PCA,ANB,HOU +ignore.urls=TOK,PCA,ANB,HOU,C17 # sets ordered by release time (newest goes first) -token.lookup.order=ANB,HOU,MM3,DDS,AKH,DD3DVD,DD3EVG,DD3GVL,DD3JVC,H09,AER,PCA,C16,V16,MPS,KLD,DDR,CN2,EMN,EMA,SOI,DDQ,CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,DRB,V09,V10,V11,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC \ No newline at end of file +token.lookup.order=C17,ANB,HOU,MM3,DDS,AKH,DD3DVD,DD3EVG,DD3GVL,DD3JVC,H09,AER,PCA,C16,V16,MPS,KLD,DDR,CN2,EMN,EMA,SOI,DDQ,CP,CMA,ARENA,SUS,APAC,EURO,UGIN,C15,OGW,EXP,DDP,BFZ,DRB,V09,V10,V11,V12,V13,V14,V15,TPR,MPRP,DD3,DDO,ORI,MM2,PTC,DTK,FRF,KTK,M15,VMA,CNS,JOU,BNG,THS,DDL,M14,MMA,DGM,GTC,RTR,M13,AVR,DDI,DKA,ISD,M12,NPH,MBS,SOM,M11,ROE,DDE,WWK,ZEN,M10,GVL,ARB,DVD,CFX,JVC,ALA,EVE,SHM,EVG,MOR,LRW,10E,CLS,CHK,GRC \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Commander2017.java b/Mage.Sets/src/mage/sets/Commander2017.java new file mode 100644 index 00000000000..fa1e02ff482 --- /dev/null +++ b/Mage.Sets/src/mage/sets/Commander2017.java @@ -0,0 +1,50 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets; + +import mage.cards.ExpansionSet; +import mage.constants.SetType; + +/** + * + * @author fireshoes + */ +public class Commander2017 extends ExpansionSet { + + private static final Commander2017 instance = new Commander2017(); + + public static Commander2017 getInstance() { + return instance; + } + + private Commander2017() { + super("Commander 2017 Edition", "C17", ExpansionSet.buildDate(2017, 8, 25), SetType.SUPPLEMENTAL); + this.blockName = "Command Zone"; + + } +} \ No newline at end of file diff --git a/Utils/known-sets.txt b/Utils/known-sets.txt index f586453abb3..3732a92345d 100644 --- a/Utils/known-sets.txt +++ b/Utils/known-sets.txt @@ -23,6 +23,7 @@ Commander 2013 Edition|Commander2013| Commander 2014 Edition|Commander2014| Commander 2015|Commander2015| Commander 2016|Commander2016| +Commander 2017|Commander2017| Commander Anthology|CommanderAnthology| Commander's Arsenal|CommandersArsenal| Conflux|Conflux| @@ -88,6 +89,7 @@ Hour of Devastation|HourOfDevastation| Ice Age|IceAge| Innistrad|Innistrad| Invasion|Invasion| +Ixalan|Ixalan| Journey into Nyx|JourneyIntoNyx| Judge Promo|JudgePromo| Judgment|Judgment| diff --git a/Utils/mtg-sets-data.txt b/Utils/mtg-sets-data.txt index e131cd91321..e7e2d3ee2d9 100644 --- a/Utils/mtg-sets-data.txt +++ b/Utils/mtg-sets-data.txt @@ -31,6 +31,7 @@ Commander 2013 Edition|C13| Commander 2014 Edition|C14| Commander 2015 Edition|C15| Commander 2016 Edition|C16| +Commander 2017 Edition|C17| Champions of Kamigawa|CHK| Chronicles|CHR| Clash Pack|CLASH| From fdf15262f94db05075ec8063bff3307a153bfefb Mon Sep 17 00:00:00 2001 From: magenoxx Date: Tue, 18 Apr 2017 19:56:35 +0300 Subject: [PATCH 2/5] Returned back my old old avatars --- Mage.Server/src/main/java/mage/server/Session.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index fe01b269c01..bdc2744cace 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -317,6 +317,10 @@ public class Session { return 1020; case "fireshoes": return 1021; + case "noxx": + return 1000; + case "magenoxx": + return 1018; } return 11; } From 9e1acd5daaaac9ecd0056660cf1511566073c52c Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 18 Apr 2017 12:08:15 -0500 Subject: [PATCH 3/5] - Fixed Hapatra, Vizier of Poisons. Bug #3157 --- Mage.Sets/src/mage/cards/h/HapatraVizierOfPoisons.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HapatraVizierOfPoisons.java b/Mage.Sets/src/mage/cards/h/HapatraVizierOfPoisons.java index 88d51b4cba8..803d2decbef 100644 --- a/Mage.Sets/src/mage/cards/h/HapatraVizierOfPoisons.java +++ b/Mage.Sets/src/mage/cards/h/HapatraVizierOfPoisons.java @@ -100,12 +100,14 @@ class HapatraVizierOfPoisonsTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { - if (event.getData().equals(CounterType.M1M1.getName())) { + if (event.getData().equals(CounterType.M1M1.getName()) + && controllerId.equals(game.getControllerId(event.getSourceId()))) { Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId()); if (permanent == null) { permanent = game.getPermanentEntering(event.getTargetId()); } - return (permanent != null && permanent.isCreature()); + return (permanent != null + && permanent.isCreature()); } return false; From 0ea2ce12bfc6d66d41fbac3d73451c5725b4e2c2 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Tue, 18 Apr 2017 21:13:32 +0300 Subject: [PATCH 4/5] #3144: EmbalmTest that reproduces bug. --- .../cards/abilities/keywords/EmbalmTest.java | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java new file mode 100644 index 00000000000..4e1021a12cc --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/EmbalmTest.java @@ -0,0 +1,169 @@ +/* + * Copyright 2017 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package org.mage.test.cards.abilities.keywords; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author noxx + */ +public class EmbalmTest extends CardTestPlayerBase { + + /* + * Tests that Embalm doesn't affect card to be case as usual card with ETB trigger + */ + @Test + public void testCreatureWithEmbalmJustCastAndTarget() { + + /* + Angel of Sanctions {3}{W}{W} + Creature - Angel + Flying + When Angel of Sanctions enters the battlefield, you may exile target nonland permanent an opponent controls until Angel of Sanctions leaves the battlefield. + Embalm {5}{W} + */ + String aSanctions = "Angel of Sanctions"; // {W} 3/4 + String yOx = "Yoked Ox"; // {W} 0/4 + String wKnight = "White Knight"; // {W}{W} 2/2 + + addCard(Zone.HAND, playerA, aSanctions); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 5); + + addCard(Zone.BATTLEFIELD, playerB, yOx); + addCard(Zone.BATTLEFIELD, playerB, wKnight); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aSanctions); + addTarget(playerA, yOx); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, aSanctions, 1); + assertPermanentCount(playerB, yOx, 0); + assertPermanentCount(playerB, wKnight, 1); + + } + + /* + * Tests that creature after using Embalm will be able to use ETB effect from original card + */ + @Test + public void testCreatureETBAfterEmbalm() { + + /* + Angel of Sanctions {3}{W}{W} + Creature - Angel + Flying + When Angel of Sanctions enters the battlefield, you may exile target nonland permanent an opponent controls until Angel of Sanctions leaves the battlefield. + Embalm {5}{W} + */ + String aSanctions = "Angel of Sanctions"; // {3}{W}{W} 3/4 + String yOx = "Yoked Ox"; // {W} 0/4 + String wKnight = "White Knight"; // {W}{W} 2/2 + String dBlade = "Doom Blade"; // {1}{B} + + addCard(Zone.HAND, playerA, aSanctions); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 11); + + addCard(Zone.HAND, playerB, dBlade); + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2); + addCard(Zone.BATTLEFIELD, playerB, yOx); + addCard(Zone.BATTLEFIELD, playerB, wKnight); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aSanctions); + addTarget(playerA, yOx); + castSpell(1, PhaseStep.BEGIN_COMBAT, playerB, dBlade); + addTarget(playerB, aSanctions); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Embalm"); + addTarget(playerA, wKnight); + + setStopAt(1, PhaseStep.END_TURN); + execute(); + + assertHandCount(playerB, 0); + assertPermanentCount(playerA, aSanctions, 1); + assertPermanentCount(playerB, yOx, 1); + assertPermanentCount(playerB, wKnight, 0); + assertGraveyardCount(playerA, aSanctions, 0); + } + + /* + * Tests that not only creature targeted by original creature is returned. + * After using Embalm creature will exile another creature and should return it back when leaves battlefield. + * + * Bug: #3144 + */ + @Test + public void testCreatureExiledByEmbalmCreatureReturns() { + + /* + Angel of Sanctions {3}{W}{W} + Creature - Angel + Flying + When Angel of Sanctions enters the battlefield, you may exile target nonland permanent an opponent controls until Angel of Sanctions leaves the battlefield. + Embalm {5}{W} + */ + String aSanctions = "Angel of Sanctions"; // {3}{W}{W} 3/4 + String yOx = "Yoked Ox"; // {W} 0/4 + String wKnight = "White Knight"; // {W}{W} 2/2 + String dBlade = "Doom Blade"; // {1}{B} + + addCard(Zone.HAND, playerA, aSanctions); + addCard(Zone.BATTLEFIELD, playerA, "Plains", 11); + + addCard(Zone.HAND, playerB, dBlade, 2); + addCard(Zone.BATTLEFIELD, playerB, "Swamp", 4); + addCard(Zone.BATTLEFIELD, playerB, yOx); + addCard(Zone.BATTLEFIELD, playerB, wKnight); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, aSanctions); + addTarget(playerA, yOx); + castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, dBlade); + addTarget(playerB, aSanctions); + activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Embalm"); + addTarget(playerA, wKnight); + castSpell(1, PhaseStep.END_TURN, playerB, dBlade); + addTarget(playerB, aSanctions); + + setStopAt(1, PhaseStep.CLEANUP); + execute(); + + assertHandCount(playerB, 0); + assertPermanentCount(playerA, aSanctions, 0); + assertPermanentCount(playerB, yOx, 1); + // second creature should also return after embalm token leaves battlefield + // Bug: #3144 + assertPermanentCount(playerB, wKnight, 1); + assertGraveyardCount(playerA, aSanctions, 0); + assertGraveyardCount(playerB, dBlade, 2); + } +} From 6ee2e69f2ca801af09b07b4b5049ebb385a030b7 Mon Sep 17 00:00:00 2001 From: magenoxx Date: Tue, 18 Apr 2017 22:03:33 +0300 Subject: [PATCH 5/5] Fixed #3144: added searching for exile zone with change zone counter (that's true for tokens from graveyard) --- ...LeaveReturnExiledToBattlefieldAbility.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledToBattlefieldAbility.java b/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledToBattlefieldAbility.java index 996b05d9c67..af95c8eaeed 100644 --- a/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledToBattlefieldAbility.java +++ b/Mage/src/main/java/mage/abilities/common/delayed/OnLeaveReturnExiledToBattlefieldAbility.java @@ -106,15 +106,29 @@ class ReturnExiledPermanentsEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = source.getSourceObject(game); if (sourceObject != null && controller != null) { - UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); - if (exileZone != null) { - ExileZone exile = game.getExile().getExileZone(exileZone); - if (exile != null) { - controller.moveCards(new LinkedHashSet<>(exile.getCards(game)), Zone.BATTLEFIELD, source, game, false, false, true, null); - } - return true; + ExileZone exile = getExileIfPossible(game, source); + if (exile != null) { + return controller.moveCards(new LinkedHashSet<>(exile.getCards(game)), Zone.BATTLEFIELD, source, game, false, false, true, null); } } return false; } + + private ExileZone getExileIfPossible(final Game game, final Ability source) { + UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + + if (exileZone != null) { + ExileZone exile = game.getExile().getExileZone(exileZone); + if (exile == null) { + // try without ZoneChangeCounter - that is useful for tokens + exileZone = CardUtil.getCardExileZoneId(game, source); + if (exileZone != null) { + return game.getExile().getExileZone(exileZone); + } + } + return exile; + } + + return null; + } }