diff --git a/Mage.Sets/src/mage/sets/alliances/BountyOfTheHunt.java b/Mage.Sets/src/mage/sets/alliances/BountyOfTheHunt.java new file mode 100644 index 00000000000..b9d73b4a470 --- /dev/null +++ b/Mage.Sets/src/mage/sets/alliances/BountyOfTheHunt.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.alliances; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LoneFox + */ +public class BountyOfTheHunt extends mage.sets.masterseditionii.BountyOfTheHunt { + + public BountyOfTheHunt(UUID ownerId) { + super(ownerId); + this.cardNumber = 63; + this.expansionSetCode = "ALL"; + this.rarity = Rarity.UNCOMMON; + } + + public BountyOfTheHunt(final BountyOfTheHunt card) { + super(card); + } + + @Override + public BountyOfTheHunt copy() { + return new BountyOfTheHunt(this); + } +} diff --git a/Mage.Sets/src/mage/sets/alliances/Contagion.java b/Mage.Sets/src/mage/sets/alliances/Contagion.java index a4f7ee3d23a..c88002e8558 100644 --- a/Mage.Sets/src/mage/sets/alliances/Contagion.java +++ b/Mage.Sets/src/mage/sets/alliances/Contagion.java @@ -30,23 +30,18 @@ package mage.sets.alliances; import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.Mode; import mage.abilities.costs.AlternativeCostSourceAbility; import mage.abilities.costs.common.ExileFromHandCost; import mage.abilities.costs.common.PayLifeCost; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; -import mage.counters.BoostCounter; +import mage.counters.CounterType; import mage.filter.common.FilterOwnedCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardIdPredicate; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCardInHand; import mage.target.common.TargetCreaturePermanentAmount; @@ -55,7 +50,7 @@ import mage.target.common.TargetCreaturePermanentAmount; * @author Plopman */ public class Contagion extends CardImpl { - + public Contagion(UUID ownerId) { super(ownerId, 4, "Contagion", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{B}{B}"); this.expansionSetCode = "ALL"; @@ -63,15 +58,15 @@ public class Contagion extends CardImpl { FilterOwnedCard filter = new FilterOwnedCard("black card from your hand"); filter.add(new ColorPredicate(ObjectColor.BLACK)); filter.add(Predicates.not(new CardIdPredicate(this.getId()))); // the exile cost can never be paid with the card itself - + // You may pay 1 life and exile a black card from your hand rather than pay Contagion's mana cost. AlternativeCostSourceAbility ability = new AlternativeCostSourceAbility(new PayLifeCost(1)); ability.addCost(new ExileFromHandCost(new TargetCardInHand(filter))); - this.addAbility(ability); - + this.addAbility(ability); + // Distribute two -2/-1 counters among one or two target creatures. this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(2)); - this.getSpellAbility().addEffect(new DistributeCountersEffect()); + this.getSpellAbility().addEffect(new DistributeCountersEffect(CounterType.M2M1, 2, false, "one or two target creatures")); } public Contagion(final Contagion card) { @@ -83,40 +78,3 @@ public class Contagion extends CardImpl { return new Contagion(this); } } - -class DistributeCountersEffect extends OneShotEffect { - - - public DistributeCountersEffect() { - super(Outcome.UnboostCreature); - } - - public DistributeCountersEffect(final DistributeCountersEffect effect) { - super(effect); - } - - @Override - public DistributeCountersEffect copy() { - return new DistributeCountersEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target: multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - int amount = multiTarget.getTargetAmount(target); - permanent.addCounters(new BoostCounter(-2, -1, amount), game); - } - } - } - return true; - } - - @Override - public String getText(Mode mode) { - return "Distribute two -2/-1 counters among one or two target creatures"; - } -} diff --git a/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java b/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java index b2fdf9ac90e..fb08f62d85e 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/BlessingsOfNature.java @@ -28,18 +28,14 @@ package mage.sets.avacynrestored; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.abilities.keyword.MiracleAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCreaturePermanentAmount; /** @@ -54,7 +50,7 @@ public class BlessingsOfNature extends CardImpl { // Distribute four +1/+1 counters among any number of target creatures. - this.getSpellAbility().addEffect(new BlessingsOfNatureEffect()); + this.getSpellAbility().addEffect(new DistributeCountersEffect(CounterType.P1P1, 4, false, "any number of target creatures")); this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(4)); this.addAbility(new MiracleAbility(this, new ManaCostsImpl("{G}"))); @@ -69,34 +65,3 @@ public class BlessingsOfNature extends CardImpl { return new BlessingsOfNature(this); } } - -class BlessingsOfNatureEffect extends OneShotEffect { - - public BlessingsOfNatureEffect() { - super(Outcome.BoostCreature); - this.staticText = "Distribute four +1/+1 counters among any number of target creatures"; - } - - public BlessingsOfNatureEffect(final BlessingsOfNatureEffect effect) { - super(effect); - } - - @Override - public BlessingsOfNatureEffect copy() { - return new BlessingsOfNatureEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target : multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - } - } - } - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java b/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java index 39ab666cef4..5b5c93caeba 100644 --- a/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java +++ b/Mage.Sets/src/mage/sets/championsofkamigawa/JuganTheRisingStar.java @@ -29,19 +29,15 @@ package mage.sets.championsofkamigawa; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCreaturePermanentAmount; /** @@ -62,7 +58,7 @@ public class JuganTheRisingStar extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); // When Jugan, the Rising Star dies, you may distribute five +1/+1 counters among any number of target creatures. - Ability ability = new DiesTriggeredAbility(new JuganTheRisingStarMultiEffect(), true); + Ability ability = new DiesTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, 5, false, "any number of target creatures"), true); ability.addTarget(new TargetCreaturePermanentAmount(5)); this.addAbility(ability); } @@ -77,35 +73,3 @@ public class JuganTheRisingStar extends CardImpl { } } - -class JuganTheRisingStarMultiEffect extends OneShotEffect { - - public JuganTheRisingStarMultiEffect() { - super(Outcome.BoostCreature); - this.staticText = "distribute five +1/+1 counters among any number of target creatures"; - } - - public JuganTheRisingStarMultiEffect(final JuganTheRisingStarMultiEffect effect) { - super(effect); - } - - @Override - public JuganTheRisingStarMultiEffect copy() { - return new JuganTheRisingStarMultiEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target: multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - } - } - } - return true; - } - -} diff --git a/Mage.Sets/src/mage/sets/journeyintonyx/AjaniMentorOfHeroes.java b/Mage.Sets/src/mage/sets/journeyintonyx/AjaniMentorOfHeroes.java index 2fce108dbb9..8cb23a8b8a9 100644 --- a/Mage.Sets/src/mage/sets/journeyintonyx/AjaniMentorOfHeroes.java +++ b/Mage.Sets/src/mage/sets/journeyintonyx/AjaniMentorOfHeroes.java @@ -31,12 +31,11 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.LoyaltyAbility; import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.GainLifeEffect; import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; import mage.constants.Zone; @@ -47,10 +46,6 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.ControllerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.Target; import mage.target.common.TargetCreaturePermanentAmount; /** @@ -78,7 +73,7 @@ public class AjaniMentorOfHeroes extends CardImpl { this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4)); // +1: Distribute three +1/+1 counters among one, two, or three target creatures you control - Ability ability = new LoyaltyAbility(new AjaniMentorOfHeroesAddCountersEffect(), 1); + Ability ability = new LoyaltyAbility(new DistributeCountersEffect(CounterType.P1P1, 3, false, "one, two, or three target creatures you control"), 1); ability.addTarget(new TargetCreaturePermanentAmount(3, filter)); this.addAbility(ability); @@ -98,37 +93,3 @@ public class AjaniMentorOfHeroes extends CardImpl { return new AjaniMentorOfHeroes(this); } } - -class AjaniMentorOfHeroesAddCountersEffect extends OneShotEffect { - - public AjaniMentorOfHeroesAddCountersEffect() { - super(Outcome.BoostCreature); - this.staticText = "Distribute three +1/+1 counters among one, two, or three target creatures you control"; - } - - public AjaniMentorOfHeroesAddCountersEffect(final AjaniMentorOfHeroesAddCountersEffect effect) { - super(effect); - } - - @Override - public AjaniMentorOfHeroesAddCountersEffect copy() { - return new AjaniMentorOfHeroesAddCountersEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target : multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - game.informPlayers(new StringBuilder(controller.getLogName()).append(" puts ").append(multiTarget.getTargetAmount(target)).append(" ").append(CounterType.P1P1.getName().toLowerCase()).append(" counter on ").append(permanent.getName()).toString()); - } - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/AbzanCharm.java b/Mage.Sets/src/mage/sets/khansoftarkir/AbzanCharm.java index 8294c22e25f..23f53bab6bc 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/AbzanCharm.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/AbzanCharm.java @@ -28,23 +28,18 @@ package mage.sets.khansoftarkir; import java.util.UUID; -import mage.abilities.Ability; import mage.abilities.Mode; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; import mage.filter.Filter; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanentAmount; @@ -78,7 +73,7 @@ public class AbzanCharm extends CardImpl { // *Distribute two +1/+1 counters among one or two target creatures. mode = new Mode(); - mode.getEffects().add(new AbzanCharmDistributeEffect()); + mode.getEffects().add(new DistributeCountersEffect(CounterType.P1P1, 2, false, "one or two target creatures")); mode.getTargets().add(new TargetCreaturePermanentAmount(2)); this.getSpellAbility().addMode(mode); @@ -93,34 +88,3 @@ public class AbzanCharm extends CardImpl { return new AbzanCharm(this); } } - -class AbzanCharmDistributeEffect extends OneShotEffect { - - public AbzanCharmDistributeEffect() { - super(Outcome.BoostCreature); - this.staticText = "Distribute two +1/+1 counters among one or two target creatures"; - } - - public AbzanCharmDistributeEffect(final AbzanCharmDistributeEffect effect) { - super(effect); - } - - @Override - public AbzanCharmDistributeEffect copy() { - return new AbzanCharmDistributeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target : multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - } - } - } - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/khansoftarkir/ArmamentCorps.java b/Mage.Sets/src/mage/sets/khansoftarkir/ArmamentCorps.java index 66e27e47e9a..9aae2bfa5ff 100644 --- a/Mage.Sets/src/mage/sets/khansoftarkir/ArmamentCorps.java +++ b/Mage.Sets/src/mage/sets/khansoftarkir/ArmamentCorps.java @@ -31,15 +31,14 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; +import mage.constants.TargetController; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; import mage.target.common.TargetCreaturePermanentAmount; /** @@ -48,6 +47,12 @@ import mage.target.common.TargetCreaturePermanentAmount; */ public class ArmamentCorps extends CardImpl { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } + public ArmamentCorps(UUID ownerId) { super(ownerId, 165, "Armament Corps", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}{B}{G}"); this.expansionSetCode = "KTK"; @@ -58,8 +63,8 @@ public class ArmamentCorps extends CardImpl { this.toughness = new MageInt(4); // When Armament Corps enters the battlefield, distribute two +1/+1 counters among one or two target creatures you control. - Ability ability = new EntersBattlefieldTriggeredAbility(new ArmamentCorpsDistributeEffect(), false); - ability.addTarget(new TargetCreaturePermanentAmount(2)); + Ability ability = new EntersBattlefieldTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, 2, false, "one or two target creatures you control"), false); + ability.addTarget(new TargetCreaturePermanentAmount(2, filter)); this.addAbility(ability); } @@ -72,34 +77,3 @@ public class ArmamentCorps extends CardImpl { return new ArmamentCorps(this); } } - -class ArmamentCorpsDistributeEffect extends OneShotEffect { - - public ArmamentCorpsDistributeEffect() { - super(Outcome.BoostCreature); - this.staticText = "Distribute two +1/+1 counters among one or two target creatures"; - } - - public ArmamentCorpsDistributeEffect(final ArmamentCorpsDistributeEffect effect) { - super(effect); - } - - @Override - public ArmamentCorpsDistributeEffect copy() { - return new ArmamentCorpsDistributeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target : multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - } - } - } - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/masterseditionii/BountyOfTheHunt.java b/Mage.Sets/src/mage/sets/masterseditionii/BountyOfTheHunt.java new file mode 100644 index 00000000000..d95658f3157 --- /dev/null +++ b/Mage.Sets/src/mage/sets/masterseditionii/BountyOfTheHunt.java @@ -0,0 +1,77 @@ +/* + * 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.masterseditionii; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.costs.AlternativeCostSourceAbility; +import mage.abilities.costs.common.ExileFromHandCost; +import mage.abilities.effects.common.counter.DistributeCountersEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.common.TargetCardInHand; +import mage.target.common.TargetCreaturePermanentAmount; + +/** + * + * @author LoneFox + */ +public class BountyOfTheHunt extends CardImpl { + + private static final FilterCard filter = new FilterCard("a green card from your hand"); + + static { + filter.add(new ColorPredicate(ObjectColor.GREEN)); + } + + + public BountyOfTheHunt(UUID ownerId) { + super(ownerId, 154, "Bounty of the Hunt", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{3}{G}{G}"); + this.expansionSetCode = "ME2"; + + // You may exile a green card from your hand rather than pay Bounty of the Hunt's mana cost. + this.addAbility(new AlternativeCostSourceAbility(new ExileFromHandCost(new TargetCardInHand(filter)))); + + // Distribute three +1/+1 counters among one, two, or three target creatures. For each +1/+1 counter you put on a creature this way, remove a +1/+1 counter from that creature at the beginning of the next cleanup step. + this.getSpellAbility().addEffect(new DistributeCountersEffect(CounterType.P1P1, 3, true, "one, two, or three target creatures")); + this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(3)); + } + + public BountyOfTheHunt(final BountyOfTheHunt card) { + super(card); + } + + @Override + public BountyOfTheHunt copy() { + return new BountyOfTheHunt(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mirrodin/WurmskinForger.java b/Mage.Sets/src/mage/sets/mirrodin/WurmskinForger.java new file mode 100644 index 00000000000..6e685c0ffc5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/mirrodin/WurmskinForger.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.mirrodin; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.counter.DistributeCountersEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanentAmount; + +/** + * + * @author LoneFox + */ +public class WurmskinForger extends CardImpl { + + public WurmskinForger(UUID ownerId) { + super(ownerId, 140, "Wurmskin Forger", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{G}{G}"); + this.expansionSetCode = "MRD"; + this.subtype.add("Elf"); + this.subtype.add("Warrior"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // When Wurmskin Forger enters the battlefield, distribute three +1/+1 counters among one, two, or three target creatures. + Ability ability = new EntersBattlefieldTriggeredAbility(new DistributeCountersEffect(CounterType.P1P1, 3, false, "one, two, or three target creatures"), false); + ability.addTarget(new TargetCreaturePermanentAmount(3)); + this.addAbility(ability); + } + + public WurmskinForger(final WurmskinForger card) { + super(card); + } + + @java.lang.Override + public WurmskinForger copy() { + return new WurmskinForger(this); + } +} diff --git a/Mage.Sets/src/mage/sets/stronghold/ElvenRite.java b/Mage.Sets/src/mage/sets/stronghold/ElvenRite.java index 02f5e410088..70eb510639b 100644 --- a/Mage.Sets/src/mage/sets/stronghold/ElvenRite.java +++ b/Mage.Sets/src/mage/sets/stronghold/ElvenRite.java @@ -28,16 +28,11 @@ package mage.sets.stronghold; import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.counter.DistributeCountersEffect; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.Rarity; import mage.counters.CounterType; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.common.TargetCreaturePermanentAmount; /** @@ -51,7 +46,7 @@ public class ElvenRite extends CardImpl { this.expansionSetCode = "STH"; // Distribute two +1/+1 counters among one or two target creatures. - this.getSpellAbility().addEffect(new ElvenRiteDistributeEffect()); + this.getSpellAbility().addEffect(new DistributeCountersEffect(CounterType.P1P1, 2, false, "one or two target creatures")); this.getSpellAbility().addTarget(new TargetCreaturePermanentAmount(2)); } @@ -64,34 +59,3 @@ public class ElvenRite extends CardImpl { return new ElvenRite(this); } } - -class ElvenRiteDistributeEffect extends OneShotEffect { - - public ElvenRiteDistributeEffect() { - super(Outcome.BoostCreature); - this.staticText = "Distribute two +1/+1 counters among one or two target creatures"; - } - - public ElvenRiteDistributeEffect(final ElvenRiteDistributeEffect effect) { - super(effect); - } - - @Override - public ElvenRiteDistributeEffect copy() { - return new ElvenRiteDistributeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - if (source.getTargets().size() > 0) { - Target multiTarget = source.getTargets().get(0); - for (UUID target : multiTarget.getTargets()) { - Permanent permanent = game.getPermanent(target); - if (permanent != null) { - permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game); - } - } - } - return true; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/torment/ShamblingSwarm.java b/Mage.Sets/src/mage/sets/torment/ShamblingSwarm.java new file mode 100644 index 00000000000..3cd23c9452c --- /dev/null +++ b/Mage.Sets/src/mage/sets/torment/ShamblingSwarm.java @@ -0,0 +1,68 @@ +/* + * 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.torment; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.effects.common.counter.DistributeCountersEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanentAmount; + +/** + * + * @author LoneFox + */ +public class ShamblingSwarm extends CardImpl { + + public ShamblingSwarm(UUID ownerId) { + super(ownerId, 82, "Shambling Swarm", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{B}{B}{B}"); + this.expansionSetCode = "TOR"; + this.subtype.add("Horror"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Shambling Swarm dies, distribute three -1/-1 counters among one, two, or three target creatures. For each -1/-1 counter you put on a creature this way, remove a -1/-1 counter from that creature at the beginning of the next end step. + Ability ability = new DiesTriggeredAbility(new DistributeCountersEffect(CounterType.M1M1, 3, true, "one, two, or three target creatures"), false); + ability.addTarget(new TargetCreaturePermanentAmount(3)); + this.addAbility(ability); + } + + public ShamblingSwarm(final ShamblingSwarm card) { + super(card); + } + + @Override + public ShamblingSwarm copy() { + return new ShamblingSwarm(this); + } +} diff --git a/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java new file mode 100644 index 00000000000..d1fdf6be711 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/counter/DistributeCountersEffect.java @@ -0,0 +1,154 @@ +/* + * 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.counter; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.Mode; +import mage.abilities.common.delayed.AtTheBeginOfNextCleanupDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.util.CardUtil; + +/** + * + * @author LoneFox + */ +public class DistributeCountersEffect extends OneShotEffect { + + private final CounterType counterType; + private final int amount; + private final boolean removeAtEndOfTurn; + private final String targetDescription; + + public DistributeCountersEffect(CounterType counterType, int amount, boolean removeAtEndOfTurn, String targetDescription) { + super(Outcome.BoostCreature); + this.counterType = counterType; + this.amount = amount; + this.removeAtEndOfTurn = removeAtEndOfTurn; + this.targetDescription = targetDescription; + } + + public DistributeCountersEffect(final DistributeCountersEffect effect) { + super(effect); + this.counterType = effect.counterType; + this.amount = effect.amount; + this.removeAtEndOfTurn = effect.removeAtEndOfTurn; + this.targetDescription = effect.targetDescription; + } + + @Override + public DistributeCountersEffect copy() { + return new DistributeCountersEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if(source.getTargets().size() > 0) { + Target multiTarget = source.getTargets().get(0); + for(UUID target : multiTarget.getTargets()) { + Permanent permanent = game.getPermanent(target); + if(permanent != null) { + permanent.addCounters(counterType.createInstance(multiTarget.getTargetAmount(target)), game); + } + } + + if(removeAtEndOfTurn) { + DelayedTriggeredAbility ability = new AtTheBeginOfNextCleanupDelayedTriggeredAbility( + new RemoveCountersAtEndOfTurn(counterType)); + ability.setSourceId(source.getSourceId()); + ability.setControllerId(source.getControllerId()); + ability.setSourceObject(source.getSourceObject(game), game); + ability.getTargets().addAll(source.getTargets()); + game.addDelayedTriggeredAbility(ability); + } + + return true; + } + return false; + } + + @Override + public String getText(Mode mode) { + if (!staticText.isEmpty()) { + return staticText; + } + + String name = counterType.getName(); + String text = "distribute " + CardUtil.numberToText(amount) + " " + name + " counters among " + targetDescription + "."; + if(removeAtEndOfTurn) { + text += " For each " + name + " counter you put on a creature this way, remove a " + + name + " counter from that creature at the beginning of the next cleanup step."; + } + return text; + } +} + +class RemoveCountersAtEndOfTurn extends OneShotEffect { + + private final CounterType counterType; + + public RemoveCountersAtEndOfTurn(CounterType counterType) { + super(Outcome.Detriment); + this.counterType = counterType; + String name = counterType.getName(); + staticText = "For each " + name + " counter you put on a creature this way, remove a " + + name + " counter from that creature at the beginning of the next cleanup step."; + } + + public RemoveCountersAtEndOfTurn(final RemoveCountersAtEndOfTurn effect) { + super(effect); + this.counterType = effect.counterType; + } + + @Override + public RemoveCountersAtEndOfTurn copy() { + return new RemoveCountersAtEndOfTurn(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if(source.getTargets().size() > 0) { + Target multiTarget = source.getTargets().get(0); + for(UUID target : multiTarget.getTargets()) { + Permanent permanent = game.getPermanent(target); + if(permanent != null) { + permanent.removeCounters(counterType.getName(), multiTarget.getTargetAmount(target), game); + } + } + return true; + } + return false; + } +} diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index f0091d4a2b1..afccad2b15a 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -74,6 +74,7 @@ public enum CounterType { LOYALTY("loyalty"), MANNEQUIN("mannequin"), M1M1(new BoostCounter(-1, -1).name), + M2M1(new BoostCounter(-2, -1).name), M2M2(new BoostCounter(-2, -2).name), MINING("mining"), MUSTER("muster"), @@ -153,6 +154,8 @@ public enum CounterType { return new BoostCounter(2, 2, amount); case M1M1: return new BoostCounter(-1, -1, amount); + case M2M1: + return new BoostCounter(-2, -1, amount); case M2M2: return new BoostCounter(-2, -2, amount); default: