diff --git a/Mage.Sets/src/mage/cards/c/CrownOfAscension.java b/Mage.Sets/src/mage/cards/c/CrownOfAscension.java new file mode 100644 index 0000000000..3d6eb889d2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CrownOfAscension.java @@ -0,0 +1,60 @@ +package mage.cards.c; + +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author awjackson + */ +public final class CrownOfAscension extends CardImpl { + + public CrownOfAscension(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted creature has flying. + this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect( + FlyingAbility.getInstance(), AttachmentType.AURA + ))); + + // Sacrifice Crown of Ascension: Enchanted creature and other creatures that share a creature type with it + // gain flying until end of turn. + this.addAbility(new SimpleActivatedAbility( + new GainAbilityAllEffect( + FlyingAbility.getInstance(), + Duration.EndOfTurn, + StaticFilters.FILTER_CREATURE_ENCHANTED_AND_SHARE_TYPE + ), + new SacrificeSourceCost() + )); + } + + private CrownOfAscension(final CrownOfAscension card) { + super(card); + } + + @Override + public CrownOfAscension copy() { + return new CrownOfAscension(this); + } +} diff --git a/Mage.Sets/src/mage/cards/c/CrownOfSuspicion.java b/Mage.Sets/src/mage/cards/c/CrownOfSuspicion.java new file mode 100644 index 0000000000..84e24d333c --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CrownOfSuspicion.java @@ -0,0 +1,53 @@ +package mage.cards.c; + +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author awjackson + */ +public final class CrownOfSuspicion extends CardImpl { + + public CrownOfSuspicion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Removal)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted creature gets +2/-1. + this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(2, -1))); + + // Sacrifice Crown of Suspicion: Enchanted creature and other creatures that share a creature type with it + // get +2/-1 until end of turn. + this.addAbility(new SimpleActivatedAbility( + new BoostAllEffect(2, -1, Duration.EndOfTurn, StaticFilters.FILTER_CREATURE_ENCHANTED_AND_SHARE_TYPE, false), + new SacrificeSourceCost() + )); + } + + private CrownOfSuspicion(final CrownOfSuspicion card) { + super(card); + } + + @Override + public CrownOfSuspicion copy() { + return new CrownOfSuspicion(this); + } +} diff --git a/Mage.Sets/src/mage/cards/c/CrownOfVigor.java b/Mage.Sets/src/mage/cards/c/CrownOfVigor.java new file mode 100644 index 0000000000..139a82d3c0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CrownOfVigor.java @@ -0,0 +1,53 @@ +package mage.cards.c; + +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeSourceCost; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author awjackson + */ +public final class CrownOfVigor extends CardImpl { + + public CrownOfVigor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // Enchanted creature gets +1/+1. + this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(1, 1))); + + // Sacrifice Crown of Vigor: Enchanted creature and other creatures that share a creature type with it + // get +1/+1 until end of turn. + this.addAbility(new SimpleActivatedAbility( + new BoostAllEffect(1, 1, Duration.EndOfTurn, StaticFilters.FILTER_CREATURE_ENCHANTED_AND_SHARE_TYPE, false), + new SacrificeSourceCost() + )); + } + + private CrownOfVigor(final CrownOfVigor card) { + super(card); + } + + @Override + public CrownOfVigor copy() { + return new CrownOfVigor(this); + } +} diff --git a/Mage/src/main/java/mage/filter/predicate/permanent/AttachedOrShareCreatureTypePredicate.java b/Mage/src/main/java/mage/filter/predicate/permanent/AttachedOrShareCreatureTypePredicate.java new file mode 100644 index 0000000000..7e095d7aec --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/permanent/AttachedOrShareCreatureTypePredicate.java @@ -0,0 +1,33 @@ +package mage.filter.predicate.permanent; + +import mage.filter.predicate.ObjectSourcePlayer; +import mage.filter.predicate.ObjectSourcePlayerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.UUID; + +public enum AttachedOrShareCreatureTypePredicate implements ObjectSourcePlayerPredicate { + instance; + + @Override + public boolean apply(ObjectSourcePlayer input, Game game) { + Permanent attachment = input.getSource().getSourcePermanentOrLKI(game); + if (attachment == null) { + return false; + } + UUID attachedId = attachment.getAttachedTo(); + if (attachedId == null) { + return false; + } + Permanent otherPermanent = input.getObject(); + if (attachedId.equals(otherPermanent.getId())) { + return true; + } + Permanent attachedPermanent = game.getPermanentOrLKIBattlefield(attachedId); + if (attachedPermanent == null) { + return false; + } + return attachedPermanent.shareCreatureTypes(game, otherPermanent); + } +}