refactored effects which cause other permanents to enter tapped

This commit is contained in:
Evan Kranzler 2021-11-11 07:51:12 -05:00
parent 1d610aed69
commit ca16f363c8
17 changed files with 231 additions and 871 deletions

View file

@ -1,18 +1,19 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.effects.common.continuous.CantCastMoreThanOneSpellEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
@ -21,6 +22,13 @@ import java.util.UUID;
*/
public final class ArchonOfEmeria extends CardImpl {
private static final FilterPermanent filter = new FilterLandPermanent("nonbasic lands your opponents control");
static {
filter.add(Predicates.not(SuperType.BASIC.getPredicate()));
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
public ArchonOfEmeria(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
@ -35,7 +43,7 @@ public final class ArchonOfEmeria extends CardImpl {
this.addAbility(new SimpleStaticAbility(new CantCastMoreThanOneSpellEffect(TargetController.ANY)));
// Nonbasic lands your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(new ArchonOfEmeriaEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private ArchonOfEmeria(final ArchonOfEmeria card) {
@ -47,45 +55,3 @@ public final class ArchonOfEmeria extends CardImpl {
return new ArchonOfEmeria(this);
}
}
class ArchonOfEmeriaEffect extends ReplacementEffectImpl {
ArchonOfEmeriaEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "nonbasic lands your opponents control enter the battlefield tapped";
}
private ArchonOfEmeriaEffect(final ArchonOfEmeriaEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isLand(game) && !permanent.isBasic()) {
return true;
}
}
return false;
}
@Override
public ArchonOfEmeriaEffect copy() {
return new ArchonOfEmeriaEffect(this);
}
}

View file

@ -1,42 +1,36 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterOpponentsCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class AuthorityOfTheConsuls extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
private static final FilterPermanent filter
= new FilterOpponentsCreaturePermanent("creatures your opponents control");
public AuthorityOfTheConsuls(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}");
// Creatures your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AuthorityOfTheConsulsTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
// Whenever a creature enters the battlefield under an opponent's control, you gain 1 life.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new GainLifeEffect(1), filter,
"Whenever a creature enters the battlefield under an opponent's control, you gain 1 life."));
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
new GainLifeEffect(1), filter, "Whenever a creature enters " +
"the battlefield under an opponent's control, you gain 1 life."
));
}
private AuthorityOfTheConsuls(final AuthorityOfTheConsuls card) {
@ -48,45 +42,3 @@ public final class AuthorityOfTheConsuls extends CardImpl {
return new AuthorityOfTheConsuls(this);
}
}
class AuthorityOfTheConsulsTapEffect extends ReplacementEffectImpl {
AuthorityOfTheConsulsTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Creatures your opponents control enter the battlefield tapped";
}
AuthorityOfTheConsulsTapEffect(final AuthorityOfTheConsulsTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isCreature(game)) {
return true;
}
}
return false;
}
@Override
public AuthorityOfTheConsulsTapEffect copy() {
return new AuthorityOfTheConsulsTapEffect(this);
}
}

View file

@ -1,36 +1,30 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.keyword.ExtortAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class BlindObedience extends CardImpl {
public BlindObedience(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
// Extort (Whenever you cast a spell, you may pay {WB}. If you do, each opponent loses 1 life and you gain that much life.)
this.addAbility(new ExtortAbility());
// Artifacts and creatures your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BlindObedienceTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_ARTIFACT_OR_CREATURE
).setText("artifacts and creatures your opponents control enter the battlefield tapped")));
}
@ -43,45 +37,3 @@ public final class BlindObedience extends CardImpl {
return new BlindObedience(this);
}
}
class BlindObedienceTapEffect extends ReplacementEffectImpl {
BlindObedienceTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts and creatures your opponents control enter the battlefield tapped";
}
BlindObedienceTapEffect(final BlindObedienceTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && (permanent.isCreature(game) || permanent.isArtifact(game))) {
return true;
}
}
return false;
}
@Override
public BlindObedienceTapEffect copy() {
return new BlindObedienceTapEffect(this);
}
}

View file

