mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Starfield of Nyx - Fixed that the continuous effect's dependancy to continuousEffects that add subtype aura was not checked. Reworked the dependency check to be a bit more generic (#1259).
This commit is contained in:
parent
daea667cbf
commit
0ca991c4ba
22 changed files with 408 additions and 185 deletions
|
@ -34,10 +34,12 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
@ -71,12 +73,13 @@ public class AmbushCommander extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Forests you control are 1/1 green Elf creatures that are still lands.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new AmbushCommanderToken(),
|
||||
"lands", filter2, Duration.WhileOnBattlefield)));
|
||||
ContinuousEffect effect = new BecomesCreatureAllEffect(new AmbushCommanderToken(), "lands", filter2, Duration.WhileOnBattlefield);
|
||||
effect.getDependencyTypes().add(DependencyType.BecomeForest);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
// {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3,3, Duration.EndOfTurn),
|
||||
new ManaCostsImpl("{1}{G}"));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1, filter, true)));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3, 3, Duration.EndOfTurn),
|
||||
new ManaCostsImpl("{1}{G}"));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -92,6 +95,7 @@ public class AmbushCommander extends CardImpl {
|
|||
}
|
||||
|
||||
class AmbushCommanderToken extends Token {
|
||||
|
||||
public AmbushCommanderToken() {
|
||||
super("Elf", "1/1 green Elf creatures");
|
||||
subtype.add("Elf");
|
||||
|
|
|
@ -28,15 +28,11 @@
|
|||
package mage.sets.fatereforged;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesAuraAttachToManifestSourceEffect;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
|
|||
import mage.abilities.mana.RedManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -86,6 +87,7 @@ public class MagusOfTheMoon extends CardImpl {
|
|||
MagusOfTheMoonEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
this.staticText = "Nonbasic lands are Mountains";
|
||||
dependencyTypes.add(DependencyType.BecomeMountain);
|
||||
}
|
||||
|
||||
MagusOfTheMoonEffect(final MagusOfTheMoonEffect effect) {
|
||||
|
|
|
@ -41,6 +41,7 @@ import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
|||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
|
@ -53,7 +54,6 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.sets.futuresight.MagusOfTheMoon;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -133,7 +133,7 @@ public class Conversion extends CardImpl {
|
|||
Set<UUID> dependentTo = null;
|
||||
for (ContinuousEffect effect : allEffectsInLayer) {
|
||||
// http://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/286046-conversion-magus-of-the-moon
|
||||
if (MagusOfTheMoon.class.equals(effect.getClass().getEnclosingClass())) {
|
||||
if (effect.getDependencyTypes().contains(DependencyType.BecomeMountain)) {
|
||||
if (dependentTo == null) {
|
||||
dependentTo = new HashSet<>();
|
||||
}
|
||||
|
|
|
@ -29,24 +29,22 @@ package mage.sets.limitedalpha;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author KholdFuzion
|
||||
|
||||
*
|
||||
*/
|
||||
public class KormusBell extends CardImpl {
|
||||
|
||||
|
@ -55,7 +53,9 @@ public class KormusBell extends CardImpl {
|
|||
this.expansionSetCode = "LEA";
|
||||
|
||||
// All Swamps are 1/1 black creatures that are still lands.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new KormusBellToken(), "lands", new FilterPermanent("Swamp", "Swamps"), Duration.WhileOnBattlefield)));
|
||||
ContinuousEffect effect = new BecomesCreatureAllEffect(new KormusBellToken(), "lands", new FilterPermanent("Swamp", "Swamps"), Duration.WhileOnBattlefield);
|
||||
effect.getDependencyTypes().add(DependencyType.BecomeSwamp);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
||||
public KormusBell(final KormusBell card) {
|
||||
|
@ -69,6 +69,7 @@ public class KormusBell extends CardImpl {
|
|||
}
|
||||
|
||||
class KormusBellToken extends Token {
|
||||
|
||||
public KormusBellToken() {
|
||||
super("", "1/1 creature");
|
||||
cardType.add(CardType.CREATURE);
|
||||
|
@ -77,4 +78,4 @@ class KormusBellToken extends Token {
|
|||
color.setBlack(true); //Check Oracle, yes they are black
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,11 @@ package mage.sets.limitedalpha;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
@ -51,14 +53,15 @@ public class LivingLands extends CardImpl {
|
|||
static {
|
||||
filter.add(new SubtypePredicate("Forest"));
|
||||
}
|
||||
|
||||
|
||||
public LivingLands(UUID ownerId) {
|
||||
super(ownerId, 118, "Living Lands", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
||||
this.expansionSetCode = "LEA";
|
||||
|
||||
|
||||
// All Forests are 1/1 creatures that are still lands.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new LivingLandsToken(), "lands", filter, Duration.WhileOnBattlefield)));
|
||||
ContinuousEffect effect = new BecomesCreatureAllEffect(new LivingLandsToken(), "lands", filter, Duration.WhileOnBattlefield);
|
||||
effect.getDependencyTypes().add(DependencyType.BecomeForest);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
||||
public LivingLands(final LivingLands card) {
|
||||
|
|
|
@ -27,16 +27,21 @@
|
|||
*/
|
||||
package mage.sets.magicorigins;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -70,6 +75,7 @@ public class StarfieldOfNyx extends CardImpl {
|
|||
static {
|
||||
filterEnchantmentYouControl.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
static {
|
||||
filterGraveyardEnchantment.add(new CardTypePredicate(CardType.ENCHANTMENT));
|
||||
filterGraveyardEnchantment.add(new OwnerPredicate(TargetController.YOU));
|
||||
|
@ -86,7 +92,8 @@ public class StarfieldOfNyx extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// As long as you control five or more enchantments, each other non-Aura enchantment you control is a creature in addition to its other types and has base power and base toughness each equal to its converted mana cost.
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(new StarfieldOfNyxEffect(), new PermanentsOnTheBattlefieldCondition(filterEnchantmentYouControl, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 4), rule1);
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||
new StarfieldOfNyxEffect(), new PermanentsOnTheBattlefieldCondition(filterEnchantmentYouControl, PermanentsOnTheBattlefieldCondition.CountType.MORE_THAN, 4), rule1);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
||||
|
@ -103,6 +110,7 @@ public class StarfieldOfNyx extends CardImpl {
|
|||
class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("Each other non-Aura enchantment you control");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new SubtypePredicate("Aura")));
|
||||
filter.add(new AnotherPredicate());
|
||||
|
@ -152,10 +160,23 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
||||
Set<UUID> dependentTo = null;
|
||||
for (ContinuousEffect effect : allEffectsInLayer) {
|
||||
// http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17664&start=30#p185513
|
||||
if (effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)) {
|
||||
if (dependentTo == null) {
|
||||
dependentTo = new HashSet<>();
|
||||
}
|
||||
dependentTo.add(effect.getId());
|
||||
}
|
||||
}
|
||||
return dependentTo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,11 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
@ -67,8 +69,10 @@ public class TheloniteDruid extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// {1}{G}, {tap}, Sacrifice a creature: Forests you control become 2/3 creatures until end of turn. They're still lands.
|
||||
ContinuousEffect effect = new BecomesCreatureAllEffect(new TheloniteDruidLandToken(), "Forests", filter, Duration.EndOfTurn);
|
||||
effect.getDependencyTypes().add(DependencyType.BecomeForest);
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new BecomesCreatureAllEffect(new TheloniteDruidLandToken(), "Forests", filter, Duration.EndOfTurn),
|
||||
effect,
|
||||
new ManaCostsImpl("{1}{G}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
|
||||
|
@ -86,10 +90,11 @@ public class TheloniteDruid extends CardImpl {
|
|||
}
|
||||
|
||||
class TheloniteDruidLandToken extends Token {
|
||||
|
||||
public TheloniteDruidLandToken() {
|
||||
super("", "2/3 creatures");
|
||||
cardType.add(CardType.CREATURE);
|
||||
power = new MageInt(2);
|
||||
toughness = new MageInt(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.effects.ContinuousEffectImpl;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -80,6 +81,7 @@ public class EnchantedEvening extends CardImpl {
|
|||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.addedCardType = addedCardType;
|
||||
this.filter = filter;
|
||||
this.dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||
}
|
||||
|
||||
public EnchangedEveningEffect(final EnchangedEveningEffect effect) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.urzasdestiny;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -37,6 +38,7 @@ import mage.abilities.effects.ContinuousEffect;
|
|||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.PTChangingEffects_7;
|
||||
|
@ -51,7 +53,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
|||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.sets.shadowmoor.EnchantedEvening;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -82,10 +83,12 @@ public class Opalescence extends CardImpl {
|
|||
class OpalescenceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("Each other non-Aura enchantment");
|
||||
private static final EnumSet checkDependencyTypes;
|
||||
|
||||
static {
|
||||
filter.add(Predicates.not(new SubtypePredicate("Aura")));
|
||||
filter.add(new AnotherPredicate());
|
||||
checkDependencyTypes = EnumSet.of(DependencyType.AuraAddingRemoving, DependencyType.EnchantmentAddingRemoving);
|
||||
}
|
||||
|
||||
public OpalescenceEffect() {
|
||||
|
@ -140,11 +143,13 @@ class OpalescenceEffect extends ContinuousEffectImpl {
|
|||
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
||||
Set<UUID> dependentTo = null;
|
||||
for (ContinuousEffect effect : allEffectsInLayer) {
|
||||
if (EnchantedEvening.class.equals(effect.getClass().getEnclosingClass())) {
|
||||
if (dependentTo == null) {
|
||||
dependentTo = new HashSet<>();
|
||||
for (DependencyType dependencyType : effect.getDependencyTypes()) {
|
||||
if (checkDependencyTypes.contains(dependencyType)) {
|
||||
if (dependentTo == null) {
|
||||
dependentTo = new HashSet<>();
|
||||
}
|
||||
dependentTo.add(effect.getId());
|
||||
}
|
||||
dependentTo.add(effect.getId());
|
||||
}
|
||||
}
|
||||
return dependentTo;
|
||||
|
|
|
@ -48,6 +48,7 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -77,13 +78,12 @@ public class Necromancy extends CardImpl {
|
|||
super(ownerId, 14, "Necromancy", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
|
||||
this.expansionSetCode = "VIS";
|
||||
|
||||
|
||||
// You may cast Necromancy as though it had flash. If you cast it any time a sorcery couldn't have been cast, the controller of the permanent it becomes sacrifices it at the beginning of the next cleanup step.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastSourceAsThoughItHadFlashEffect(this, Duration.EndOfGame, true)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CastSourceAsThoughItHadFlashEffect(this, Duration.EndOfGame, true)));
|
||||
this.addAbility(new CastAtInstantTimeTriggeredAbility());
|
||||
|
||||
// When Necromancy enters the battlefield, if it's on the battlefield, it becomes an Aura with "enchant creature put onto the battlefield with Necromancy."
|
||||
// Put target creature card from a graveyard onto the battlefield under your control and attach Necromancy to it.
|
||||
|
||||
// When Necromancy enters the battlefield, if it's on the battlefield, it becomes an Aura with "enchant creature put onto the battlefield with Necromancy."
|
||||
// Put target creature card from a graveyard onto the battlefield under your control and attach Necromancy to it.
|
||||
// When Necromancy leaves the battlefield, that creature's controller sacrifices it.
|
||||
Ability ability = new ConditionalTriggeredAbility(
|
||||
new EntersBattlefieldTriggeredAbility(new NecromancyReAttachEffect(), false),
|
||||
|
@ -91,7 +91,7 @@ public class Necromancy extends CardImpl {
|
|||
"When {this} enters the battlefield, if it's on the battlefield, it becomes an Aura with \"enchant creature put onto the battlefield with {this}.\" Put target creature card from a graveyard onto the battlefield under your control and attach {this} to it.");
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new NecromancyLeavesBattlefieldTriggeredEffect(), false));
|
||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new NecromancyLeavesBattlefieldTriggeredEffect(), false));
|
||||
}
|
||||
|
||||
public Necromancy(final Necromancy card) {
|
||||
|
@ -104,7 +104,6 @@ public class Necromancy extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class CastSourceAsThoughItHadFlashEffect extends AsThoughEffectImpl {
|
||||
|
||||
private final boolean sacrificeIfCastAsInstant;
|
||||
|
@ -115,7 +114,6 @@ class CastSourceAsThoughItHadFlashEffect extends AsThoughEffectImpl {
|
|||
staticText = "You may cast {this} as though it had flash";
|
||||
}
|
||||
|
||||
|
||||
public CastSourceAsThoughItHadFlashEffect(final CastSourceAsThoughItHadFlashEffect effect) {
|
||||
super(effect);
|
||||
this.sacrificeIfCastAsInstant = effect.sacrificeIfCastAsInstant;
|
||||
|
@ -139,6 +137,7 @@ class CastSourceAsThoughItHadFlashEffect extends AsThoughEffectImpl {
|
|||
}
|
||||
|
||||
class CastAtInstantTimeTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CastAtInstantTimeTriggeredAbility() {
|
||||
super(Zone.STACK, new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextCleanupDelayedTriggeredAbility(new SacrificeSourceEffect())));
|
||||
}
|
||||
|
@ -176,21 +175,21 @@ class CastAtInstantTimeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
class NecromancyReAttachEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public NecromancyReAttachEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "it becomes an Aura with \"enchant creature put onto the battlefield with {this}\"";
|
||||
}
|
||||
|
||||
|
||||
public NecromancyReAttachEffect(final NecromancyReAttachEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NecromancyReAttachEffect copy() {
|
||||
return new NecromancyReAttachEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -211,27 +210,27 @@ class NecromancyReAttachEffect extends OneShotEffect {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class NecromancyLeavesBattlefieldTriggeredEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public NecromancyLeavesBattlefieldTriggeredEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "enchanted creature's controller sacrifices it";
|
||||
}
|
||||
|
||||
|
||||
public NecromancyLeavesBattlefieldTriggeredEffect(final NecromancyLeavesBattlefieldTriggeredEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NecromancyLeavesBattlefieldTriggeredEffect copy() {
|
||||
return new NecromancyLeavesBattlefieldTriggeredEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -252,7 +251,7 @@ class NecromancyLeavesBattlefieldTriggeredEffect extends OneShotEffect {
|
|||
class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||
|
||||
private final static Ability newAbility = new EnchantAbility("creature put onto the battlefield with Necromancy");
|
||||
|
||||
|
||||
static {
|
||||
newAbility.setRuleAtTheTop(true);
|
||||
}
|
||||
|
@ -263,9 +262,9 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
|
|||
super(Duration.Custom, Outcome.AddAbility);
|
||||
staticText = "it becomes an Aura with \"enchant creature put onto the battlefield with {this}\"";
|
||||
this.target = target;
|
||||
dependencyTypes.add(DependencyType.AuraAddingRemoving);
|
||||
}
|
||||
|
||||
|
||||
public NecromancyChangeAbilityEffect(final NecromancyChangeAbilityEffect effect) {
|
||||
super(effect);
|
||||
this.target = effect.target;
|
||||
|
@ -275,7 +274,7 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
|
|||
public NecromancyChangeAbilityEffect copy() {
|
||||
return new NecromancyChangeAbilityEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
|
@ -301,8 +300,8 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
|
|||
permanent.getSpellAbility().getTargets().add(target);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.discard();
|
||||
return false;
|
||||
}
|
||||
|
@ -316,5 +315,5 @@ class NecromancyChangeAbilityEffect extends ContinuousEffectImpl implements Sour
|
|||
public boolean hasLayer(Layer layer) {
|
||||
return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.TypeChangingEffects_4.equals(layer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.enchantments;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class StarfieldOfNyxTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* I had Starfield of Nyx out. With the upkeep trigger, I brought back a
|
||||
* Cloudform, which was the fifth enchantment. I had another Cloudform, and
|
||||
* Starfield of Nyx not only turned both of them into creatures (it
|
||||
* shouldn't, because they're auras), but it also destroyed them. The
|
||||
* manifests stayed on the battlefield without Flying or Hexproof.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testBaneAlleyBroker() {
|
||||
// At the beginning of your upkeep, if you control an artifact, put a 1/1 colorless Thopter artifact creature token with flying onto the battlefield.
|
||||
// Whenever one or more artifact creatures you control deal combat damage to a player, draw a card.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Thopter Spy Network", 2); // {2}{U}{U} - added to come to 5 enchantments on the battlefield
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 8);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
// At the beginning of your upkeep, you may return target enchantment card from your graveyard to the battlefield.
|
||||
// As long as you control five or more enchantments, each other non-Aura enchantment you control is a creature in
|
||||
// addition to its other types and has base power and base toughness each equal to its converted mana cost.
|
||||
addCard(Zone.HAND, playerA, "Starfield of Nyx"); // "{4}{W}"
|
||||
// When Cloudform enters the battlefield, it becomes an Aura with enchant creature. Manifest the top card of your library and attach Cloudform to it.
|
||||
// Enchanted creature has flying and hexproof.
|
||||
addCard(Zone.HAND, playerA, "Cloudform"); // {1}{U}{U}
|
||||
addCard(Zone.GRAVEYARD, playerA, "Cloudform");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Starfield of Nyx");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cloudform");
|
||||
|
||||
addTarget(playerA, "Cloudform");
|
||||
|
||||
setStopAt(3, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Thopter Spy Network", 0);
|
||||
assertPowerToughness(playerA, "", 2, 2, Filter.ComparisonScope.All); // the manifested cards
|
||||
assertPermanentCount(playerA, "Starfield of Nyx", 1);
|
||||
assertPowerToughness(playerA, "Thopter Spy Network", 4, 4, Filter.ComparisonScope.All);
|
||||
assertPermanentCount(playerA, "Cloudform", 2);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,9 +3,7 @@ package org.mage.test.cards.facedown;
|
|||
import mage.cards.Card;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.ExileZone;
|
||||
import org.junit.Assert;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
@ -15,14 +13,12 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class BaneAlleyBrokerTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Bane Alley Broker
|
||||
* Creature — Human Rogue 0/3, 1UB (3)
|
||||
* {T}: Draw a card, then exile a card from your hand face down.
|
||||
* You may look at cards exiled with Bane Alley Broker.
|
||||
* {U}{B}, {T}: Return a card exiled with Bane Alley Broker to its owner's hand.
|
||||
*
|
||||
* Bane Alley Broker Creature — Human Rogue 0/3, 1UB (3) {T}: Draw a card,
|
||||
* then exile a card from your hand face down. You may look at cards exiled
|
||||
* with Bane Alley Broker. {U}{B}, {T}: Return a card exiled with Bane Alley
|
||||
* Broker to its owner's hand.
|
||||
*
|
||||
*/
|
||||
|
||||
// test that cards exiled using Bane Alley Broker are face down
|
||||
@Test
|
||||
public void testBaneAlleyBroker() {
|
||||
|
@ -31,20 +27,20 @@ public class BaneAlleyBrokerTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Sejiri Merfolk");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Draw a card, then exile a card from your hand face down.");
|
||||
addTarget(playerA, "Goblin Roughrider");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertHandCount(playerA, 2);
|
||||
assertHandCount(playerA, "Sejiri Merfolk", 1);
|
||||
assertHandCount(playerA, "Goblin Roughrider", 0);
|
||||
|
||||
assertExileCount("Goblin Roughrider", 1);
|
||||
|
||||
for (Card card :currentGame.getExile().getAllCards(currentGame)){
|
||||
for (Card card : currentGame.getExile().getAllCards(currentGame)) {
|
||||
if (card.getName().equals("Goblin Roughrider")) {
|
||||
Assert.assertTrue("Exiled card is not face down", card.isFaceDown(currentGame));
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
@ -20,12 +20,11 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -42,6 +41,7 @@ import mage.abilities.effects.common.CreateSpecialActionEffect;
|
|||
import mage.abilities.effects.common.RemoveSpecialActionEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -76,25 +76,25 @@ public class LicidAbility extends ActivatedAbilityImpl {
|
|||
}
|
||||
|
||||
class LicidEffect extends OneShotEffect {
|
||||
|
||||
|
||||
private final ManaCost specialActionCost;
|
||||
|
||||
|
||||
LicidEffect(ManaCost specialActionCost) {
|
||||
super(Outcome.Neutral);
|
||||
this.specialActionCost = specialActionCost;
|
||||
this.staticText = "{this} loses this ability and becomes an Aura enchantment with enchant creature. Attach it to target creature. You may pay " + specialActionCost.getText() + " to end this effect";
|
||||
}
|
||||
|
||||
|
||||
LicidEffect(final LicidEffect effect) {
|
||||
super(effect);
|
||||
this.specialActionCost = effect.specialActionCost;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LicidEffect copy() {
|
||||
return new LicidEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent licid = (Permanent) source.getSourceObjectIfItStillExists(game);
|
||||
|
@ -113,15 +113,16 @@ class LicidEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class LicidContinuousEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
private final UUID messageId;
|
||||
|
||||
|
||||
LicidContinuousEffect(UUID messageId) {
|
||||
super(Duration.Custom, Outcome.Neutral);
|
||||
this.messageId = messageId;
|
||||
dependencyTypes.add(DependencyType.AuraAddingRemoving);
|
||||
}
|
||||
|
||||
LicidContinuousEffect(LicidContinuousEffect ability) {
|
||||
LicidContinuousEffect(final LicidContinuousEffect ability) {
|
||||
super(ability);
|
||||
this.messageId = ability.messageId;
|
||||
}
|
||||
|
@ -201,28 +202,28 @@ class LicidSpecialAction extends SpecialAction {
|
|||
}
|
||||
|
||||
class LicidSpecialActionEffect extends OneShotEffect {
|
||||
|
||||
|
||||
private final UUID messageId;
|
||||
private final UUID generatingSpecialActionId;
|
||||
|
||||
|
||||
LicidSpecialActionEffect(UUID messageId, UUID generatingSpecialActionId, String licidName) {
|
||||
super(Outcome.Neutral);
|
||||
this.messageId = messageId;
|
||||
this.generatingSpecialActionId = generatingSpecialActionId;
|
||||
this.staticText = "End " + licidName + " Effect";
|
||||
}
|
||||
|
||||
|
||||
LicidSpecialActionEffect(final LicidSpecialActionEffect effect) {
|
||||
super(effect);
|
||||
this.messageId = effect.messageId;
|
||||
this.generatingSpecialActionId = effect.generatingSpecialActionId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LicidSpecialActionEffect copy() {
|
||||
return new LicidSpecialActionEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
new RemoveSpecialActionEffect(this.generatingSpecialActionId).apply(game, source);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package mage.abilities.decorator;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.condition.Condition;
|
||||
|
@ -25,7 +28,6 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
protected Condition condition;
|
||||
protected boolean initDone = false;
|
||||
|
||||
|
||||
public ConditionalContinuousEffect(ContinuousEffect effect, Condition condition, String text) {
|
||||
this(effect, null, condition, text);
|
||||
}
|
||||
|
@ -61,7 +63,7 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
public boolean isDiscarded() {
|
||||
return this.discarded || effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
if (baseCondition instanceof LockedInCondition) {
|
||||
|
@ -70,7 +72,7 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
condition = baseCondition;
|
||||
}
|
||||
effect.setTargetPointer(this.targetPointer);
|
||||
effect.init(source, game);
|
||||
effect.init(source, game);
|
||||
if (otherwiseEffect != null) {
|
||||
otherwiseEffect.setTargetPointer(this.targetPointer);
|
||||
otherwiseEffect.init(source, game);
|
||||
|
@ -134,4 +136,13 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
|||
public ConditionalContinuousEffect copy() {
|
||||
return new ConditionalContinuousEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
||||
if (effect != null) {
|
||||
return effect.isDependentTo(allEffectsInLayer);
|
||||
}
|
||||
return super.isDependentTo(allEffectsInLayer);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.SubLayer;
|
||||
|
@ -73,6 +74,8 @@ public interface ContinuousEffect extends Effect {
|
|||
|
||||
Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer);
|
||||
|
||||
Set<DependencyType> getDependencyTypes();
|
||||
|
||||
@Override
|
||||
void newId();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.abilities.effects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
@ -39,6 +40,7 @@ import mage.abilities.dynamicvalue.common.DomainValue;
|
|||
import mage.abilities.dynamicvalue.common.SignInversionDynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Layer;
|
||||
|
@ -69,6 +71,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
protected boolean affectedObjectsSet = false;
|
||||
protected List<MageObjectReference> affectedObjectList = new ArrayList<>();
|
||||
protected boolean temporary = false;
|
||||
protected EnumSet<DependencyType> dependencyTypes;
|
||||
|
||||
// until your next turn
|
||||
protected int startingTurn;
|
||||
|
@ -79,6 +82,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
this.duration = duration;
|
||||
this.order = 0;
|
||||
this.effectType = EffectType.CONTINUOUS;
|
||||
this.dependencyTypes = EnumSet.noneOf(DependencyType.class);
|
||||
}
|
||||
|
||||
public ContinuousEffectImpl(Duration duration, Layer layer, SubLayer sublayer, Outcome outcome) {
|
||||
|
@ -100,6 +104,7 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
this.temporary = effect.temporary;
|
||||
this.startingTurn = effect.startingTurn;
|
||||
this.startingControllerId = effect.startingControllerId;
|
||||
this.dependencyTypes = effect.dependencyTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -256,4 +261,9 @@ public abstract class ContinuousEffectImpl extends EffectImpl implements Continu
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<DependencyType> getDependencyTypes() {
|
||||
return dependencyTypes;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,14 +25,18 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -40,12 +44,15 @@ import mage.game.permanent.Permanent;
|
|||
* @author nantuko
|
||||
*/
|
||||
public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
private final CardType addedCardType;
|
||||
|
||||
public AddCardTypeTargetEffect(CardType addedCardType, Duration duration) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.addedCardType = addedCardType;
|
||||
if (addedCardType.equals(CardType.ENCHANTMENT)) {
|
||||
dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||
}
|
||||
}
|
||||
|
||||
public AddCardTypeTargetEffect(final AddCardTypeTargetEffect effect) {
|
||||
|
@ -56,7 +63,7 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
for (UUID targetId :targetPointer.getTargets(game, source)) {
|
||||
for (UUID targetId : targetPointer.getTargets(game, source)) {
|
||||
Permanent target = game.getPermanent(targetId);
|
||||
if (target != null) {
|
||||
if (!target.getCardType().contains(addedCardType)) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import mage.MageObjectReference;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
|
@ -56,10 +57,10 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou
|
|||
newAbility = new EnchantAbility(target.getTargetName());
|
||||
newAbility.setRuleAtTheTop(true);
|
||||
staticText = "it becomes an Aura with enchant " + target.getTargetName();
|
||||
dependencyTypes.add(DependencyType.AuraAddingRemoving);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public BecomesAuraSourceEffect(final BecomesAuraSourceEffect effect) {
|
||||
super(effect);
|
||||
this.target = effect.target;
|
||||
|
@ -112,4 +113,4 @@ public class BecomesAuraSourceEffect extends ContinuousEffectImpl implements Sou
|
|||
return Layer.AbilityAddingRemovingEffects_6.equals(layer) || Layer.TypeChangingEffects_4.equals(layer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.abilities.mana.WhiteManaAbility;
|
|||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceBasicLandType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -73,6 +74,21 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl {
|
|||
public BecomesBasicLandTargetEffect(Duration duration, boolean chooseLandType, boolean loseOther, String... landNames) {
|
||||
super(duration, Outcome.Detriment);
|
||||
this.landTypes.addAll(Arrays.asList(landNames));
|
||||
if (landTypes.contains("Mountain")) {
|
||||
dependencyTypes.add(DependencyType.BecomeMountain);
|
||||
}
|
||||
if (landTypes.contains("Forest")) {
|
||||
dependencyTypes.add(DependencyType.BecomeForest);
|
||||
}
|
||||
if (landTypes.contains("Swamp")) {
|
||||
dependencyTypes.add(DependencyType.BecomeSwamp);
|
||||
}
|
||||
if (landTypes.contains("Island")) {
|
||||
dependencyTypes.add(DependencyType.BecomeIsland);
|
||||
}
|
||||
if (landTypes.contains("Plains")) {
|
||||
dependencyTypes.add(DependencyType.BecomePlains);
|
||||
}
|
||||
this.chooseLandType = chooseLandType;
|
||||
this.staticText = setText();
|
||||
this.loseOther = loseOther;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -37,6 +36,7 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.effects.common.continuous.SourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
|
@ -54,57 +54,66 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
*
|
||||
* 702.102. Bestow
|
||||
*
|
||||
* 702.102a Bestow represents two static abilities, one that functions while the card with bestow is
|
||||
* on the stack and another that functions both while it’s on stack and while it’s on the battlefield.
|
||||
* “Bestow [cost]” means “You may cast this card by paying [cost] rather than its mana cost.” and “If
|
||||
* you chose to pay this spell’s bestow cost, it becomes an Aura enchantment and gains enchant creature.
|
||||
* These effects last until one of two things happens: this spell has an illegal target as it resolves
|
||||
* and or the permanent this spell becomes, becomes unattached.” Paying a card’s bestow cost follows the
|
||||
* rules for paying alternative costs in rules 601.2b and 601.2e–g.
|
||||
* 702.102a Bestow represents two static abilities, one that functions while the
|
||||
* card with bestow is on the stack and another that functions both while it’s
|
||||
* on stack and while it’s on the battlefield. “Bestow [cost]” means “You may
|
||||
* cast this card by paying [cost] rather than its mana cost.” and “If you chose
|
||||
* to pay this spell’s bestow cost, it becomes an Aura enchantment and gains
|
||||
* enchant creature. These effects last until one of two things happens: this
|
||||
* spell has an illegal target as it resolves and or the permanent this spell
|
||||
* becomes, becomes unattached.” Paying a card’s bestow cost follows the rules
|
||||
* for paying alternative costs in rules 601.2b and 601.2e–g.
|
||||
*
|
||||
* 702.102b If a spell’s controller chooses to pay its bestow cost, that player chooses a legal target
|
||||
* for that Aura spell as defined by its enchant creature ability and rule 601.2c. See also rule 303.4.
|
||||
* 702.102b If a spell’s controller chooses to pay its bestow cost, that player
|
||||
* chooses a legal target for that Aura spell as defined by its enchant creature
|
||||
* ability and rule 601.2c. See also rule 303.4.
|
||||
*
|
||||
* 702.102c A spell’s controller can’t choose to pay its bestow cost unless that player can choose a legal
|
||||
* target for that spell after it becomes an Aura spell.
|
||||
* 702.102c A spell’s controller can’t choose to pay its bestow cost unless that
|
||||
* player can choose a legal target for that spell after it becomes an Aura
|
||||
* spell.
|
||||
*
|
||||
* 702.102d As an Aura spell with bestow begins resolving, if its target is illegal, the effect making
|
||||
* it an Aura spell ends. It continues resolving as a creature spell and will be put onto the battlefield
|
||||
* under the control of the spell’s controller. This is an exception to rule 608.3a.
|
||||
* 702.102d As an Aura spell with bestow begins resolving, if its target is
|
||||
* illegal, the effect making it an Aura spell ends. It continues resolving as a
|
||||
* creature spell and will be put onto the battlefield under the control of the
|
||||
* spell’s controller. This is an exception to rule 608.3a.
|
||||
*
|
||||
* 702.102e If an Aura with bestow is attached to an illegal object or player, it becomes unattached.
|
||||
* This is an exception to rule 704.5n.
|
||||
*
|
||||
* You don’t choose whether the spell is going to be an Aura spell or not until the spell is already on
|
||||
* the stack. Abilities that affect when you can cast a spell, such as flash, will apply to the creature
|
||||
* card in whatever zone you’re casting it from. For example, an effect that said you can cast creature
|
||||
* spells as though they have flash will allow you to cast a creature card with bestow as an Aura spell
|
||||
* anytime you could cast an instant.
|
||||
* 702.102e If an Aura with bestow is attached to an illegal object or player,
|
||||
* it becomes unattached. This is an exception to rule 704.5n.
|
||||
*
|
||||
* On the stack, a spell with bestow is either a creature spell or an Aura spell. It’s never both.
|
||||
* You don’t choose whether the spell is going to be an Aura spell or not until
|
||||
* the spell is already on the stack. Abilities that affect when you can cast a
|
||||
* spell, such as flash, will apply to the creature card in whatever zone you’re
|
||||
* casting it from. For example, an effect that said you can cast creature
|
||||
* spells as though they have flash will allow you to cast a creature card with
|
||||
* bestow as an Aura spell anytime you could cast an instant.
|
||||
*
|
||||
* Unlike other Aura spells, an Aura spell with bestow isn’t countered if its target is illegal as it
|
||||
* begins to resolve. Rather, the effect making it an Aura spell ends, it loses enchant creature, it
|
||||
* returns to being an enchantment creature spell, and it resolves and enters the battlefield as an
|
||||
* On the stack, a spell with bestow is either a creature spell or an Aura
|
||||
* spell. It’s never both.
|
||||
*
|
||||
* Unlike other Aura spells, an Aura spell with bestow isn’t countered if its
|
||||
* target is illegal as it begins to resolve. Rather, the effect making it an
|
||||
* Aura spell ends, it loses enchant creature, it returns to being an
|
||||
* enchantment creature spell, and it resolves and enters the battlefield as an
|
||||
* enchantment creature.
|
||||
*
|
||||
* Unlike other Auras, an Aura with bestow isn’t put into its owner’s graveyard if it becomes unattached.
|
||||
* Rather, the effect making it an Aura ends, it loses enchant creature, and it remains on the
|
||||
* battlefield as an enchantment creature. It can attack (and its {T} abilities can be activated,
|
||||
* if it has any) on the turn it becomes unattached if it’s been under your control continuously,
|
||||
* even as an Aura, since your most recent turn began.
|
||||
* Unlike other Auras, an Aura with bestow isn’t put into its owner’s graveyard
|
||||
* if it becomes unattached. Rather, the effect making it an Aura ends, it loses
|
||||
* enchant creature, and it remains on the battlefield as an enchantment
|
||||
* creature. It can attack (and its {T} abilities can be activated, if it has
|
||||
* any) on the turn it becomes unattached if it’s been under your control
|
||||
* continuously, even as an Aura, since your most recent turn began.
|
||||
*
|
||||
* If a permanent with bestow enters the battlefield by any method other than being cast, it will be
|
||||
* an enchantment creature. You can’t choose to pay the bestow cost and have it become an Aura.
|
||||
* If a permanent with bestow enters the battlefield by any method other than
|
||||
* being cast, it will be an enchantment creature. You can’t choose to pay the
|
||||
* bestow cost and have it become an Aura.
|
||||
*
|
||||
* Auras attached to a creature don’t become tapped when the creature becomes tapped. Except in some
|
||||
* rare cases, an Aura with bestow remains untapped when it becomes unattached and becomes a creature.
|
||||
* Auras attached to a creature don’t become tapped when the creature becomes
|
||||
* tapped. Except in some rare cases, an Aura with bestow remains untapped when
|
||||
* it becomes unattached and becomes a creature.
|
||||
*
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
|
||||
public class BestowAbility extends SpellAbility {
|
||||
|
||||
public BestowAbility(Card card, String manaString) {
|
||||
|
@ -135,67 +144,67 @@ public class BestowAbility extends SpellAbility {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Bestow " + getManaCostsToPay().getText()+ " <i>(If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)</i>";
|
||||
return "Bestow " + getManaCostsToPay().getText() + " <i>(If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)</i>";
|
||||
}
|
||||
|
||||
}
|
||||
class BestowTypeChangingEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||
|
||||
class BestowTypeChangingEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||
private boolean wasAttached;
|
||||
|
||||
private boolean wasAttached;
|
||||
|
||||
public BestowTypeChangingEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
wasAttached = false;
|
||||
}
|
||||
|
||||
public BestowTypeChangingEffect(final BestowTypeChangingEffect effect) {
|
||||
super(effect);
|
||||
this.wasAttached = effect.wasAttached;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BestowTypeChangingEffect copy() {
|
||||
return new BestowTypeChangingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (permanent.getAttachedTo() == null) {
|
||||
if (wasAttached && permanent.getSubtype().contains("Aura")) {
|
||||
permanent.getSubtype().remove("Aura");
|
||||
wasAttached = false;
|
||||
}
|
||||
} else {
|
||||
permanent.getCardType().remove(CardType.CREATURE);
|
||||
permanent.getSubtype().clear();
|
||||
if (!permanent.getSubtype().contains("Aura")) {
|
||||
permanent.getSubtype().add("Aura");
|
||||
}
|
||||
wasAttached = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
public BestowTypeChangingEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
wasAttached = false;
|
||||
dependencyTypes.add(DependencyType.AuraAddingRemoving);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
public BestowTypeChangingEffect(final BestowTypeChangingEffect effect) {
|
||||
super(effect);
|
||||
this.wasAttached = effect.wasAttached;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BestowTypeChangingEffect copy() {
|
||||
return new BestowTypeChangingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (permanent.getAttachedTo() == null) {
|
||||
if (wasAttached && permanent.getSubtype().contains("Aura")) {
|
||||
permanent.getSubtype().remove("Aura");
|
||||
wasAttached = false;
|
||||
}
|
||||
} else {
|
||||
permanent.getCardType().remove(CardType.CREATURE);
|
||||
permanent.getSubtype().clear();
|
||||
if (!permanent.getSubtype().contains("Aura")) {
|
||||
permanent.getSubtype().add("Aura");
|
||||
}
|
||||
wasAttached = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
50
Mage/src/mage/constants/DependencyType.java
Normal file
50
Mage/src/mage/constants/DependencyType.java
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.constants;
|
||||
|
||||
/**
|
||||
* Dependency types are a part of a workaround solution to handle dependencies
|
||||
* of continuous effects.
|
||||
*
|
||||
* http://magiccards.info/rule/613-interaction-of-continuous-effects.html
|
||||
*
|
||||
* https://github.com/magefree/mage/issues/1259
|
||||
*
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public enum DependencyType {
|
||||
|
||||
AuraAddingRemoving,
|
||||
BecomeForest,
|
||||
BecomeIsland,
|
||||
BecomeMountain,
|
||||
BecomePlains,
|
||||
BecomeSwamp,
|
||||
EnchantmentAddingRemoving;
|
||||
}
|
Loading…
Reference in a new issue