From 5ab54142de71690d2d681cdd6a6f8f4c7827a9c5 Mon Sep 17 00:00:00 2001 From: drmDev Date: Fri, 15 Apr 2016 12:24:04 -0400 Subject: [PATCH] W16 fix. Eldrazi Obligator fix and test --- .../client/util/sets/ConstructedFormats.java | 5 +-- .../src/mage/deck/Standard.java | 8 ++-- Mage.Sets/src/mage/sets/WelcomeDeck2016.java | 2 +- .../oathofthegatewatch/EldraziObligator.java | 19 ++++---- .../single/ogw/EldraziObligatorTest.java | 45 +++++++++++++++++++ .../src/main/java/mage/constants/SetType.java | 1 + 6 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/EldraziObligatorTest.java diff --git a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java index cdace71dfa..dc2e405921 100644 --- a/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java +++ b/Mage.Client/src/main/java/mage/client/util/sets/ConstructedFormats.java @@ -1,7 +1,6 @@ package mage.client.util.sets; import java.util.ArrayList; -import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.Date; @@ -47,7 +46,7 @@ public class ConstructedFormats { public static List getSetsByFormat(final String format) { if(!format.equals(ALL)) { - return underlyingSetCodesPerFormat.get(format); + return underlyingSetCodesPerFormat.get(format); } return all; @@ -65,7 +64,7 @@ public class ConstructedFormats { for (ExpansionInfo set : ExpansionRepository.instance.getAll()) { expansionInfo.put(set.getName(), set); formats.add(set.getName()); - if (set.getType().equals(SetType.CORE) || set.getType().equals(SetType.EXPANSION)) { + if (set.getType().equals(SetType.CORE) || set.getType().equals(SetType.EXPANSION) || set.getType().equals(SetType.SUPPLEMENTAL_STANDARD_LEGAL)) { if (STANDARD_CARDS.getSetCodes().contains(set.getCode())) { if(underlyingSetCodesPerFormat.get(STANDARD) == null) { underlyingSetCodesPerFormat.put(STANDARD, new ArrayList()); diff --git a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java index d29cd6eac1..054c8505d1 100644 --- a/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java +++ b/Mage.Server.Plugins/Mage.Deck.Constructed/src/mage/deck/Standard.java @@ -29,14 +29,14 @@ package mage.deck; import java.util.ArrayList; -import mage.cards.ExpansionSet; -import mage.cards.Sets; -import mage.cards.decks.Constructed; import java.util.Collections; import java.util.Comparator; import java.util.GregorianCalendar; import java.util.Iterator; import java.util.List; +import mage.cards.ExpansionSet; +import mage.cards.Sets; +import mage.cards.decks.Constructed; import mage.constants.SetType; /** @@ -58,7 +58,7 @@ public class Standard extends Constructed { int blocksAdded = 0; for (Iterator iter = sets.iterator(); iter.hasNext() && blocksAdded < 3; ) { ExpansionSet set = iter.next(); - if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION) { // Still adding core sets because of Magic Origins + if (set.getSetType() == SetType.CORE || set.getSetType() == SetType.EXPANSION || set.getSetType() == SetType.SUPPLEMENTAL_STANDARD_LEGAL) { // Still adding core sets because of Magic Origins setCodes.add(set.getCode()); if (set.getReleaseDate().before(current.getTime()) // This stops spoiled sets from counting as "new" blocks && set.getParentSet() == null diff --git a/Mage.Sets/src/mage/sets/WelcomeDeck2016.java b/Mage.Sets/src/mage/sets/WelcomeDeck2016.java index 966891bc45..6467e4644b 100644 --- a/Mage.Sets/src/mage/sets/WelcomeDeck2016.java +++ b/Mage.Sets/src/mage/sets/WelcomeDeck2016.java @@ -44,7 +44,7 @@ public class WelcomeDeck2016 extends ExpansionSet { } private WelcomeDeck2016() { - super("Welcome Deck 2016", "W16", "mage.sets.welcomedeck2016", new GregorianCalendar(2016, 3, 8).getTime(), SetType.SUPPLEMENTAL); + super("Welcome Deck 2016", "W16", "mage.sets.welcomedeck2016", new GregorianCalendar(2016, 3, 8).getTime(), SetType.SUPPLEMENTAL_STANDARD_LEGAL); this.hasBasicLands = false; this.hasBoosters = false; } diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/EldraziObligator.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/EldraziObligator.java index 4d11fd7cd9..60830f3a27 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/EldraziObligator.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/EldraziObligator.java @@ -65,15 +65,18 @@ public class EldraziObligator extends CardImpl { // Haste this.addAbility(HasteAbility.getInstance()); - + + DoIfCostPaid costPaidEffect = new DoIfCostPaid(new GainControlTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{C}")); + Effect untapEffect = new UntapTargetEffect(); + untapEffect.setText("Untap that creature"); + Effect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); + hasteEffect.setText("It gains haste until end of turn"); + costPaidEffect.addEffect(untapEffect); + costPaidEffect.addEffect(hasteEffect); + // When you cast Eldrazi Obligator, you may pay {1}{C}. If you do, gain control of target creature until end of turn. Untap that creature. It gains haste until end of turn. - Ability ability = new CastSourceTriggeredAbility(new DoIfCostPaid(new GainControlTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{C}"))); - Effect effect = new UntapTargetEffect(); - effect.setText("Untap that creature"); - ability.addEffect(effect); - effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); - effect.setText("It gains haste until end of turn"); - ability.addEffect(effect); + Ability ability = new CastSourceTriggeredAbility(costPaidEffect); + Target target = new TargetCreaturePermanent(new FilterCreaturePermanent()); ability.addTarget(target); this.addAbility(ability); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/EldraziObligatorTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/EldraziObligatorTest.java new file mode 100644 index 0000000000..e4a4d057ed --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/ogw/EldraziObligatorTest.java @@ -0,0 +1,45 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.mage.test.cards.single.ogw; + +import mage.abilities.keyword.HasteAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) + */ +public class EldraziObligatorTest extends CardTestPlayerBase { + + /* + * Reported bug: Eldrazi Obligator is untapping targetted creature when cost is not paid + */ + @Test + public void targetCreatureDoNotPayAdditionalCost() { + + addCard(Zone.BATTLEFIELD, playerA, "Bronze Sable"); // 2/1 + + //When you cast Eldrazi Obligator, you may pay {1}{C}. If you do, gain control of target creature until end of turn, + //untap that creature, and it gains haste until end of turn. + addCard(Zone.HAND, playerB, "Eldrazi Obligator"); // 3/1 w/haste + addCard(Zone.BATTLEFIELD, playerB, "Mountain", 3); + + attack(1, playerA, "Bronze Sable"); // tap dat sable + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Eldrazi Obligator"); + setChoice(playerB, "No"); + setStopAt(2, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Bronze Sable", 1); + assertPermanentCount(playerB, "Eldrazi Obligator", 1); + assertAbility(playerA, "Bronze Sable", HasteAbility.getInstance(), false); // should not gain haste or untap + assertTapped("Bronze Sable", true); + } +} diff --git a/Mage/src/main/java/mage/constants/SetType.java b/Mage/src/main/java/mage/constants/SetType.java index 3ad9e322ad..b53d73dd56 100644 --- a/Mage/src/main/java/mage/constants/SetType.java +++ b/Mage/src/main/java/mage/constants/SetType.java @@ -9,6 +9,7 @@ public enum SetType { CORE("Core"), MAGIC_ONLINE("Magic Online"), SUPPLEMENTAL("Supplemental"), + SUPPLEMENTAL_STANDARD_LEGAL("Standard Legal Supplemental"), PROMOTIONAL("Promotional"), JOKESET("Joke Set");