Fixed multitarget handling of Decimate and Boom//Bust.

This commit is contained in:
LevelX2 2015-09-08 08:09:48 +02:00
parent 0dcd11cf4b
commit b4d7009af8
3 changed files with 13 additions and 14 deletions

View file

@ -48,9 +48,8 @@ public class Decimate extends CardImpl {
super(ownerId, 287, "Decimate", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{2}{R}{G}");
this.expansionSetCode = "ODY";
// Destroy target artifact, target creature, target enchantment, and target land.
Effect effect = new DestroyTargetEffect();
Effect effect = new DestroyTargetEffect(false, true);
effect.setText("Destroy target artifact, target creature, target enchantment, and target land.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetArtifactPermanent());

View file

@ -25,32 +25,25 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.planarchaos;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class BoomBust extends SplitCard {
private static final FilterLandPermanent filter1 = new FilterLandPermanent("land you control");
private static final FilterLandPermanent filter2 = new FilterLandPermanent("land you don't control");
static {
filter1.add(new ControllerPredicate(TargetController.YOU));
filter2.add(new ControllerPredicate(TargetController.NOT_YOU));
@ -62,7 +55,7 @@ public class BoomBust extends SplitCard {
// Boom
// Destroy target land you control and target land you don't control.
Effect effect = new DestroyTargetEffect();
Effect effect = new DestroyTargetEffect(false, true);
effect.setText("Destroy target land you control and target land you don't control");
getLeftHalfCard().getSpellAbility().addEffect(effect);
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(filter1));

View file

@ -46,6 +46,7 @@ import mage.util.CardUtil;
public class DestroyTargetEffect extends OneShotEffect {
protected boolean noRegen;
protected boolean multitargetHandling;
public DestroyTargetEffect() {
this(false);
@ -57,13 +58,19 @@ public class DestroyTargetEffect extends OneShotEffect {
}
public DestroyTargetEffect(boolean noRegen) {
this(noRegen, false);
}
public DestroyTargetEffect(boolean noRegen, boolean multitargetHandling) {
super(Outcome.DestroyPermanent);
this.noRegen = noRegen;
this.multitargetHandling = multitargetHandling;
}
public DestroyTargetEffect(final DestroyTargetEffect effect) {
super(effect);
this.noRegen = effect.noRegen;
this.multitargetHandling = effect.multitargetHandling;
}
@Override
@ -74,7 +81,7 @@ public class DestroyTargetEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int affectedTargets = 0;
if (source.getTargets().size() > 1 && targetPointer instanceof FirstTargetPointer) { // Decimate
if (multitargetHandling && source.getTargets().size() > 1 && targetPointer instanceof FirstTargetPointer) { // Decimate
for (Target target : source.getTargets()) {
for (UUID permanentId : target.getTargets()) {
Permanent permanent = game.getPermanent(permanentId);