From db7f61e6c5bb7bf4d99559bec13bde1925dcc4b6 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 15 Sep 2019 10:56:43 -0400 Subject: [PATCH] fixed Vantress Gargoyle erroring --- .../src/mage/cards/v/VantressGargoyle.java | 60 +++++++++++++------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/Mage.Sets/src/mage/cards/v/VantressGargoyle.java b/Mage.Sets/src/mage/cards/v/VantressGargoyle.java index 09c5ac5add3..0639373464c 100644 --- a/Mage.Sets/src/mage/cards/v/VantressGargoyle.java +++ b/Mage.Sets/src/mage/cards/v/VantressGargoyle.java @@ -4,17 +4,16 @@ 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.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.TargetController; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -26,8 +25,6 @@ import java.util.UUID; */ 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}"); @@ -39,13 +36,10 @@ public final class VantressGargoyle extends CardImpl { 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())); + this.addAbility(new SimpleStaticAbility(new VantressGargoyleAttackEffect())); // 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" - ))); + this.addAbility(new SimpleStaticAbility(new VantressGargoyleBlockEffect())); // {T}: Each player puts the top card of their library into their graveyard. this.addAbility(new SimpleActivatedAbility( @@ -63,14 +57,14 @@ public final class VantressGargoyle extends CardImpl { } } -class VantressGargoyleEffect extends RestrictionEffect { +class VantressGargoyleAttackEffect extends RestrictionEffect { - VantressGargoyleEffect() { + VantressGargoyleAttackEffect() { super(Duration.WhileOnBattlefield); staticText = "{this} can't attack unless defending player has seven or more cards in their graveyard"; } - private VantressGargoyleEffect(final VantressGargoyleEffect effect) { + private VantressGargoyleAttackEffect(final VantressGargoyleAttackEffect effect) { super(effect); } @@ -86,7 +80,37 @@ class VantressGargoyleEffect extends RestrictionEffect { } @Override - public VantressGargoyleEffect copy() { - return new VantressGargoyleEffect(this); + public VantressGargoyleAttackEffect copy() { + return new VantressGargoyleAttackEffect(this); } -} \ No newline at end of file +} + +class VantressGargoyleBlockEffect extends RestrictionEffect { + + VantressGargoyleBlockEffect() { + super(Duration.WhileOnBattlefield); + staticText = "{this} can't block unless you have four or more cards in hand"; + } + + private VantressGargoyleBlockEffect(final VantressGargoyleBlockEffect effect) { + super(effect); + } + + @Override + public VantressGargoyleBlockEffect copy() { + return new VantressGargoyleBlockEffect(this); + } + + @Override + public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game, boolean canUseChooseDialogs) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + Player player = game.getPlayer(source.getControllerId()); + return player != null + && player.getHand().size() < 4 + && permanent.getId().equals(source.getSourceId()); + } +}