mirror of
https://github.com/correl/mage.git
synced 2024-12-28 11:14:13 +00:00
- Fixed #6136
This commit is contained in:
parent
3076b08250
commit
732ed1aed8
2 changed files with 29 additions and 16 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.e;
|
package mage.cards.e;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -20,10 +19,11 @@ import mage.game.permanent.Permanent;
|
||||||
public final class EnchantedEvening extends CardImpl {
|
public final class EnchantedEvening extends CardImpl {
|
||||||
|
|
||||||
public EnchantedEvening(UUID ownerId, CardSetInfo setInfo) {
|
public EnchantedEvening(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W/U}{W/U}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W/U}{W/U}");
|
||||||
|
|
||||||
// All permanents are enchantments in addition to their other types.
|
// All permanents are enchantments in addition to their other types.
|
||||||
Effect effect = new EnchangedEveningEffect(CardType.ENCHANTMENT, Duration.WhileOnBattlefield, new FilterPermanent());
|
Effect effect = new EnchangedEveningEffect(CardType.ENCHANTMENT,
|
||||||
|
Duration.WhileOnBattlefield, new FilterPermanent());
|
||||||
effect.setText("All permanents are enchantments in addition to their other types");
|
effect.setText("All permanents are enchantments in addition to their other types");
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ public final class EnchantedEvening extends CardImpl {
|
||||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||||
this.addedCardType = addedCardType;
|
this.addedCardType = addedCardType;
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
this.dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnchangedEveningEffect(final EnchangedEveningEffect effect) {
|
public EnchangedEveningEffect(final EnchangedEveningEffect effect) {
|
||||||
|
@ -60,7 +60,8 @@ public final class EnchantedEvening extends CardImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||||
if (permanent != null && !permanent.getCardType().contains(addedCardType)) {
|
if (permanent != null
|
||||||
|
&& !permanent.getCardType().contains(addedCardType)) {
|
||||||
permanent.addCardType(addedCardType);
|
permanent.addCardType(addedCardType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -35,10 +34,13 @@ import mage.target.common.TargetCardInGraveyard;
|
||||||
*/
|
*/
|
||||||
public final class StarfieldOfNyx extends CardImpl {
|
public final class StarfieldOfNyx extends CardImpl {
|
||||||
|
|
||||||
private static final String rule1 = "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.";
|
private static final String rule1 = "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.";
|
||||||
|
|
||||||
private static final FilterCard filterGraveyardEnchantment = new FilterCard("enchantment card from your graveyard");
|
private static final FilterCard filterGraveyardEnchantment = new FilterCard("enchantment card from your graveyard");
|
||||||
private static final FilterEnchantmentPermanent filterEnchantmentYouControl = new FilterEnchantmentPermanent("enchantment you control");
|
private static final FilterEnchantmentPermanent filterEnchantmentYouControl
|
||||||
|
= new FilterEnchantmentPermanent("enchantment you control");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterEnchantmentYouControl.add(new ControllerPredicate(TargetController.YOU));
|
filterEnchantmentYouControl.add(new ControllerPredicate(TargetController.YOU));
|
||||||
|
@ -52,15 +54,19 @@ public final class StarfieldOfNyx extends CardImpl {
|
||||||
public StarfieldOfNyx(UUID ownerId, CardSetInfo setInfo) {
|
public StarfieldOfNyx(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}");
|
||||||
|
|
||||||
// At the beginning of your upkeep, you may return target enchantment card from your graveyard to the battlefield.
|
// At the beginning of your upkeep, you may return target enchantment card
|
||||||
|
// from your graveyard to the battlefield.
|
||||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD,
|
||||||
new ReturnFromGraveyardToBattlefieldTargetEffect(), TargetController.YOU, true);
|
new ReturnFromGraveyardToBattlefieldTargetEffect(), TargetController.YOU, true);
|
||||||
ability.addTarget(new TargetCardInGraveyard(filterGraveyardEnchantment));
|
ability.addTarget(new TargetCardInGraveyard(filterGraveyardEnchantment));
|
||||||
this.addAbility(ability);
|
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.
|
// 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(
|
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(
|
||||||
new StarfieldOfNyxEffect(), new PermanentsOnTheBattlefieldCondition(filterEnchantmentYouControl, ComparisonType.MORE_THAN, 4), rule1);
|
new StarfieldOfNyxEffect(), new PermanentsOnTheBattlefieldCondition(
|
||||||
|
filterEnchantmentYouControl, ComparisonType.MORE_THAN, 4), rule1);
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +82,8 @@ public final class StarfieldOfNyx extends CardImpl {
|
||||||
|
|
||||||
class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("Each other non-Aura enchantment you control");
|
private static final FilterEnchantmentPermanent filter
|
||||||
|
= new FilterEnchantmentPermanent("Each other non-Aura enchantment you control");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(Predicates.not(new SubtypePredicate(SubType.AURA)));
|
filter.add(Predicates.not(new SubtypePredicate(SubType.AURA)));
|
||||||
|
@ -86,7 +93,9 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public StarfieldOfNyxEffect() {
|
public StarfieldOfNyxEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
|
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
|
||||||
staticText = "Each other non-Aura enchantment you control is a creature in addition to its other types and has base power and toughness each equal to its converted mana cost";
|
staticText = "Each other non-Aura enchantment you control is a creature "
|
||||||
|
+ "in addition to its other types and has base power and "
|
||||||
|
+ "toughness each equal to its converted mana cost";
|
||||||
}
|
}
|
||||||
|
|
||||||
public StarfieldOfNyxEffect(final StarfieldOfNyxEffect effect) {
|
public StarfieldOfNyxEffect(final StarfieldOfNyxEffect effect) {
|
||||||
|
@ -100,7 +109,8 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@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 permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter,
|
||||||
|
source.getControllerId(), source.getSourceId(), game)) {
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case TypeChangingEffects_4:
|
case TypeChangingEffects_4:
|
||||||
if (sublayer == SubLayer.NA) {
|
if (sublayer == SubLayer.NA) {
|
||||||
|
@ -129,14 +139,16 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasLayer(Layer layer) {
|
public boolean hasLayer(Layer layer) {
|
||||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;
|
return layer == Layer.PTChangingEffects_7
|
||||||
|
|| layer == Layer.TypeChangingEffects_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
public Set<UUID> isDependentTo(List<ContinuousEffect> allEffectsInLayer) {
|
||||||
return allEffectsInLayer
|
return allEffectsInLayer
|
||||||
.stream()
|
.stream()
|
||||||
.filter(effect -> effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving))
|
.filter(effect -> effect.getDependencyTypes().contains(DependencyType.AuraAddingRemoving)
|
||||||
|
|| effect.getDependencyTypes().contains(DependencyType.EnchantmentAddingRemoving)) // example: Enchanted Evening
|
||||||
.map(Effect::getId)
|
.map(Effect::getId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue