From 26ddf9d0b15ce650c3abde2acbd58185e469be41 Mon Sep 17 00:00:00 2001 From: xenohedron Date: Mon, 10 Jul 2023 00:29:33 -0400 Subject: [PATCH] Fix #9841 (Duel for Dominance) --- .../src/mage/cards/d/DuelForDominance.java | 64 +++++-------------- 1 file changed, 17 insertions(+), 47 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DuelForDominance.java b/Mage.Sets/src/mage/cards/d/DuelForDominance.java index 4d6442a3534..b7c8409769c 100644 --- a/Mage.Sets/src/mage/cards/d/DuelForDominance.java +++ b/Mage.Sets/src/mage/cards/d/DuelForDominance.java @@ -1,26 +1,23 @@ package mage.cards.d; -import java.util.UUID; - -import mage.abilities.Ability; import mage.abilities.condition.common.CovenCondition; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.FightTargetsEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.hint.common.CovenHint; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.AbilityWord; import mage.constants.CardType; -import mage.constants.Outcome; import mage.counters.CounterType; import mage.filter.StaticFilters; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * - * @author weirddan455 + * @author xenohedron */ public final class DuelForDominance extends CardImpl { @@ -28,11 +25,19 @@ public final class DuelForDominance extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}"); // Coven — Choose target creature you control and target creature you don't control. - // If you control three or more creatures with different powers, put a +1/+1 counter on the chosen creature you control. - // Then the chosen creatures fight each other. - this.getSpellAbility().addEffect(new DuelForDominanceEffect()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); + // If you control three or more creatures with different powers, put a +1/+1 counter on the chosen creature you control. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new AddCountersTargetEffect(CounterType.P1P1.createInstance()), + CovenCondition.instance, + "Choose target creature you control and target creature you don't control. " + + "If you control three or more creatures with different powers, put a +1/+1 counter on the chosen creature you control." + )); + // Then the chosen creatures fight each other. + this.getSpellAbility().addEffect(new FightTargetsEffect() + .setText("Then the chosen creatures fight each other. (They each deal damage equal to their power to the other.)") + ); this.getSpellAbility().setAbilityWord(AbilityWord.COVEN); this.getSpellAbility().addHint(CovenHint.instance); } @@ -46,38 +51,3 @@ public final class DuelForDominance extends CardImpl { return new DuelForDominance(this); } } - -class DuelForDominanceEffect extends OneShotEffect { - - public DuelForDominanceEffect() { - super(Outcome.Benefit); - staticText = "Choose target creature you control and target creature you don't control. " + - "If you control three or more creatures with different powers, put a +1/+1 counter on the chosen creature you control. " + - "Then the chosen creatures fight each other"; - } - - private DuelForDominanceEffect(final DuelForDominanceEffect effect) { - super(effect); - } - - @Override - public DuelForDominanceEffect copy() { - return new DuelForDominanceEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent controlledCreature = game.getPermanent(source.getTargets().get(0).getFirstTarget()); - if (controlledCreature == null) { - return false; - } - if (CovenCondition.instance.apply(game, source)) { - controlledCreature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game); - } - Permanent enemyCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); - if (enemyCreature != null) { - controlledCreature.fight(enemyCreature, source, game); - } - return true; - } -}