Add DistributeCountersEffect and use it for existing cards. Fix Armament Corps, which allowed to

put counters on other players' creatures. Implement cards: Bounty of the Hunt, Shambling Swarm, and
Wurmskin Forger
This commit is contained in:
LoneFox 2015-12-15 14:11:08 +02:00
parent 6b3f61ce4c
commit 86104fa124
13 changed files with 458 additions and 283 deletions

View file

@ -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);
}
}

View file

@ -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";
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}