forked from External/mage
fixed Winter's Rest throwing an error
This commit is contained in:
parent
4796c37b95
commit
9dc0b64a11
1 changed files with 38 additions and 15 deletions
|
|
@ -3,8 +3,6 @@ package mage.cards.w;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect;
|
||||
import mage.abilities.effects.common.TapEnchantedEffect;
|
||||
|
|
@ -19,6 +17,8 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.SupertypePredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
|
@ -29,13 +29,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class WintersRest extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent();
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
filter.add(new SupertypePredicate(SuperType.SNOW));
|
||||
}
|
||||
|
||||
public WintersRest(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
|
|
@ -53,12 +46,7 @@ public final class WintersRest extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect()));
|
||||
|
||||
// As long as you control another snow permanent, enchanted creature doesn't untap during its controller's untap step.
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new DontUntapInControllersUntapStepEnchantedEffect(),
|
||||
new PermanentsOnTheBattlefieldCondition(filter),
|
||||
"As long as you control another snow permanent, " +
|
||||
"enchanted creature doesn't untap during its controller's untap step."
|
||||
)));
|
||||
this.addAbility(new SimpleStaticAbility(new WintersRestEffect()));
|
||||
}
|
||||
|
||||
private WintersRest(final WintersRest card) {
|
||||
|
|
@ -70,3 +58,38 @@ public final class WintersRest extends CardImpl {
|
|||
return new WintersRest(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WintersRestEffect extends DontUntapInControllersUntapStepEnchantedEffect {
|
||||
|
||||
private static final FilterPermanent filter = new FilterControlledPermanent();
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
filter.add(new SupertypePredicate(SuperType.SNOW));
|
||||
}
|
||||
|
||||
WintersRestEffect() {
|
||||
super();
|
||||
staticText = "As long as you control another snow permanent, " +
|
||||
"enchanted creature doesn't untap during its controller's untap step.";
|
||||
}
|
||||
|
||||
private WintersRestEffect(final WintersRestEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WintersRestEffect copy() {
|
||||
return new WintersRestEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getBattlefield().getActivePermanents(
|
||||
filter, source.getControllerId(), source.getSourceId(), game
|
||||
).isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return super.applies(event, source, game);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue