From 35b78f8d11bb5d9899636cc69b879ea494c3ffed Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 22 Apr 2018 17:24:24 -0400 Subject: [PATCH] Fixed Goblin Barrage not targeting correctly --- Mage.Sets/src/mage/cards/g/GoblinBarrage.java | 15 ++++----------- .../common/TargetPermanentOrPlayer.java | 19 +++++++++---------- .../common/TargetPlayerOrPlaneswalker.java | 2 +- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/Mage.Sets/src/mage/cards/g/GoblinBarrage.java b/Mage.Sets/src/mage/cards/g/GoblinBarrage.java index 5f52d74209..a99ceb3a91 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinBarrage.java +++ b/Mage.Sets/src/mage/cards/g/GoblinBarrage.java @@ -31,8 +31,6 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.common.KickedCondition; import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.decorator.ConditionalOneShotEffect; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; @@ -47,7 +45,6 @@ import mage.game.Game; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetPlayerOrPlaneswalker; -import mage.target.targetpointer.SecondTargetPointer; /** * @@ -64,15 +61,11 @@ public class GoblinBarrage extends CardImpl { this.addAbility(new KickerAbility(new SacrificeTargetCost(new TargetControlledPermanent(filter)))); // Goblin Barrage deals 4 damage to target creature. If this spell was kicked, it also deals 4 damage to target player or planeswalker. - this.getSpellAbility().addEffect(new DamageTargetEffect(4).setUseOnlyTargetPointer(true)); + this.getSpellAbility().addEffect(new DamageTargetEffect(4) + .setText("{this} deals 4 damage to target creature. If this spell was kicked, " + + "it also deals 4 damage to target player or planeswalker") + ); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - - ConditionalOneShotEffect effect = new ConditionalOneShotEffect( - (OneShotEffect) new DamageTargetEffect(4).setUseOnlyTargetPointer(true), KickedCondition.instance, - "If this spell was kicked, it also deals 4 damage to target player or planeswalker."); - effect.setTargetPointer(new SecondTargetPointer()); - this.getSpellAbility().addEffect(effect); - } @Override diff --git a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java index 4be0a4b88b..e7c7864ac1 100644 --- a/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java +++ b/Mage/src/main/java/mage/target/common/TargetPermanentOrPlayer.java @@ -60,22 +60,21 @@ public class TargetPermanentOrPlayer extends TargetImpl { } public TargetPermanentOrPlayer(int minNumTargets, int maxNumTargets) { - this.minNumberOfTargets = minNumTargets; - this.maxNumberOfTargets = maxNumTargets; - this.zone = Zone.ALL; - this.filter = new FilterPermanentOrPlayer(); - this.targetName = filter.getMessage(); - this.filterPermanent = this.filter.getPermanentFilter(); + this(minNumTargets, maxNumTargets, false); } public TargetPermanentOrPlayer(int minNumTargets, int maxNumTargets, boolean notTarget) { - this(minNumTargets, maxNumTargets); - this.notTarget = notTarget; + this(minNumTargets, maxNumTargets, new FilterPermanentOrPlayer(), notTarget); } public TargetPermanentOrPlayer(int minNumTargets, int maxNumTargets, FilterPermanentOrPlayer filter, boolean notTarget) { - this(minNumTargets, maxNumTargets, notTarget); + this.minNumberOfTargets = minNumTargets; + this.maxNumberOfTargets = maxNumTargets; + this.zone = Zone.ALL; this.filter = filter; + this.targetName = filter.getMessage(); + this.filterPermanent = this.filter.getPermanentFilter(); + this.notTarget = notTarget; } public TargetPermanentOrPlayer(final TargetPermanentOrPlayer target) { @@ -164,7 +163,7 @@ public class TargetPermanentOrPlayer extends TargetImpl { } } } - for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, sourceControllerId, game)) { + for (Permanent permanent : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT, sourceControllerId, game)) { if (permanent.canBeTargetedBy(targetSource, sourceControllerId, game) && filter.match(permanent, sourceId, sourceControllerId, game)) { count++; if (count >= this.minNumberOfTargets) { diff --git a/Mage/src/main/java/mage/target/common/TargetPlayerOrPlaneswalker.java b/Mage/src/main/java/mage/target/common/TargetPlayerOrPlaneswalker.java index 72f72cf813..27101e8ad3 100644 --- a/Mage/src/main/java/mage/target/common/TargetPlayerOrPlaneswalker.java +++ b/Mage/src/main/java/mage/target/common/TargetPlayerOrPlaneswalker.java @@ -14,7 +14,7 @@ import mage.filter.common.FilterPlayerOrPlaneswalker; public class TargetPlayerOrPlaneswalker extends TargetPermanentOrPlayer { public TargetPlayerOrPlaneswalker() { - this(1, 1, new FilterPlayerOrPlaneswalker("player or planeswalker"), false); + this(1, 1, new FilterPlayerOrPlaneswalker(), false); } public TargetPlayerOrPlaneswalker(int numTargets) {