diff --git a/Mage.Sets/src/mage/cards/t/TamiyosCompleation.java b/Mage.Sets/src/mage/cards/t/TamiyosCompleation.java new file mode 100644 index 0000000000..3d5fe53db7 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TamiyosCompleation.java @@ -0,0 +1,132 @@ +package mage.cards.t; + +import java.util.UUID; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +import mage.constants.*; +import mage.abilities.keyword.FlashAbility; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.abilities.effects.common.AttachEffect; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; + +/** + * + * @author weirddan455 + */ +public final class TamiyosCompleation extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("artifact, creature, or planeswalker"); + + static { + filter.add(Predicates.or(CardType.ARTIFACT.getPredicate(), CardType.CREATURE.getPredicate(), CardType.PLANESWALKER.getPredicate())); + } + + public TamiyosCompleation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}"); + + this.subtype.add(SubType.AURA); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Enchant artifact, creature, or planeswalker + TargetPermanent auraTarget = new TargetPermanent(filter); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.LoseAbility)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // When Tamiyo's Compleation enters the battlefield, tap enchanted permanent. If it's an Equipment, unattach it. + this.addAbility(new EntersBattlefieldTriggeredAbility(new TamiyosCompleationTapEffect())); + + // Enchanted permanent loses all abilities and doesn't untap during its controller's untap step. + Ability ability = new SimpleStaticAbility(new TamiyosCompleationLoseAbilitiesEffect()); + ability.addEffect(new DontUntapInControllersUntapStepEnchantedEffect().setText("and doesn't untap during its controller's untap step")); + this.addAbility(ability); + } + + private TamiyosCompleation(final TamiyosCompleation card) { + super(card); + } + + @Override + public TamiyosCompleation copy() { + return new TamiyosCompleation(this); + } +} + +class TamiyosCompleationTapEffect extends OneShotEffect { + + public TamiyosCompleationTapEffect() { + super(Outcome.Tap); + this.staticText = "tap enchanted permanent. If it's an Equipment, unattach it"; + } + + private TamiyosCompleationTapEffect(final TamiyosCompleationTapEffect effect) { + super(effect); + } + + @Override + public TamiyosCompleationTapEffect copy() { + return new TamiyosCompleationTapEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = source.getSourcePermanentIfItStillExists(game); + if (enchantment != null) { + Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); + if (enchanted != null) { + enchanted.tap(source, game); + if (enchanted.hasSubtype(SubType.EQUIPMENT, game)) { + Permanent creature = game.getPermanent(enchanted.getAttachedTo()); + if (creature != null) { + creature.removeAttachment(enchanted.getId(), source, game); + } + } + return true; + } + } + return false; + } +} + +class TamiyosCompleationLoseAbilitiesEffect extends ContinuousEffectImpl { + + public TamiyosCompleationLoseAbilitiesEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility); + this.staticText = "Enchanted permanent loses all abilities"; + } + + private TamiyosCompleationLoseAbilitiesEffect(final TamiyosCompleationLoseAbilitiesEffect effect) { + super(effect); + } + + @Override + public TamiyosCompleationLoseAbilitiesEffect copy() { + return new TamiyosCompleationLoseAbilitiesEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent enchantment = source.getSourcePermanentIfItStillExists(game); + if (enchantment != null) { + Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); + if (enchanted != null) { + enchanted.removeAllAbilities(source.getSourceId(), game); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index b3ddeb0f32..1d662bb0c0 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -131,6 +131,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Surgehacker Mech", 260, Rarity.RARE, mage.cards.s.SurgehackerMech.class)); cards.add(new SetCardInfo("Swamp", 287, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Takenuma, Abandoned Mire", 278, Rarity.RARE, mage.cards.t.TakenumaAbandonedMire.class)); + cards.add(new SetCardInfo("Tamiyo's Compleation", 83, Rarity.COMMON, mage.cards.t.TamiyosCompleation.class)); cards.add(new SetCardInfo("Tempered in Solitude", 165, Rarity.UNCOMMON, mage.cards.t.TemperedInSolitude.class)); cards.add(new SetCardInfo("The Fall of Lord Konda", 12, Rarity.UNCOMMON, mage.cards.t.TheFallOfLordKonda.class)); cards.add(new SetCardInfo("The Modern Age", 66, Rarity.COMMON, mage.cards.t.TheModernAge.class));