@ -1,33 +1,30 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author North
*/
public final class DueRespect extends CardImpl {
public DueRespect(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{W}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}");
// Permanents enter the battlefield tapped this turn.
this.getSpellAbility().addEffect(new DueRespectEffect());
this.getSpellAbility().addEffect(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_PERMANENTS, Duration.EndOfTurn
));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("<br>"));
}
private DueRespect(final DueRespect card) {
@ -39,40 +36,3 @@ public final class DueRespect extends CardImpl {
return new DueRespect(this);
}
}
class DueRespectEffect extends ReplacementEffectImpl {
DueRespectEffect() {
super(Duration.EndOfTurn, Outcome.Tap);
staticText = "Permanents enter the battlefield tapped this turn";
}
DueRespectEffect(final DueRespectEffect effect) {
super(effect);
}
@Override
public DueRespectEffect copy() {
return new DueRespectEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.tap(source, game);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
}

View file

@ -1,32 +1,39 @@
package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class FrozenAether extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("artifacts, creatures, and lands your opponents control");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()
));
}
public FrozenAether(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FrozenAetherTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private FrozenAether(final FrozenAether card) {
@ -38,48 +45,3 @@ public final class FrozenAether extends CardImpl {
return new FrozenAether(this);
}
}
class FrozenAetherTapEffect extends ReplacementEffectImpl {
FrozenAetherTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts, creatures, and lands your opponents control enter the battlefield tapped";
}
FrozenAetherTapEffect(final FrozenAetherTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null
&& (permanent.isCreature(game)
|| permanent.isLand(game)
|| permanent.isArtifact(game))) {
return true;
}
}
return false;
}
@Override
public FrozenAetherTapEffect copy() {
return new FrozenAetherTapEffect(this);
}
}

View file

@ -1,16 +1,13 @@
package mage.cards.i;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import java.util.UUID;
@ -27,8 +24,9 @@ public final class ImposingSovereign extends CardImpl {
this.toughness = new MageInt(1);
// Creatures your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ImposingSovereignEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
).setText("creatures your opponents control enter the battlefield tapped")));
}
private ImposingSovereign(final ImposingSovereign card) {
@ -40,43 +38,3 @@ public final class ImposingSovereign extends CardImpl {
return new ImposingSovereign(this);
}
}
class ImposingSovereignEffect extends ReplacementEffectImpl {
ImposingSovereignEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Creatures your opponents control enter the battlefield tapped";
}
private ImposingSovereignEffect(final ImposingSovereignEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.tap(source, game);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
return false;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && permanent.isCreature(game);
}
@Override
public ImposingSovereignEffect copy() {
return new ImposingSovereignEffect(this);
}
}

View file

@ -1,26 +1,18 @@
package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class KinjallisSunwing extends CardImpl {
@ -36,7 +28,9 @@ public final class KinjallisSunwing extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Creatures your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KinjallisSunwingEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
).setText("creatures your opponents control enter the battlefield tapped")));
}
private KinjallisSunwing(final KinjallisSunwing card) {
@ -48,45 +42,3 @@ public final class KinjallisSunwing extends CardImpl {
return new KinjallisSunwing(this);
}
}
class KinjallisSunwingEffect extends ReplacementEffectImpl {
KinjallisSunwingEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Creatures your opponents control enter the battlefield tapped";
}
KinjallisSunwingEffect(final KinjallisSunwingEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.tap(source, game);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isCreature(game)) {
return true;
}
}
return false;
}
@Override
public KinjallisSunwingEffect copy() {
return new KinjallisSunwingEffect(this);
}
}

View file

@ -1,32 +1,39 @@
package mage.cards.k;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
*
* @author Quercitron
*/
public final class Kismet extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("artifacts, creatures, and lands your opponents control");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()
));
}
public Kismet(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
// Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new KismetEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private Kismet(final Kismet card) {
@ -38,47 +45,3 @@ public final class Kismet extends CardImpl {
return new Kismet(this);
}
}
class KismetEffect extends ReplacementEffectImpl {
KismetEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts, creatures, and lands your opponents control enter the battlefield tapped";
}
KismetEffect(final KismetEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && (permanent.isArtifact(game)
|| permanent.isCreature(game)
|| permanent.isLand(game))) {
return true;
}
}
return false;
}
@Override
public KismetEffect copy() {
return new KismetEffect(this);
}
}

