diff --git a/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java b/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java index d8d8cbebbc..3900257f47 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java +++ b/Mage.Sets/src/mage/sets/lorwyn/FodderLaunch.java @@ -36,6 +36,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageTargetControllerEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.constants.Duration; @@ -70,7 +71,7 @@ public class FodderLaunch extends CardImpl { //Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller. this.getSpellAbility().addEffect(new BoostTargetEffect(-5, -5, Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - this.getSpellAbility().addEffect(new FodderLaunchEffect()); + this.getSpellAbility().addEffect(new DamageTargetControllerEffect(5)); } public FodderLaunch(final FodderLaunch card) { @@ -83,35 +84,3 @@ public class FodderLaunch extends CardImpl { } } - -class FodderLaunchEffect extends OneShotEffect { - - public FodderLaunchEffect() { - super(Outcome.Damage); - this.staticText = "Target creature gets -5/-5 until end of turn. Fodder Launch deals 5 damage to that creature's controller."; - } - - public FodderLaunchEffect(final FodderLaunchEffect effect) { - super(effect); - } - - @Override - public FodderLaunchEffect copy() { - return new FodderLaunchEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - MageObject sourceObject = game.getObject(source.getSourceId()); - if (controller != null && sourceObject != null) { - Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); - if (targetCreature != null) { - Player controllerOfTargetCreature = game.getPlayer(targetCreature.getControllerId()); - controllerOfTargetCreature.damage(5, source.getSourceId(), game, false, true); - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java b/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java index 513bf353a4..cdb736215b 100644 --- a/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java +++ b/Mage.Sets/src/mage/sets/lorwyn/QuillSlingerBoggart.java @@ -61,7 +61,7 @@ public class QuillSlingerBoggart extends CardImpl { this.toughness = new MageInt(2); // Whenever a player casts a Kithkin spell, you may have target player lose 1 life. - Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(2), filter, true); + Ability ability = new SpellCastAllTriggeredAbility(new LoseLifeTargetEffect(1), filter, true); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/planeshift/MoggJailer.java b/Mage.Sets/src/mage/sets/planeshift/MoggJailer.java index d4c0a32314..e58a1f8755 100644 --- a/Mage.Sets/src/mage/sets/planeshift/MoggJailer.java +++ b/Mage.Sets/src/mage/sets/planeshift/MoggJailer.java @@ -29,24 +29,18 @@ package mage.sets.planeshift; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.Effect; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.CantAttackIfDefenderControlsPermanent; import mage.cards.CardImpl; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.Filter; -import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.PowerPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; /** * @@ -59,7 +53,6 @@ public class MoggJailer extends CardImpl { static { filter.add(Predicates.and(new PowerPredicate(Filter.ComparisonType.LessThan, 2), Predicates.not(new TappedPredicate()))); - //filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3)); } public MoggJailer(UUID ownerId) { @@ -70,7 +63,7 @@ public class MoggJailer extends CardImpl { this.toughness = new MageInt(2); // Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less. - Effect effect = new CantAttackIfDefenderControllsPermanent(filter); + Effect effect = new CantAttackIfDefenderControlsPermanent(filter); effect.setText("Mogg Jailer can't attack if defending player controls an untapped creature with power 2 or less."); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } @@ -84,50 +77,3 @@ public class MoggJailer extends CardImpl { return new MoggJailer(this); } } - -class CantAttackIfDefenderControllsPermanent extends RestrictionEffect { - - private final FilterPermanent filter; - - public CantAttackIfDefenderControllsPermanent(FilterPermanent filter) { - super(Duration.WhileOnBattlefield); - this.filter = filter; - staticText = new StringBuilder("{this} can't attack if defending player controls ").append(filter.getMessage()).toString(); - } - - public CantAttackIfDefenderControllsPermanent(final CantAttackIfDefenderControllsPermanent effect) { - super(effect); - this.filter = effect.filter; - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getId().equals(source.getSourceId()); - } - - @Override - public boolean canAttack(UUID defenderId, Ability source, Game game) { - UUID defendingPlayerId; - Player player = game.getPlayer(defenderId); - if (player == null) { - Permanent permanent = game.getPermanent(defenderId); - if (permanent != null) { - defendingPlayerId = permanent.getControllerId(); - } else { - return true; - } - } else { - defendingPlayerId = defenderId; - } - if (defendingPlayerId != null && game.getBattlefield().countAll(filter, defendingPlayerId, game) > 0) { - return false; - } - return true; - } - - @Override - public CantAttackIfDefenderControllsPermanent copy() { - return new CantAttackIfDefenderControllsPermanent(this); - } - -} \ No newline at end of file