From 1673a0dcf61a09df45cf2d84fcbfbd17450aa01a Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 17 Sep 2016 02:09:36 +0200 Subject: [PATCH] [KLD] Added 6 blue cards. --- .../mage/sets/kaladesh/AetherMeltdown.java | 94 +++++++++++++ .../mage/sets/kaladesh/AetherTheorist.java | 75 +++++++++++ .../mage/sets/kaladesh/ConfiscationCoup.java | 125 ++++++++++++++++++ .../mage/sets/kaladesh/DramaticReversal.java | 67 ++++++++++ .../mage/sets/kaladesh/FailedInspection.java | 62 +++++++++ .../mage/sets/kaladesh/GearseekerSerpent.java | 118 +++++++++++++++++ 6 files changed, 541 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/kaladesh/AetherMeltdown.java create mode 100644 Mage.Sets/src/mage/sets/kaladesh/AetherTheorist.java create mode 100644 Mage.Sets/src/mage/sets/kaladesh/ConfiscationCoup.java create mode 100644 Mage.Sets/src/mage/sets/kaladesh/DramaticReversal.java create mode 100644 Mage.Sets/src/mage/sets/kaladesh/FailedInspection.java create mode 100644 Mage.Sets/src/mage/sets/kaladesh/GearseekerSerpent.java diff --git a/Mage.Sets/src/mage/sets/kaladesh/AetherMeltdown.java b/Mage.Sets/src/mage/sets/kaladesh/AetherMeltdown.java new file mode 100644 index 00000000000..3ce7a70c2fe --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/AetherMeltdown.java @@ -0,0 +1,94 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class AetherMeltdown extends CardImpl { + + private final static FilterPermanent filter = new FilterPermanent("creature or vehicle"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new SubtypePredicate("Vehicle"))); + } + + public AetherMeltdown(UUID ownerId) { + super(ownerId, 36, "Aether Meltdown", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Aura"); + + // Flash + this.addAbility(FlashAbility.getInstance()); + // Enchant creature or vehicle. + TargetPermanent auraTarget = new TargetPermanent(filter); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When Aether Meltdown enters the battlefield, you get {E}{E}. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GetEnergyCountersControllerEffect(2))); + // Enchanted permanent gets -4/-0. + Effect effect = new BoostEnchantedEffect(-4, 0, Duration.WhileOnBattlefield); + effect.setText("Enchanted permanent gets -4/-0"); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + } + + public AetherMeltdown(final AetherMeltdown card) { + super(card); + } + + @Override + public AetherMeltdown copy() { + return new AetherMeltdown(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/AetherTheorist.java b/Mage.Sets/src/mage/sets/kaladesh/AetherTheorist.java new file mode 100644 index 00000000000..7aee9057454 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/AetherTheorist.java @@ -0,0 +1,75 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.PayEnergyCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class AetherTheorist extends CardImpl { + + public AetherTheorist(UUID ownerId) { + super(ownerId, 37, "Aether Theorist", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Vedelkan"); + this.subtype.add("Rogue"); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // When Aether Theorist enters the battlefield, you get {E}{E}{E}. + this.addAbility(new EntersBattlefieldTriggeredAbility(new GetEnergyCountersControllerEffect(3))); + + // Tap, Pay {E}: Scry 1. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScryEffect(1), new TapSourceCost()); + ability.addCost(new PayEnergyCost(1)); + this.addAbility(ability); + } + + public AetherTheorist(final AetherTheorist card) { + super(card); + } + + @Override + public AetherTheorist copy() { + return new AetherTheorist(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/ConfiscationCoup.java b/Mage.Sets/src/mage/sets/kaladesh/ConfiscationCoup.java new file mode 100644 index 00000000000..d8d04be2c36 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/ConfiscationCoup.java @@ -0,0 +1,125 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.PayEnergyCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.effects.common.counter.GetEnergyCountersControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class ConfiscationCoup extends CardImpl { + + private final static FilterPermanent filter = new FilterPermanent("creature or artifact"); + + static { + filter.add(Predicates.or(new CardTypePredicate(CardType.CREATURE), new CardTypePredicate(CardType.ARTIFACT))); + } + + public ConfiscationCoup(UUID ownerId) { + super(ownerId, 41, "Confiscation Coup", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}{U}"); + this.expansionSetCode = "KLD"; + + // Choose target creature or artifact. You get {E}{E}{E}{E}, then you may pay an amount of {E} equal to that permanent's converted mana cost. If you do, gain control of it. + this.getSpellAbility().addEffect(new ConfiscationCoupEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + public ConfiscationCoup(final ConfiscationCoup card) { + super(card); + } + + @Override + public ConfiscationCoup copy() { + return new ConfiscationCoup(this); + } +} + +class ConfiscationCoupEffect extends OneShotEffect { + + public ConfiscationCoupEffect() { + super(Outcome.GainControl); + this.staticText = "Choose target creature or artifact. You get {E}{E}{E}{E}, then you may pay an amount of {E} equal to that permanent's converted mana cost. If you do, gain control of it"; + } + + public ConfiscationCoupEffect(final ConfiscationCoupEffect effect) { + super(effect); + } + + @Override + public ConfiscationCoupEffect copy() { + return new ConfiscationCoupEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + new GetEnergyCountersControllerEffect(4).apply(game, source); + Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (targetPermanent != null) { + Cost cost = new PayEnergyCost(targetPermanent.getManaCost().convertedManaCost()); + if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)) { + String energy = ""; + for (int i = 0; i < targetPermanent.getManaCost().convertedManaCost(); i++) { + energy += "{E}"; + } + if (controller.chooseUse(outcome, "Pay " + energy + " to get control of " + targetPermanent.getLogName() + "?", source, game)) { + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + ContinuousEffect controllEffect = new GainControlTargetEffect(Duration.Custom); + controllEffect.setTargetPointer(new FixedTarget(targetPermanent, game)); + game.addEffect(controllEffect, source); + } + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/DramaticReversal.java b/Mage.Sets/src/mage/sets/kaladesh/DramaticReversal.java new file mode 100644 index 00000000000..b4d2fa1d41f --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/DramaticReversal.java @@ -0,0 +1,67 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author LevelX2 + */ +public class DramaticReversal extends CardImpl { + + private final static FilterNonlandPermanent filter = new FilterNonlandPermanent("nonland permanents"); + + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + } + + public DramaticReversal(UUID ownerId) { + super(ownerId, 44, "Dramatic Reversal", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{U}"); + this.expansionSetCode = "KLD"; + + // Untap all nonland permanents you control. + this.getSpellAbility().addEffect(new UntapAllControllerEffect(filter)); + } + + public DramaticReversal(final DramaticReversal card) { + super(card); + } + + @Override + public DramaticReversal copy() { + return new DramaticReversal(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/FailedInspection.java b/Mage.Sets/src/mage/sets/kaladesh/FailedInspection.java new file mode 100644 index 00000000000..9958ac94d1c --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/FailedInspection.java @@ -0,0 +1,62 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.abilities.effects.common.CounterTargetEffect; +import mage.abilities.effects.common.DrawDiscardControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.TargetSpell; + +/** + * + * @author LevelX2 + */ +public class FailedInspection extends CardImpl { + + public FailedInspection(UUID ownerId) { + super(ownerId, 47, "Failed Inspection", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); + this.expansionSetCode = "KLD"; + + // Counter target spell. Draw a card, then discard a card. + this.getSpellAbility().addEffect(new CounterTargetEffect()); + this.getSpellAbility().addTarget(new TargetSpell()); + this.getSpellAbility().addEffect(new DrawDiscardControllerEffect(1, 1)); + } + + public FailedInspection(final FailedInspection card) { + super(card); + } + + @Override + public FailedInspection copy() { + return new FailedInspection(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/GearseekerSerpent.java b/Mage.Sets/src/mage/sets/kaladesh/GearseekerSerpent.java new file mode 100644 index 00000000000..89df9c20e54 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/GearseekerSerpent.java @@ -0,0 +1,118 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.kaladesh; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect; +import mage.abilities.effects.common.cost.CostModificationEffectImpl; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.CostModificationType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.util.CardUtil; + +/** + * + * @author LevelX2 + */ +public class GearseekerSerpent extends CardImpl { + + public GearseekerSerpent(UUID ownerId) { + super(ownerId, 48, "Gearseeker Serpent", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{U}{U}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Serpent"); + this.power = new MageInt(5); + this.toughness = new MageInt(6); + + // Gearseeker Serpent costs {1} less to cast for each artifact you control + this.addAbility(new SimpleStaticAbility(Zone.STACK, new GearseekerSerpentCostReductionEffect())); + + // 5U: Gearseeker Serpent can't be blocked this turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, + new CantBeBlockedSourceEffect(Duration.EndOfTurn), + new ManaCostsImpl<>("{5}{U}"))); + } + + public GearseekerSerpent(final GearseekerSerpent card) { + super(card); + } + + @Override + public GearseekerSerpent copy() { + return new GearseekerSerpent(this); + } +} + +class GearseekerSerpentCostReductionEffect extends CostModificationEffectImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent(); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + } + + public GearseekerSerpentCostReductionEffect() { + super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST); + staticText = "{this} costs {1} less to cast for each artifact you control"; + } + + protected GearseekerSerpentCostReductionEffect(final GearseekerSerpentCostReductionEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source, Ability abilityToModify) { + int count = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game).size(); + if (count > 0) { + CardUtil.reduceCost(abilityToModify, count); + } + + return true; + } + + @Override + public boolean applies(Ability abilityToModify, Ability source, Game game) { + return abilityToModify.getSourceId().equals(source.getSourceId()); + } + + @Override + public GearseekerSerpentCostReductionEffect copy() { + return new GearseekerSerpentCostReductionEffect(this); + } +}