View file

@ -1,31 +1,38 @@
package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class LoxodonGatekeeper extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("artifacts, creatures, and lands your opponents control");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate(),
CardType.LAND.getPredicate()
));
}
public LoxodonGatekeeper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.ELEPHANT);
this.subtype.add(SubType.SOLDIER);
@ -33,8 +40,7 @@ public final class LoxodonGatekeeper extends CardImpl {
this.toughness = new MageInt(3);
// Artifacts, creatures, and lands your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LoxodonGatekeeperTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private LoxodonGatekeeper(final LoxodonGatekeeper card) {
@ -46,48 +52,3 @@ public final class LoxodonGatekeeper extends CardImpl {
return new LoxodonGatekeeper(this);
}
}
class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl {
LoxodonGatekeeperTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts, creatures, and lands your opponents control enter the battlefield tapped";
}
LoxodonGatekeeperTapEffect(final LoxodonGatekeeperTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null
&& (permanent.isCreature(game)
|| permanent.isLand(game)
|| permanent.isArtifact(game))) {
return true;
}
}
return false;
}
@Override
public LoxodonGatekeeperTapEffect copy() {
return new LoxodonGatekeeperTapEffect(this);
}
}

View file

@ -1,32 +1,34 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterArtifactPermanent;
import mage.target.common.TargetArtifactPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class Manglehorn extends CardImpl {
private static final FilterPermanent filter = new FilterArtifactPermanent("artifacts your opponents control");
static {
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
public Manglehorn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
@ -40,7 +42,7 @@ public final class Manglehorn extends CardImpl {
this.addAbility(ability);
// Artifacts your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ManglehornTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private Manglehorn(final Manglehorn card) {
@ -52,45 +54,3 @@ public final class Manglehorn extends CardImpl {
return new Manglehorn(this);
}
}
class ManglehornTapEffect extends ReplacementEffectImpl {
ManglehornTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts your opponents control enter the battlefield tapped";
}
ManglehornTapEffect(final ManglehornTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isArtifact(game)) {
return true;
}
}
return false;
}
@Override
public ManglehornTapEffect copy() {
return new ManglehornTapEffect(this);
}
}

View file

@ -2,7 +2,7 @@ package mage.cards.n;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.effects.common.continuous.PlayAdditionalLandsControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -11,8 +11,6 @@ import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
@ -29,7 +27,9 @@ public final class NahirisLithoforming extends CardImpl {
// Sacrifice X lands. For each land sacrificed this way, draw a card. You may play X additional lands this turn. Lands you control enter the battlefield tapped this turn.
this.getSpellAbility().addEffect(new NahirisLithoformingSacrificeEffect());
this.getSpellAbility().addEffect(new NahirisLithoformingTappedEffect());
this.getSpellAbility().addEffect(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS, Duration.EndOfTurn
));
}
private NahirisLithoforming(final NahirisLithoforming card) {
@ -88,45 +88,3 @@ class NahirisLithoformingSacrificeEffect extends OneShotEffect {
return true;
}
}
class NahirisLithoformingTappedEffect extends ReplacementEffectImpl {
NahirisLithoformingTappedEffect() {
super(Duration.EndOfTurn, Outcome.Tap);
staticText = "Lands you control enter the battlefield tapped this turn.";
}
NahirisLithoformingTappedEffect(final NahirisLithoformingTappedEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (source.getControllerId().equals(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isLand(game)) {
return true;
}
}
return false;
}
@Override
public NahirisLithoformingTappedEffect copy() {
return new NahirisLithoformingTappedEffect(this);
}
}

View file

@ -1,32 +1,24 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class OrbOfDreams extends CardImpl {
public OrbOfDreams(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Permanents enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new OrbOfDreamsEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(StaticFilters.FILTER_PERMANENTS)));
}
private OrbOfDreams(final OrbOfDreams card) {
@ -37,41 +29,4 @@ public final class OrbOfDreams extends CardImpl {
public OrbOfDreams copy() {
return new OrbOfDreams(this);
}
private static class OrbOfDreamsEffect extends ReplacementEffectImpl {
OrbOfDreamsEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap, false);
staticText = "Permanents enter the battlefield tapped";
}
OrbOfDreamsEffect(final OrbOfDreamsEffect effect) {
super(effect);
}
@Override
public OrbOfDreamsEffect copy() {
return new OrbOfDreamsEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null) {
permanent.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
}
}

View file

@ -7,8 +7,8 @@ import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CounterUnlessPaysEffect;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.VigilanceAbility;
@ -16,8 +16,9 @@ import mage.cards.Card;
import mage.cards.CardSetInfo;
import mage.cards.ModalDoubleFacesCard;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.StackObject;
@ -31,6 +32,13 @@ import java.util.UUID;
*/
public final class ReidaneGodOfTheWorthy extends ModalDoubleFacesCard {
private static final FilterPermanent filter = new FilterLandPermanent("snow lands your opponents control");
static {
filter.add(SuperType.SNOW.getPredicate());
filter.add(TargetController.OPPONENT.getControllerPredicate());
}
public ReidaneGodOfTheWorthy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo,
new CardType[]{CardType.CREATURE}, new SubType[]{SubType.GOD}, "{2}{W}",
@ -50,7 +58,7 @@ public final class ReidaneGodOfTheWorthy extends ModalDoubleFacesCard {
this.getLeftHalfCard().addAbility(VigilanceAbility.getInstance());
// Snow lands your opponents control enter the battlefield tapped.
this.getLeftHalfCard().addAbility(new SimpleStaticAbility(new ReidaneGodOfTheWorthyTapEffect()));
this.getLeftHalfCard().addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
// Noncreature spells your opponents cast with converted mana cost 4 or more cost {2} more to cast.
this.getLeftHalfCard().addAbility(new SimpleStaticAbility(new ReidaneGodOfTheWorthyCostEffect()));
@ -77,46 +85,6 @@ public final class ReidaneGodOfTheWorthy extends ModalDoubleFacesCard {
}
}
class ReidaneGodOfTheWorthyTapEffect extends ReplacementEffectImpl {
ReidaneGodOfTheWorthyTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "snow lands your opponents control enter the battlefield tapped";
}
private ReidaneGodOfTheWorthyTapEffect(final ReidaneGodOfTheWorthyTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
return false;
}
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && permanent.isLand(game) && permanent.isSnow();
}
@Override
public ReidaneGodOfTheWorthyTapEffect copy() {
return new ReidaneGodOfTheWorthyTapEffect(this);
}
}
class ReidaneGodOfTheWorthyCostEffect extends CostModificationEffectImpl {
ReidaneGodOfTheWorthyCostEffect() {

View file

@ -1,32 +1,35 @@
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class RootMaze extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifacts and lands");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.LAND.getPredicate()
));
}
public RootMaze(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
// Artifacts and lands enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new RootMazeEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private RootMaze(final RootMaze card) {
@ -38,40 +41,3 @@ public final class RootMaze extends CardImpl {
return new RootMaze(this);
}
}
class RootMazeEffect extends ReplacementEffectImpl {
RootMazeEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Artifacts and lands enter the battlefield tapped";
}
RootMazeEffect(final RootMazeEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return permanent != null && (permanent.isLand(game) || permanent.isArtifact(game));
}
@Override
public RootMazeEffect copy() {
return new RootMazeEffect(this);
}
}

View file

@ -1,28 +1,39 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class ThaliaHereticCathar extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent("creatures and nonbasic lands your opponents control");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
Predicates.and(
Predicates.not(SuperType.BASIC.getPredicate()),
CardType.LAND.getPredicate()
)
));
}
public ThaliaHereticCathar(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
@ -33,7 +44,7 @@ public final class ThaliaHereticCathar extends CardImpl {
this.addAbility(FirstStrikeAbility.getInstance());
// Creatures and nonbasic lands your opponents control enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ThaliaTapEffect()));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(filter)));
}
private ThaliaHereticCathar(final ThaliaHereticCathar card) {
@ -45,46 +56,3 @@ public final class ThaliaHereticCathar extends CardImpl {
return new ThaliaHereticCathar(this);
}
}
class ThaliaTapEffect extends ReplacementEffectImpl {
ThaliaTapEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Creatures and nonbasic lands your opponents control enter the battlefield tapped";
}
ThaliaTapEffect(final ThaliaTapEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && (permanent.isCreature(game) ||
(permanent.isLand(game) && !permanent.isBasic()))) {
return true;
}
}
return false;
}
@Override
public ThaliaTapEffect copy() {
return new ThaliaTapEffect(this);
}
}

View file

@ -1,30 +1,28 @@
package mage.cards.u;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.PermanentsEnterBattlefieldTappedEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author Loki
*/
public final class UrabraskTheHidden extends CardImpl {
public UrabraskTheHidden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.PRAETOR);
@ -32,8 +30,14 @@ public final class UrabraskTheHidden extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Creatures"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new UrabraskTheHiddenEffect()));
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
HasteAbility.getInstance(), Duration.WhileOnBattlefield,
StaticFilters.FILTER_PERMANENT_CREATURES
)));
this.addAbility(new SimpleStaticAbility(new PermanentsEnterBattlefieldTappedEffect(
StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE
).setText("creatures your opponents control enter the battlefield tapped")));
}
private UrabraskTheHidden(final UrabraskTheHidden card) {
@ -45,45 +49,3 @@ public final class UrabraskTheHidden extends CardImpl {
return new UrabraskTheHidden(this);
}
}
class UrabraskTheHiddenEffect extends ReplacementEffectImpl {
UrabraskTheHiddenEffect() {
super(Duration.WhileOnBattlefield, Outcome.Tap);
staticText = "Creatures your opponents control enter the battlefield tapped";
}
UrabraskTheHiddenEffect(final UrabraskTheHiddenEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.setTapped(true);
}
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (permanent != null && permanent.isCreature(game)) {
return true;
}
}
return false;
}
@Override
public UrabraskTheHiddenEffect copy() {
return new UrabraskTheHiddenEffect(this);
}
}

View file

@ -1,6 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
@ -11,38 +12,32 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author Eirkei
*/
public class PermanentsEnterBattlefieldTappedEffect extends ReplacementEffectImpl {
protected FilterPermanent filter;
public PermanentsEnterBattlefieldTappedEffect() {
this(new FilterPermanent());
protected final FilterPermanent filter;
public PermanentsEnterBattlefieldTappedEffect(FilterPermanent filter) {
this(filter, Duration.WhileOnBattlefield);
}
public PermanentsEnterBattlefieldTappedEffect(FilterPermanent filter) {
super(Duration.WhileOnBattlefield, Outcome.Tap);
public PermanentsEnterBattlefieldTappedEffect(FilterPermanent filter, Duration duration) {
super(duration, Outcome.Tap);
this.filter = filter;
this.setText();
}
public PermanentsEnterBattlefieldTappedEffect(final PermanentsEnterBattlefieldTappedEffect effect) {
super(effect);
if (effect.filter != null){
this.filter = effect.filter.copy();
}
this.filter = effect.filter;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
if (target != null) {
target.tap(source, game);
}
return false;
}
@ -54,7 +49,6 @@ public class PermanentsEnterBattlefieldTappedEffect extends ReplacementEffectImp
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
return filter.match(permanent, source.getSourceId(), event.getPlayerId(), game);
}
@ -62,11 +56,14 @@ public class PermanentsEnterBattlefieldTappedEffect extends ReplacementEffectImp
public PermanentsEnterBattlefieldTappedEffect copy() {
return new PermanentsEnterBattlefieldTappedEffect(this);
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage());
sb.append(" enter the battlefield tapped");
staticText = sb.toString();
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return filter.getMessage()
+ " enter the battlefield tapped"
+ (duration == Duration.EndOfTurn ? " this turn" : "");
}
}