mirror of
https://github.com/correl/mage.git
synced 2024-12-27 20:06:31 +00:00
Fix Nightcreep applying to things that ETB after it
This commit is contained in:
parent
b246a47ece
commit
d1de6cf3e6
1 changed files with 46 additions and 43 deletions
|
@ -1,29 +1,20 @@
|
||||||
package mage.cards.n;
|
package mage.cards.n;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import mage.MageObject;
|
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.Mode;
|
import mage.abilities.effects.common.continuous.BecomesBasicLandTargetEffect;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
|
||||||
import mage.abilities.effects.ContinuousEffect;
|
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.abilities.effects.common.continuous.AddCardSubtypeAllEffect;
|
|
||||||
import mage.abilities.effects.common.continuous.BecomesColorAllEffect;
|
|
||||||
import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect;
|
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
|
||||||
import mage.abilities.mana.BlackManaAbility;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.choices.ChoiceColor;
|
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.filter.common.FilterLandPermanent;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.target.targetpointer.FixedTargets;
|
||||||
import mage.players.Player;
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -36,8 +27,8 @@ public final class Nightcreep extends CardImpl {
|
||||||
|
|
||||||
|
|
||||||
// Until end of turn, all creatures become black and all lands become Swamps.
|
// Until end of turn, all creatures become black and all lands become Swamps.
|
||||||
this.getSpellAbility().addEffect(new BecomesColorAllEffect(ObjectColor.BLACK, Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE, true, "Until end of turn, all creatures become black and all lands become Swamps"));
|
this.getSpellAbility().addEffect(new NightcreepCreatureEffect());
|
||||||
this.getSpellAbility().addEffect(new NightcreepEffect());
|
this.getSpellAbility().addEffect(new NightcreepLandEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Nightcreep(final Nightcreep card) {
|
public Nightcreep(final Nightcreep card) {
|
||||||
|
@ -50,48 +41,60 @@ public final class Nightcreep extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NightcreepEffect extends ContinuousEffectImpl {
|
class NightcreepLandEffect extends BecomesBasicLandTargetEffect {
|
||||||
|
|
||||||
public NightcreepEffect() {
|
public NightcreepLandEffect() {
|
||||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
super(Duration.EndOfTurn, SubType.SWAMP);
|
||||||
this.staticText = "";
|
this.staticText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public NightcreepEffect(NightcreepEffect effect) {
|
public NightcreepLandEffect(NightcreepLandEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
|
List<Permanent> targets = new ArrayList<>(game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), source.getSourceId(), game));
|
||||||
|
this.setTargetPointer(new FixedTargets(targets, game));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
for (Permanent land : game.getBattlefield().getActivePermanents(StaticFilters.FILTER_LAND, source.getControllerId(), game)) {
|
return super.apply(layer, sublayer, source, game);
|
||||||
switch (layer) {
|
|
||||||
case TypeChangingEffects_4:
|
|
||||||
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
|
||||||
// So the ability removing has to be done before Layer 6
|
|
||||||
land.removeAllAbilities(source.getSourceId(), game);
|
|
||||||
land.getSubtype(game).removeAll(SubType.getLandTypes(false));
|
|
||||||
land.getSubtype(game).add(SubType.SWAMP);
|
|
||||||
break;
|
|
||||||
case AbilityAddingRemovingEffects_6:
|
|
||||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public NightcreepLandEffect copy() {
|
||||||
return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
|
return new NightcreepLandEffect(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
class NightcreepCreatureEffect extends BecomesColorTargetEffect {
|
||||||
return false;
|
|
||||||
}
|
public NightcreepCreatureEffect() {
|
||||||
|
super(ObjectColor.BLACK, Duration.EndOfTurn);
|
||||||
@Override
|
this.staticText = "Until end of turn, all creatures become black and all lands become Swamps";
|
||||||
public NightcreepEffect copy() {
|
}
|
||||||
return new NightcreepEffect(this);
|
|
||||||
|
public NightcreepCreatureEffect(NightcreepCreatureEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(Ability source, Game game) {
|
||||||
|
super.init(source, game);
|
||||||
|
List<Permanent> targets = new ArrayList<>(game.getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source.getSourceId(), game));
|
||||||
|
this.setTargetPointer(new FixedTargets(targets, game));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||||
|
return super.apply(layer, sublayer, source, game);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NightcreepCreatureEffect copy() {
|
||||||
|
return new NightcreepCreatureEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue