From a383bffc9b0d16b979dab59817975a9fe4460e96 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 11 Jun 2020 19:34:54 -0400 Subject: [PATCH] Implemented Thieves' Guild Enforcer --- .../mage/cards/t/ThievesGuildEnforcer.java | 89 +++++++++++++++++++ Mage.Sets/src/mage/sets/CoreSet2021.java | 1 + 2 files changed, 90 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java diff --git a/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java new file mode 100644 index 0000000000..2e87972f01 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/ThievesGuildEnforcer.java @@ -0,0 +1,89 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveEachPlayerEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; +import mage.game.Game; +import mage.players.Library; +import mage.players.Player; + +import java.util.Objects; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ThievesGuildEnforcer extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent(SubType.ROGUE, "{this} or another Rogue"); + + public ThievesGuildEnforcer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // Whenever Thieves' Guild Enforcer or another Rogue enters the battlefield under your control, each opponent mills two cards. + this.addAbility(new EntersBattlefieldControlledTriggeredAbility( + new PutTopCardOfLibraryIntoGraveEachPlayerEffect( + 2, TargetController.OPPONENT + ), filter + )); + + // As long as an opponent has eight or more cards in their graveyard, Thieves' Guild Enforcer gets +2/+1 and has deathtouch. + Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect( + new BoostSourceEffect(2, 1, Duration.WhileOnBattlefield), + ThievesGuildEnforcerCondition.instance, "as long as an opponent " + + "has eight or more cards in their graveyard, {this} gets +2/+1" + )); + ability.addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect( + DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield + ), ThievesGuildEnforcerCondition.instance, "and has deathtouch")); + this.addAbility(ability); + } + + private ThievesGuildEnforcer(final ThievesGuildEnforcer card) { + super(card); + } + + @Override + public ThievesGuildEnforcer copy() { + return new ThievesGuildEnforcer(this); + } +} + +enum ThievesGuildEnforcerCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game + .getOpponents(source.getControllerId()) + .stream() + .map(game::getPlayer) + .filter(Objects::nonNull) + .map(Player::getLibrary) + .mapToInt(Library::size) + .anyMatch(i -> i >= 8); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2021.java b/Mage.Sets/src/mage/sets/CoreSet2021.java index 821c0d4bc8..eb75b80dd8 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2021.java +++ b/Mage.Sets/src/mage/sets/CoreSet2021.java @@ -137,6 +137,7 @@ public final class CoreSet2021 extends ExpansionSet { cards.add(new SetCardInfo("Temple of Mystery", 254, Rarity.RARE, mage.cards.t.TempleOfMystery.class)); cards.add(new SetCardInfo("Temple of Silence", 255, Rarity.RARE, mage.cards.t.TempleOfSilence.class)); cards.add(new SetCardInfo("Temple of Triumph", 256, Rarity.RARE, mage.cards.t.TempleOfTriumph.class)); + cards.add(new SetCardInfo("Thieves' Guild Enforcer", 125, Rarity.RARE, mage.cards.t.ThievesGuildEnforcer.class)); cards.add(new SetCardInfo("Tide Skimmer", 79, Rarity.UNCOMMON, mage.cards.t.TideSkimmer.class)); cards.add(new SetCardInfo("Tormod's Crypt", 241, Rarity.UNCOMMON, mage.cards.t.TormodsCrypt.class)); cards.add(new SetCardInfo("Ugin, the Spirit Dragon", 1, Rarity.MYTHIC, mage.cards.u.UginTheSpiritDragon.class));