From 1d84f3a5b2f4d132a5a28f776696aca00efbaff1 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Sun, 2 Aug 2015 19:25:27 +0300 Subject: [PATCH 1/4] Implement cards: Addle, Ancient Kavu, Dead Ringers, and Raging Spirit --- .../src/mage/sets/apocalypse/DeadRingers.java | 102 +++++++++++++++++ Mage.Sets/src/mage/sets/invasion/Addle.java | 54 +++++++++ .../src/mage/sets/invasion/AncientKavu.java | 67 +++++++++++ .../src/mage/sets/mirage/RagingSpirit.java | 67 +++++++++++ .../src/mage/sets/vintagemasters/Addle.java | 107 ++++++++++++++++++ 5 files changed, 397 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java create mode 100644 Mage.Sets/src/mage/sets/invasion/Addle.java create mode 100644 Mage.Sets/src/mage/sets/invasion/AncientKavu.java create mode 100644 Mage.Sets/src/mage/sets/mirage/RagingSpirit.java create mode 100644 Mage.Sets/src/mage/sets/vintagemasters/Addle.java diff --git a/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java b/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java new file mode 100644 index 00000000000..60d856bbee0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java @@ -0,0 +1,102 @@ +/* + * 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.apocalypse; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class DeadRingers extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonblack creature"); + + static { + filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK))); + } + + public DeadRingers(UUID ownerId) { + super(ownerId, 37, "Dead Ringers", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{B}"); + this.expansionSetCode = "APC"; + + // Destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated. + this.getSpellAbility().addEffect(new DeadRingersEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2, filter, false)); + } + + public DeadRingers(final DeadRingers card) { + super(card); + } + + @Override + public DeadRingers copy() { + return new DeadRingers(this); + } +} + +class DeadRingersEffect extends DestroyTargetEffect { + + public DeadRingersEffect() { + super(true); + staticText = "estroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated."; + } + + public DeadRingersEffect(final DeadRingersEffect effect) { + super(effect); + } + + @Override + public DeadRingersEffect copy() { + return new DeadRingersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Target target = source.getTargets().get(0); + Permanent first = game.getPermanentOrLKIBattlefield(target.getTargets().get(0)); + Permanent second = game.getPermanentOrLKIBattlefield(target.getTargets().get(1)); + if(first != null && second != null && first.getColor(game).equals(second.getColor(game))) { + return super.apply(game, source); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/invasion/Addle.java b/Mage.Sets/src/mage/sets/invasion/Addle.java new file mode 100644 index 00000000000..c24d025e91e --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/Addle.java @@ -0,0 +1,54 @@ +/* + * 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.invasion; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class Addle extends mage.sets.vintagemasters.Addle { + + public Addle(UUID ownerId) { + super(ownerId); + this.cardNumber = 91; + this.expansionSetCode = "INV"; + this.rarity = Rarity.UNCOMMON; + } + + public Addle(final Addle card) { + super(card); + } + + @Override + public Addle copy() { + return new Addle(this); + } +} diff --git a/Mage.Sets/src/mage/sets/invasion/AncientKavu.java b/Mage.Sets/src/mage/sets/invasion/AncientKavu.java new file mode 100644 index 00000000000..9a2e595139c --- /dev/null +++ b/Mage.Sets/src/mage/sets/invasion/AncientKavu.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.invasion; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BecomesColorSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class AncientKavu extends CardImpl { + + public AncientKavu(UUID ownerId) { + super(ownerId, 136, "Ancient Kavu", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "INV"; + this.subtype.add("Kavu"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // {2}: Ancient Kavu becomes colorless until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl("{2}"))); + } + + public AncientKavu(final AncientKavu card) { + super(card); + } + + @Override + public AncientKavu copy() { + return new AncientKavu(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirage/RagingSpirit.java b/Mage.Sets/src/mage/sets/mirage/RagingSpirit.java new file mode 100644 index 00000000000..436e9f76045 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirage/RagingSpirit.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.mirage; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.BecomesColorSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LoneFox + */ +public class RagingSpirit extends CardImpl { + + public RagingSpirit(UUID ownerId) { + super(ownerId, 188, "Raging Spirit", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "MIR"; + this.subtype.add("Spirit"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // {2}: Raging Spirit becomes colorless until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesColorSourceEffect(new ObjectColor(), Duration.EndOfTurn), new ManaCostsImpl("{2}"))); + } + + public RagingSpirit(final RagingSpirit card) { + super(card); + } + + @Override + public RagingSpirit copy() { + return new RagingSpirit(this); + } +} diff --git a/Mage.Sets/src/mage/sets/vintagemasters/Addle.java b/Mage.Sets/src/mage/sets/vintagemasters/Addle.java new file mode 100644 index 00000000000..baa462bbf4e --- /dev/null +++ b/Mage.Sets/src/mage/sets/vintagemasters/Addle.java @@ -0,0 +1,107 @@ +/* + * 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.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.discard.DiscardCardYouChooseTargetEffect; +import mage.cards.CardImpl; +import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LoneFox + */ +public class Addle extends CardImpl { + + public Addle(UUID ownerId) { + super(ownerId, 103, "Addle", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}"); + this.expansionSetCode = "VMA"; + + // Choose a color. Target player reveals his or her hand and you choose a card of that color from it. That player discards that card. + this.getSpellAbility().addEffect(new AddleEffect()); + this.getSpellAbility().addTarget(new TargetPlayer()); + } + + public Addle(final Addle card) { + super(card); + } + + @Override + public Addle copy() { + return new Addle(this); + } +} + +class AddleEffect extends OneShotEffect { + + AddleEffect() { + super(Outcome.Discard); + staticText = "Choose a color. Target player reveals his or her hand and you choose a card of that color from it. That player discards that card."; + } + + AddleEffect(final AddleEffect effect) { + super(effect); + } + + @Override + public AddleEffect copy() { + return new AddleEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if(controller != null) { + ChoiceColor choice = new ChoiceColor(); + controller.choose(outcome, choice, game); + ObjectColor color = choice.getColor(); + if(color != null) { + game.informPlayers(new StringBuilder(controller.getLogName()).append(" chooses ").append(color).toString()); + FilterCard filter = new FilterCard(); + filter.add(new ColorPredicate(color)); + Effect effect = new DiscardCardYouChooseTargetEffect(filter); + return effect.apply(game, source); + } + } + return false; + } +} From 7963188f7627e34d09391061a2845641fb120e17 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Sun, 2 Aug 2015 21:13:49 +0300 Subject: [PATCH 2/4] Fix typo --- Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java b/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java index 60d856bbee0..22e8ab64b2d 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java +++ b/Mage.Sets/src/mage/sets/apocalypse/DeadRingers.java @@ -77,7 +77,7 @@ class DeadRingersEffect extends DestroyTargetEffect { public DeadRingersEffect() { super(true); - staticText = "estroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated."; + staticText = "Destroy two target nonblack creatures unless either one is a color the other isn't. They can't be regenerated."; } public DeadRingersEffect(final DeadRingersEffect effect) { From 2934942a78ee50b3cee8cb4440bafd4587e54ff7 Mon Sep 17 00:00:00 2001 From: LoneFox Date: Sun, 2 Aug 2015 22:07:16 +0300 Subject: [PATCH 3/4] Implement cards: Betrayal, Insolence, and Seizures. Fix Lust for War, which was incorrectly giving an ability to enchanted creature --- Mage.Sets/src/mage/sets/iceage/Seizures.java | 121 ++++++++++++++++++ .../src/mage/sets/planeshift/Insolence.java | 74 +++++++++++ .../sets/riseoftheeldrazi/LustForWar.java | 20 +-- Mage.Sets/src/mage/sets/visions/Betrayal.java | 81 ++++++++++++ ...BecomesTappedAttachedTriggeredAbility.java | 80 ++++++++++++ .../DamageAttachedControllerEffect.java | 88 +++++++++++++ 6 files changed, 455 insertions(+), 9 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/iceage/Seizures.java create mode 100644 Mage.Sets/src/mage/sets/planeshift/Insolence.java create mode 100644 Mage.Sets/src/mage/sets/visions/Betrayal.java create mode 100644 Mage/src/mage/abilities/common/BecomesTappedAttachedTriggeredAbility.java create mode 100644 Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java diff --git a/Mage.Sets/src/mage/sets/iceage/Seizures.java b/Mage.Sets/src/mage/sets/iceage/Seizures.java new file mode 100644 index 00000000000..5fdc2881cc2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/iceage/Seizures.java @@ -0,0 +1,121 @@ +/* + * 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.iceage; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class Seizures extends CardImpl { + + public Seizures(UUID ownerId) { + super(ownerId, 47, "Seizures", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + this.expansionSetCode = "ICE"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Whenever enchanted creature becomes tapped, Seizures deals 3 damage to that creature's controller unless that player pays {3}. + this.addAbility(new BecomesTappedAttachedTriggeredAbility(new SeizuresEffect(), false)); + } + + public Seizures(final Seizures card) { + super(card); + } + + @Override + public Seizures copy() { + return new Seizures(this); + } +} + + +class SeizuresEffect extends OneShotEffect { + + public SeizuresEffect() { + super(Outcome.Damage); + staticText = "{this} deals 3 damage to that creature's controller unless that player pays {3}"; + } + + public SeizuresEffect(final SeizuresEffect effect) { + super(effect); + } + + @Override + public SeizuresEffect copy() { + return new SeizuresEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if(enchantment == null) { + return false; + } + Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if(enchanted == null) { + return false; + } + Player player = game.getPlayer(enchanted.getControllerId()); + if(player != null) { + Cost cost = new ManaCostsImpl("{3}"); + if(cost.canPay(source, source.getSourceId(), player.getId(), game) + && player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + " to avoid damage?", source, game)) { + cost.clearPaid(); + if(cost.pay(source, game, source.getSourceId(), player.getId(), false)) { + return true; + } + } + player.damage(3, source.getSourceId(), game, false, true); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/planeshift/Insolence.java b/Mage.Sets/src/mage/sets/planeshift/Insolence.java new file mode 100644 index 00000000000..4fdcbf1b6c5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planeshift/Insolence.java @@ -0,0 +1,74 @@ +/* + * 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.planeshift; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.target.TargetPermanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; +import mage.abilities.effects.common.DamageAttachedControllerEffect; + + +/** + * + * @author LoneFox + */ +public class Insolence extends CardImpl { + + public Insolence(UUID ownerId) { + super(ownerId, 63, "Insolence", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); + this.expansionSetCode = "PLS"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Whenever enchanted creature becomes tapped, Insolence deals 2 damage to that creature's controller. + this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(2), false)); + } + + public Insolence(final Insolence card) { + super(card); + } + + @Override + public Insolence copy() { + return new Insolence(this); + } +} diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LustForWar.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LustForWar.java index 403a433405f..0f72528f309 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/LustForWar.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/LustForWar.java @@ -28,17 +28,20 @@ package mage.sets.riseoftheeldrazi; import java.util.UUID; - -import mage.constants.*; import mage.abilities.Ability; -import mage.abilities.common.BecomesTappedTriggeredAbility; +import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.AttachEffect; -import mage.abilities.effects.common.DamageControllerEffect; +import mage.abilities.effects.common.DamageAttachedControllerEffect; import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect; -import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; @@ -56,17 +59,16 @@ public class LustForWar extends CardImpl { // Enchant creature TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); - this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); // Whenever enchanted creature becomes tapped, Lust for War deals 3 damage to that creature's controller. - Ability attachedAbility = new BecomesTappedTriggeredAbility(new DamageControllerEffect(3)); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(attachedAbility, AttachmentType.AURA))); + this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DamageAttachedControllerEffect(3), false)); // Enchanted creature attacks each turn if able. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new AttacksIfAbleAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.AURA))); + new AttacksIfAbleAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.AURA))); } public LustForWar(final LustForWar card) { diff --git a/Mage.Sets/src/mage/sets/visions/Betrayal.java b/Mage.Sets/src/mage/sets/visions/Betrayal.java new file mode 100644 index 00000000000..db86ed389fc --- /dev/null +++ b/Mage.Sets/src/mage/sets/visions/Betrayal.java @@ -0,0 +1,81 @@ +/* + * 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.visions; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LoneFox + */ +public class Betrayal extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature an opponent controls"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public Betrayal(UUID ownerId) { + super(ownerId, 26, "Betrayal", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}"); + this.expansionSetCode = "VIS"; + this.subtype.add("Aura"); + + // Enchant creature an opponent controls + TargetPermanent auraTarget = new TargetCreaturePermanent(filter); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + // Whenever enchanted creature becomes tapped, you draw a card. + this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), false)); + } + + public Betrayal(final Betrayal card) { + super(card); + } + + @Override + public Betrayal copy() { + return new Betrayal(this); + } +} diff --git a/Mage/src/mage/abilities/common/BecomesTappedAttachedTriggeredAbility.java b/Mage/src/mage/abilities/common/BecomesTappedAttachedTriggeredAbility.java new file mode 100644 index 00000000000..3c09bae181c --- /dev/null +++ b/Mage/src/mage/abilities/common/BecomesTappedAttachedTriggeredAbility.java @@ -0,0 +1,80 @@ +/* + * 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.common; + +import mage.constants.Zone; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; + +/** + * + * @author LoneFox + */ +public class BecomesTappedAttachedTriggeredAbility extends TriggeredAbilityImpl { + + public BecomesTappedAttachedTriggeredAbility(Effect effect, boolean isOptional) { + super(Zone.BATTLEFIELD, effect, isOptional); + } + + public BecomesTappedAttachedTriggeredAbility(Effect effect) { + super(Zone.BATTLEFIELD, effect); + } + + public BecomesTappedAttachedTriggeredAbility(final BecomesTappedAttachedTriggeredAbility ability) { + super(ability); + } + + @Override + public BecomesTappedAttachedTriggeredAbility copy() { + return new BecomesTappedAttachedTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.TAPPED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent enchantment = game.getPermanent(this.getSourceId()); + if(enchantment == null) { + return false; + } + Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); + return enchanted != null && event.getTargetId().equals(enchanted.getId()); + } + + @Override + public String getRule() { + return "Whenever enchanted creature becomes tapped, " + super.getRule(); + } +} diff --git a/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java b/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.java new file mode 100644 index 00000000000..59d67607b10 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/DamageAttachedControllerEffect.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.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LoneFox + */ +public class DamageAttachedControllerEffect extends OneShotEffect { + + protected int amount; + + public DamageAttachedControllerEffect(int amount) { + super(Outcome.Damage); + this.amount = amount; + } + + public DamageAttachedControllerEffect(final DamageAttachedControllerEffect effect) { + super(effect); + this.amount = effect.amount; + } + + @Override + public DamageAttachedControllerEffect copy() { + return new DamageAttachedControllerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if(enchantment == null) { + return false; + } + Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo()); + if(enchanted == null) { + return false; + } + Player player = game.getPlayer(enchanted.getControllerId()); + if(player != null) { + player.damage(amount, source.getSourceId(), game, false, true); + return true; + } + return false; + } + + @Override + public String getText(Mode mode) { + if (staticText != null && !staticText.isEmpty()) { + return staticText; + } + return "{this} deals " + amount + " to that creature's controller"; + } + +} From 1ba5dbda973118c1e59fad2b830a413c5042691c Mon Sep 17 00:00:00 2001 From: LoneFox Date: Mon, 3 Aug 2015 16:06:25 +0300 Subject: [PATCH 4/4] Implement cards: Dralnu's Pet, Malicious Advice, and Mask of Intolerance --- .../sets/apocalypse/MaskOfIntolerance.java | 82 +++++++++++ .../src/mage/sets/planeshift/DralnusPet.java | 132 ++++++++++++++++++ .../mage/sets/planeshift/MaliciousAdvice.java | 91 ++++++++++++ .../dynamicvalue/common/DomainValue.java | 12 +- 4 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java create mode 100644 Mage.Sets/src/mage/sets/planeshift/DralnusPet.java create mode 100644 Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java diff --git a/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java b/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java new file mode 100644 index 00000000000..5a5cebcb196 --- /dev/null +++ b/Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.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.apocalypse; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.IntCompareCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.dynamicvalue.common.DomainValue; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.game.Game; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LoneFox + */ +public class MaskOfIntolerance extends CardImpl { + + public MaskOfIntolerance(UUID ownerId) { + super(ownerId, 138, "Mask of Intolerance", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}"); + this.expansionSetCode = "APC"; + + // At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her. + TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.ANY, false); + this.addAbility(new ConditionalTriggeredAbility(ability, new MaskOfIntoleranceCondition(), + "At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her.")); + } + + public MaskOfIntolerance(final MaskOfIntolerance card) { + super(card); + } + + @Override + public MaskOfIntolerance copy() { + return new MaskOfIntolerance(this); + } +} + +class MaskOfIntoleranceCondition extends IntCompareCondition { + + public MaskOfIntoleranceCondition() { + super(ComparisonType.GreaterThan, 3); + } + + @Override + protected int getInputValue(Game game, Ability source) { + return new DomainValue(1, game.getActivePlayerId()).calculate(game, source, null); + } +} diff --git a/Mage.Sets/src/mage/sets/planeshift/DralnusPet.java b/Mage.Sets/src/mage/sets/planeshift/DralnusPet.java new file mode 100644 index 00000000000..11e62798662 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planeshift/DralnusPet.java @@ -0,0 +1,132 @@ +/* + * 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.planeshift; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.condition.common.KickedCondition; +import mage.abilities.costs.Cost; +import mage.abilities.costs.Costs; +import mage.abilities.costs.CostsImpl; +import mage.abilities.costs.common.DiscardCardCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.EntersBattlefieldEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.KickerAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterCreatureCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LoneFox + * @author LevelX + */ +public class DralnusPet extends CardImpl { + + public DralnusPet(UUID ownerId) { + super(ownerId, 23, "Dralnu's Pet", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + this.expansionSetCode = "PLS"; + this.subtype.add("Shapeshifter"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Kicker-{2}{B}, Discard a creature card. + Costs kickerCosts = new CostsImpl<>(); + kickerCosts.add(new ManaCostsImpl<>("{2}{B}")); + kickerCosts.add(new DiscardCardCost(new FilterCreatureCard())); + this.addAbility(new KickerAbility(kickerCosts)); + // If Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost. + Ability ability = new EntersBattlefieldAbility(new DralnusPetEffect(), KickedCondition.getInstance(), true, + "If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost", ""); + ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield)); + this.addAbility(ability); + } + + public DralnusPet(final DralnusPet card) { + super(card); + } + + @Override + public DralnusPet copy() { + return new DralnusPet(this); + } +} + +class DralnusPetEffect extends OneShotEffect { + + public DralnusPetEffect() { + super(Outcome.BoostCreature); + this.staticText = "and with X +1/+1 counters on it, where X is the discarded card's converted mana cost"; + } + + public DralnusPetEffect(final DralnusPetEffect effect) { + super(effect); + } + + @Override + public DralnusPetEffect copy() { + return new DralnusPetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (controller != null && permanent != null) { + Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY); + if (obj != null && obj instanceof SpellAbility) { + int cmc = 0; + for (Cost cost : ((SpellAbility) obj).getCosts()) { + if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) { + cmc = ((DiscardCardCost) cost).getCards().get(0).getManaCost().convertedManaCost(); + } + if (cmc > 0) { + return new AddCountersSourceEffect(CounterType.P1P1.createInstance(cmc), true).apply(game, source); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java b/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java new file mode 100644 index 00000000000..9633c1f4193 --- /dev/null +++ b/Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java @@ -0,0 +1,91 @@ +/* + * 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.planeshift; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.dynamicvalue.common.ManacostVariableValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.target.TargetPermanent; + +/** + * + * @author LoneFox + */ +public class MaliciousAdvice extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("artifacts, creatures, and/or lands"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE), + new CardTypePredicate(CardType.LAND))); + } + + public MaliciousAdvice(UUID ownerId) { + super(ownerId, 114, "Malicious Advice", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{X}{U}{B}"); + this.expansionSetCode = "PLS"; + + // Tap X target artifacts, creatures, and/or lands. You lose X life. + Effect effect = new TapTargetEffect(); + effect.setText("Tap X target artifacts, creatures, and/or lands"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(new ManacostVariableValue())); + // Correct number of targets will be set in adjustTargets + // I'm not sure if/why this needs to be here, but other such cards do have it... + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + if(ability instanceof SpellAbility) { + ability.getTargets().clear(); + ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter)); + } + } + + public MaliciousAdvice(final MaliciousAdvice card) { + super(card); + } + + @Override + public MaliciousAdvice copy() { + return new MaliciousAdvice(this); + } +} diff --git a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java index ca8f4f68cc9..9d021891669 100644 --- a/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java +++ b/Mage/src/mage/abilities/dynamicvalue/common/DomainValue.java @@ -15,6 +15,7 @@ public class DomainValue implements DynamicValue { private Integer amount; private boolean countTargetPlayer; + private UUID player; public DomainValue() { this(1); @@ -33,9 +34,15 @@ public class DomainValue implements DynamicValue { this.countTargetPlayer = countTargetPlayer; } + public DomainValue(Integer amount, UUID player) { + this(amount, false); + this.player = player; + } + public DomainValue(final DomainValue dynamicValue) { this.amount = dynamicValue.amount; this.countTargetPlayer = dynamicValue.countTargetPlayer; + this.player = dynamicValue.player; } @Override @@ -46,7 +53,10 @@ public class DomainValue implements DynamicValue { int haveSwamps = 0; int haveForests = 0; UUID targetPlayer; - if (countTargetPlayer) { + if(player != null) { + targetPlayer = player; + } + else if(countTargetPlayer) { targetPlayer = sourceAbility.getTargets().getFirstTarget(); } else { targetPlayer = sourceAbility.getControllerId();