From b4be2e5f4a150c477e86d3a0fc4d0232655fb612 Mon Sep 17 00:00:00 2001 From: jeffwadsworth Date: Mon, 2 Dec 2019 12:00:19 -0600 Subject: [PATCH] - Fix for Vivien, Arkbow Ranger --- .../src/mage/cards/v/VivienArkbowRanger.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Mage.Sets/src/mage/cards/v/VivienArkbowRanger.java b/Mage.Sets/src/mage/cards/v/VivienArkbowRanger.java index e5c72823ab..b6f7107c14 100644 --- a/Mage.Sets/src/mage/cards/v/VivienArkbowRanger.java +++ b/Mage.Sets/src/mage/cards/v/VivienArkbowRanger.java @@ -18,10 +18,13 @@ import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreatureOrPlaneswalker; +import mage.target.common.TargetCreaturePermanentAmount; import java.util.UUID; import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; import mage.target.common.TargetCreaturePermanent; +import mage.target.targetadjustment.TargetAdjuster; /** * @author TheElk801 @@ -37,13 +40,13 @@ public final class VivienArkbowRanger extends CardImpl { // +1: Distribute two +1/+1 counters among up to two target creatures. They gain trample until end of turn. Ability ability = new LoyaltyAbility(new DistributeCountersEffect( - CounterType.P1P1, 2, false, "up to two target creatures" - ), 1); + CounterType.P1P1, 2, false, "up to two target creatures"), 1); ability.addEffect(new GainAbilityTargetEffect( TrampleAbility.getInstance(), Duration.EndOfTurn, "They gain trample until end of turn" )); ability.addTarget(new TargetCreaturePermanent(0, 2, new FilterCreaturePermanent(), false)); + ability.setTargetAdjuster(VivienArkbowRangerAdjuster.instance); this.addAbility(ability); // −3: Target creature you control deals damage equal to its power to target creature or planeswalker. @@ -67,4 +70,17 @@ public final class VivienArkbowRanger extends CardImpl { public VivienArkbowRanger copy() { return new VivienArkbowRanger(this); } + + enum VivienArkbowRangerAdjuster implements TargetAdjuster { + instance; + + @Override + public void adjustTargets(Ability ability, Game game) { + // if targets are available, switch over to a working target method + if (game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), game).size() > 0) { + ability.getTargets().clear(); + ability.addTarget(new TargetCreaturePermanentAmount(2)); + } + } + } }