Fix #2890 Unified Will text

This commit is contained in:
Plopman 2017-02-26 21:20:23 +01:00
parent 1101e80bfc
commit 781ba84a74

View file

@ -30,15 +30,16 @@ package mage.cards.u;
import mage.constants.CardType; import mage.constants.CardType;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game; import mage.game.Game;
import mage.game.stack.StackObject; import mage.game.stack.StackObject;
import mage.target.TargetSpell; import mage.target.TargetSpell;
import java.util.UUID; import java.util.UUID;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
/** /**
* *
@ -49,6 +50,7 @@ public class UnifiedWill extends CardImpl {
public UnifiedWill(UUID ownerId, CardSetInfo setInfo) { public UnifiedWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
// Counter target spell if you control more creatures than that spell's controller.
this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addTarget(new TargetSpell());
this.getSpellAbility().addEffect(new UnifiedWillEffect()); this.getSpellAbility().addEffect(new UnifiedWillEffect());
} }
@ -64,22 +66,22 @@ public class UnifiedWill extends CardImpl {
} }
class UnifiedWillEffect extends CounterTargetEffect { class UnifiedWillEffect extends OneShotEffect {
private static FilterCreaturePermanent filter = new FilterCreaturePermanent(); public UnifiedWillEffect() {
super(Outcome.Detriment);
public UnifiedWillEffect() {} staticText = "Counter target spell if you control more creatures than that spell's controller";
}
public UnifiedWillEffect(final UnifiedWillEffect effect) { public UnifiedWillEffect(final UnifiedWillEffect effect) {
super(effect); super(effect);
staticText = "Counter target spell if you control more creatures than that spell's controller";
} }
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget()); StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
if (stackObject != null) { if (stackObject != null) {
if (game.getBattlefield().countAll(filter, source.getControllerId(), game) > game.getBattlefield().countAll(filter, stackObject.getControllerId(), game)) { if (game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game) > game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, stackObject.getControllerId(), game)) {
return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game); return game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
} }
return true; return true;