diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java index 49cd01066b..9823a3a6f8 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfCruelty.java @@ -31,7 +31,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsBiggestOrTiedCreatureCondition; +import mage.abilities.condition.common.ControlsCreatureGreatestPowerCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; @@ -59,7 +59,7 @@ public class TriumphOfCruelty extends CardImpl { TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new DiscardTargetEffect(1), TargetController.YOU, false); Target target = new TargetOpponent(); ability.addTarget(target); - this.addAbility(new ConditionalTriggeredAbility(ability, ControlsBiggestOrTiedCreatureCondition.getInstance(), ruleText)); + this.addAbility(new ConditionalTriggeredAbility(ability, ControlsCreatureGreatestPowerCondition.getInstance(), ruleText)); } public TriumphOfCruelty(final TriumphOfCruelty card) { diff --git a/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfFerocity.java b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfFerocity.java index 1c208120f7..f0aff0368b 100644 --- a/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfFerocity.java +++ b/Mage.Sets/src/mage/sets/avacynrestored/TriumphOfFerocity.java @@ -31,7 +31,7 @@ import mage.constants.CardType; import mage.constants.Rarity; import mage.abilities.TriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.condition.common.ControlsBiggestOrTiedCreatureCondition; +import mage.abilities.condition.common.ControlsCreatureGreatestPowerCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; @@ -54,7 +54,7 @@ public class TriumphOfFerocity extends CardImpl { // At the beginning of your upkeep, draw a card if you control the creature with the greatest power or tied for the greatest power. TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.YOU, false); - this.addAbility(new ConditionalTriggeredAbility(ability, ControlsBiggestOrTiedCreatureCondition.getInstance(), ruleText)); + this.addAbility(new ConditionalTriggeredAbility(ability, ControlsCreatureGreatestPowerCondition.getInstance(), ruleText)); } public TriumphOfFerocity(final TriumphOfFerocity card) { diff --git a/Mage.Sets/src/mage/sets/exodus/Bequeathal.java b/Mage.Sets/src/mage/sets/exodus/Bequeathal.java new file mode 100644 index 0000000000..2f695dd97f --- /dev/null +++ b/Mage.Sets/src/mage/sets/exodus/Bequeathal.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.exodus; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class Bequeathal extends CardImpl { + + public Bequeathal(UUID ownerId) { + super(ownerId, 106, "Bequeathal", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{G}"); + this.expansionSetCode = "EXO"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.DrawCard)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When enchanted creature dies, you draw two cards. + this.addAbility( new DiesAttachedTriggeredAbility(new DrawCardSourceControllerEffect(2), "enchanted creature")); + } + + public Bequeathal(final Bequeathal card) { + super(card); + } + + @Override + public Bequeathal copy() { + return new Bequeathal(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/AbzanBeastmaster.java b/Mage.Sets/src/mage/sets/fatereforged/AbzanBeastmaster.java new file mode 100644 index 0000000000..874004d998 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/AbzanBeastmaster.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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.ControlsCreatureGreatestToughnessCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author LevelX2 + */ +public class AbzanBeastmaster extends CardImpl { + + public AbzanBeastmaster(UUID ownerId) { + super(ownerId, 119, "Abzan Beastmaster", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Hound"); + this.subtype.add("Shaman"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // At the beginning of your upkeep, draw a card if you control the creature with the greatest toughness or tied for the greatest toughness. + this.addAbility(new ConditionalTriggeredAbility( + new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.YOU, false), + ControlsCreatureGreatestToughnessCondition.getInstance(), + "At the beginning of your upkeep, draw a card if you control the creature with the greatest toughness or tied for the greatest toughness." + )); + } + + public AbzanBeastmaster(final AbzanBeastmaster card) { + super(card); + } + + @Override + public AbzanBeastmaster copy() { + return new AbzanBeastmaster(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/AinokGuide.java b/Mage.Sets/src/mage/sets/fatereforged/AinokGuide.java new file mode 100644 index 0000000000..bbd7bb1f34 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/AinokGuide.java @@ -0,0 +1,78 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.effects.common.search.SearchLibraryPutOnLibraryEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.counters.CounterType; +import mage.filter.common.FilterBasicLandCard; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class AinokGuide extends CardImpl { + + public AinokGuide(UUID ownerId) { + super(ownerId, 121, "Ainok Guide", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Hound"); + this.subtype.add("Scout"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // When Ainok Guide enters the battlefield, choose one - + // * Put a +1/+1 counter on Ainok Guide. + Ability ability = new EntersBattlefieldTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); + + // * Search your library for a basic land card, reveal it, then shuffle your library and put that card on top of it. + Mode mode = new Mode(); + mode.getEffects().add(new SearchLibraryPutOnLibraryEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true)); + ability.addMode(mode); + this.addAbility(ability); + + } + + public AinokGuide(final AinokGuide card) { + super(card); + } + + @Override + public AinokGuide copy() { + return new AinokGuide(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/AmbushKrotiq.java b/Mage.Sets/src/mage/sets/fatereforged/AmbushKrotiq.java new file mode 100644 index 0000000000..f033aa6cef --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/AmbushKrotiq.java @@ -0,0 +1,75 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; + +/** + * + * @author LevelX2 + */ +public class AmbushKrotiq extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control"); + + static { + filter.add(new AnotherPredicate()); + } + + public AmbushKrotiq(UUID ownerId) { + super(ownerId, 122, "Ambush Krotiq", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{5}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Insect"); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + // When Ambush Krotiq enters the battlefield, return another creature you control to its owner's hand. + this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter))); + + } + + public AmbushKrotiq(final AmbushKrotiq card) { + super(card); + } + + @Override + public AmbushKrotiq copy() { + return new AmbushKrotiq(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/BattlefrontKrushok.java b/Mage.Sets/src/mage/sets/fatereforged/BattlefrontKrushok.java new file mode 100644 index 0000000000..3a09ea1388 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/BattlefrontKrushok.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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBeBlockedByMoreThanOneAllEffect; +import mage.abilities.effects.common.combat.CantBeBlockedByMoreThanOneSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.CounterPredicate; + +/** + * + * @author LevelX2 + */ +public class BattlefrontKrushok extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control with a +1/+1 counter on it"); + + static { + filter.add(new CounterPredicate(CounterType.P1P1)); + } + + public BattlefrontKrushok(UUID ownerId) { + super(ownerId, 125, "Battlefront Krushok", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Beast"); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Battlefront Krushok can't be blocked by more than one creature. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByMoreThanOneSourceEffect())); + + // Each creature you control with a +1/+1 counter on it can't be blocked by more than one creature. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByMoreThanOneAllEffect(filter))); + } + + public BattlefrontKrushok(final BattlefrontKrushok card) { + super(card); + } + + @Override + public BattlefrontKrushok copy() { + return new BattlefrontKrushok(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/CachedDefenses.java b/Mage.Sets/src/mage/sets/fatereforged/CachedDefenses.java new file mode 100644 index 0000000000..ddc670938f --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/CachedDefenses.java @@ -0,0 +1,58 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.effects.keyword.BolsterEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class CachedDefenses extends CardImpl { + + public CachedDefenses(UUID ownerId) { + super(ownerId, 126, "Cached Defenses", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}"); + this.expansionSetCode = "FRF"; + + // Bolster 3. + this.getSpellAbility().addEffect(new BolsterEffect(3)); + } + + public CachedDefenses(final CachedDefenses card) { + super(card); + } + + @Override + public CachedDefenses copy() { + return new CachedDefenses(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/FruitOfTheFirstTree.java b/Mage.Sets/src/mage/sets/fatereforged/FruitOfTheFirstTree.java new file mode 100644 index 0000000000..b88d13a88e --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/FruitOfTheFirstTree.java @@ -0,0 +1,114 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import static javax.xml.bind.JAXBIntrospector.getValue; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.common.DiesAttachedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class FruitOfTheFirstTree extends CardImpl { + + public FruitOfTheFirstTree(UUID ownerId) { + super(ownerId, 132, "Fruit of the First Tree", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Aura"); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // When enchanted creature dies, you gain X life and draw X cards, where X is its toughness. + this.addAbility( new DiesAttachedTriggeredAbility(new FruitOfTheFirstTreeEffect(), "enchanted creature")); + } + + public FruitOfTheFirstTree(final FruitOfTheFirstTree card) { + super(card); + } + + @Override + public FruitOfTheFirstTree copy() { + return new FruitOfTheFirstTree(this); + } +} + +class FruitOfTheFirstTreeEffect extends OneShotEffect { + + public FruitOfTheFirstTreeEffect() { + super(Outcome.Benefit); + } + + public FruitOfTheFirstTreeEffect(FruitOfTheFirstTreeEffect copy) { + super(copy); + } + + @Override + public FruitOfTheFirstTreeEffect copy() { + return new FruitOfTheFirstTreeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent creature = (Permanent) getValue("attachedTo"); + if (creature != null){ + Player controller = game.getPlayer(creature.getOwnerId()); + if (controller != null) { + controller.gainLife(creature.getToughness().getValue(), game); + controller.drawCards(creature.getToughness().getValue(), game); + return true; + } + } + return false; + } + + @Override + public String getText(Mode mode) { + return "you gain X life and draw X cards, where X is its toughness"; + } + +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/ReturnToTheEarth.java b/Mage.Sets/src/mage/sets/fatereforged/ReturnToTheEarth.java new file mode 100644 index 0000000000..4aa9f3d084 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/ReturnToTheEarth.java @@ -0,0 +1,78 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class ReturnToTheEarth extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("artifact, enchantment, or creature with flying"); + + static { + filter.add(Predicates.or( + new CardTypePredicate(CardType.ARTIFACT), + new CardTypePredicate(CardType.ENCHANTMENT), + Predicates.and( + new CardTypePredicate(CardType.CREATURE), + new AbilityPredicate(FlyingAbility.class)) + )); + } + + public ReturnToTheEarth(UUID ownerId) { + super(ownerId, 135, "Return to the Earth", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{G}"); + this.expansionSetCode = "FRF"; + + // Destroy target artifact, enchantment, or creature with flying. + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + + } + + public ReturnToTheEarth(final ReturnToTheEarth card) { + super(card); + } + + @Override + public ReturnToTheEarth copy() { + return new ReturnToTheEarth(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/RuthlessInstincts.java b/Mage.Sets/src/mage/sets/fatereforged/RuthlessInstincts.java new file mode 100644 index 0000000000..a619d2abd3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/RuthlessInstincts.java @@ -0,0 +1,100 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.Mode; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.target.Target; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class RuthlessInstincts extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nonattacking creature"); + private static final FilterCreaturePermanent filterAttacking = new FilterCreaturePermanent("attacking creature"); + + static { + filter.add(Predicates.not(new AttackingPredicate())); + filterAttacking.add(new AttackingPredicate()); + } + + public RuthlessInstincts(UUID ownerId) { + super(ownerId, 136, "Ruthless Instincts", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G}"); + this.expansionSetCode = "FRF"; + + // Choose one - + // * Target nonattacking creature gains reach and deathtouch until end of turn. Untap it. + Effect effect = new GainAbilityTargetEffect(ReachAbility.getInstance(), Duration.EndOfTurn); + effect.setText("Target nonattacking creature gains reach"); + this.getSpellAbility().addEffect(effect); + effect = new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and deathtouch until end of turn"); + this.getSpellAbility().addEffect(effect); + effect = new UntapTargetEffect(); + effect.setText("Untap it"); + this.getSpellAbility().addEffect(effect); + Target target = new TargetCreaturePermanent(filter); + this.getSpellAbility().addTarget(target); + // * Target attacking creature gets +2/+2 and gains trample until end of turn. + Mode mode = new Mode(); + effect = new BoostTargetEffect(2,2,Duration.EndOfTurn); + effect.setText("Target attacking creature gets +2/+2"); + mode.getEffects().add(effect); + effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn); + effect.setText("and gains trample until end of turn"); + mode.getEffects().add(effect); + mode.getTargets().add(new TargetCreaturePermanent(filterAttacking)); + this.getSpellAbility().addMode(mode); + } + + public RuthlessInstincts(final RuthlessInstincts card) { + super(card); + } + + @Override + public RuthlessInstincts copy() { + return new RuthlessInstincts(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java new file mode 100644 index 0000000000..3d9e62e256 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/SuddenReclamation.java @@ -0,0 +1,114 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveControllerEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterLandCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class SuddenReclamation extends CardImpl { + + public SuddenReclamation(UUID ownerId) { + super(ownerId, 139, "Sudden Reclamation", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{G}"); + this.expansionSetCode = "FRF"; + + // Put the top four cards of your library into your graveyard, then return a creature card and a land card from your graveyard to your hand. + this.getSpellAbility().addEffect(new PutTopCardOfLibraryIntoGraveControllerEffect(4)); + this.getSpellAbility().addEffect(new SuddenReclamationEffect()); + } + + public SuddenReclamation(final SuddenReclamation card) { + super(card); + } + + @Override + public SuddenReclamation copy() { + return new SuddenReclamation(this); + } +} + +class SuddenReclamationEffect extends OneShotEffect { + + public SuddenReclamationEffect() { + super(Outcome.ReturnToHand); + this.staticText = ", then return a creature card and a land card from your graveyard to your hand"; + } + + public SuddenReclamationEffect(final SuddenReclamationEffect effect) { + super(effect); + } + + @Override + public SuddenReclamationEffect copy() { + return new SuddenReclamationEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Target target = new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")); + target.setNotTarget(true); + if (target.canChoose(source.getSourceId(), controller.getId(), game) && + controller.chooseTarget(outcome, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD); + } + } + target = new TargetCardInYourGraveyard(new FilterLandCard("land card from your graveyard")); + target.setNotTarget(true); + if (target.canChoose(source.getSourceId(), controller.getId(), game) && + controller.chooseTarget(outcome, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.GRAVEYARD); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/TemurSabertooth.java b/Mage.Sets/src/mage/sets/fatereforged/TemurSabertooth.java new file mode 100644 index 0000000000..4e0ff31bcd --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/TemurSabertooth.java @@ -0,0 +1,121 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.keyword.IndestructibleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class TemurSabertooth extends CardImpl { + + public TemurSabertooth(UUID ownerId) { + super(ownerId, 141, "Temur Sabertooth", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Cat"); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // {1}{G}: You may return another creature you control to its owner's hand. If you do, Temur Sabertooth gains indestructible until end of turn. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new TemurSabertoothEffect(), new ManaCostsImpl("{1}{G}"))); + + } + + public TemurSabertooth(final TemurSabertooth card) { + super(card); + } + + @Override + public TemurSabertooth copy() { + return new TemurSabertooth(this); + } +} + +class TemurSabertoothEffect extends OneShotEffect { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature you control"); + + static { + filter.add(new AnotherPredicate()); + } + + public TemurSabertoothEffect() { + super(Outcome.Detriment); + this.staticText = "You may return another creature you control to its owner's hand. If you do, {this} gains indestructible until end of turn"; + } + + public TemurSabertoothEffect(final TemurSabertoothEffect effect) { + super(effect); + } + + @Override + public TemurSabertoothEffect copy() { + return new TemurSabertoothEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Target target = new TargetPermanent(1,1, filter, true); + if (target.canChoose(source.getSourceId(), controller.getId(), game)) { + if (controller.chooseUse(outcome, "Return another creature to hand?", game) && + controller.chooseTarget(outcome, target, source, game)) { + Permanent toHand = game.getPermanent(target.getFirstTarget()); + if (toHand != null) { + controller.moveCardToHandWithInfo(toHand, source.getSourceId(), game, Zone.BATTLEFIELD); + } + game.addEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), source); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/WardenOfTheFirstTree.java b/Mage.Sets/src/mage/sets/fatereforged/WardenOfTheFirstTree.java new file mode 100644 index 0000000000..71c56b1fc4 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/WardenOfTheFirstTree.java @@ -0,0 +1,138 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.LockedInCondition; +import mage.abilities.condition.common.SourceMatchesFilterCondition; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.permanent.token.Token; + +/** + * + * @author LevelX2 + */ +public class WardenOfTheFirstTree extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(); + + static { + filter.add(new SubtypePredicate("Warrior")); + filter2.add(new SubtypePredicate("Spirit")); + } + + public WardenOfTheFirstTree(UUID ownerId) { + super(ownerId, 143, "Warden of the First Tree", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Human"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {1}{W/B}: Warden of the First Tree becomes a Human Warrior with base power and toughness 3/3. + this.addAbility(new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new BecomesCreatureSourceEffect(new WardenOfTheFirstTree1(), "", Duration.Custom), + new ManaCostsImpl("{1}{W/B}"))); + + // {2}{W/B}{W/B}: If Warden of the First Tree is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink. + this.addAbility(new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new ConditionalContinousEffect( + new BecomesCreatureSourceEffect(new WardenOfTheFirstTree2(), "", Duration.Custom), + new LockedInCondition(new SourceMatchesFilterCondition(filter)), + "If {this} is a Warrior, it becomes a Human Spirit Warrior with trample and lifelink"), + new ManaCostsImpl("{2}{W/B}{W/B}") + )); + + // {3}{W/B}{W/B}{W/B}: If Warden of the First Tree is a Spirit, put five +1/+1 counters on it. + this.addAbility(new SimpleActivatedAbility( + Zone.BATTLEFIELD, + new ConditionalOneShotEffect( + new AddCountersSourceEffect(CounterType.P1P1.createInstance(5)), + new SourceMatchesFilterCondition(filter2), + "If {this} is a Spirit, put five +1/+1 counters on it"), + new ManaCostsImpl("{3}{W/B}{W/B}{W/B}") + )); + } + + public WardenOfTheFirstTree(final WardenOfTheFirstTree card) { + super(card); + } + + @Override + public WardenOfTheFirstTree copy() { + return new WardenOfTheFirstTree(this); + } +} + +class WardenOfTheFirstTree1 extends Token { + + public WardenOfTheFirstTree1() { + super("Warden of the First Tree", "Human Warrior with base power and toughness 3/3"); + this.cardType.add(CardType.CREATURE); + this.subtype.add("Human"); + this.subtype.add("Warrior"); + + this.power = new MageInt(3); + this.toughness = new MageInt(3); + } +} + +class WardenOfTheFirstTree2 extends Token { + + public WardenOfTheFirstTree2() { + super("Warden of the First Tree", "Human Spirit Warrior with trample and lifelink"); + this.cardType.add(CardType.CREATURE); + this.subtype.add("Human"); + this.subtype.add("Spirit"); + this.subtype.add("Warrior"); + + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + this.addAbility(TrampleAbility.getInstance()); + this.addAbility(LifelinkAbility.getInstance()); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/WhispererOfTheWilds.java b/Mage.Sets/src/mage/sets/fatereforged/WhispererOfTheWilds.java new file mode 100644 index 0000000000..ae58a337ea --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/WhispererOfTheWilds.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.fatereforged; + +import java.util.UUID; +import mage.MageInt; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.condition.common.FerociousCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.BasicManaEffect; +import mage.abilities.mana.ActivateIfConditionManaAbility; +import mage.abilities.mana.GreenManaAbility; +import mage.cards.CardImpl; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class WhispererOfTheWilds extends CardImpl { + + public WhispererOfTheWilds(UUID ownerId) { + super(ownerId, 144, "Whisperer of the Wilds", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); + this.expansionSetCode = "FRF"; + this.subtype.add("Human"); + this.subtype.add("Shaman"); + this.power = new MageInt(0); + this.toughness = new MageInt(2); + + // {T}: Add {G} to your mana pool. + this.addAbility(new GreenManaAbility()); + + // Ferocious - {T}: Add {G}{G} to your mana pool. Activate this ability only if you control a creature with power 4 or greater. + Ability ability = new ActivateIfConditionManaAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.GreenMana(2)), new TapSourceCost(), FerociousCondition.getInstance()); + ability.setAbilityWord(AbilityWord.FEROCIOUS); + this.addAbility(ability); + } + + public WhispererOfTheWilds(final WhispererOfTheWilds card) { + super(card); + } + + @Override + public WhispererOfTheWilds copy() { + return new WhispererOfTheWilds(this); + } +} diff --git a/Mage.Sets/src/mage/sets/fatereforged/WindsOfQalSisma.java b/Mage.Sets/src/mage/sets/fatereforged/WindsOfQalSisma.java new file mode 100644 index 0000000000..ce0b351213 --- /dev/null +++ b/Mage.Sets/src/mage/sets/fatereforged/WindsOfQalSisma.java @@ -0,0 +1,79 @@ +/* + * 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.fatereforged; + +import java.util.UUID; +import mage.abilities.condition.LockedInCondition; +import mage.abilities.condition.common.FerociousCondition; +import mage.abilities.decorator.ConditionalReplacementEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.PreventAllDamageByAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerPredicate; + +/** + * + * @author LevelX2 + */ +public class WindsOfQalSisma extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures your opponents control"); + + static { + filter.add(new ControllerPredicate(TargetController.OPPONENT)); + } + + public WindsOfQalSisma(UUID ownerId) { + super(ownerId, 147, "Winds of Qal Sisma", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{G}"); + this.expansionSetCode = "FRF"; + + // Prevent all combat damage that would be dealt this turn. + // Ferocious - If you control a creature with power 4 or greater, instead prevent all combat damage that would be dealt this turn by creatures your opponents control. + Effect effect = new ConditionalReplacementEffect( + new PreventAllDamageByAllEffect(filter, Duration.EndOfTurn, true), + new LockedInCondition(FerociousCondition.getInstance()), + new PreventAllDamageByAllEffect(Duration.EndOfTurn, true)); + effect.setText("Prevent all combat damage that would be dealt this turn.
" + + "Ferocious — If you control a creature with power 4 or greater, instead prevent all combat damage that would be dealt this turn by creatures your opponents control"); + this.getSpellAbility().addEffect(effect); + } + + public WindsOfQalSisma(final WindsOfQalSisma card) { + super(card); + } + + @Override + public WindsOfQalSisma copy() { + return new WindsOfQalSisma(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magic2015/InvasiveSpecies.java b/Mage.Sets/src/mage/sets/magic2015/InvasiveSpecies.java index 8abc56d165..82e592a4b6 100644 --- a/Mage.Sets/src/mage/sets/magic2015/InvasiveSpecies.java +++ b/Mage.Sets/src/mage/sets/magic2015/InvasiveSpecies.java @@ -61,9 +61,8 @@ public class InvasiveSpecies extends CardImpl { this.toughness = new MageInt(3); // When Invasive Species enters the battlefield, return another permanent you control to its owner's hand. - Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(filter))); - this.addAbility(ability); } public InvasiveSpecies(final InvasiveSpecies card) { diff --git a/Mage.Sets/src/mage/sets/shardsofalara/BanewaspAffliction.java b/Mage.Sets/src/mage/sets/shardsofalara/BanewaspAffliction.java index a5080df5dd..00d12c9dd4 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/BanewaspAffliction.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/BanewaspAffliction.java @@ -28,10 +28,6 @@ package mage.sets.shardsofalara; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.common.DiesAttachedTriggeredAbility; @@ -39,6 +35,9 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.keyword.EnchantAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -64,9 +63,9 @@ public class BanewaspAffliction extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); + // When enchanted creature dies, that creature's controller loses life equal to its toughness. - ability = new DiesAttachedTriggeredAbility(new LoseLifeEffect(), "enchanted creature"); - this.addAbility(ability); + this.addAbility( new DiesAttachedTriggeredAbility(new BanewaspAfflictionLoseLifeEffect(), "enchanted creature")); } public BanewaspAffliction(final BanewaspAffliction card) { @@ -80,33 +79,30 @@ public class BanewaspAffliction extends CardImpl { } -class LoseLifeEffect extends OneShotEffect { +class BanewaspAfflictionLoseLifeEffect extends OneShotEffect { - public LoseLifeEffect() { + public BanewaspAfflictionLoseLifeEffect() { super(Outcome.LoseLife); } - public LoseLifeEffect(LoseLifeEffect copy) { + public BanewaspAfflictionLoseLifeEffect(BanewaspAfflictionLoseLifeEffect copy) { super(copy); } @Override - public LoseLifeEffect copy() { - return new LoseLifeEffect(this); + public BanewaspAfflictionLoseLifeEffect copy() { + return new BanewaspAfflictionLoseLifeEffect(this); } @Override public boolean apply(Game game, Ability source) { - Permanent banewaspAffliction = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - if(banewaspAffliction != null){ - Permanent creature = (Permanent) game.getLastKnownInformation(banewaspAffliction.getAttachedTo(), Zone.BATTLEFIELD); - if(creature != null){ - Player player = game.getPlayer(creature.getOwnerId()); - if (player != null) { - player.loseLife(creature.getToughness().getValue(), game); - return true; - } + Permanent creature = (Permanent) getValue("attachedTo"); + if(creature != null){ + Player player = game.getPlayer(creature.getOwnerId()); + if (player != null) { + player.loseLife(creature.getToughness().getValue(), game); + return true; } } return false; @@ -117,5 +113,4 @@ class LoseLifeEffect extends OneShotEffect { return "that creature's controller loses life equal to its toughness"; } - } diff --git a/Mage.Sets/src/mage/sets/worldwake/PilgrimsEye.java b/Mage.Sets/src/mage/sets/worldwake/PilgrimsEye.java index 56833f6528..cb7602bf7b 100644 --- a/Mage.Sets/src/mage/sets/worldwake/PilgrimsEye.java +++ b/Mage.Sets/src/mage/sets/worldwake/PilgrimsEye.java @@ -37,6 +37,7 @@ import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.filter.FilterCard; +import mage.filter.common.FilterBasicLandCard; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.SupertypePredicate; import mage.target.common.TargetCardInLibrary; @@ -63,7 +64,7 @@ public class PilgrimsEye extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // When Pilgrim's Eye enters the battlefield, you may search your library for a basic land card, reveal it, put it into your hand, then shuffle your library. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(filter), true, true), true)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard()), true, true), true)); } public PilgrimsEye (final PilgrimsEye card) { diff --git a/Mage/src/mage/abilities/condition/common/ControlsBiggestOrTiedCreatureCondition.java b/Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestPowerCondition.java similarity index 88% rename from Mage/src/mage/abilities/condition/common/ControlsBiggestOrTiedCreatureCondition.java rename to Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestPowerCondition.java index eaed22f3d5..83f5d27381 100644 --- a/Mage/src/mage/abilities/condition/common/ControlsBiggestOrTiedCreatureCondition.java +++ b/Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestPowerCondition.java @@ -27,26 +27,25 @@ */ package mage.abilities.condition.common; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.Condition; import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; - /** * Condition for: * - if you control the creature with the greatest power or tied for the greatest power * * @author noxx */ -public class ControlsBiggestOrTiedCreatureCondition implements Condition { +public class ControlsCreatureGreatestPowerCondition implements Condition { - private static ControlsBiggestOrTiedCreatureCondition fInstance = new ControlsBiggestOrTiedCreatureCondition(); + private static final ControlsCreatureGreatestPowerCondition fInstance = new ControlsCreatureGreatestPowerCondition(); private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); @@ -76,4 +75,10 @@ public class ControlsBiggestOrTiedCreatureCondition implements Condition { } return controllers.contains(source.getControllerId()); } + + @Override + public String toString() { + return "you control the creature with the greatest power or tied for the greatest power"; + } + } diff --git a/Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestToughnessCondition.java b/Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestToughnessCondition.java new file mode 100644 index 0000000000..2ebe0b066b --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/ControlsCreatureGreatestToughnessCondition.java @@ -0,0 +1,84 @@ +/* + * 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.abilities.condition.common; + +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * Condition for: + * - if you control the creature with the greatest toughness or tied for the greatest toughness + * + * @author LevelX2 + */ +public class ControlsCreatureGreatestToughnessCondition implements Condition { + + private static final ControlsCreatureGreatestToughnessCondition fInstance = new ControlsCreatureGreatestToughnessCondition(); + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + public static Condition getInstance() { + return fInstance; + } + + @Override + public boolean apply(Game game, Ability source) { + Set controllers = new HashSet<>(); + Integer maxToughness = null; + + List permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game); + for (Permanent permanent : permanents) { + if (permanent == null) { + continue; + } + + int toughness = permanent.getToughness().getValue(); + if (maxToughness == null || toughness > maxToughness) { + maxToughness = permanent.getToughness().getValue(); + controllers.clear(); + } + if (toughness == maxToughness) { + controllers.add(permanent.getControllerId()); + } + } + return controllers.contains(source.getControllerId()); + } + + @Override + public String toString() { + return "you control the creature with the greatest toughness or tied for the greatest toughness"; + } + +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/FerociousCondition.java b/Mage/src/mage/abilities/condition/common/FerociousCondition.java index ebabb79a59..22f900d7de 100644 --- a/Mage/src/mage/abilities/condition/common/FerociousCondition.java +++ b/Mage/src/mage/abilities/condition/common/FerociousCondition.java @@ -60,4 +60,10 @@ public class FerociousCondition implements Condition { return game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0; } + @Override + public String toString() { + return "you control a creature with power 4 or greater"; + } + + } diff --git a/Mage/src/mage/abilities/effects/common/PreventAllDamageByAllEffect.java b/Mage/src/mage/abilities/effects/common/PreventAllDamageByAllEffect.java index 690263f520..e2087c588c 100644 --- a/Mage/src/mage/abilities/effects/common/PreventAllDamageByAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/PreventAllDamageByAllEffect.java @@ -80,7 +80,7 @@ public class PreventAllDamageByAllEffect extends PreventionEffectImpl { return true; } Permanent permanent = game.getPermanent(damageEvent.getSourceId()); - if (permanent != null && filter.match(permanent, game)) { + if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) { return true; } }