diff --git a/Mage.Sets/src/mage/cards/s/SecurityBypass.java b/Mage.Sets/src/mage/cards/s/SecurityBypass.java new file mode 100644 index 00000000000..8f9379cc0a0 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SecurityBypass.java @@ -0,0 +1,76 @@ +package mage.cards.s; + +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalRestrictionEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.effects.keyword.ConniveSourceEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SecurityBypass extends CardImpl { + + public SecurityBypass(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.BoostCreature)); + this.addAbility(new EnchantAbility(auraTarget.getTargetName())); + + // As long as enchanted creature is attacking alone, it can't be blocked. + this.addAbility(new SimpleStaticAbility(new ConditionalRestrictionEffect( + new CantBeBlockedSourceEffect(), SecurityBypassCondition.instance, + "as long as enchanted creature is attacking alone, it can't be blocked" + ))); + + // Enchanted creature has "Whenever this creature deals combat damage to a player, it connives." + this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect( + new DealsCombatDamageToAPlayerTriggeredAbility(new ConniveSourceEffect(), false) + .setTriggerPhrase("Whenever this creature deals combat damage to a player, "), + AttachmentType.AURA, Duration.WhileOnBattlefield, "enchanted creature has " + + "\"Whenever this creature deals combat damage to a player, it connives.\" " + + "(Its controller draws a card, then discards a card. If they discarded a nonland card, " + + "they put a +1/+1 counter on this creature.)" + ))); + } + + private SecurityBypass(final SecurityBypass card) { + super(card); + } + + @Override + public SecurityBypass copy() { + return new SecurityBypass(this); + } +} + +enum SecurityBypassCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + Permanent aura = source.getSourcePermanentIfItStillExists(game); + return aura != null + && game.getCombat().attacksAlone() + && game.getCombat().getAttackers().contains(aura.getAttachedTo()); + } +} diff --git a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java index 8ab64c1c540..11774bbeea1 100644 --- a/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java +++ b/Mage.Sets/src/mage/sets/StreetsOfNewCapenna.java @@ -108,6 +108,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet { cards.add(new SetCardInfo("Rob the Archives", 122, Rarity.UNCOMMON, mage.cards.r.RobTheArchives.class)); cards.add(new SetCardInfo("Rooftop Nuisance", 57, Rarity.COMMON, mage.cards.r.RooftopNuisance.class)); cards.add(new SetCardInfo("Rumor Gatherer", 29, Rarity.UNCOMMON, mage.cards.r.RumorGatherer.class)); + cards.add(new SetCardInfo("Security Bypass", 59, Rarity.COMMON, mage.cards.s.SecurityBypass.class)); cards.add(new SetCardInfo("Shadow of Mortality", 94, Rarity.RARE, mage.cards.s.ShadowOfMortality.class)); cards.add(new SetCardInfo("Shakedown Heavy", 95, Rarity.RARE, mage.cards.s.ShakedownHeavy.class)); cards.add(new SetCardInfo("Skybridge Towers", 256, Rarity.COMMON, mage.cards.s.SkybridgeTowers.class));