From 239222b397ce2155cf893b0b62d9ae9e67f0449e Mon Sep 17 00:00:00 2001 From: Noah Gleason Date: Sun, 1 Jul 2018 18:24:59 -0400 Subject: [PATCH] Implement Street Savvy --- Mage.Sets/src/mage/cards/s/StreetSavvy.java | 80 +++++++++++++++++++++ Mage.Sets/src/mage/sets/Dissension.java | 1 + 2 files changed, 81 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/StreetSavvy.java diff --git a/Mage.Sets/src/mage/cards/s/StreetSavvy.java b/Mage.Sets/src/mage/cards/s/StreetSavvy.java new file mode 100644 index 0000000000..f7d89d9b12 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/StreetSavvy.java @@ -0,0 +1,80 @@ +package mage.cards.s; + +import java.util.UUID; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.effects.common.AttachEffect; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; + +/** + * + * @author noahg + */ +public final class StreetSavvy extends CardImpl { + + public StreetSavvy(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +0/+2 and can block creatures with landwalk abilities as though they didn't have those abilities. + SimpleStaticAbility staticAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(0 ,2) + .setText("Enchanted creature gets +0/+2 and can block creatures with landwalk abilities as though they didn't have those abilities.")); + staticAbility.addEffect(new StreetSavvyEffect()); + this.addAbility(staticAbility); + } + + public StreetSavvy(final StreetSavvy card) { + super(card); + } + + @Override + public StreetSavvy copy() { + return new StreetSavvy(this); + } +} + +class StreetSavvyEffect extends AsThoughEffectImpl { + + public StreetSavvyEffect() { + super(AsThoughEffectType.BLOCK_LANDWALK, Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = ""; + } + + public StreetSavvyEffect(final StreetSavvyEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public StreetSavvyEffect copy() { + return new StreetSavvyEffect(this); + } + + @Override + public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) { + Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); + return sourcePermanent != null && sourceId.equals(sourcePermanent.getAttachedTo()); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Dissension.java b/Mage.Sets/src/mage/sets/Dissension.java index 7a258b0b16..66d8b0ef0d 100644 --- a/Mage.Sets/src/mage/sets/Dissension.java +++ b/Mage.Sets/src/mage/sets/Dissension.java @@ -173,6 +173,7 @@ public final class Dissension extends ExpansionSet { cards.add(new SetCardInfo("Stoic Ephemera", 19, Rarity.UNCOMMON, mage.cards.s.StoicEphemera.class)); cards.add(new SetCardInfo("Stomp and Howl", 96, Rarity.UNCOMMON, mage.cards.s.StompAndHowl.class)); cards.add(new SetCardInfo("Stormscale Anarch", 74, Rarity.RARE, mage.cards.s.StormscaleAnarch.class)); + cards.add(new SetCardInfo("Street Savvy", 97, Rarity.COMMON, mage.cards.s.StreetSavvy.class)); cards.add(new SetCardInfo("Supply // Demand", 157, Rarity.UNCOMMON, mage.cards.s.SupplyDemand.class)); cards.add(new SetCardInfo("Taste for Mayhem", 75, Rarity.COMMON, mage.cards.t.TasteForMayhem.class)); cards.add(new SetCardInfo("Thrive", 98, Rarity.COMMON, mage.cards.t.Thrive.class));