From 9f3e2aa4c4cc87492fcbef62fe4bcd99cb7d59f8 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Thu, 14 Jan 2016 23:03:38 +0100 Subject: [PATCH] * Akoum Flameseeker - Fixed wrong discard and draw handling. --- .../oathofthegatewatch/AkoumFlameseeker.java | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Mage.Sets/src/mage/sets/oathofthegatewatch/AkoumFlameseeker.java b/Mage.Sets/src/mage/sets/oathofthegatewatch/AkoumFlameseeker.java index 2a125667800..800c4fa4240 100644 --- a/Mage.Sets/src/mage/sets/oathofthegatewatch/AkoumFlameseeker.java +++ b/Mage.Sets/src/mage/sets/oathofthegatewatch/AkoumFlameseeker.java @@ -31,20 +31,22 @@ import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.common.DiscardCardCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.effects.common.DoIfCostPaid; -import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; +import mage.cards.Cards; import mage.constants.AbilityWord; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Game; +import mage.players.Player; import mage.target.common.TargetControlledPermanent; /** @@ -70,7 +72,8 @@ public class AkoumFlameseeker extends CardImpl { this.toughness = new MageInt(2); // Cohort — {T}, Tap an untapped Ally you control: Discard a card. If you do, draw a card. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, (new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new DiscardCardCost())), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, + new AkoumFlameseekerEffect(), new TapSourceCost()); ability.addCost(new TapTargetCost(new TargetControlledPermanent(filter))); ability.setAbilityWord(AbilityWord.COHORT); this.addAbility(ability); @@ -85,3 +88,33 @@ public class AkoumFlameseeker extends CardImpl { return new AkoumFlameseeker(this); } } + +class AkoumFlameseekerEffect extends OneShotEffect { + + public AkoumFlameseekerEffect() { + super(Outcome.DrawCard); + this.staticText = "Discard a card. If you do, draw a card"; + } + + public AkoumFlameseekerEffect(final AkoumFlameseekerEffect effect) { + super(effect); + } + + @Override + public AkoumFlameseekerEffect copy() { + return new AkoumFlameseekerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Cards cards = controller.discard(1, applyEffectsAfter, source, game); + if (!cards.isEmpty()) { + controller.drawCards(1, game); + } + return true; + } + return false; + } +}