diff --git a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java index f0deeee1443..30532719a62 100644 --- a/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java +++ b/Mage.Sets/src/mage/sets/fifthdawn/SummonersEgg.java @@ -97,7 +97,8 @@ class SummonersEggImprintEffect extends OneShotEffect { && controller.choose(Outcome.Benefit, controller.getHand(), target, game)) { Card card = controller.getHand().get(target.getFirstTarget(), game); if (card != null) { - controller.moveCardToExileWithInfo(card, source.getSourceId(), sourcePermanent.getIdName() +" (Imprint)", source.getSourceId(), game, Zone.HAND, true); + card.setFaceDown(true, game); + controller.moveCardsToExile(card, source, game, false, source.getSourceId(), sourcePermanent.getIdName() + " (Imprint)"); card.setFaceDown(true, game); Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { @@ -110,7 +111,7 @@ class SummonersEggImprintEffect extends OneShotEffect { return true; } return false; - + } @Override @@ -144,10 +145,10 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect { if (SummonersEgg != null && SummonersEgg.getImprinted() != null && !SummonersEgg.getImprinted().isEmpty()) { Card imprintedCard = game.getCard(SummonersEgg.getImprinted().get(0)); if (imprintedCard != null && game.getState().getZone(imprintedCard.getId()).equals(Zone.EXILED)) { - //turn the exiled card face up. + //turn the exiled card face up. imprintedCard.turnFaceUp(game, source.getControllerId()); - //If it's a creature card, - if(imprintedCard.getCardType().contains(CardType.CREATURE)){ + //If it's a creature card, + if (imprintedCard.getCardType().contains(CardType.CREATURE)) { //put it onto the battlefield under your control imprintedCard.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), source.getControllerId()); } @@ -157,4 +158,4 @@ class SummonersEggPutOntoBattlefieldEffect extends OneShotEffect { } return false; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/AetherbornMarauder.java b/Mage.Sets/src/mage/sets/kaladesh/AetherbornMarauder.java new file mode 100644 index 00000000000..3d76d931f36 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/AetherbornMarauder.java @@ -0,0 +1,133 @@ +/* + * 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.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.predicate.permanent.CounterPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author LevelX2 + */ +public class AetherbornMarauder extends CardImpl { + + public AetherbornMarauder(UUID ownerId) { + super(ownerId, 71, "Aetherborn Marauder", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Aetherborn"); + this.subtype.add("Rogue"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + // When Aetherborn Marauder enters the battlefield, move any number of +1/+1 counters from other permanents you control onto Aetherborn Marauder. + this.addAbility(new EntersBattlefieldTriggeredAbility(new AetherbornMarauderEffect(), false)); + + } + + public AetherbornMarauder(final AetherbornMarauder card) { + super(card); + } + + @Override + public AetherbornMarauder copy() { + return new AetherbornMarauder(this); + } +} + +class AetherbornMarauderEffect extends OneShotEffect { + + public AetherbornMarauderEffect() { + super(Outcome.Benefit); + this.staticText = "move any number of +1/+1 counters from other permanents you control onto {this}"; + } + + public AetherbornMarauderEffect(final AetherbornMarauderEffect effect) { + super(effect); + } + + @Override + public AetherbornMarauderEffect copy() { + return new AetherbornMarauderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourceObject = game.getPermanent(source.getSourceId()); + if (controller != null && sourceObject != null) { + FilterControlledPermanent filter = new FilterControlledPermanent("permanent you control from where you like to remove +1/+1 counters"); + filter.add(new AnotherPredicate()); + filter.add(new CounterPredicate(CounterType.P1P1)); + boolean firstRun = true; + while (game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) > 0) { + if (controller.chooseUse(outcome, "Move " + (firstRun ? "any" : "more") + " +1/+1 counters from other permanents you control to " + sourceObject.getLogName() + "?", source, game)) { + firstRun = false; + TargetControlledPermanent target = new TargetControlledPermanent(filter); + Permanent fromPermanent = game.getPermanent(target.getFirstTarget()); + if (fromPermanent != null) { + int numberOfCounters = fromPermanent.getCounters(game).getCount(CounterType.P1P1); + int numberToMove = 1; + if (numberOfCounters > 1) { + numberToMove = controller.getAmount(0, numberOfCounters, "How many +1/+1 counters do you want to move?", game); + } + if (numberToMove > 0) { + fromPermanent.removeCounters(CounterType.P1P1.createInstance(numberToMove), game); + sourceObject.addCounters(CounterType.P1P1.createInstance(numberToMove), game); + } + } + } else { + break; + } + + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/DhundOperative.java b/Mage.Sets/src/mage/sets/kaladesh/DhundOperative.java new file mode 100644 index 00000000000..e4eb99414e7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/DhundOperative.java @@ -0,0 +1,83 @@ +/* + * 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.SimpleStaticAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.StaticFilters; + +/** + * + * @author LevelX2 + */ +public class DhundOperative extends CardImpl { + + public DhundOperative(UUID ownerId) { + super(ownerId, 74, "Dhund Operative", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // As long as you control an artifact, Dhund Operative gets +1/+0 and has deathtouch. + Effect boostEffect = new ConditionalContinuousEffect( + new BoostSourceEffect(2, 0, Duration.WhileOnBattlefield), + new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT), + "As long as you control an artifact, {this} gets +1/+0"); + Effect gainAbilityEffect = new ConditionalContinuousEffect( + new GainAbilitySourceEffect(DeathtouchAbility.getInstance(), Duration.WhileOnBattlefield), + new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT), + "and has deathtouch"); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, boostEffect); + ability.addEffect(gainAbilityEffect); + this.addAbility(ability); + } + + public DhundOperative(final DhundOperative card) { + super(card); + } + + @Override + public DhundOperative copy() { + return new DhundOperative(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/DieYoung.java b/Mage.Sets/src/mage/sets/kaladesh/DieYoung.java new file mode 100644 index 00000000000..aa4ac91db34 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/DieYoung.java @@ -0,0 +1,112 @@ +/* + * 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.BoostTargetEffect; +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.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author LevelX2 + */ +public class DieYoung extends CardImpl { + + public DieYoung(UUID ownerId) { + super(ownerId, 76, "Die Young", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{B}"); + this.expansionSetCode = "KLD"; + + // Choose target creature. You get {E}{E}, then you may pay any amount of {E}. The creature gets -1/-1 until end of turn for each {E} paid this way. + this.getSpellAbility().addEffect(new DieYoungEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public DieYoung(final DieYoung card) { + super(card); + } + + @Override + public DieYoung copy() { + return new DieYoung(this); + } +} + +class DieYoungEffect extends OneShotEffect { + + public DieYoungEffect() { + super(Outcome.UnboostCreature); + this.staticText = "Choose target creature. You get {E}{E}, then you may pay any amount of {E}. The creature gets -1/-1 until end of turn for each {E} paid this way"; + } + + public DieYoungEffect(final DieYoungEffect effect) { + super(effect); + } + + @Override + public DieYoungEffect copy() { + return new DieYoungEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + new GetEnergyCountersControllerEffect(2).apply(game, source); + int numberToPayed = controller.getAmount(0, controller.getCounters().getCount(CounterType.ENERGY), "staticText", game); + if (numberToPayed > 0) { + Cost cost = new PayEnergyCost(numberToPayed); + if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), true)) { + Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (targetCreature != null) { + ContinuousEffect effect = new BoostTargetEffect(numberToPayed, numberToPayed, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(targetCreature, game)); + game.addEffect(effect, source); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/DukharaScavenger.java b/Mage.Sets/src/mage/sets/kaladesh/DukharaScavenger.java new file mode 100644 index 00000000000..d9578af6409 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/DukharaScavenger.java @@ -0,0 +1,71 @@ +/* + * 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.effects.Effect; +import mage.abilities.effects.common.PutOnLibraryTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.StaticFilters; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class DukharaScavenger extends CardImpl { + + public DukharaScavenger(UUID ownerId) { + super(ownerId, 77, "Dukhara Scavenger", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Crocodile"); + this.power = new MageInt(4); + this.toughness = new MageInt(6); + + // When Dukhara Scavenger enters the battlefield, you may put target artifact or creature card from your graveyard on top of your library. + Effect effect = new PutOnLibraryTargetEffect(true); + effect.setText("you may put target artifact or creature card from your graveyard on top of your library"); + Ability ability = new EntersBattlefieldTriggeredAbility(effect, true); + ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_ARTIFACT_OR_CREATURE)); + this.addAbility(ability); + } + + public DukharaScavenger(final DukharaScavenger card) { + super(card); + } + + @Override + public DukharaScavenger copy() { + return new DukharaScavenger(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/EliminateTheCompetition.java b/Mage.Sets/src/mage/sets/kaladesh/EliminateTheCompetition.java new file mode 100644 index 00000000000..dc2b496b63f --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/EliminateTheCompetition.java @@ -0,0 +1,81 @@ +/* + * 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.common.SacrificeXTargetCost; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.AbilityType; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class EliminateTheCompetition extends CardImpl { + + public EliminateTheCompetition(UUID ownerId) { + super(ownerId, 78, "Eliminate the Competition", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}"); + this.expansionSetCode = "KLD"; + + // As an additional cost to cast Eliminate the Competition, sacrifice X creatures. + this.getSpellAbility().addCost(new SacrificeXTargetCost(new FilterControlledCreaturePermanent("creatures"), true)); + + // Destroy X target creatures. + Effect effect = new DestroyTargetEffect(); + effect.setText("Destroy X target creatures"); + this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + public EliminateTheCompetition(final EliminateTheCompetition card) { + super(card); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + if (ability.getAbilityType().equals(AbilityType.SPELL)) { + ability.getTargets().clear(); + int sac = new GetXValue().calculate(game, ability, null); + ability.addTarget(new TargetCreaturePermanent(sac, sac)); + } + } + + @Override + public EliminateTheCompetition copy() { + return new EliminateTheCompetition(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/EmbraalBruiser.java b/Mage.Sets/src/mage/sets/kaladesh/EmbraalBruiser.java new file mode 100644 index 00000000000..8a536b2c6d3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/EmbraalBruiser.java @@ -0,0 +1,76 @@ +/* + * 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.common.EntersBattlefieldTappedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.StaticFilters; + +/** + * + * @author LevelX2 + */ +public class EmbraalBruiser extends CardImpl { + + public EmbraalBruiser(UUID ownerId) { + super(ownerId, 79, "Embraal Bruiser", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Human"); + this.subtype.add("Warrior"); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // Embraal Bruiser enters the battlefield tapped. + this.addAbility(new EntersBattlefieldTappedAbility()); + + // Embraal Bruiser has menace as long as you control an artifact. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( + new GainAbilitySourceEffect(new MenaceAbility()), + new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT), + "{this} has menace as long as you control an artifact"))); + } + + public EmbraalBruiser(final EmbraalBruiser card) { + super(card); + } + + @Override + public EmbraalBruiser copy() { + return new EmbraalBruiser(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/FoundryScreecher.java b/Mage.Sets/src/mage/sets/kaladesh/FoundryScreecher.java new file mode 100644 index 00000000000..7e0629ebcc1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/FoundryScreecher.java @@ -0,0 +1,74 @@ +/* + * 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.common.SimpleStaticAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.StaticFilters; + +/** + * + * @author LevelX2 + */ +public class FoundryScreecher extends CardImpl { + + public FoundryScreecher(UUID ownerId) { + super(ownerId, 82, "Foundry Screecher", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Bat"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // Foundry Screecher gets +1/+0 as long as you control an artifact. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect( + new BoostSourceEffect(1, 0, Duration.WhileOnBattlefield), + new PermanentsOnTheBattlefieldCondition(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT), + "{this} gets +1/+0 as long as you control an artifact"))); + } + + public FoundryScreecher(final FoundryScreecher card) { + super(card); + } + + @Override + public FoundryScreecher copy() { + return new FoundryScreecher(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/FretworkColony.java b/Mage.Sets/src/mage/sets/kaladesh/FretworkColony.java new file mode 100644 index 00000000000..30c6fa7eaeb --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/FretworkColony.java @@ -0,0 +1,77 @@ +/* + * 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.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.CantBlockAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.counters.CounterType; + +/** + * + * @author LevelX2 + */ +public class FretworkColony extends CardImpl { + + public FretworkColony(UUID ownerId) { + super(ownerId, 83, "Fretwork Colony", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Insect"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Fretwork Colony can't block. + this.addAbility(new CantBlockAbility()); + + // At the beginning of your upkeep, put a +1/+1 counter on Fretwork Colony and you lose 1 life. + Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), TargetController.YOU, false); + Effect effect = new LoseLifeSourceControllerEffect(1); + effect.setText("and you lose 1 life"); + ability.addEffect(effect); + this.addAbility(ability); + + } + + public FretworkColony(final FretworkColony card) { + super(card); + } + + @Override + public FretworkColony copy() { + return new FretworkColony(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/GontiLordOfLuxury.java b/Mage.Sets/src/mage/sets/kaladesh/GontiLordOfLuxury.java new file mode 100644 index 00000000000..0d798520d76 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/GontiLordOfLuxury.java @@ -0,0 +1,287 @@ +/* + * 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.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.AsThoughEffectImpl; +import mage.abilities.effects.AsThoughManaEffect; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.AsThoughEffectType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.ManaType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.game.ExileZone; +import mage.game.Game; +import mage.players.ManaPoolItem; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetOpponent; +import mage.target.targetpointer.FixedTarget; +import mage.util.CardUtil; + +/** + * + * @author LevelX2 + */ +public class GontiLordOfLuxury extends CardImpl { + + protected static final String VALUE_PREFIX = "ExileZones"; + + public GontiLordOfLuxury(UUID ownerId) { + super(ownerId, 84, "Gonti, Lord of Luxury", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}"); + this.expansionSetCode = "KLD"; + this.supertype.add("Legendary"); + this.subtype.add("Aetherborn"); + this.subtype.add("Rogue"); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Deathtouch + this.addAbility(DeathtouchAbility.getInstance()); + + // When Gonti, Lord of Luxury enters the battlefield, look at the top four cards of target opponent's library, exile one of them face down, then put the rest on the bottom of that library in a random order. For as long as that card remains exiled, you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it. + Ability ability = new EntersBattlefieldTriggeredAbility(new GontiLordOfLuxuryEffect()); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + + } + + public GontiLordOfLuxury(final GontiLordOfLuxury card) { + super(card); + } + + @Override + public GontiLordOfLuxury copy() { + return new GontiLordOfLuxury(this); + } +} + +class GontiLordOfLuxuryEffect extends OneShotEffect { + + public GontiLordOfLuxuryEffect() { + super(Outcome.Benefit); + this.staticText = "look at the top four cards of target opponent's library, exile one of them face down, then put the rest on the bottom of that library in a random order. For as long as that card remains exiled, you may look at it, you may cast it, and you may spend mana as though it were mana of any type to cast it"; + } + + public GontiLordOfLuxuryEffect(final GontiLordOfLuxuryEffect effect) { + super(effect); + } + + @Override + public GontiLordOfLuxuryEffect copy() { + return new GontiLordOfLuxuryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && opponent != null && sourceObject != null) { + Cards topCards = new CardsImpl(); + topCards.addAll(opponent.getLibrary().getTopCards(game, 4)); + TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard("card to exile")); + if (controller.choose(outcome, topCards, target, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + topCards.remove(card); + // move card to exile + UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); + card.setFaceDown(true, game); + controller.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName()); + card.setFaceDown(true, game); + Set exileZones = (Set) game.getState().getValue(GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString()); + if (exileZones == null) { + exileZones = new HashSet<>(); + game.getState().setValue(GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString(), exileZones); + } + exileZones.add(exileZoneId); + // allow to cast the card + ContinuousEffect effect = new GontiLordOfLuxuryCastFromExileEffect(); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + // and you may spend mana as though it were mana of any color to cast it + effect = new GontiLordOfLuxurySpendAnyManaEffect(); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + } + while (!topCards.isEmpty()) { + Card libCard = topCards.getRandom(game); + topCards.remove(card); + controller.moveCardToLibraryWithInfo(libCard, source.getSourceId(), game, Zone.LIBRARY, false, false); + } + } + return true; + } + return false; + } +} + +class GontiLordOfLuxuryCastFromExileEffect extends AsThoughEffectImpl { + + public GontiLordOfLuxuryCastFromExileEffect() { + super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit); + staticText = "You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color to cast that spell"; + } + + public GontiLordOfLuxuryCastFromExileEffect(final GontiLordOfLuxuryCastFromExileEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public GontiLordOfLuxuryCastFromExileEffect copy() { + return new GontiLordOfLuxuryCastFromExileEffect(this); + } + + @Override + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (objectId.equals(getTargetPointer().getFirst(game, source))) { + if (affectedControllerId.equals(source.getControllerId())) { + return true; + } + } else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) { + // object has moved zone so effect can be discarted + this.discard(); + } + return false; + } +} + +class GontiLordOfLuxurySpendAnyManaEffect extends AsThoughEffectImpl implements AsThoughManaEffect { + + public GontiLordOfLuxurySpendAnyManaEffect() { + super(AsThoughEffectType.SPEND_OTHER_MANA, Duration.Custom, Outcome.Benefit); + staticText = "you may spend mana as though it were mana of any color to cast it"; + } + + public GontiLordOfLuxurySpendAnyManaEffect(final GontiLordOfLuxurySpendAnyManaEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public GontiLordOfLuxurySpendAnyManaEffect copy() { + return new GontiLordOfLuxurySpendAnyManaEffect(this); + } + + @Override + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget()) + && game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) { + + if (affectedControllerId.equals(source.getControllerId())) { + // if the card moved from exile to spell the zone change counter is increased by 1 + if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) { + return true; + } + } + + } else if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) { + // object has moved zone so effect can be discarted + this.discard(); + } + return false; + } + + @Override + public ManaType getAsThoughManaType(ManaType manaType, ManaPoolItem mana, UUID affectedControllerId, Ability source, Game game) { + return mana.getFirstAvailable(); + } +} + +class GontiLordOfLuxuryLookEffect extends AsThoughEffectImpl { + + public GontiLordOfLuxuryLookEffect() { + super(AsThoughEffectType.LOOK_AT_FACE_DOWN, Duration.EndOfGame, Outcome.Benefit); + staticText = "You may look at the cards exiled with {this}"; + } + + public GontiLordOfLuxuryLookEffect(final GontiLordOfLuxuryLookEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + return true; + } + + @Override + public GontiLordOfLuxuryLookEffect copy() { + return new GontiLordOfLuxuryLookEffect(this); + } + + @Override + public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) { + if (affectedControllerId.equals(source.getControllerId()) && game.getState().getZone(objectId).equals(Zone.EXILED)) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { + Card card = game.getCard(objectId); + if (card != null && card.isFaceDown(game)) { + Set exileZones = (Set) game.getState().getValue(GontiLordOfLuxury.VALUE_PREFIX + source.getSourceId().toString()); + if (exileZones != null) { + for (ExileZone exileZone : game.getExile().getExileZones()) { + if (exileZone.contains(objectId)) { + if (!exileZones.contains(exileZone.getId())) { + return false; + } + } + } + return true; + } + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/HarshScrutiny.java b/Mage.Sets/src/mage/sets/kaladesh/HarshScrutiny.java new file mode 100644 index 00000000000..38585ec2ce2 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/HarshScrutiny.java @@ -0,0 +1,63 @@ +/* + * 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.discard.DiscardCardYouChooseTargetEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreatureCard; +import mage.target.common.TargetOpponent; + +/** + * + * @author LevelX2 + */ +public class HarshScrutiny extends CardImpl { + + public HarshScrutiny(UUID ownerId) { + super(ownerId, 85, "Harsh Scrutiny", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{B}"); + this.expansionSetCode = "KLD"; + + // Target opponent reveals his or her hand. You choose a creature card from it. That player discards that card. Scry 1. + this.getSpellAbility().addTarget(new TargetOpponent()); + this.getSpellAbility().addEffect(new DiscardCardYouChooseTargetEffect(new FilterCreatureCard("a creature card"))); + this.getSpellAbility().addEffect(new ScryEffect(1)); + } + + public HarshScrutiny(final HarshScrutiny card) { + super(card); + } + + @Override + public HarshScrutiny copy() { + return new HarshScrutiny(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/JanjeetSentry.java b/Mage.Sets/src/mage/sets/kaladesh/JanjeetSentry.java index 9cd4793cd70..b6bfc27b0a4 100644 --- a/Mage.Sets/src/mage/sets/kaladesh/JanjeetSentry.java +++ b/Mage.Sets/src/mage/sets/kaladesh/JanjeetSentry.java @@ -40,9 +40,7 @@ import mage.cards.CardImpl; import mage.constants.CardType; 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.StaticFilters; import mage.target.TargetPermanent; /** @@ -51,15 +49,6 @@ import mage.target.TargetPermanent; */ public class JanjeetSentry extends CardImpl { - private static final FilterPermanent filter = new FilterPermanent("artifact or creature"); - - static { - filter.add(Predicates.or( - new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE) - )); - } - public JanjeetSentry(UUID ownerId) { super(ownerId, 53, "Janjeet Sentry", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.expansionSetCode = "KLD"; @@ -75,7 +64,7 @@ public class JanjeetSentry extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MayTapOrUntapTargetEffect(), new TapSourceCost()); ability.addCost(new PayEnergyCost(2)); this.addAbility(ability); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE)); } public JanjeetSentry(final JanjeetSentry card) { diff --git a/Mage.Sets/src/mage/sets/kaladesh/LostLegacy.java b/Mage.Sets/src/mage/sets/kaladesh/LostLegacy.java new file mode 100644 index 00000000000..eca25bd5efb --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/LostLegacy.java @@ -0,0 +1,107 @@ +/* + * 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.Mode; +import mage.abilities.effects.common.NameACardEffect; +import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.NamePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; + +/** + * + * @author LevelX2 + */ +public class LostLegacy extends CardImpl { + + public LostLegacy(UUID ownerId) { + super(ownerId, 88, "Lost Legacy", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{1}{B}{B}"); + this.expansionSetCode = "KLD"; + + // Name a nonartifact, nonland card. Search target player's graveyard, hand and library for any number of cards with that name and exile them. That player shuffles his or her library, then draws a card for each card exiled from hand this way. + this.getSpellAbility().addEffect((new NameACardEffect(NameACardEffect.TypeOfName.NON_ARTFIACT_AND_NON_LAND_NAME))); + this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addEffect(new LostLegacyEffect()); + } + + public LostLegacy(final LostLegacy card) { + super(card); + } + + @Override + public LostLegacy copy() { + return new LostLegacy(this); + } +} + +class LostLegacyEffect extends SearchTargetGraveyardHandLibraryForCardNameAndExileEffect { + + LostLegacyEffect() { + super(true, "target player's", "any number of cards with that name"); + } + + LostLegacyEffect(final LostLegacyEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY); + Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (targetPlayer != null) { + FilterCard filter = new FilterCard(); + filter.add(new NamePredicate(cardName)); + int cardsInHandBefore = targetPlayer.getHand().count(filter, game); + boolean result = super.applySearchAndExile(game, source, cardName, targetPointer.getFirst(game, source)); + int cardsExiled = cardsInHandBefore - targetPlayer.getHand().count(filter, game); + if (cardsExiled > 0) { + targetPlayer.drawCards(cardsExiled, game); + } + return result; + } + return false; + } + + @Override + public LostLegacyEffect copy() { + return new LostLegacyEffect(this); + } + + @Override + public String getText(Mode mode) { + return "Search target player's graveyard, hand and library for any number of cards with that name and exile them. That player shuffles his or her library, then draws a card for each card exiled from hand this way"; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/MidnightOil.java b/Mage.Sets/src/mage/sets/kaladesh/MidnightOil.java new file mode 100644 index 00000000000..f80d820a337 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/MidnightOil.java @@ -0,0 +1,127 @@ +/* + * 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.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfDrawTriggeredAbility; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.dynamicvalue.common.CountersSourceCount; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; +import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect.HandSizeModification; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.counter.RemoveCounterSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; + +/** + * + * @author LevelX2 + */ +public class MidnightOil extends CardImpl { + + public MidnightOil(UUID ownerId) { + super(ownerId, 92, "Midnight Oil", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}"); + this.expansionSetCode = "KLD"; + + // Midnight Oil enters the battlefield with seven hour counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(new Counter(CounterType.HOUR.createInstance(7))), + "with seven hour counters on it")); + + // At the beginning of your draw step, draw an additional card and remove two hour counters from Midnight Oil. + Ability ability = new BeginningOfDrawTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.YOU, false); + Effect effect = new RemoveCounterSourceEffect(CounterType.HOUR.createInstance(2)); + effect.setText("and remove two hour counters from {this}"); + ability.addEffect(effect); + this.addAbility(ability); + + // Your maximum hand size is equal to the number of hour counters on Midnight Oil. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MaximumHandSizeControllerEffect(new CountersSourceCount(CounterType.HOUR), Duration.WhileOnBattlefield, HandSizeModification.SET, TargetController.YOU))); + + // Whenever you discard a card, you lose 1 life. + this.addAbility(new MidnightOilTriggeredAbility(new LoseLifeSourceControllerEffect(1))); + + } + + public MidnightOil(final MidnightOil card) { + super(card); + } + + @Override + public MidnightOil copy() { + return new MidnightOil(this); + } +} + +class MidnightOilTriggeredAbility extends TriggeredAbilityImpl { + + MidnightOilTriggeredAbility(Effect effect) { + super(Zone.BATTLEFIELD, effect, false); + } + + MidnightOilTriggeredAbility(final MidnightOilTriggeredAbility ability) { + super(ability); + } + + @Override + public MidnightOilTriggeredAbility copy() { + return new MidnightOilTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.DISCARDED_CARD; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (getControllerId().equals(event.getPlayerId())) { + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever you discard a card, " + super.getRule(); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/NightMarketLookout.java b/Mage.Sets/src/mage/sets/kaladesh/NightMarketLookout.java new file mode 100644 index 00000000000..81b71b35fa8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/NightMarketLookout.java @@ -0,0 +1,72 @@ +/* + * 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.BecomesTappedSourceTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class NightMarketLookout extends CardImpl { + + public NightMarketLookout(UUID ownerId) { + super(ownerId, 95, "Night Market Lookout", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Human"); + this.subtype.add("Rogue"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Night Market Lookout becomes tapped, each opponent loses 1 life and you gain 1 life. + Ability ability = new BecomesTappedSourceTriggeredAbility(new LoseLifeOpponentsEffect(1), false); + Effect effect = new GainLifeEffect(1); + effect.setText("and you gain 1 life"); + ability.addEffect(effect); + this.addAbility(ability); + + } + + public NightMarketLookout(final NightMarketLookout card) { + super(card); + } + + @Override + public NightMarketLookout copy() { + return new NightMarketLookout(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/RestorationGearsmith.java b/Mage.Sets/src/mage/sets/kaladesh/RestorationGearsmith.java index e9f6ff9e589..936a19ccde5 100644 --- a/Mage.Sets/src/mage/sets/kaladesh/RestorationGearsmith.java +++ b/Mage.Sets/src/mage/sets/kaladesh/RestorationGearsmith.java @@ -1,76 +1,69 @@ -/* - * 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.effects.common.ReturnFromGraveyardToHandTargetEffect; -import mage.cards.CardImpl; -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.filter.FilterCard; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.target.common.TargetCardInYourGraveyard; - -/** - * - * @author emerald000 - */ -public class RestorationGearsmith extends CardImpl { - - private static final FilterCard filter = new FilterCard("artifact or creature card"); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE))); - } - - public RestorationGearsmith(UUID ownerId) { - super(ownerId, 185, "Restoration Gearsmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}{B}"); - this.expansionSetCode = "KLD"; - this.subtype.add("Human"); - this.subtype.add("Artificer"); - this.power = new MageInt(3); - this.toughness = new MageInt(3); - - // When Restoration Gearsmith enters the battlefield, return target artifact or creature card from your graveyard to your hand. - Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect()); - ability.addTarget(new TargetCardInYourGraveyard(filter)); - this.addAbility(ability); - } - - public RestorationGearsmith(final RestorationGearsmith card) { - super(card); - } - - @Override - public RestorationGearsmith copy() { - return new RestorationGearsmith(this); - } -} +/* + * 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.effects.common.ReturnFromGraveyardToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.StaticFilters; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author emerald000 + */ +public class RestorationGearsmith extends CardImpl { + + public RestorationGearsmith(UUID ownerId) { + super(ownerId, 185, "Restoration Gearsmith", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{W}{B}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Human"); + this.subtype.add("Artificer"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // When Restoration Gearsmith enters the battlefield, return target artifact or creature card from your graveyard to your hand. + Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToHandTargetEffect()); + ability.addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_ARTIFACT_OR_CREATURE)); + this.addAbility(ability); + } + + public RestorationGearsmith(final RestorationGearsmith card) { + super(card); + } + + @Override + public RestorationGearsmith copy() { + return new RestorationGearsmith(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/SaheeliRai.java b/Mage.Sets/src/mage/sets/kaladesh/SaheeliRai.java index 538a07becc2..fc7d8d8a9cb 100644 --- a/Mage.Sets/src/mage/sets/kaladesh/SaheeliRai.java +++ b/Mage.Sets/src/mage/sets/kaladesh/SaheeliRai.java @@ -1,168 +1,161 @@ -/* - * 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.DelayedTriggeredAbility; -import mage.abilities.LoyaltyAbility; -import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; -import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; -import mage.abilities.effects.Effect; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DamagePlayersEffect; -import mage.abilities.effects.common.ExileTargetEffect; -import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect; -import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; -import mage.abilities.effects.keyword.ScryEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.Cards; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.TargetController; -import mage.filter.common.FilterArtifactCard; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.common.TargetCardInLibrary; -import mage.target.common.TargetControlledPermanent; -import mage.target.targetpointer.FixedTarget; - -/** - * - * @author emerald000 - */ -public class SaheeliRai extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifact or creature you control"); - static { - filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE))); - } - - public SaheeliRai(UUID ownerId) { - super(ownerId, 186, "Saheeli Rai", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{1}{U}{R}"); - this.expansionSetCode = "KLD"; - this.subtype.add("Saheeli"); - - this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); - - // +1: Scry 1. Saheeli Rai deals 1 damage to each opponent. - Effect effect = new ScryEffect(1); - effect.setText("Scry 1"); - Ability ability = new LoyaltyAbility(effect, 1); - ability.addEffect(new DamagePlayersEffect(1, TargetController.OPPONENT)); - this.addAbility(ability); - - // -2: Create a token that's a copy of target artifact or creature you control, except it's an artifact in addition to its other types. That token gains haste. Exile it at the beginning of the next end step. - ability = new LoyaltyAbility(new SaheeliRaiCreateTokenEffect(), -2); - ability.addTarget(new TargetControlledPermanent(filter)); - this.addAbility(ability); - - // -7: Search your library for up to three artifact cards with different names, put them onto the battlefield, then shuffle your library. - this.addAbility(new LoyaltyAbility(new SearchLibraryPutInPlayEffect(new SaheeliRaiTarget()) , -7)); - } - - public SaheeliRai(final SaheeliRai card) { - super(card); - } - - @Override - public SaheeliRai copy() { - return new SaheeliRai(this); - } -} - -class SaheeliRaiCreateTokenEffect extends OneShotEffect { - - SaheeliRaiCreateTokenEffect() { - super(Outcome.Copy); - this.staticText = "Create a token that's a copy of target artifact or creature you control, except it's an artifact in addition to its other types. That token gains haste. Exile it at the beginning of the next end step"; - } - - SaheeliRaiCreateTokenEffect(final SaheeliRaiCreateTokenEffect effect) { - super(effect); - } - - @Override - public SaheeliRaiCreateTokenEffect copy() { - return new SaheeliRaiCreateTokenEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent copiedPermanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - if (copiedPermanent != null) { - PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, CardType.ARTIFACT, true); - if (effect.apply(game, source)) { - for (Permanent copyPermanent : effect.getAddedPermanent()) { - ExileTargetEffect exileEffect = new ExileTargetEffect(); - exileEffect.setTargetPointer(new FixedTarget(copyPermanent, game)); - DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); - game.addDelayedTriggeredAbility(delayedAbility, source); - } - return true; - } - } - return false; - } -} - -class SaheeliRaiTarget extends TargetCardInLibrary { - - SaheeliRaiTarget() { - super(0, 3, new FilterArtifactCard("artifact cards with different names")); - } - - SaheeliRaiTarget(final SaheeliRaiTarget target) { - super(target); - } - - @Override - public SaheeliRaiTarget copy() { - return new SaheeliRaiTarget(this); - } - - @Override - public boolean canTarget(UUID id, Cards cards, Game game) { - Card card = cards.get(id, game); - if (card != null) { - for (UUID targetId : this.getTargets()) { - Card iCard = game.getCard(targetId); - if (iCard != null && iCard.getName().equals(card.getName())) { - return false; - } - } - return filter.match(card, game); - } - return false; - } -} +/* + * 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.DelayedTriggeredAbility; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamagePlayersEffect; +import mage.abilities.effects.common.ExileTargetEffect; +import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.abilities.effects.keyword.ScryEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.StaticFilters; +import mage.filter.common.FilterArtifactCard; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author emerald000 + */ +public class SaheeliRai extends CardImpl { + + public SaheeliRai(UUID ownerId) { + super(ownerId, 186, "Saheeli Rai", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{1}{U}{R}"); + this.expansionSetCode = "KLD"; + this.subtype.add("Saheeli"); + + this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(3)); + + // +1: Scry 1. Saheeli Rai deals 1 damage to each opponent. + Effect effect = new ScryEffect(1); + effect.setText("Scry 1"); + Ability ability = new LoyaltyAbility(effect, 1); + ability.addEffect(new DamagePlayersEffect(1, TargetController.OPPONENT)); + this.addAbility(ability); + + // -2: Create a token that's a copy of target artifact or creature you control, except it's an artifact in addition to its other types. That token gains haste. Exile it at the beginning of the next end step. + ability = new LoyaltyAbility(new SaheeliRaiCreateTokenEffect(), -2); + ability.addTarget(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE)); + this.addAbility(ability); + + // -7: Search your library for up to three artifact cards with different names, put them onto the battlefield, then shuffle your library. + this.addAbility(new LoyaltyAbility(new SearchLibraryPutInPlayEffect(new SaheeliRaiTarget()), -7)); + } + + public SaheeliRai(final SaheeliRai card) { + super(card); + } + + @Override + public SaheeliRai copy() { + return new SaheeliRai(this); + } +} + +class SaheeliRaiCreateTokenEffect extends OneShotEffect { + + SaheeliRaiCreateTokenEffect() { + super(Outcome.Copy); + this.staticText = "Create a token that's a copy of target artifact or creature you control, except it's an artifact in addition to its other types. That token gains haste. Exile it at the beginning of the next end step"; + } + + SaheeliRaiCreateTokenEffect(final SaheeliRaiCreateTokenEffect effect) { + super(effect); + } + + @Override + public SaheeliRaiCreateTokenEffect copy() { + return new SaheeliRaiCreateTokenEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent copiedPermanent = game.getPermanent(this.getTargetPointer().getFirst(game, source)); + if (copiedPermanent != null) { + PutTokenOntoBattlefieldCopyTargetEffect effect = new PutTokenOntoBattlefieldCopyTargetEffect(null, CardType.ARTIFACT, true); + if (effect.apply(game, source)) { + for (Permanent copyPermanent : effect.getAddedPermanent()) { + ExileTargetEffect exileEffect = new ExileTargetEffect(); + exileEffect.setTargetPointer(new FixedTarget(copyPermanent, game)); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); + game.addDelayedTriggeredAbility(delayedAbility, source); + } + return true; + } + } + return false; + } +} + +class SaheeliRaiTarget extends TargetCardInLibrary { + + SaheeliRaiTarget() { + super(0, 3, new FilterArtifactCard("artifact cards with different names")); + } + + SaheeliRaiTarget(final SaheeliRaiTarget target) { + super(target); + } + + @Override + public SaheeliRaiTarget copy() { + return new SaheeliRaiTarget(this); + } + + @Override + public boolean canTarget(UUID id, Cards cards, Game game) { + Card card = cards.get(id, game); + if (card != null) { + for (UUID targetId : this.getTargets()) { + Card iCard = game.getCard(targetId); + if (iCard != null && iCard.getName().equals(card.getName())) { + return false; + } + } + return filter.match(card, game); + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/ShrewdNegotiation.java b/Mage.Sets/src/mage/sets/kaladesh/ShrewdNegotiation.java index cbe03dbdf4e..869f0f538fa 100644 --- a/Mage.Sets/src/mage/sets/kaladesh/ShrewdNegotiation.java +++ b/Mage.Sets/src/mage/sets/kaladesh/ShrewdNegotiation.java @@ -55,7 +55,7 @@ public class ShrewdNegotiation extends CardImpl { static { filter.add(new ControllerPredicate(TargetController.NOT_YOU)); filter.add(Predicates.or(new CardTypePredicate(CardType.ARTIFACT), - new CardTypePredicate(CardType.CREATURE))); + new CardTypePredicate(CardType.CREATURE))); } public ShrewdNegotiation(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/kaladesh/SubtleStrike.java b/Mage.Sets/src/mage/sets/kaladesh/SubtleStrike.java new file mode 100644 index 00000000000..746681c62e9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/SubtleStrike.java @@ -0,0 +1,73 @@ +/* + * 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.Mode; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class SubtleStrike extends CardImpl { + + public SubtleStrike(UUID ownerId) { + super(ownerId, 100, "Subtle Strike", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{B}"); + this.expansionSetCode = "KLD"; + + // Choose one or both — + this.getSpellAbility().getModes().setMinModes(1); + this.getSpellAbility().getModes().setMaxModes(2); + // • Target creature gets -1/-1 until end of turn. + this.getSpellAbility().addEffect(new BoostTargetEffect(-1, -1, Duration.EndOfTurn)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // • Put a +1/+1 counter on target creature. + Mode mode1 = new Mode(); + mode1.getEffects().add(new AddCountersTargetEffect(CounterType.P1P1.createInstance())); + mode1.getTargets().add(new TargetCreaturePermanent()); + this.getSpellAbility().addMode(mode1); + + } + + public SubtleStrike(final SubtleStrike card) { + super(card); + } + + @Override + public SubtleStrike copy() { + return new SubtleStrike(this); + } +} diff --git a/Mage.Sets/src/mage/sets/kaladesh/TidyConclusion.java b/Mage.Sets/src/mage/sets/kaladesh/TidyConclusion.java new file mode 100644 index 00000000000..43463c205c3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/kaladesh/TidyConclusion.java @@ -0,0 +1,64 @@ +/* + * 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.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class TidyConclusion extends CardImpl { + + public TidyConclusion(UUID ownerId) { + super(ownerId, 103, "Tidy Conclusion", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{B}{B}"); + this.expansionSetCode = "KLD"; + + // Destroy target creature. You gain 1 life for each artifact you control. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(new FilterControlledArtifactPermanent()))); + } + + public TidyConclusion(final TidyConclusion card) { + super(card); + } + + @Override + public TidyConclusion copy() { + return new TidyConclusion(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java b/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java index b09c671834c..be22e05fb79 100644 --- a/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java +++ b/Mage.Sets/src/mage/sets/magic2015/ScrapyardMongrel.java @@ -51,10 +51,6 @@ import mage.filter.common.FilterControlledArtifactPermanent; */ public class ScrapyardMongrel extends CardImpl { - private static final FilterPermanent filter = new FilterControlledArtifactPermanent(); - - private static final String rule = "As long as you control an artifact, {this} gets +2/+0 and has trample"; - public ScrapyardMongrel(UUID ownerId) { super(ownerId, 160, "Scrapyard Mongrel", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.expansionSetCode = "M15"; @@ -65,6 +61,7 @@ public class ScrapyardMongrel extends CardImpl { this.toughness = new MageInt(3); // As long as you control an artifact, Scrapyard Mongrel gets +2/+0 and has trample. + FilterPermanent filter = new FilterControlledArtifactPermanent(); Effect boostEffect = new ConditionalContinuousEffect( new BoostSourceEffect(2, 0, Duration.WhileOnBattlefield), new PermanentsOnTheBattlefieldCondition(filter), diff --git a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java index f68c5edd6d1..7a5a26312da 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/SacrificeXTargetCost.java @@ -25,7 +25,6 @@ * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ - package mage.abilities.costs.common; import mage.abilities.Ability; @@ -39,17 +38,17 @@ import mage.target.common.TargetControlledPermanent; * * @author LevelX2 */ -public class SacrificeXTargetCost extends VariableCostImpl { +public class SacrificeXTargetCost extends VariableCostImpl { protected FilterControlledPermanent filter; - + public SacrificeXTargetCost(FilterControlledPermanent filter) { this(filter, false); } public SacrificeXTargetCost(FilterControlledPermanent filter, boolean additionalCostText) { - super(new StringBuilder(filter.getMessage()).append(" to sacrifice").toString()); - this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, sacrifice ":"Sacrifice ").append(xText).append(" ").append(filter.getMessage()).toString(); + super(filter.getMessage() + " to sacrifice"); + this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + " " + filter.getMessage(); this.filter = filter; } diff --git a/Mage/src/main/java/mage/abilities/dynamicvalue/common/StaticValue.java b/Mage/src/main/java/mage/abilities/dynamicvalue/common/StaticValue.java index 9a82e65c6f5..0297eec66af 100644 --- a/Mage/src/main/java/mage/abilities/dynamicvalue/common/StaticValue.java +++ b/Mage/src/main/java/mage/abilities/dynamicvalue/common/StaticValue.java @@ -43,4 +43,8 @@ public class StaticValue implements DynamicValue { public String getMessage() { return message; } + + public int getValue() { + return value; + } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java index fd9594e9c20..dccac2abdc6 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/NameACardEffect.java @@ -50,6 +50,7 @@ public class NameACardEffect extends OneShotEffect { public enum TypeOfName { ALL, + NON_ARTFIACT_AND_NON_LAND_NAME, NON_LAND_NAME, NON_LAND_AND_NON_CREATURE_NAME, CREATURE_NAME @@ -82,6 +83,10 @@ public class NameACardEffect extends OneShotEffect { cardChoice.setChoices(CardRepository.instance.getNames()); cardChoice.setMessage("Name a card"); break; + case NON_ARTFIACT_AND_NON_LAND_NAME: + cardChoice.setChoices(CardRepository.instance.getNonArtifactAndNonLandNames()); + cardChoice.setMessage("Name a non artifact and non land card"); + break; case NON_LAND_AND_NON_CREATURE_NAME: cardChoice.setChoices(CardRepository.instance.getNonLandAndNonCreatureNames()); cardChoice.setMessage("Name a non land and non creature card"); @@ -125,6 +130,9 @@ public class NameACardEffect extends OneShotEffect { case ALL: sb.append("card"); break; + case NON_ARTFIACT_AND_NON_LAND_NAME: + sb.append("nonartifact, nonland card"); + break; case NON_LAND_AND_NON_CREATURE_NAME: sb.append("card other than a creature or a land card"); break; diff --git a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java index 2b86084bb93..c4a3edf16c9 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PutOnLibraryTargetEffect.java @@ -30,19 +30,18 @@ package mage.abilities.effects.common; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import mage.constants.Outcome; -import mage.constants.Zone; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; - -import java.util.UUID; -import mage.cards.Cards; -import mage.cards.CardsImpl; import mage.target.Target; import mage.util.CardUtil; @@ -149,16 +148,14 @@ public class PutOnLibraryTargetEffect extends OneShotEffect { } StringBuilder sb = new StringBuilder(); Target target = mode.getTargets().get(0); - sb.append("Put "); + sb.append("put "); if (target.getMaxNumberOfTargets() == 0) { sb.append("any number of "); - } else { - if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) { - if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { - sb.append("up to "); - } - sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); + } else if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) { + if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) { + sb.append("up to "); } + sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" "); } sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on "); sb.append(onTop ? "top" : "the bottom").append(" of its owner's library"); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java index 72ae0db2a89..b7e9cd575a8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/MaximumHandSizeControllerEffect.java @@ -29,6 +29,8 @@ package mage.abilities.effects.common.continuous; import java.util.UUID; import mage.abilities.Ability; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.ContinuousEffectImpl; import mage.constants.Duration; import mage.constants.Layer; @@ -48,7 +50,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { SET, INCREASE, REDUCE }; - protected int handSize; + protected DynamicValue handSize; protected HandSizeModification handSizeModification; protected TargetController targetController; @@ -63,6 +65,10 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { } public MaximumHandSizeControllerEffect(int handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) { + this(new StaticValue(handSize), duration, handSizeModification, targetController); + } + + public MaximumHandSizeControllerEffect(DynamicValue handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) { super(duration, Layer.PlayerEffects, SubLayer.NA, defineOutcome(handSizeModification, targetController)); this.handSize = handSize; this.handSizeModification = handSizeModification; @@ -98,16 +104,16 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { switch (targetController) { case ANY: for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - setHandSize(game, playerId); + setHandSize(game, source, playerId); } break; case OPPONENT: for (UUID playerId : game.getOpponents(source.getControllerId())) { - setHandSize(game, playerId); + setHandSize(game, source, playerId); } break; case YOU: - setHandSize(game, source.getControllerId()); + setHandSize(game, source, source.getControllerId()); break; default: throw new UnsupportedOperationException("Not supported yet."); @@ -117,18 +123,18 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { return false; } - private void setHandSize(Game game, UUID playerId) { + private void setHandSize(Game game, Ability source, UUID playerId) { Player player = game.getPlayer(playerId); if (player != null) { switch (handSizeModification) { case SET: - player.setMaxHandSize(handSize); + player.setMaxHandSize(handSize.calculate(game, source, this)); break; case INCREASE: - player.setMaxHandSize(player.getMaxHandSize() + handSize); + player.setMaxHandSize(player.getMaxHandSize() + handSize.calculate(game, source, this)); break; case REDUCE: - player.setMaxHandSize(player.getMaxHandSize() - handSize); + player.setMaxHandSize(player.getMaxHandSize() - handSize.calculate(game, source, this)); break; } } @@ -138,21 +144,21 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { StringBuilder sb = new StringBuilder(); switch (targetController) { case ANY: - if (handSize == Integer.MAX_VALUE) { + if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) { sb.append("All players have no "); } else { sb.append("All players "); } break; case OPPONENT: - if (handSize == Integer.MAX_VALUE) { + if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) { sb.append("Each opponent has no "); } else { sb.append("Each opponent's "); } break; case YOU: - if (handSize == Integer.MAX_VALUE) { + if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) { sb.append("You have no "); } else { sb.append("Your "); @@ -164,11 +170,11 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl { sb.append(" is increased by "); } else if (handSizeModification.equals(HandSizeModification.REDUCE)) { sb.append(" is reduced by "); - } else if (handSize != Integer.MAX_VALUE) { + } else if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) { sb.append(" is "); } - if (handSize != Integer.MAX_VALUE) { - sb.append(CardUtil.numberToText(handSize)); + if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() != Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) { + sb.append(CardUtil.numberToText(((StaticValue) handSize).getValue())); } if (duration == Duration.EndOfGame) { sb.append(" for the rest of the game"); diff --git a/Mage/src/main/java/mage/cards/repository/CardRepository.java b/Mage/src/main/java/mage/cards/repository/CardRepository.java index e1029ad89f9..c139decda4e 100644 --- a/Mage/src/main/java/mage/cards/repository/CardRepository.java +++ b/Mage/src/main/java/mage/cards/repository/CardRepository.java @@ -42,7 +42,6 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Random; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.Callable; @@ -214,6 +213,28 @@ public enum CardRepository { return names; } + public Set getNonArtifactAndNonLandNames() { + Set names = new TreeSet<>(); + try { + QueryBuilder qb = cardDao.queryBuilder(); + qb.distinct().selectColumns("name"); + Where where = qb.where(); + where.and(where.not().like("types", '%' + CardType.ARTIFACT.name() + '%'), where.not().like("types", '%' + CardType.LAND.name() + '%')); + List results = cardDao.query(qb.prepare()); + for (CardInfo card : results) { + int result = card.getName().indexOf(" // "); + if (result > 0) { + names.add(card.getName().substring(0, result)); + names.add(card.getName().substring(result + 4)); + } else { + names.add(card.getName()); + } + } + } catch (SQLException ex) { + } + return names; + } + public Set getCreatureTypes() { TreeSet subtypes = new TreeSet<>(); try { diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 6e1817559e4..dca963a223f 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -67,6 +67,7 @@ public enum CounterType { HATCHLING("hatchling"), HEALING("healing"), HOOFPRINT("hoofprint"), + HOUR("hour"), ICE("ice"), INTERVENTION("intervention"), JAVELIN("javelin"), diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java new file mode 100644 index 00000000000..8c423ef922d --- /dev/null +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -0,0 +1,40 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.filter; + +import mage.constants.CardType; +import mage.filter.common.FilterControlledArtifactPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; + +/** + * + * @author LevelX2 + */ +public class StaticFilters { + + public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature"); + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("artifact or creature you control"); + public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent(); + public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card"); + + static { + FILTER_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE) + )); + FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE) + )); + FILTER_CARD_ARTIFACT_OR_CREATURE.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.CREATURE) + )); + } + +} diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index f8720a39749..a6498f0ab33 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -29752,7 +29752,7 @@ Morbid Curiosity|Kaladesh|94|U|{1}{B}{B}|Sorcery|||As an additional cast to cost Night Market Lookout|Kaladesh|95|C|{B}|Creature - Human Rogue|1|1|Whenever Night Market Lookout becomes tapped, each opponent loses 1 life and you gain 1 life.| Noxious Gearhulk|Kaladesh|96|M|{4}{B}{B}|Artifact Creature - Construct|5|4|Menace$When Noxious Gearhulk enters the battlefield, you may destroy another target creature. If a creature is destroyed this way, you gain life equal to its toughness.| Ovalchase Daredevil|Kaladesh|97|U|{3}{B}|Creature - Human Pilot|4|2|Whenever an artifact enters the battlefield under your control, you may return Ovalchase Daredevil from your graveyard to your hand.| -Prakhata Club Secruity|Kaladesh|98|C|{3}{B}|Creature - Aetherborn Warrior|3|4|| +Prakhata Club Security|Kaladesh|98|C|{3}{B}|Creature - Aetherborn Warrior|3|4|| Rush of Vitality|Kaladesh|99|C|{1}{B}|Instant|||Target creature gets +1/+0 and gains lifelink and indestructible until end of turn.| Subtle Strike|Kaladesh|100|C|{1}{B}|Instant|||Choose one or both —$• Target creature gets -1/-1 until end of turn.$• Put a +1/+1 counter on target creature.| Syndicate Trafficker|Kaladesh|101|R|{1}{B}|Crature - Aetherborn Rogue|3|1|{1}, Sacrifice an artifact: Put a +1/+1 counter on Syndicate Trafficker. It gains indestructible until end of turn.|