forked from External/mage
Fix Sky Swallower (#10542)
* Static filter for another controlled permanent * Fix Sky Swallower
This commit is contained in:
parent
83c1e4395a
commit
f2378a5b3d
5 changed files with 32 additions and 55 deletions
|
|
@ -9,8 +9,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -20,12 +19,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class FelidarGuardian extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another target permanent you control");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public FelidarGuardian(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
|
||||
|
||||
|
|
@ -37,7 +30,7 @@ public final class FelidarGuardian extends CardImpl {
|
|||
// When Felidar Guardian enters the battlefield, you may exile another target permanent you control, then return that card to the battlefield under its owner's control.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ExileTargetForSourceEffect(), true);
|
||||
ability.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(", then"));
|
||||
ability.addTarget(new TargetControlledPermanent(filter));
|
||||
ability.addTarget(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_PERMANENT));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -29,16 +26,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class KelpieGuide extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledLandPermanent("you control eight or more lands");
|
||||
private static final FilterPermanent filter2
|
||||
= new FilterControlledPermanent("another target permanent you control");
|
||||
private static final Condition condition
|
||||
= new PermanentsOnTheBattlefieldCondition(filter, ComparisonType.MORE_THAN, 7);
|
||||
|
||||
static {
|
||||
filter2.add(AnotherPredicate.instance);
|
||||
}
|
||||
= new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, ComparisonType.MORE_THAN, 7);
|
||||
|
||||
public KelpieGuide(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
|
||||
|
|
@ -49,7 +38,7 @@ public final class KelpieGuide extends CardImpl {
|
|||
|
||||
// {T}: Untap another target permanent you control.
|
||||
Ability ability = new SimpleActivatedAbility(new UntapTargetEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetPermanent(filter2));
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_PERMANENT));
|
||||
this.addAbility(ability);
|
||||
|
||||
// {T}: Tap target permanent. Activate only if you control eight or more lands.
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
|
@ -27,12 +25,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class OathOfTeferi extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("another target permanent you control");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public OathOfTeferi(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}{U}");
|
||||
|
||||
|
|
@ -40,7 +32,7 @@ public final class OathOfTeferi extends CardImpl {
|
|||
|
||||
// When Oath of Teferi enters the battlefield, exile another target permanent you control. Return it to the battlefield under its owner's control at the beginning of the next end step.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new OathOfTeferiBlinkEffect());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_PERMANENT));
|
||||
this.addAbility(ability);
|
||||
|
||||
// You may activate the loyalty abilities of planeswalkers you control twice each turn rather than only once.
|
||||
|
|
|
|||
|
|
@ -2,23 +2,22 @@ package mage.cards.s;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainControlAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author ciaccona007
|
||||
* @author xenohedron
|
||||
*/
|
||||
public final class SkySwallower extends CardImpl {
|
||||
|
||||
|
|
@ -33,7 +32,7 @@ public final class SkySwallower extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Sky Swallower enters the battlefield, target opponent gains control of all other permanents you control.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new GainControlAllPermanentsEffect(Duration.EndOfGame));
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new SkySwallowerEffect());
|
||||
ability.addTarget(new TargetOpponent());
|
||||
addAbility(ability);
|
||||
}
|
||||
|
|
@ -48,35 +47,32 @@ public final class SkySwallower extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class GainControlAllPermanentsEffect extends ContinuousEffectImpl {
|
||||
private static FilterControlledPermanent filter = new FilterControlledPermanent("all other permanents you control");
|
||||
class SkySwallowerEffect extends OneShotEffect {
|
||||
|
||||
public GainControlAllPermanentsEffect(Duration duration) {
|
||||
super(duration, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.Detriment);
|
||||
SkySwallowerEffect() {
|
||||
super(Outcome.Detriment);
|
||||
this.staticText = "target opponent gains control of all other permanents you control";
|
||||
}
|
||||
|
||||
public GainControlAllPermanentsEffect(final GainControlAllPermanentsEffect effect) {
|
||||
private SkySwallowerEffect(final SkySwallowerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainControlAllPermanentsEffect copy() {
|
||||
return new GainControlAllPermanentsEffect(this);
|
||||
public SkySwallowerEffect copy() {
|
||||
return new SkySwallowerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (targetPlayer != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (permanent != null && !permanent.getId().equals(source.getSourceId())) {
|
||||
permanent.changeControllerId(targetPlayer.getId(), game, source);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
discard();
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (opponent == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return new GainControlAllEffect(Duration.Custom,
|
||||
StaticFilters.FILTER_CONTROLLED_ANOTHER_PERMANENT,
|
||||
opponent.getId()
|
||||
).apply(game, source);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -371,6 +371,13 @@ public final class StaticFilters {
|
|||
FILTER_CONTROLLED_A_PERMANENT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_ANOTHER_PERMANENT = new FilterControlledPermanent("another target permanent you control");
|
||||
|
||||
static {
|
||||
FILTER_CONTROLLED_ANOTHER_PERMANENT.add(AnotherPredicate.instance);
|
||||
FILTER_CONTROLLED_ANOTHER_PERMANENT.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENTS = new FilterControlledPermanent("permanents you control");
|
||||
|
||||
static {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue