mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
Added SkipUntapAllEffect and used it for appropriate cards.
This commit is contained in:
parent
6646aaf5b2
commit
c59c182cab
4 changed files with 160 additions and 154 deletions
|
|
@ -38,15 +38,13 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipUntapAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
|
|
@ -67,7 +65,7 @@ public class HokoriDustDrinker extends CardImpl<HokoriDustDrinker> {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Lands don't untap during their controllers' untap steps.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HokoriDustDrinkerReplacementEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipUntapAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, new FilterLandPermanent("Lands"))));
|
||||
|
||||
// At the beginning of each player's upkeep, that player untaps a land he or she controls.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new HokoriDustDrinkerUntapEffect(), TargetController.ANY, false));
|
||||
|
|
@ -85,47 +83,6 @@ public class HokoriDustDrinker extends CardImpl<HokoriDustDrinker> {
|
|||
}
|
||||
}
|
||||
|
||||
class HokoriDustDrinkerReplacementEffect extends ReplacementEffectImpl<HokoriDustDrinkerReplacementEffect> {
|
||||
|
||||
public HokoriDustDrinkerReplacementEffect() {
|
||||
super(Duration.OneUse, Outcome.Detriment);
|
||||
}
|
||||
|
||||
public HokoriDustDrinkerReplacementEffect(final HokoriDustDrinkerReplacementEffect effect) {
|
||||
super(effect);
|
||||
staticText = "Lands don't untap during their controllers' untap steps";
|
||||
}
|
||||
|
||||
@Override
|
||||
public HokoriDustDrinkerReplacementEffect copy() {
|
||||
return new HokoriDustDrinkerReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP &&
|
||||
event.getType() == GameEvent.EventType.UNTAP) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent.getCardType().contains(CardType.LAND)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class HokoriDustDrinkerUntapEffect extends OneShotEffect<HokoriDustDrinkerUntapEffect> {
|
||||
|
||||
public HokoriDustDrinkerUntapEffect() {
|
||||
|
|
|
|||
|
|
@ -29,20 +29,22 @@ package mage.sets.iceage;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipUntapAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.ColorPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +53,12 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class WrathOfMaritLage extends CardImpl<WrathOfMaritLage> {
|
||||
|
||||
|
||||
public static final FilterCreaturePermanent filter = new FilterCreaturePermanent("red creatures");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
|
||||
|
||||
public WrathOfMaritLage(UUID ownerId) {
|
||||
super(ownerId, 109, "Wrath of Marit Lage", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{U}");
|
||||
|
|
@ -62,7 +69,7 @@ public class WrathOfMaritLage extends CardImpl<WrathOfMaritLage> {
|
|||
// When Wrath of Marit Lage enters the battlefield, tap all red creatures.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new TapAllEffect()));
|
||||
// Red creatures don't untap during their controllers' untap steps.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipUntapAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, filter)));
|
||||
}
|
||||
|
||||
public WrathOfMaritLage(final WrathOfMaritLage card) {
|
||||
|
|
@ -76,12 +83,7 @@ public class WrathOfMaritLage extends CardImpl<WrathOfMaritLage> {
|
|||
}
|
||||
|
||||
class TapAllEffect extends OneShotEffect<TapAllEffect> {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Red creature");
|
||||
static{
|
||||
filter.add(new ColorPredicate(ObjectColor.RED));
|
||||
}
|
||||
|
||||
|
||||
public TapAllEffect() {
|
||||
super(Outcome.Tap);
|
||||
staticText = "tap all red creatures";
|
||||
|
|
@ -94,7 +96,7 @@ class TapAllEffect extends OneShotEffect<TapAllEffect> {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
|
||||
List<Permanent> creatures = game.getBattlefield().getActivePermanents(filter, source.getSourceId(), game);
|
||||
List<Permanent> creatures = game.getBattlefield().getActivePermanents(WrathOfMaritLage.filter, source.getSourceId(), game);
|
||||
for (Permanent creature : creatures) {
|
||||
creature.tap(game);
|
||||
}
|
||||
|
|
@ -106,48 +108,3 @@ class TapAllEffect extends OneShotEffect<TapAllEffect> {
|
|||
return new TapAllEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DontUntapEffect extends ReplacementEffectImpl<DontUntapEffect> {
|
||||
|
||||
|
||||
public DontUntapEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
}
|
||||
|
||||
public DontUntapEffect(final DontUntapEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DontUntapEffect copy() {
|
||||
return new DontUntapEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanent(event.getTargetId());
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == GameEvent.EventType.UNTAP
|
||||
&& creature != null && creature.getCardType().contains(CardType.CREATURE) && creature.getColor().isRed() && creature.getControllerId() == event.getPlayerId()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "Red creatures don't untap during their controllers' untap steps";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -31,16 +31,13 @@ import java.util.UUID;
|
|||
|
||||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipUntapAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
|
|
@ -57,7 +54,7 @@ public class IntruderAlarm extends CardImpl<IntruderAlarm> {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// Creatures don't untap during their controllers' untap steps.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new IntruderAlarmEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipUntapAllEffect(Duration.WhileOnBattlefield, TargetController.ANY, new FilterCreaturePermanent("Creatures"))));
|
||||
// Whenever a creature enters the battlefield, untap all creatures.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(new UntapAllCreatureEffect(), new FilterCreaturePermanent()));
|
||||
}
|
||||
|
|
@ -72,51 +69,6 @@ public class IntruderAlarm extends CardImpl<IntruderAlarm> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class IntruderAlarmEffect extends ReplacementEffectImpl<IntruderAlarmEffect> {
|
||||
|
||||
|
||||
public IntruderAlarmEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
}
|
||||
|
||||
public IntruderAlarmEffect(final IntruderAlarmEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntruderAlarmEffect copy() {
|
||||
return new IntruderAlarmEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanent(event.getTargetId());
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP && event.getType() == EventType.UNTAP
|
||||
&& creature != null && creature.getCardType().contains(CardType.CREATURE) && creature.getControllerId() == event.getPlayerId()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "Creatures don't untap during their controllers' untap steps";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UntapAllCreatureEffect extends OneShotEffect<UntapAllCreatureEffect> {
|
||||
|
||||
public UntapAllCreatureEffect() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue