diff --git a/Mage.Sets/src/mage/cards/b/BanishingSlash.java b/Mage.Sets/src/mage/cards/b/BanishingSlash.java index 78251be8eb..62df43ea81 100644 --- a/Mage.Sets/src/mage/cards/b/BanishingSlash.java +++ b/Mage.Sets/src/mage/cards/b/BanishingSlash.java @@ -1,18 +1,14 @@ package mage.cards.b; -import mage.abilities.condition.CompoundCondition; -import mage.abilities.condition.Condition; -import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.condition.common.ControlArtifactAndEnchantmentCondition; import mage.abilities.decorator.ConditionalOneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.DestroyTargetEffect; -import mage.abilities.hint.ConditionHint; -import mage.abilities.hint.Hint; +import mage.abilities.hint.common.ControlArtifactAndEnchantmentHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.FilterPermanent; -import mage.filter.StaticFilters; import mage.filter.predicate.Predicates; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.permanent.token.SamuraiToken; @@ -39,17 +35,6 @@ public final class BanishingSlash extends CardImpl { )); } - private static final Condition condition = new CompoundCondition( - new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT), - new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ENCHANTMENT) - ); - private static final Hint hint1 = new ConditionHint(new PermanentsOnTheBattlefieldCondition( - StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT - ), "You control an artifact"); - private static final Hint hint2 = new ConditionHint(new PermanentsOnTheBattlefieldCondition( - StaticFilters.FILTER_CONTROLLED_PERMANENT_ENCHANTMENT - ), "You control an enchantment"); - public BanishingSlash(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}{W}"); @@ -57,11 +42,10 @@ public final class BanishingSlash extends CardImpl { this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter)); this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new CreateTokenEffect(new SamuraiToken()), condition, "Then if you control " + - "an artifact and an enchantment, create a 2/2 white Samurai creature token with vigilance" + new CreateTokenEffect(new SamuraiToken()), ControlArtifactAndEnchantmentCondition.instance, "Then " + + "if you control an artifact and an enchantment, create a 2/2 white Samurai creature token with vigilance" )); - this.getSpellAbility().addHint(hint1); - this.getSpellAbility().addHint(hint2); + this.getSpellAbility().addHint(ControlArtifactAndEnchantmentHint.instance); } private BanishingSlash(final BanishingSlash card) { diff --git a/Mage.Sets/src/mage/cards/n/NaomiPillarOfOrder.java b/Mage.Sets/src/mage/cards/n/NaomiPillarOfOrder.java new file mode 100644 index 0000000000..77343d225d --- /dev/null +++ b/Mage.Sets/src/mage/cards/n/NaomiPillarOfOrder.java @@ -0,0 +1,48 @@ +package mage.cards.n; + +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; +import mage.abilities.condition.common.ControlArtifactAndEnchantmentCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.hint.common.ControlArtifactAndEnchantmentHint; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.game.permanent.token.SamuraiToken; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class NaomiPillarOfOrder extends CardImpl { + + public NaomiPillarOfOrder(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ADVISOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Whenever Naomi, Pillar of Order enters the battlefield or attacks, if you control an artifact and an enchantment, create a 2/2 white Samurai creature token with vigilance. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new EntersBattlefieldOrAttacksSourceTriggeredAbility(new CreateTokenEffect(new SamuraiToken())), + ControlArtifactAndEnchantmentCondition.instance, "Whenever {this} enters the battlefield or " + + "attacks, if you control an artifact and an enchantment, create a 2/2 white Samurai creature token with vigilance." + ).addHint(ControlArtifactAndEnchantmentHint.instance)); + } + + private NaomiPillarOfOrder(final NaomiPillarOfOrder card) { + super(card); + } + + @Override + public NaomiPillarOfOrder copy() { + return new NaomiPillarOfOrder(this); + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 40de9042ec..4bb960670e 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -62,6 +62,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Michiko's Reign of Truth", 29, Rarity.UNCOMMON, mage.cards.m.MichikosReignOfTruth.class)); cards.add(new SetCardInfo("Mountain", 299, Rarity.LAND, mage.cards.basiclands.Mountain.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Nameless Conqueror", 162, Rarity.COMMON, mage.cards.n.NamelessConqueror.class)); + cards.add(new SetCardInfo("Naomi, Pillar of Order", 229, Rarity.UNCOMMON, mage.cards.n.NaomiPillarOfOrder.class)); cards.add(new SetCardInfo("Plains", 293, Rarity.LAND, mage.cards.basiclands.Plains.class, FULL_ART_BFZ_VARIOUS)); cards.add(new SetCardInfo("Portrait of Michiko", 29, Rarity.UNCOMMON, mage.cards.p.PortraitOfMichiko.class)); cards.add(new SetCardInfo("Satoru Umezawa", 234, Rarity.RARE, mage.cards.s.SatoruUmezawa.class)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/ControlArtifactAndEnchantmentCondition.java b/Mage/src/main/java/mage/abilities/condition/common/ControlArtifactAndEnchantmentCondition.java new file mode 100644 index 0000000000..69c55da2c6 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/ControlArtifactAndEnchantmentCondition.java @@ -0,0 +1,24 @@ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.filter.StaticFilters; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public enum ControlArtifactAndEnchantmentCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getBattlefield().contains(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, source, game, 1) + && game.getBattlefield().contains(StaticFilters.FILTER_CONTROLLED_PERMANENT_ENCHANTMENT, source, game, 1); + } + + @Override + public String toString() { + return "you control an artifact and an enchantment"; + } +} diff --git a/Mage/src/main/java/mage/abilities/hint/common/ControlArtifactAndEnchantmentHint.java b/Mage/src/main/java/mage/abilities/hint/common/ControlArtifactAndEnchantmentHint.java new file mode 100644 index 0000000000..e04c0a7bf3 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/hint/common/ControlArtifactAndEnchantmentHint.java @@ -0,0 +1,34 @@ +package mage.abilities.hint.common; + +import mage.abilities.Ability; +import mage.abilities.hint.Hint; +import mage.filter.StaticFilters; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public enum ControlArtifactAndEnchantmentHint implements Hint { + instance; + + @Override + public String getText(Game game, Ability ability) { + boolean artifact = game.getBattlefield().contains( + StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, ability, game, 1 + ); + boolean enchantment = game.getBattlefield().contains( + StaticFilters.FILTER_CONTROLLED_PERMANENT_ENCHANTMENT, ability, game, 1 + ); + if (artifact) { + return "You control and artifact" + (enchantment ? " and an enchantment" : ""); + } else if (enchantment) { + return "You control an enchantment"; + } + return null; + } + + @Override + public ControlArtifactAndEnchantmentHint copy() { + return this; + } +}