From 9e3ef31b4b79d0b47043a7e840ce32ea4bd4d4a7 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 4 Nov 2015 09:29:08 +0200 Subject: [PATCH 1/6] Implement cards: Apes of Rath, Endless Scream, Fool's Tome, and Fylamarid --- .../src/mage/sets/tempest/ApesOfRath.java | 63 +++++++++++++ .../src/mage/sets/tempest/EndlessScream.java | 82 +++++++++++++++++ .../src/mage/sets/tempest/FoolsTome.java | 67 ++++++++++++++ .../src/mage/sets/tempest/Fylamarid.java | 88 +++++++++++++++++++ .../condition/common/HellbentCondition.java | 5 ++ Mage/src/mage/counters/CounterType.java | 1 + 6 files changed, 306 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/tempest/ApesOfRath.java create mode 100644 Mage.Sets/src/mage/sets/tempest/EndlessScream.java create mode 100644 Mage.Sets/src/mage/sets/tempest/FoolsTome.java create mode 100644 Mage.Sets/src/mage/sets/tempest/Fylamarid.java diff --git a/Mage.Sets/src/mage/sets/tempest/ApesOfRath.java b/Mage.Sets/src/mage/sets/tempest/ApesOfRath.java new file mode 100644 index 0000000000..9716244bdb --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/ApesOfRath.java @@ -0,0 +1,63 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.DontUntapInControllersNextUntapStepSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class ApesOfRath extends CardImpl { + + public ApesOfRath(UUID ownerId) { + super(ownerId, 108, "Apes of Rath", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Ape"); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Whenever Apes of Rath attacks, it doesn't untap during its controller's next untap step. + this.addAbility(new AttacksTriggeredAbility(new DontUntapInControllersNextUntapStepSourceEffect(), false)); + } + + public ApesOfRath(final ApesOfRath card) { + super(card); + } + + @Override + public ApesOfRath copy() { + return new ApesOfRath(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/EndlessScream.java b/Mage.Sets/src/mage/sets/tempest/EndlessScream.java new file mode 100644 index 0000000000..0b9e96f422 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/EndlessScream.java @@ -0,0 +1,82 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.CountersCount; +import mage.abilities.dynamicvalue.common.CountersCount; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.EntersBattlefieldWithXCountersEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +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.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class EndlessScream extends CardImpl { + + public EndlessScream(UUID ownerId) { + super(ownerId, 26, "Endless Scream", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{X}{B}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Endless Scream enters the battlefield with X scream counters on it. + this.addAbility(new EntersBattlefieldAbility(new EntersBattlefieldWithXCountersEffect(CounterType.SCREAM.createInstance()))); + // Enchanted creature gets +1/+0 for each scream counter on Endless Scream. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(new CountersCount(CounterType.SCREAM), new StaticValue(0), Duration.WhileOnBattlefield))); + } + + public EndlessScream(final EndlessScream card) { + super(card); + } + + @Override + public EndlessScream copy() { + return new EndlessScream(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/FoolsTome.java b/Mage.Sets/src/mage/sets/tempest/FoolsTome.java new file mode 100644 index 0000000000..0e242c64b7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/FoolsTome.java @@ -0,0 +1,67 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.common.HellbentCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalActivatedAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class FoolsTome extends CardImpl { + + public FoolsTome(UUID ownerId) { + super(ownerId, 279, "Fool's Tome", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}"); + this.expansionSetCode = "TMP"; + + // {2}, {tap}: Draw a card. Activate this ability only if you have no cards in hand. + Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), + new ManaCostsImpl("{2}"), HellbentCondition.getInstance()); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + } + + public FoolsTome(final FoolsTome card) { + super(card); + } + + @Override + public FoolsTome copy() { + return new FoolsTome(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/Fylamarid.java b/Mage.Sets/src/mage/sets/tempest/Fylamarid.java new file mode 100644 index 0000000000..38c20f6172 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Fylamarid.java @@ -0,0 +1,88 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleEvasionAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.abilities.effects.common.continuous.BecomesColorTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class Fylamarid extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLUE)); + } + + public Fylamarid(UUID ownerId) { + super(ownerId, 64, "Fylamarid", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Squid"); + this.subtype.add("Beast"); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Fylamarid can't be blocked by blue creatures. + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + // {U}: Target creature becomes blue until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorTargetEffect(ObjectColor.BLUE, + Duration.EndOfTurn), new ManaCostsImpl("{U}")); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public Fylamarid(final Fylamarid card) { + super(card); + } + + @Override + public Fylamarid copy() { + return new Fylamarid(this); + } +} diff --git a/Mage/src/mage/abilities/condition/common/HellbentCondition.java b/Mage/src/mage/abilities/condition/common/HellbentCondition.java index 598c207fd4..842e960e50 100644 --- a/Mage/src/mage/abilities/condition/common/HellbentCondition.java +++ b/Mage/src/mage/abilities/condition/common/HellbentCondition.java @@ -43,4 +43,9 @@ public class HellbentCondition implements Condition { public boolean apply(Game game, Ability source) { return game.getPlayer(source.getControllerId()).getHand().size() == 0; } + + @Override + public String toString() { + return "if you have no cards in hand"; + } } diff --git a/Mage/src/mage/counters/CounterType.java b/Mage/src/mage/counters/CounterType.java index 907e0cc852..6b5335c246 100644 --- a/Mage/src/mage/counters/CounterType.java +++ b/Mage/src/mage/counters/CounterType.java @@ -88,6 +88,7 @@ public enum CounterType { POISON("poison"), PRESSURE("pressure"), QUEST("quest"), + SCREAM("scream"), SHELL("shell"), SHIELD("shield"), SHRED("shred"), From 2080ad3ab85644e386f68a165cccc0e3d223fade Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 4 Nov 2015 10:40:07 +0200 Subject: [PATCH 2/6] Add CastOnlyIfYouHaveCastAnotherSpellEffect and use it for existing cards. Implement card: Skyshroud Condor --- .../fatereforged/HewedStoneRetainers.java | 47 +---------- .../sets/planechase2012/IllusoryAngel.java | 51 ++---------- .../mage/sets/tempest/SkyshroudCondor.java | 67 ++++++++++++++++ ...stOnlyIfYouHaveCastAnotherSpellEffect.java | 79 +++++++++++++++++++ 4 files changed, 153 insertions(+), 91 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/SkyshroudCondor.java create mode 100644 Mage/src/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java diff --git a/Mage.Sets/src/mage/sets/fatereforged/HewedStoneRetainers.java b/Mage.Sets/src/mage/sets/fatereforged/HewedStoneRetainers.java index 4a9df6b278..8d2e26b6d0 100644 --- a/Mage.Sets/src/mage/sets/fatereforged/HewedStoneRetainers.java +++ b/Mage.Sets/src/mage/sets/fatereforged/HewedStoneRetainers.java @@ -29,18 +29,12 @@ package mage.sets.fatereforged; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.ruleModifying.CastOnlyIfYouHaveCastAnotherSpellEffect; 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.game.Game; -import mage.game.events.GameEvent; -import mage.watchers.common.CastSpellLastTurnWatcher; /** * @@ -56,7 +50,7 @@ public class HewedStoneRetainers extends CardImpl { this.toughness = new MageInt(4); // Cast Hewed Stone Retainers only if you've cast another spell this turn. - this.addAbility(new SimpleStaticAbility(Zone.ALL, new HewedStoneRetainersEffect())); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastOnlyIfYouHaveCastAnotherSpellEffect())); } public HewedStoneRetainers(final HewedStoneRetainers card) { @@ -69,40 +63,3 @@ public class HewedStoneRetainers extends CardImpl { } } -class HewedStoneRetainersEffect extends ContinuousRuleModifyingEffectImpl { - HewedStoneRetainersEffect() { - super(Duration.EndOfGame, Outcome.Detriment); - staticText = "Cast {this} only if you've cast another spell this turn"; - } - - HewedStoneRetainersEffect(final HewedStoneRetainersEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.CAST_SPELL; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getSourceId().equals(source.getSourceId())) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); - if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0) { - return true; - } - } - return false; - - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public HewedStoneRetainersEffect copy() { - return new HewedStoneRetainersEffect(this); - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/planechase2012/IllusoryAngel.java b/Mage.Sets/src/mage/sets/planechase2012/IllusoryAngel.java index 81f8242dc1..b7038bd470 100644 --- a/Mage.Sets/src/mage/sets/planechase2012/IllusoryAngel.java +++ b/Mage.Sets/src/mage/sets/planechase2012/IllusoryAngel.java @@ -28,21 +28,14 @@ package mage.sets.planechase2012; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.ruleModifying.CastOnlyIfYouHaveCastAnotherSpellEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.watchers.common.CastSpellLastTurnWatcher; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; /** * @@ -55,7 +48,6 @@ public class IllusoryAngel extends CardImpl { this.expansionSetCode = "PC2"; this.subtype.add("Angel"); this.subtype.add("Illusion"); - this.power = new MageInt(4); this.toughness = new MageInt(4); @@ -63,7 +55,7 @@ public class IllusoryAngel extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Cast Illusory Angel only if you've cast another spell this turn. - this.addAbility(new SimpleStaticAbility(Zone.ALL, new IllusoryAngelEffect())); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastOnlyIfYouHaveCastAnotherSpellEffect())); } public IllusoryAngel(final IllusoryAngel card) { @@ -75,36 +67,3 @@ public class IllusoryAngel extends CardImpl { return new IllusoryAngel(this); } } - -class IllusoryAngelEffect extends ContinuousRuleModifyingEffectImpl { - IllusoryAngelEffect() { - super(Duration.EndOfGame, Outcome.Detriment); - staticText = "Cast {this} only if you've cast another spell this turn"; - } - - IllusoryAngelEffect(final IllusoryAngelEffect effect) { - super(effect); - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.CAST_SPELL; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getSourceId().equals(source.getSourceId())) { - CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); - if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0) { - return true; - } - } - return false; - - } - - @Override - public IllusoryAngelEffect copy() { - return new IllusoryAngelEffect(this); - } -} diff --git a/Mage.Sets/src/mage/sets/tempest/SkyshroudCondor.java b/Mage.Sets/src/mage/sets/tempest/SkyshroudCondor.java new file mode 100644 index 0000000000..79ba487f4d --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/SkyshroudCondor.java @@ -0,0 +1,67 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.ruleModifying.CastOnlyIfYouHaveCastAnotherSpellEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class SkyshroudCondor extends CardImpl { + + public SkyshroudCondor(UUID ownerId) { + super(ownerId, 88, "Skyshroud Condor", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Bird"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Cast Skyshroud Condor only if you've cast another spell this turn. + this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastOnlyIfYouHaveCastAnotherSpellEffect())); + } + + public SkyshroudCondor(final SkyshroudCondor card) { + super(card); + } + + @Override + public SkyshroudCondor copy() { + return new SkyshroudCondor(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java b/Mage/src/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java new file mode 100644 index 0000000000..072e2360ef --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java @@ -0,0 +1,79 @@ +/* + * 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.abilities.effects.common.ruleModifying; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.watchers.common.CastSpellLastTurnWatcher; + +/** + * + * @author LoneFox + */ + +public class CastOnlyIfYouHaveCastAnotherSpellEffect extends ContinuousRuleModifyingEffectImpl { + public CastOnlyIfYouHaveCastAnotherSpellEffect() { + super(Duration.EndOfGame, Outcome.Detriment); + staticText = "Cast {this} only if you've cast another spell this turn"; + } + + public CastOnlyIfYouHaveCastAnotherSpellEffect(final CastOnlyIfYouHaveCastAnotherSpellEffect effect) { + super(effect); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if (event.getSourceId().equals(source.getSourceId())) { + CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher"); + if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0) { + return true; + } + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public CastOnlyIfYouHaveCastAnotherSpellEffect copy() { + return new CastOnlyIfYouHaveCastAnotherSpellEffect(this); + } +} From c5617cf09aef84700783ea7482968171ab023f44 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 4 Nov 2015 10:41:10 +0200 Subject: [PATCH 3/6] Remove unnecessary custom effect class from Divine Offering. Implement card: Serene Offering --- .../sets/mirrodinbesieged/DivineOffering.java | 56 +++------------- .../src/mage/sets/tempest/SereneOffering.java | 66 +++++++++++++++++++ 2 files changed, 74 insertions(+), 48 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/SereneOffering.java diff --git a/Mage.Sets/src/mage/sets/mirrodinbesieged/DivineOffering.java b/Mage.Sets/src/mage/sets/mirrodinbesieged/DivineOffering.java index 8dd821a21b..f0f805c5b0 100644 --- a/Mage.Sets/src/mage/sets/mirrodinbesieged/DivineOffering.java +++ b/Mage.Sets/src/mage/sets/mirrodinbesieged/DivineOffering.java @@ -28,19 +28,14 @@ package mage.sets.mirrodinbesieged; import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.dynamicvalue.common.TargetConvertedManaCost; +import mage.abilities.effects.Effect; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.GainLifeEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.filter.FilterPermanent; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.TargetPermanent; +import mage.target.common.TargetArtifactPermanent; /** * @@ -48,21 +43,17 @@ import mage.target.TargetPermanent; */ public class DivineOffering extends CardImpl { - private final static FilterPermanent filter = new FilterPermanent("artifact"); - - static { - filter.add(new CardTypePredicate(CardType.ARTIFACT)); - } - public DivineOffering(UUID ownerId) { super(ownerId, 5, "Divine Offering", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{W}"); this.expansionSetCode = "MBS"; // Destroy target artifact. You gain life equal to its converted mana cost. - this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addEffect(new DestroyTargetEffect()); - this.getSpellAbility().addEffect(new DivineOfferingEffect()); + Effect effect = new GainLifeEffect(new TargetConvertedManaCost()); + effect.setText("You gain life equal to its converted mana cost"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetArtifactPermanent()); } public DivineOffering(final DivineOffering card) { @@ -73,35 +64,4 @@ public class DivineOffering extends CardImpl { public DivineOffering copy() { return new DivineOffering(this); } - - private class DivineOfferingEffect extends OneShotEffect { - - public DivineOfferingEffect() { - super(Outcome.DestroyPermanent); - staticText = "You gain life equal to its converted mana cost"; - } - - public DivineOfferingEffect(DivineOfferingEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent artifact = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); - if (artifact != null) { - int cost = artifact.getManaCost().convertedManaCost(); - Player player = game.getPlayer(source.getControllerId()); - if (player != null) { - player.gainLife(cost, game); - } - } - return true; - } - - @Override - public DivineOfferingEffect copy() { - return new DivineOfferingEffect(this); - } - - } } diff --git a/Mage.Sets/src/mage/sets/tempest/SereneOffering.java b/Mage.Sets/src/mage/sets/tempest/SereneOffering.java new file mode 100644 index 0000000000..c0d9c5746b --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/SereneOffering.java @@ -0,0 +1,66 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.dynamicvalue.common.TargetConvertedManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.common.TargetEnchantmentPermanent; + +/** + * + * @author LoneFox + */ +public class SereneOffering extends CardImpl { + + public SereneOffering(UUID ownerId) { + super(ownerId, 252, "Serene Offering", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{W}"); + this.expansionSetCode = "TMP"; + + // Destroy target enchantment. You gain life equal to its converted mana cost. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + Effect effect = new GainLifeEffect(new TargetConvertedManaCost()); + effect.setText("You gain life equal to its converted mana cost"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetEnchantmentPermanent()); + } + + public SereneOffering(final SereneOffering card) { + super(card); + } + + @Override + public SereneOffering copy() { + return new SereneOffering(this); + } +} From e04db9a4b703da6699f1add8e05624868860118b Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 4 Nov 2015 11:08:32 +0200 Subject: [PATCH 4/6] Clean up Godo's Irregulars. Implement card: Flowstone Salamander --- .../saviorsofkamigawa/GodosIrregulars.java | 28 +------ .../sets/tempest/FlowstoneSalamander.java | 73 +++++++++++++++++++ 2 files changed, 76 insertions(+), 25 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/FlowstoneSalamander.java diff --git a/Mage.Sets/src/mage/sets/saviorsofkamigawa/GodosIrregulars.java b/Mage.Sets/src/mage/sets/saviorsofkamigawa/GodosIrregulars.java index f346e94a31..1abf24633d 100644 --- a/Mage.Sets/src/mage/sets/saviorsofkamigawa/GodosIrregulars.java +++ b/Mage.Sets/src/mage/sets/saviorsofkamigawa/GodosIrregulars.java @@ -39,9 +39,6 @@ import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.BlockingAttackerIdPredicate; -import mage.filter.predicate.permanent.BlockingPredicate; -import mage.game.Game; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; /** @@ -50,14 +47,6 @@ import mage.target.common.TargetCreaturePermanent; */ public class GodosIrregulars extends CardImpl { - private static final FilterCreaturePermanent basicFilter = new FilterCreaturePermanent("creature blocking it"); - - static { - basicFilter.add(new BlockingPredicate()); - } - - public UUID originalAbilityIdToAdjust; - public GodosIrregulars(UUID ownerId) { super(ownerId, 101, "Godo's Irregulars", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}"); this.expansionSetCode = "SOK"; @@ -69,25 +58,14 @@ public class GodosIrregulars extends CardImpl { // {R}: Godo's Irregulars deals 1 damage to target creature blocking it. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R")); - ability.addTarget(new TargetCreaturePermanent()); - originalAbilityIdToAdjust = ability.getOriginalId(); + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature blocking it"); + filter.add(new BlockingAttackerIdPredicate(this.getId())); + ability.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability); } - @Override - public void adjustTargets(Ability ability, Game game) { - if (originalAbilityIdToAdjust.equals(ability.getOriginalId())) { - ability.getTargets().clear(); - FilterCreaturePermanent filter = basicFilter.copy(); - filter.add(new BlockingAttackerIdPredicate(this.getId())); - Target target = new TargetCreaturePermanent(filter); - ability.addTarget(target); - } - } - public GodosIrregulars(final GodosIrregulars card) { super(card); - this.originalAbilityIdToAdjust = card.originalAbilityIdToAdjust; } @Override diff --git a/Mage.Sets/src/mage/sets/tempest/FlowstoneSalamander.java b/Mage.Sets/src/mage/sets/tempest/FlowstoneSalamander.java new file mode 100644 index 0000000000..15ffce4603 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/FlowstoneSalamander.java @@ -0,0 +1,73 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.BlockingAttackerIdPredicate; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class FlowstoneSalamander extends CardImpl { + + public FlowstoneSalamander(UUID ownerId) { + super(ownerId, 175, "Flowstone Salamander", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Salamander"); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // {R}: Flowstone Salamander deals 1 damage to target creature blocking it. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R")); + FilterCreaturePermanent filter = new FilterCreaturePermanent("creature blocking it"); + filter.add(new BlockingAttackerIdPredicate(this.getId())); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public FlowstoneSalamander(final FlowstoneSalamander card) { + super(card); + } + + @Override + public FlowstoneSalamander copy() { + return new FlowstoneSalamander(this); + } +} From b190a73169d96555277b557f810e6c58275f56ba Mon Sep 17 00:00:00 2001 From: LoneFox Date: Wed, 4 Nov 2015 11:30:02 +0200 Subject: [PATCH 5/6] Implement cards: Canyon Drake, Havoc, Pit Imp, and Safeguard --- .../src/mage/sets/tempest/CanyonDrake.java | 73 +++++++++++++++++++ Mage.Sets/src/mage/sets/tempest/Havoc.java | 73 +++++++++++++++++++ Mage.Sets/src/mage/sets/tempest/PitImp.java | 69 ++++++++++++++++++ .../src/mage/sets/tempest/Safeguard.java | 69 ++++++++++++++++++ 4 files changed, 284 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/tempest/CanyonDrake.java create mode 100644 Mage.Sets/src/mage/sets/tempest/Havoc.java create mode 100644 Mage.Sets/src/mage/sets/tempest/PitImp.java create mode 100644 Mage.Sets/src/mage/sets/tempest/Safeguard.java diff --git a/Mage.Sets/src/mage/sets/tempest/CanyonDrake.java b/Mage.Sets/src/mage/sets/tempest/CanyonDrake.java new file mode 100644 index 0000000000..8cdbe60df5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/CanyonDrake.java @@ -0,0 +1,73 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class CanyonDrake extends CardImpl { + + public CanyonDrake(UUID ownerId) { + super(ownerId, 166, "Canyon Drake", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{R}{R}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Drake"); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // {1}, Discard a card at random: Canyon Drake gets +2/+0 until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}")); + ability.addCost(new DiscardCardCost(true)); + this.addAbility(ability); + } + + public CanyonDrake(final CanyonDrake card) { + super(card); + } + + @Override + public CanyonDrake copy() { + return new CanyonDrake(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/Havoc.java b/Mage.Sets/src/mage/sets/tempest/Havoc.java new file mode 100644 index 0000000000..9fa6a6ae8a --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Havoc.java @@ -0,0 +1,73 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.common.SpellCastOpponentTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.SetTargetPointer; +import mage.constants.Zone; +import mage.filter.FilterSpell; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author LoneFox + */ +public class Havoc extends CardImpl { + + private final static FilterSpell filter = new FilterSpell("a white spell"); + + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + + public Havoc(UUID ownerId) { + super(ownerId, 181, "Havoc", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}"); + this.expansionSetCode = "TMP"; + + // Whenever an opponent casts a white spell, he or she loses 2 life. + Effect effect = new LoseLifeTargetEffect(2); + effect.setText("he or she loses 2 life"); + this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, effect, filter, false, SetTargetPointer.PLAYER)); + } + + public Havoc(final Havoc card) { + super(card); + } + + @Override + public Havoc copy() { + return new Havoc(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/PitImp.java b/Mage.Sets/src/mage/sets/tempest/PitImp.java new file mode 100644 index 0000000000..c2ed9d8b2f --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/PitImp.java @@ -0,0 +1,69 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.LimitedTimesPerTurnActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class PitImp extends CardImpl { + + public PitImp(UUID ownerId) { + super(ownerId, 42, "Pit Imp", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Imp"); + this.power = new MageInt(0); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // {B}: Pit Imp gets +1/+0 until end of turn. Activate this ability no more than twice each turn. + this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,0,Duration.EndOfTurn), new ManaCostsImpl("{B}"), 2)); + } + + public PitImp(final PitImp card) { + super(card); + } + + @Override + public PitImp copy() { + return new PitImp(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/Safeguard.java b/Mage.Sets/src/mage/sets/tempest/Safeguard.java new file mode 100644 index 0000000000..0b8df61487 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Safeguard.java @@ -0,0 +1,69 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.PreventDamageByTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class Safeguard extends CardImpl { + + public Safeguard(UUID ownerId) { + super(ownerId, 251, "Safeguard", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{W}"); + this.expansionSetCode = "TMP"; + + // {2}{W}: Prevent all combat damage that would be dealt by target creature this turn. + Effect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true); + effect.setText("Prevent all combat damage that would be dealt by target creature this turn."); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{2}{W}")); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + public Safeguard(final Safeguard card) { + super(card); + } + + @Override + public Safeguard copy() { + return new Safeguard(this); + } +} From fde9ae68dc0cb099b4876b2a8a73e3371d76ec93 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Fri, 6 Nov 2015 09:19:47 +0200 Subject: [PATCH 6/6] Extract DestroyTargetAtBeginningOfNextEndStepEffect from Stone Giant to its own file. Implement cards: Blood Frenzy, Flowstone Sculpture, Imps' Taunt, and Mogg Cannon --- .../src/mage/sets/magic2010/StoneGiant.java | 45 +----- .../src/mage/sets/tempest/BloodFrenzy.java | 119 +++++++++++++++ .../mage/sets/tempest/FlowstoneSculpture.java | 52 +++++++ .../src/mage/sets/tempest/ImpsTaunt.java | 64 ++++++++ .../src/mage/sets/tempest/MoggCannon.java | 76 +++++++++ .../vintagemasters/FlowstoneSculpture.java | 144 ++++++++++++++++++ ...yTargetAtBeginningOfNextEndStepEffect.java | 69 +++++++++ 7 files changed, 530 insertions(+), 39 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java create mode 100644 Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java create mode 100644 Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java create mode 100644 Mage.Sets/src/mage/sets/tempest/MoggCannon.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java create mode 100644 Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java diff --git a/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java b/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java index c43cc027e9..f377e69b98 100644 --- a/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java +++ b/Mage.Sets/src/mage/sets/magic2010/StoneGiant.java @@ -28,26 +28,22 @@ package mage.sets.magic2010; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.targetpointer.FixedTarget; /** * @@ -68,7 +64,7 @@ public class StoneGiant extends CardImpl { new TapSourceCost()); ability.addTarget(new StoneGiantTarget()); // Destroy that creature at the beginning of the next end step. - ability.addEffect(new StoneGiantEffect()); + ability.addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); this.addAbility(ability); } @@ -109,32 +105,3 @@ class StoneGiantTarget extends TargetPermanent { return false; } } - -class StoneGiantEffect extends OneShotEffect { - - public StoneGiantEffect() { - super(Outcome.Detriment); - this.staticText = "Destroy that creature at the beginning of the next end step"; - } - - public StoneGiantEffect(final StoneGiantEffect effect) { - super(effect); - } - - @Override - public StoneGiantEffect copy() { - return new StoneGiantEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - DestroyTargetEffect effect = new DestroyTargetEffect(); - effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); - AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); - delayedAbility.setSourceId(source.getSourceId()); - delayedAbility.setControllerId(source.getControllerId()); - delayedAbility.setSourceObject(source.getSourceObject(game), game); - game.addDelayedTriggeredAbility(delayedAbility); - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java b/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java new file mode 100644 index 0000000000..1409650117 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/BloodFrenzy.java @@ -0,0 +1,119 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.PhaseStep; +import mage.constants.Rarity; +import mage.constants.TurnPhase; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetAttackingOrBlockingCreature; + +/** + * + * @author LoneFox + */ +public class BloodFrenzy extends CardImpl { + + public BloodFrenzy(UUID ownerId) { + super(ownerId, 164, "Blood Frenzy", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}"); + this.expansionSetCode = "TMP"; + + // Cast Blood Frenzy only before the combat damage step. + Ability ability = new SimpleStaticAbility(Zone.ALL, new BloodFrenzyCastRestriction()); + ability.setRuleAtTheTop(true); + this.addAbility(ability); + // Target attacking or blocking creature gets +4/+0 until end of turn. Destroy that creature at the beginning of the next end step. + this.getSpellAbility().addEffect(new BoostTargetEffect(4, 0, Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); + this.getSpellAbility().addTarget(new TargetAttackingOrBlockingCreature()); + } + + public BloodFrenzy(final BloodFrenzy card) { + super(card); + } + + @Override + public BloodFrenzy copy() { + return new BloodFrenzy(this); + } +} + + +class BloodFrenzyCastRestriction extends ContinuousRuleModifyingEffectImpl { + + BloodFrenzyCastRestriction() { + super(Duration.EndOfGame, Outcome.Detriment); + staticText = "Cast {this} only before the combat damage step"; + } + + BloodFrenzyCastRestriction(final BloodFrenzyCastRestriction effect) { + super(effect); + } + + @Override + public BloodFrenzyCastRestriction copy() { + return new BloodFrenzyCastRestriction(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType().equals(GameEvent.EventType.CAST_SPELL); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + if(event.getSourceId().equals(source.getSourceId())) { + if(game.getPhase().getType().equals(TurnPhase.COMBAT) + // There cannot be a legal target before declare attackers, + // so in practice it is limited to these two steps. + && (game.getStep().getType().equals(PhaseStep.DECLARE_ATTACKERS) + || game.getStep().getType().equals(PhaseStep.DECLARE_BLOCKERS))) { + return false; + } + return true; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java b/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java new file mode 100644 index 0000000000..cc468438c4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/FlowstoneSculpture.java @@ -0,0 +1,52 @@ +/* + * 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.tempest; + +import java.util.UUID; + +/** + * + * @author LoneFox + */ +public class FlowstoneSculpture extends mage.sets.vintagemasters.FlowstoneSculpture { + + public FlowstoneSculpture(UUID ownerId) { + super(ownerId); + this.cardNumber = 278; + this.expansionSetCode = "TMP"; + } + + public FlowstoneSculpture(final FlowstoneSculpture card) { + super(card); + } + + @Override + public FlowstoneSculpture copy() { + return new FlowstoneSculpture(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java b/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java new file mode 100644 index 0000000000..19e76245e1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/ImpsTaunt.java @@ -0,0 +1,64 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.effects.common.combat.AttacksIfAbleTargetEffect; +import mage.abilities.keyword.BuybackAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class ImpsTaunt extends CardImpl { + + public ImpsTaunt(UUID ownerId) { + super(ownerId, 32, "Imps' Taunt", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}"); + this.expansionSetCode = "TMP"; + + // Buyback {3} + this.addAbility(new BuybackAbility("{3}")); + // Target creature attacks this turn if able. + this.getSpellAbility().addEffect(new AttacksIfAbleTargetEffect(Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public ImpsTaunt(final ImpsTaunt card) { + super(card); + } + + @Override + public ImpsTaunt copy() { + return new ImpsTaunt(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/MoggCannon.java b/Mage.Sets/src/mage/sets/tempest/MoggCannon.java new file mode 100644 index 0000000000..45a20e8f8f --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/MoggCannon.java @@ -0,0 +1,76 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class MoggCannon extends CardImpl { + + public MoggCannon(UUID ownerId) { + super(ownerId, 288, "Mogg Cannon", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "TMP"; + + // {tap}: Target creature you control gets +1/+0 and gains flying until end of turn. Destroy that creature at the beginning of the next end step. + Effect effect = new BoostTargetEffect(1, 0, Duration.EndOfTurn); + effect.setText("target creature you control gets +1/+0"); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapSourceCost()); + effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and gains flying until end of turn"); + ability.addEffect(effect); + ability.addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect()); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + public MoggCannon(final MoggCannon card) { + super(card); + } + + @Override + public MoggCannon copy() { + return new MoggCannon(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java b/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java new file mode 100644 index 0000000000..6d67f89d7a --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/FlowstoneSculpture.java @@ -0,0 +1,144 @@ +/* + * 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.vintagemasters; + +import java.util.HashSet; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +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.players.Player; + +/** + * + * @author LoneFox + */ +public class FlowstoneSculpture extends CardImpl { + + public FlowstoneSculpture(UUID ownerId) { + super(ownerId, 268, "Flowstone Sculpture", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}"); + this.expansionSetCode = "VMA"; + this.subtype.add("Shapeshifter"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // {2}, Discard a card: Put a +1/+1 counter on Flowstone Sculpture or Flowstone Sculpture gains flying, first strike, or trample. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FlowstoneSculptureEffect(), new ManaCostsImpl("{2}")); + ability.addCost(new DiscardCardCost()); + this.addAbility(ability); + } + + public FlowstoneSculpture(final FlowstoneSculpture card) { + super(card); + } + + @Override + public FlowstoneSculpture copy() { + return new FlowstoneSculpture(this); + } +} + +class FlowstoneSculptureEffect extends OneShotEffect { + + private static final HashSet choices = new HashSet<>(); + + static { + choices.add("+1/+1 counter"); + choices.add("Flying"); + choices.add("First Strike"); + choices.add("Trample"); + } + + public FlowstoneSculptureEffect() { + super(Outcome.Benefit); + staticText = "Put a +1/+1 counter on {this} or {this} gains flying, first strike, or trample."; + } + + public FlowstoneSculptureEffect(final FlowstoneSculptureEffect effect) { + super(effect); + } + + @Override + public FlowstoneSculptureEffect copy() { + return new FlowstoneSculptureEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if(controller != null) { + Choice choice = new ChoiceImpl(true); + choice.setMessage("Choose ability to add"); + choice.setChoices(choices); + while(!controller.choose(outcome, choice, game)) { + if(controller.canRespond()) { + return false; + } + } + + String chosen = choice.getChoice(); + if(chosen.equals("+1/+1 counter")) { + return new AddCountersSourceEffect(CounterType.P1P1.createInstance()).apply(game, source); + } + else { + Ability gainedAbility; + if(chosen.equals("Flying")) { + gainedAbility = FlyingAbility.getInstance(); + } + else if(chosen.equals("First strike")) { + gainedAbility = FirstStrikeAbility.getInstance(); + } + else { + gainedAbility = TrampleAbility.getInstance(); + } + game.addEffect(new GainAbilitySourceEffect(gainedAbility, Duration.WhileOnBattlefield), source); + return true; + } + + } + return false; + } +} diff --git a/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java b/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java new file mode 100644 index 0000000000..02bb996773 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DestroyTargetAtBeginningOfNextEndStepEffect.java @@ -0,0 +1,69 @@ +/* + * 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.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LoneFox + */ +public class DestroyTargetAtBeginningOfNextEndStepEffect extends OneShotEffect { + + public DestroyTargetAtBeginningOfNextEndStepEffect() { + super(Outcome.Detriment); + this.staticText = "Destroy that creature at the beginning of the next end step"; + } + + public DestroyTargetAtBeginningOfNextEndStepEffect(final DestroyTargetAtBeginningOfNextEndStepEffect effect) { + super(effect); + } + + @Override + public DestroyTargetAtBeginningOfNextEndStepEffect copy() { + return new DestroyTargetAtBeginningOfNextEndStepEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + DestroyTargetEffect effect = new DestroyTargetEffect(); + effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); + AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + delayedAbility.setSourceObject(source.getSourceObject(game), game); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } +}