mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
Fix #2890 Unified Will text
This commit is contained in:
parent
1101e80bfc
commit
781ba84a74
1 changed files with 10 additions and 8 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue