From 4e974b0d3c9c55504920fd31f28e6e35a45bfac9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 14 Sep 2019 17:52:45 -0400 Subject: [PATCH] Implemented Vantress Gargoyle --- .../src/mage/cards/c/ChainedThroatseeker.java | 19 ++-- .../src/mage/cards/v/VantressGargoyle.java | 92 +++++++++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + 3 files changed, 100 insertions(+), 12 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/v/VantressGargoyle.java diff --git a/Mage.Sets/src/mage/cards/c/ChainedThroatseeker.java b/Mage.Sets/src/mage/cards/c/ChainedThroatseeker.java index f9ac5ba327..ded5fb991e 100644 --- a/Mage.Sets/src/mage/cards/c/ChainedThroatseeker.java +++ b/Mage.Sets/src/mage/cards/c/ChainedThroatseeker.java @@ -10,7 +10,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; -import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -34,10 +33,10 @@ public final class ChainedThroatseeker extends CardImpl { this.addAbility(InfectAbility.getInstance()); // Chained Throatseeker can't attack unless defending player is poisoned. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ChainedThroatseekerCantAttackEffect())); + this.addAbility(new SimpleStaticAbility(new ChainedThroatseekerCantAttackEffect())); } - public ChainedThroatseeker(final ChainedThroatseeker card) { + private ChainedThroatseeker(final ChainedThroatseeker card) { super(card); } @@ -49,12 +48,12 @@ public final class ChainedThroatseeker extends CardImpl { class ChainedThroatseekerCantAttackEffect extends RestrictionEffect { - public ChainedThroatseekerCantAttackEffect() { + ChainedThroatseekerCantAttackEffect() { super(Duration.WhileOnBattlefield); staticText = "{this} can't attack unless defending player is poisoned"; } - public ChainedThroatseekerCantAttackEffect(final ChainedThroatseekerCantAttackEffect effect) { + private ChainedThroatseekerCantAttackEffect(final ChainedThroatseekerCantAttackEffect effect) { super(effect); } @@ -65,16 +64,12 @@ class ChainedThroatseekerCantAttackEffect extends RestrictionEffect { @Override public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) { - Player targetPlayer = game.getPlayer(defenderId); - if (targetPlayer != null) { - return targetPlayer.getCounters().containsKey(CounterType.POISON); - } - return false; + Player targetPlayer = game.getPlayerOrPlaneswalkerController(defenderId); + return targetPlayer != null && targetPlayer.getCounters().containsKey(CounterType.POISON); } @Override public ChainedThroatseekerCantAttackEffect copy() { return new ChainedThroatseekerCantAttackEffect(this); } - -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/v/VantressGargoyle.java b/Mage.Sets/src/mage/cards/v/VantressGargoyle.java new file mode 100644 index 0000000000..09c5ac5add --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VantressGargoyle.java @@ -0,0 +1,92 @@ +package mage.cards.v; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInHandCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveEachPlayerEffect; +import mage.abilities.effects.common.combat.CantBlockSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class VantressGargoyle extends CardImpl { + + private static final Condition condition = new CardsInHandCondition(ComparisonType.FEWER_THAN, 4); + + public VantressGargoyle(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{1}{U}"); + + this.subtype.add(SubType.GARGOYLE); + this.power = new MageInt(5); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Vantress Gargoyle can't attack unless defending player has seven or more cards in their graveyard. + this.addAbility(new SimpleStaticAbility(new VantressGargoyleEffect())); + + // Vantress Gargoyle can't block unless you have four or more cards in hand. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( + new CantBlockSourceEffect(Duration.WhileOnBattlefield), condition, + "{this} can't block unless you have four or more cards in hand" + ))); + + // {T}: Each player puts the top card of their library into their graveyard. + this.addAbility(new SimpleActivatedAbility( + new PutTopCardOfLibraryIntoGraveEachPlayerEffect(1, TargetController.ANY), new TapSourceCost() + )); + } + + private VantressGargoyle(final VantressGargoyle card) { + super(card); + } + + @Override + public VantressGargoyle copy() { + return new VantressGargoyle(this); + } +} + +class VantressGargoyleEffect extends RestrictionEffect { + + VantressGargoyleEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't attack unless defending player has seven or more cards in their graveyard"; + } + + private VantressGargoyleEffect(final VantressGargoyleEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return permanent.getId().equals(source.getSourceId()); + } + + @Override + public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) { + Player player = game.getPlayerOrPlaneswalkerController(defenderId); + return player != null && player.getGraveyard().size() > 6; + } + + @Override + public VantressGargoyleEffect copy() { + return new VantressGargoyleEffect(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index 1276b76e94..bb7105c5cc 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -186,6 +186,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Trapped in the Tower", 33, Rarity.COMMON, mage.cards.t.TrappedInTheTower.class)); cards.add(new SetCardInfo("True Love's Kiss", 34, Rarity.COMMON, mage.cards.t.TrueLovesKiss.class)); cards.add(new SetCardInfo("Turn into a Pumpkin", 69, Rarity.UNCOMMON, mage.cards.t.TurnIntoAPumpkin.class)); + cards.add(new SetCardInfo("Vantress Gargoyle", 71, Rarity.RARE, mage.cards.v.VantressGargoyle.class)); cards.add(new SetCardInfo("Venerable Knight", 35, Rarity.UNCOMMON, mage.cards.v.VenerableKnight.class)); cards.add(new SetCardInfo("Wandermare", 204, Rarity.UNCOMMON, mage.cards.w.Wandermare.class)); cards.add(new SetCardInfo("Weaselback Redcap", 148, Rarity.COMMON, mage.cards.w.WeaselbackRedcap.class));