From 89350f1a91573a378b6d4bb45ffe3374e9a1e283 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 10 Jan 2016 12:02:46 +0100 Subject: [PATCH] [OGW] Added Oath of Gideon, Wall of Resurgence and Cultivator Drone. --- .../oathofthegatewatch/CultivatorDrone.java | 125 ++++++++++++++++++ .../sets/oathofthegatewatch/OathOfGideon.java | 118 +++++++++++++++++ .../oathofthegatewatch/WallOfResurgence.java | 94 +++++++++++++ .../test/cards/planeswalker/AjaniTest.java | 90 +++++++++++++ 4 files changed, 427 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/oathofthegatewatch/CultivatorDrone.java create mode 100644 Mage.Sets/src/mage/sets/oathofthegatewatch/OathOfGideon.java create mode 100644 Mage.Sets/src/mage/sets/oathofthegatewatch/WallOfResurgence.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/AjaniTest.java diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/CultivatorDrone.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/CultivatorDrone.java new file mode 100644 index 00000000000..9b3bd755c93 --- /dev/null +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/CultivatorDrone.java @@ -0,0 +1,125 @@ +/* + * 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.oathofthegatewatch; + +import java.util.UUID; +import mage.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.ActivatedAbility; +import mage.abilities.SpellAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCost; +import mage.abilities.keyword.DevoidAbility; +import mage.abilities.mana.ConditionalColorlessManaAbility; +import mage.abilities.mana.builder.ConditionalManaBuilder; +import mage.abilities.mana.conditional.ManaCondition; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class CultivatorDrone extends CardImpl { + + public CultivatorDrone(UUID ownerId) { + super(ownerId, 42, "Cultivator Drone", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "OGW"; + this.subtype.add("Eldrazi"); + this.subtype.add("Drone"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Devoid + this.addAbility(new DevoidAbility(this.color)); + // {T}: Add {C} to your mana pool. Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}. + this.addAbility(new ConditionalColorlessManaAbility(new TapSourceCost(), 1, new CultivatorDroneManaBuilder())); + } + + public CultivatorDrone(final CultivatorDrone card) { + super(card); + } + + @Override + public CultivatorDrone copy() { + return new CultivatorDrone(this); + } +} + +class CultivatorDroneManaBuilder extends ConditionalManaBuilder { + + @Override + public ConditionalMana build(Object... options) { + return new CultivatorDroneConditionalMana(this.mana); + } + + @Override + public String getRule() { + return "Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}"; + } +} + +class CultivatorDroneConditionalMana extends ConditionalMana { + + public CultivatorDroneConditionalMana(Mana mana) { + super(mana); + staticText = "Spend this mana only to cast a colorless spell, activate an ability of a colorless permanent, or pay a cost that contains {C}"; + addCondition(new CultivatorDroneManaCondition()); + } +} + +class CultivatorDroneManaCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { + if (source instanceof SpellAbility) { + MageObject object = game.getObject(source.getSourceId()); + if (object != null && object.getColor(game).isColorless()) { + return true; + } + } + if (source instanceof ActivatedAbility) { + Permanent object = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (object != null && object.getColor(game).isColorless()) { + return true; + } + } + if (costToPay instanceof ManaCost) { + return ((ManaCost) costToPay).getText().contains("{C}"); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/OathOfGideon.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/OathOfGideon.java new file mode 100644 index 00000000000..ab557ac3339 --- /dev/null +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/OathOfGideon.java @@ -0,0 +1,118 @@ +/* + * 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.oathofthegatewatch; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.EntersTheBattlefieldEvent; +import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class OathOfGideon extends CardImpl { + + public OathOfGideon(UUID ownerId) { + super(ownerId, 30, "Oath of Gideon", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + this.expansionSetCode = "OGW"; + this.supertype.add("Legendary"); + + // When Oath of Gideon enters the battlefield, put two 1/1 Kor Ally creature tokens onto the battlefield. + this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new KorAllyToken(), 2), false)); + + // Each planeswalker you control enters the battlefield with an additional loyalty counter on it. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OathOfGideonReplacementEffect())); + } + + public OathOfGideon(final OathOfGideon card) { + super(card); + } + + @Override + public OathOfGideon copy() { + return new OathOfGideon(this); + } +} + +class OathOfGideonReplacementEffect extends ReplacementEffectImpl { + + OathOfGideonReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "Each planeswalker you control enters the battlefield with an additional loyalty counter on it"; + } + + OathOfGideonReplacementEffect(OathOfGideonReplacementEffect effect) { + super(effect); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); + return creature != null && creature.getControllerId().equals(source.getControllerId()) + && creature.getCardType().contains(CardType.PLANESWALKER) + && !event.getTargetId().equals(source.getSourceId()); + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); + if (creature != null) { + creature.addCounters(CounterType.LOYALTY.createInstance(), game); + } + return false; + } + + @Override + public OathOfGideonReplacementEffect copy() { + return new OathOfGideonReplacementEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/WallOfResurgence.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/WallOfResurgence.java new file mode 100644 index 00000000000..4316f9e5e46 --- /dev/null +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/WallOfResurgence.java @@ -0,0 +1,94 @@ +/* + * 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.oathofthegatewatch; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledLandPermanent; +import mage.game.permanent.token.Token; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LevelX2 + */ +public class WallOfResurgence extends CardImpl { + + public WallOfResurgence(UUID ownerId) { + super(ownerId, 39, "Wall of Resurgence", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); + this.expansionSetCode = "OGW"; + this.subtype.add("Wall"); + this.power = new MageInt(0); + this.toughness = new MageInt(6); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + // When Wall of Resurgence enters the battlefield, you may put three +1/+1 counters on target land you control. If you do, that land becomes a 0/0 Elemental creature with haste that's still a land. + Ability ability = new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance(3)), true); + Effect effect = new BecomesCreatureTargetEffect(new WallOfResurgenceToken(), false, true, Duration.Custom); + effect.setText("If you do, that land becomes a 0/0 Elemental creature with haste that's still a land"); + ability.addEffect(effect); + ability.addTarget(new TargetControlledPermanent(new FilterControlledLandPermanent())); + this.addAbility(ability); + } + + public WallOfResurgence(final WallOfResurgence card) { + super(card); + } + + @Override + public WallOfResurgence copy() { + return new WallOfResurgence(this); + } +} + +class WallOfResurgenceToken extends Token { + + public WallOfResurgenceToken() { + super("", "0/0 Elemental creature with haste"); + this.cardType.add(CardType.CREATURE); + + this.subtype.add("Elemental"); + this.power = new MageInt(0); + this.toughness = new MageInt(0); + + this.addAbility(HasteAbility.getInstance()); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/AjaniTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/AjaniTest.java new file mode 100644 index 00000000000..fa25073a1ad --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/planeswalker/AjaniTest.java @@ -0,0 +1,90 @@ +/* + * 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 org.mage.test.cards.planeswalker; + +import mage.constants.PhaseStep; +import mage.constants.Zone; +import mage.counters.CounterType; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class AjaniTest extends CardTestPlayerBase { + + @Test + public void CastAjani() { + // +1: You gain 2 life. + // -1: Put a +1/+1 counter on each creature you control. Those creatures gain vigilance until end of turn. + // -6: Put a white Avatar creature token onto the battlefield. It has "This creature's power and toughness are each equal to your life total." + addCard(Zone.HAND, playerA, "Ajani Goldmane"); // {2}{W}{W} starts with 4 Loyality counters + addCard(Zone.BATTLEFIELD, playerA, "Plains", 4); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ajani Goldmane"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: You gain 2 life"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Ajani Goldmane", 1); + assertCounterCount("Ajani Goldmane", CounterType.LOYALTY, 5); // 4 + 1 = 5 + + assertLife(playerA, 22); + assertLife(playerB, 20); + } + + @Test + public void CastAjaniWithOathOfGideon() { + // +1: You gain 2 life. + // -1: Put a +1/+1 counter on each creature you control. Those creatures gain vigilance until end of turn. + // -6: Put a white Avatar creature token onto the battlefield. It has "This creature's power and toughness are each equal to your life total." + addCard(Zone.HAND, playerA, "Ajani Goldmane"); // {2}{W}{W} starts with 4 Loyality counters + // When Oath of Gideon enters the battlefield, put two 1/1 Kor Ally creature tokens onto the battlefield. + // Each planeswalker you control enters the battlefield with an additional loyalty counter on it. + addCard(Zone.HAND, playerA, "Oath of Gideon"); // {2}{W} + addCard(Zone.BATTLEFIELD, playerA, "Plains", 7); + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oath of Gideon"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ajani Goldmane"); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: You gain 2 life"); + + setStopAt(1, PhaseStep.BEGIN_COMBAT); + execute(); + + assertPermanentCount(playerA, "Kor Ally", 2); + assertPermanentCount(playerA, "Oath of Gideon", 1); + assertPermanentCount(playerA, "Ajani Goldmane", 1); + assertCounterCount("Ajani Goldmane", CounterType.LOYALTY, 6); // 5 + 1 = 5 + + assertLife(playerA, 22); + assertLife(playerB, 20); + } + +}