Fixed Goblin Barrage not targeting correctly

This commit is contained in:
Evan Kranzler 2018-04-22 17:24:24 -04:00
parent 9b2af09505
commit 35b78f8d11
3 changed files with 14 additions and 22 deletions

View file

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

View file

@ -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) {

View file

@ -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) {