From 128b972765f4982ab0c64fcb67b44a0f1bc3eed7 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 24 Jun 2017 14:00:21 +0200 Subject: [PATCH] [HOU] Added 5 black cards. --- .../src/mage/cards/a/AnakinSkywalker.java | 271 ++++++++-------- .../src/mage/cards/a/AyliEternalPilgrim.java | 22 +- .../src/mage/cards/b/BlazingHellhound.java | 14 +- Mage.Sets/src/mage/cards/b/BloodBairn.java | 14 +- Mage.Sets/src/mage/cards/b/BloodHost.java | 15 +- .../src/mage/cards/b/BontuTheGlorified.java | 11 +- .../src/mage/cards/b/ButcherOfTheHorde.java | 17 +- .../src/mage/cards/c/CartelAristocrat.java | 15 +- .../src/mage/cards/c/CorpseBlockade.java | 12 +- .../src/mage/cards/d/DiscipleOfBolas.java | 13 +- Mage.Sets/src/mage/cards/d/Dreamstealer.java | 108 +++++++ Mage.Sets/src/mage/cards/e/EaterOfHope.java | 10 +- .../src/mage/cards/f/FelhideBrawler.java | 59 +--- Mage.Sets/src/mage/cards/f/FellShepherd.java | 18 +- .../src/mage/cards/f/FiligreeFracture.java | 23 +- Mage.Sets/src/mage/cards/f/FleshCarver.java | 11 +- .../src/mage/cards/g/GhoulcallerGisa.java | 13 +- Mage.Sets/src/mage/cards/g/GobblingOoze.java | 15 +- .../src/mage/cards/g/GoldnightCommander.java | 15 +- .../src/mage/cards/g/GriffinProtector.java | 12 +- .../src/mage/cards/g/GrimgrinCorpseBorn.java | 16 +- .../src/mage/cards/h/HealerOfThePride.java | 12 +- .../mage/cards/h/HeartPiercerManticore.java | 11 +- Mage.Sets/src/mage/cards/h/HourOfGlory.java | 113 +++++++ Mage.Sets/src/mage/cards/h/HowlpackWolf.java | 53 +--- .../cards/j/JaliraMasterPolymorphist.java | 7 +- .../mage/cards/j/JaradGolgariLichLord.java | 17 +- .../src/mage/cards/k/KheruBloodsucker.java | 14 +- Mage.Sets/src/mage/cards/k/KheruDreadmaw.java | 15 +- Mage.Sets/src/mage/cards/k/KruinStriker.java | 13 +- .../src/mage/cards/l/LilianasDefeat.java | 105 +++++++ Mage.Sets/src/mage/cards/l/LukeSkywalker.java | 263 ++++++++-------- .../mage/cards/m/MauraudingBoneslasher.java | 77 +++++ Mage.Sets/src/mage/cards/m/MindlessNull.java | 42 +-- .../mage/cards/o/OliviaMobilizedForWar.java | 15 +- .../mage/cards/p/ProsshSkyraiderOfKher.java | 12 +- .../src/mage/cards/q/QarsiHighPriest.java | 16 +- Mage.Sets/src/mage/cards/r/RavenousWampa.java | 293 +++++++++--------- .../mage/cards/r/RazakethTheFoulblooded.java | 84 +++++ .../src/mage/cards/r/RubblebackRhino.java | 10 +- .../src/mage/cards/s/ScourgeOfSkolaVale.java | 13 +- Mage.Sets/src/mage/cards/s/SuturePriest.java | 26 +- .../mage/cards/t/TymaretTheMurderKing.java | 13 +- .../src/mage/cards/v/VampireWarlord.java | 12 +- .../mage/cards/v/VarolzTheScarStriped.java | 14 +- Mage.Sets/src/mage/cards/v/VoraciousNull.java | 13 +- .../mage/cards/y/YahenniUndyingPartisan.java | 11 +- .../src/mage/sets/HourOfDevastation.java | 5 + ...CantBlockUnlessYouControlSourceEffect.java | 71 +++++ .../abilities/keyword/EternalizeAbility.java | 2 +- .../main/java/mage/filter/StaticFilters.java | 4 + Utils/keywords.txt | 1 + Utils/mtg-cards-data.txt | 2 +- 53 files changed, 1143 insertions(+), 920 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/d/Dreamstealer.java create mode 100644 Mage.Sets/src/mage/cards/h/HourOfGlory.java create mode 100644 Mage.Sets/src/mage/cards/l/LilianasDefeat.java create mode 100644 Mage.Sets/src/mage/cards/m/MauraudingBoneslasher.java create mode 100644 Mage.Sets/src/mage/cards/r/RazakethTheFoulblooded.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockUnlessYouControlSourceEffect.java diff --git a/Mage.Sets/src/mage/cards/a/AnakinSkywalker.java b/Mage.Sets/src/mage/cards/a/AnakinSkywalker.java index 955aa645bf..3cc77e187f 100644 --- a/Mage.Sets/src/mage/cards/a/AnakinSkywalker.java +++ b/Mage.Sets/src/mage/cards/a/AnakinSkywalker.java @@ -1,139 +1,132 @@ -/* - * 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.cards.a; - -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.ActivateAsSorceryActivatedAbility; -import mage.abilities.common.DiesCreatureTriggeredAbility; -import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.effects.ReplacementEffectImpl; -import mage.abilities.effects.common.TransformSourceEffect; -import mage.abilities.effects.common.continuous.BoostTargetEffect; -import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.abilities.keyword.TransformAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.d.DarthVader; -import mage.constants.*; -import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.ZoneChangeEvent; -import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; - -import java.util.UUID; - -/** - * - * @author Styxo - */ -public class AnakinSkywalker extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - - public AnakinSkywalker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}{R}"); - addSuperType(SuperType.LEGENDARY); - this.subtype.add("Human"); - this.subtype.add("Sith"); - this.power = new MageInt(4); - this.toughness = new MageInt(4); - - this.transformable = true; - this.secondSideCardClazz = DarthVader.class; - - // Whenever another creature dies, put a +1/+1 counter on Anakin Skywalker. - this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, true)); - - // Sacrifice another creature: Target creature gets -1/-1 until end of turn. Activate this ability only as a sorcery. - Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(-1, -1, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter))); - ability.addTarget(new TargetCreaturePermanent()); - this.addAbility(ability); - - // If Anakin Skywalker would be destroyed, regenerate, then transform him instead. - this.addAbility(new TransformAbility()); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AnakinSkywalkerEffect())); - - } - - public AnakinSkywalker(final AnakinSkywalker card) { - super(card); - } - - @Override - public AnakinSkywalker copy() { - return new AnakinSkywalker(this); - } -} - -class AnakinSkywalkerEffect extends ReplacementEffectImpl { - - AnakinSkywalkerEffect() { - super(Duration.WhileOnBattlefield, Outcome.Transform); - staticText = "If {this} would die, regenerate and transform him instead"; - } - - AnakinSkywalkerEffect(final AnakinSkywalkerEffect effect) { - super(effect); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent != null) { - permanent.regenerate(source.getSourceId(), game); - return new TransformSourceEffect(true).apply(game, source); - } - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ZONE_CHANGE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getTargetId().equals(source.getSourceId()) && ((ZoneChangeEvent) event).isDiesEvent(); - } - - @Override - public AnakinSkywalkerEffect copy() { - return new AnakinSkywalkerEffect(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.cards.a; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ActivateAsSorceryActivatedAbility; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.TransformSourceEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.TransformAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.d.DarthVader; +import mage.constants.*; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Styxo + */ +public class AnakinSkywalker extends CardImpl { + + public AnakinSkywalker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}{R}"); + addSuperType(SuperType.LEGENDARY); + this.subtype.add("Human"); + this.subtype.add("Sith"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + this.transformable = true; + this.secondSideCardClazz = DarthVader.class; + + // Whenever another creature dies, put a +1/+1 counter on Anakin Skywalker. + this.addAbility(new DiesCreatureTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false, true)); + + // Sacrifice another creature: Target creature gets -1/-1 until end of turn. Activate this ability only as a sorcery. + Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(-1, -1, Duration.EndOfTurn), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // If Anakin Skywalker would be destroyed, regenerate, then transform him instead. + this.addAbility(new TransformAbility()); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AnakinSkywalkerEffect())); + + } + + public AnakinSkywalker(final AnakinSkywalker card) { + super(card); + } + + @Override + public AnakinSkywalker copy() { + return new AnakinSkywalker(this); + } +} + +class AnakinSkywalkerEffect extends ReplacementEffectImpl { + + AnakinSkywalkerEffect() { + super(Duration.WhileOnBattlefield, Outcome.Transform); + staticText = "If {this} would die, regenerate and transform him instead"; + } + + AnakinSkywalkerEffect(final AnakinSkywalkerEffect effect) { + super(effect); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (permanent != null) { + permanent.regenerate(source.getSourceId(), game); + return new TransformSourceEffect(true).apply(game, source); + } + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return event.getTargetId().equals(source.getSourceId()) && ((ZoneChangeEvent) event).isDiesEvent(); + } + + @Override + public AnakinSkywalkerEffect copy() { + return new AnakinSkywalkerEffect(this); + } +} diff --git a/Mage.Sets/src/mage/cards/a/AyliEternalPilgrim.java b/Mage.Sets/src/mage/cards/a/AyliEternalPilgrim.java index bf60957b7f..a65a9c4524 100644 --- a/Mage.Sets/src/mage/cards/a/AyliEternalPilgrim.java +++ b/Mage.Sets/src/mage/cards/a/AyliEternalPilgrim.java @@ -27,6 +27,7 @@ */ package mage.cards.a; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -45,29 +46,20 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SuperType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetNonlandPermanent; -import java.util.UUID; - /** * * @author fireshoes */ public class AyliEternalPilgrim extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } public AyliEternalPilgrim(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}"); this.addSuperType(SuperType.LEGENDARY); this.subtype.add("Kor"); this.subtype.add("Cleric"); @@ -76,14 +68,14 @@ public class AyliEternalPilgrim extends CardImpl { // Deathtouch this.addAbility(DeathtouchAbility.getInstance()); - + // {1}, Sacrifice another creature: You gain life equal to the sacrificed creature's toughness. Effect effect = new GainLifeEffect(new SacrificeCostCreaturesToughness()); effect.setText("You gain life equal to the sacrificed creature's toughness"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new GenericManaCost(1)); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); - + // {1}{W}{B}, Sacrifice another creature: Exile target nonland permanent. Activate this ability only if you have at least 10 life more than your starting life total. ability = new ConditionalActivatedAbility( Zone.BATTLEFIELD, @@ -91,7 +83,7 @@ public class AyliEternalPilgrim extends CardImpl { new ManaCostsImpl("{1}{W}{B}"), new AyliEternalPilgrimCondition(), "{1}{W}{B}, Sacrifice another creature: Exile target nonland permanent. Activate this ability only if you have at least 10 life more than your starting life total"); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); ability.addTarget(new TargetNonlandPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BlazingHellhound.java b/Mage.Sets/src/mage/cards/b/BlazingHellhound.java index d1bb7f99b0..ac07422a24 100644 --- a/Mage.Sets/src/mage/cards/b/BlazingHellhound.java +++ b/Mage.Sets/src/mage/cards/b/BlazingHellhound.java @@ -37,28 +37,20 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreatureOrPlayer; import java.util.UUID; +import mage.filter.StaticFilters; /** * * @author fireshoes */ public class BlazingHellhound extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } public BlazingHellhound(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{R}"); this.subtype.add("Elemental"); this.subtype.add("Hound"); this.power = new MageInt(4); @@ -66,7 +58,7 @@ public class BlazingHellhound extends CardImpl { // {1}, Sacrifice another creature: Blazing Hellhound deals 1 damage to target creature or player. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BloodBairn.java b/Mage.Sets/src/mage/cards/b/BloodBairn.java index a9a14a02c8..b4583c5b26 100644 --- a/Mage.Sets/src/mage/cards/b/BloodBairn.java +++ b/Mage.Sets/src/mage/cards/b/BloodBairn.java @@ -36,11 +36,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -48,13 +47,8 @@ import java.util.UUID; */ public class BloodBairn extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public BloodBairn(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Vampire"); this.power = new MageInt(2); @@ -63,8 +57,8 @@ public class BloodBairn extends CardImpl { // Sacrifice another creature: Blood Bairn gets +2/+2 until end of turn. this.addAbility(new SimpleActivatedAbility( Zone.BATTLEFIELD, - new BoostSourceEffect(2,2, Duration.EndOfTurn), - new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter, true)))); + new BoostSourceEffect(2, 2, Duration.EndOfTurn), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)))); } diff --git a/Mage.Sets/src/mage/cards/b/BloodHost.java b/Mage.Sets/src/mage/cards/b/BloodHost.java index 2b6bf81db6..55c5c0f711 100644 --- a/Mage.Sets/src/mage/cards/b/BloodHost.java +++ b/Mage.Sets/src/mage/cards/b/BloodHost.java @@ -40,26 +40,19 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledPermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * * @author emerald000 */ public class BloodHost extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } public BloodHost(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); this.subtype.add("Vampire"); this.power = new MageInt(3); @@ -69,7 +62,7 @@ public class BloodHost extends CardImpl { Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance()); effect.setText("Put a +1/+1 counter on {this}"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); // and you gain 2 life. effect = new GainLifeEffect(2); effect.setText("and you gain 2 life"); @@ -85,4 +78,4 @@ public class BloodHost extends CardImpl { public BloodHost copy() { return new BloodHost(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java b/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java index 179ff976b2..f81c3ac33a 100644 --- a/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java +++ b/Mage.Sets/src/mage/cards/b/BontuTheGlorified.java @@ -47,8 +47,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SuperType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -61,12 +60,6 @@ import mage.watchers.common.CreaturesDiedWatcher; */ public class BontuTheGlorified extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public BontuTheGlorified(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); addSuperType(SuperType.LEGENDARY); @@ -89,7 +82,7 @@ public class BontuTheGlorified extends CardImpl { Effect effect = new GainLifeEffect(1); effect.setText("and you gain 1 life"); ability.addEffect(effect); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/ButcherOfTheHorde.java b/Mage.Sets/src/mage/cards/b/ButcherOfTheHorde.java index ce2fc76b96..b07a1ec491 100644 --- a/Mage.Sets/src/mage/cards/b/ButcherOfTheHorde.java +++ b/Mage.Sets/src/mage/cards/b/ButcherOfTheHorde.java @@ -47,8 +47,6 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; @@ -56,6 +54,7 @@ import mage.target.common.TargetControlledCreaturePermanent; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -63,14 +62,8 @@ import java.util.UUID; */ public class ButcherOfTheHorde extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public ButcherOfTheHorde(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{W}{B}"); this.subtype.add("Demon"); this.power = new MageInt(5); @@ -80,7 +73,8 @@ public class ButcherOfTheHorde extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Sacrifice another creature: Butcher of the Horde gains your choice of vigilance, lifelink, or haste until end of turn. this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, - new ButcherOfTheHordeEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter, false)))); + new ButcherOfTheHordeEffect(), new SacrificeTargetCost( + new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false)))); } public ButcherOfTheHorde(final ButcherOfTheHorde card) { @@ -94,6 +88,7 @@ public class ButcherOfTheHorde extends CardImpl { } class ButcherOfTheHordeEffect extends OneShotEffect { + ButcherOfTheHordeEffect() { super(Outcome.AddAbility); staticText = "{this} gains your choice of vigilance, lifelink, or haste until end of turn"; @@ -148,4 +143,4 @@ class ButcherOfTheHordeEffect extends OneShotEffect { return new ButcherOfTheHordeEffect(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/c/CartelAristocrat.java b/Mage.Sets/src/mage/cards/c/CartelAristocrat.java index 18b4f515dd..390953b993 100644 --- a/Mage.Sets/src/mage/cards/c/CartelAristocrat.java +++ b/Mage.Sets/src/mage/cards/c/CartelAristocrat.java @@ -36,12 +36,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledPermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * Gatecrash FAQ (01.2013) You choose the color when the ability resolves. @@ -50,14 +48,8 @@ import java.util.UUID; */ public class CartelAristocrat extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public CartelAristocrat(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}"); this.subtype.add("Human"); this.subtype.add("Advisor"); @@ -66,7 +58,8 @@ public class CartelAristocrat extends CardImpl { // Sacrifice another creature: Cartel Aristocrat gains protection from the color of your choice until end of turn. this.addAbility(new SimpleActivatedAbility( - Zone.BATTLEFIELD, new GainProtectionFromColorSourceEffect(Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledPermanent(filter)))); + Zone.BATTLEFIELD, new GainProtectionFromColorSourceEffect(Duration.EndOfTurn), + new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)))); } public CartelAristocrat(final CartelAristocrat card) { diff --git a/Mage.Sets/src/mage/cards/c/CorpseBlockade.java b/Mage.Sets/src/mage/cards/c/CorpseBlockade.java index b81fb701b6..4bc629a5c4 100644 --- a/Mage.Sets/src/mage/cards/c/CorpseBlockade.java +++ b/Mage.Sets/src/mage/cards/c/CorpseBlockade.java @@ -38,11 +38,10 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -50,13 +49,8 @@ import java.util.UUID; */ public class CorpseBlockade extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public CorpseBlockade(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Zombie"); this.power = new MageInt(1); @@ -69,7 +63,7 @@ public class CorpseBlockade extends CardImpl { this.addAbility(new SimpleActivatedAbility( Zone.BATTLEFIELD, new GainAbilitySourceEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn), - new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1,filter, true)))); + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)))); } public CorpseBlockade(final CorpseBlockade card) { diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java index 2fd39336ec..1f844b6e21 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java @@ -35,8 +35,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -44,6 +42,7 @@ import mage.target.Target; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -52,7 +51,7 @@ import java.util.UUID; public class DiscipleOfBolas extends CardImpl { public DiscipleOfBolas(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}"); this.subtype.add("Human"); this.subtype.add("Wizard"); @@ -90,12 +89,10 @@ class DiscipleOfBolasEffect extends OneShotEffect { } @Override - public boolean apply(Game game, Ability source) { + public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - filter.add(new AnotherPredicate()); - Target target = new TargetControlledCreaturePermanent(1,1, filter, true); + Target target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true); target.setRequired(true); if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) { controller.chooseTarget(outcome, target, source, game); @@ -112,5 +109,3 @@ class DiscipleOfBolasEffect extends OneShotEffect { return false; } } - - diff --git a/Mage.Sets/src/mage/cards/d/Dreamstealer.java b/Mage.Sets/src/mage/cards/d/Dreamstealer.java new file mode 100644 index 0000000000..5261bd39c6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/Dreamstealer.java @@ -0,0 +1,108 @@ +/* + * 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.cards.d; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.EternalizeAbility; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class Dreamstealer extends CardImpl { + + public Dreamstealer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add("Human"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(2); + + // Menace + this.addAbility(new MenaceAbility()); + + // When Dreamstealer deals combat damage to a player, that player discards that many cards. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DreamstealerDiscardEffect(), false, true)); + + // Eternalize {4}{B}{B} + this.addAbility(new EternalizeAbility(new ManaCostsImpl("{4}{B}{B}"), this)); + + } + + public Dreamstealer(final Dreamstealer card) { + super(card); + } + + @Override + public Dreamstealer copy() { + return new Dreamstealer(this); + } +} + +class DreamstealerDiscardEffect extends OneShotEffect { + + public DreamstealerDiscardEffect() { + super(Outcome.Discard); + this.staticText = "that player discards that many cards"; + } + + public DreamstealerDiscardEffect(final DreamstealerDiscardEffect effect) { + super(effect); + } + + @Override + public DreamstealerDiscardEffect copy() { + return new DreamstealerDiscardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); + if (targetPlayer != null) { + int damage = (Integer) getValue("damage"); + targetPlayer.discard(damage, false, source, game); + game.informPlayers(targetPlayer.getLogName() + "discards " + damage + " card(s)"); + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/cards/e/EaterOfHope.java b/Mage.Sets/src/mage/cards/e/EaterOfHope.java index 542c8595d0..38fd517e5e 100644 --- a/Mage.Sets/src/mage/cards/e/EaterOfHope.java +++ b/Mage.Sets/src/mage/cards/e/EaterOfHope.java @@ -27,6 +27,7 @@ */ package mage.cards.e; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -39,29 +40,26 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; -import java.util.UUID; - /** * * @author Quercitron */ public class EaterOfHope extends CardImpl { - private static final FilterControlledCreaturePermanent regenFilter = new FilterControlledCreaturePermanent("another creature"); private static final FilterControlledCreaturePermanent destroyFilter = new FilterControlledCreaturePermanent("two other creatures"); static { - regenFilter.add(new AnotherPredicate()); destroyFilter.add(new AnotherPredicate()); } public EaterOfHope(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}"); this.subtype.add("Demon"); this.power = new MageInt(6); @@ -72,7 +70,7 @@ public class EaterOfHope extends CardImpl { // {B}, Sacrifice another creature: Regenerate Eater of Hope. Ability regenAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{B}")); - regenAbility.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, regenFilter, true))); + regenAbility.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true))); this.addAbility(regenAbility); // {2}{B}, Sacrifice two other creatures: Destroy target creature. diff --git a/Mage.Sets/src/mage/cards/f/FelhideBrawler.java b/Mage.Sets/src/mage/cards/f/FelhideBrawler.java index b7160c37b4..f1c720e790 100644 --- a/Mage.Sets/src/mage/cards/f/FelhideBrawler.java +++ b/Mage.Sets/src/mage/cards/f/FelhideBrawler.java @@ -27,23 +27,18 @@ */ package mage.cards.f; +import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.CantBlockUnlessYouControlSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; - -import java.util.UUID; /** * @@ -51,15 +46,22 @@ import java.util.UUID; */ public class FelhideBrawler extends CardImpl { + private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Minotaur"); + + static { + filter.add(new SubtypePredicate(SubType.MINOTAUR)); + filter.add(new AnotherPredicate()); + } + public FelhideBrawler(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add("Minotaur"); this.power = new MageInt(2); this.toughness = new MageInt(2); // Felhide Brawler can't block unless you control another Minotaur. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new FelhideBrawlerRestrictionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockUnlessYouControlSourceEffect(filter))); } public FelhideBrawler(final FelhideBrawler card) { @@ -71,42 +73,3 @@ public class FelhideBrawler extends CardImpl { return new FelhideBrawler(this); } } - -class FelhideBrawlerRestrictionEffect extends RestrictionEffect { - - private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Minotaur"); - - static { - filter.add(new SubtypePredicate(SubType.MINOTAUR)); - filter.add(new AnotherPredicate()); - } - - public FelhideBrawlerRestrictionEffect() { - super(Duration.WhileOnBattlefield); - - staticText = "{this} can't block unless you control another Minotaur"; - } - - public FelhideBrawlerRestrictionEffect(final FelhideBrawlerRestrictionEffect effect) { - super(effect); - } - - @Override - public FelhideBrawlerRestrictionEffect copy() { - return new FelhideBrawlerRestrictionEffect(this); - } - - @Override - public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { - return false; - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - if (permanent.getId().equals(source.getSourceId()) - && game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) == 0) { - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/f/FellShepherd.java b/Mage.Sets/src/mage/cards/f/FellShepherd.java index d14f87a448..d751d0e421 100644 --- a/Mage.Sets/src/mage/cards/f/FellShepherd.java +++ b/Mage.Sets/src/mage/cards/f/FellShepherd.java @@ -40,8 +40,6 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -53,6 +51,7 @@ import mage.watchers.Watcher; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -60,13 +59,8 @@ import java.util.UUID; */ public class FellShepherd extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public FellShepherd(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}"); this.subtype.add("Avatar"); this.power = new MageInt(8); @@ -76,8 +70,8 @@ public class FellShepherd extends CardImpl { this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new FellShepherdEffect(), true), new FellShepherdWatcher()); // {B}, Sacrifice another creature: Target creature gets -2/-2 until end of turn. - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(-2,-2, Duration.EndOfTurn), new ManaCostsImpl("{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(-2, -2, Duration.EndOfTurn), new ManaCostsImpl("{B}")); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); @@ -120,7 +114,7 @@ class FellShepherdWatcher extends Watcher { public void watch(GameEvent event, Game game) { if (event.getType() == EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).isDiesEvent()) { MageObject card = game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); - if (card != null && ((Card)card).getOwnerId().equals(this.controllerId) && card.isCreature()) { + if (card != null && ((Card) card).getOwnerId().equals(this.controllerId) && card.isCreature()) { creatureIds.add(card.getId()); } } @@ -163,7 +157,7 @@ class FellShepherdEffect extends OneShotEffect { } } } - if (sb.length()> 0) { + if (sb.length() > 0) { sb.insert(0, "Fell Shepherd - returning to hand:"); game.informPlayers(sb.toString()); } diff --git a/Mage.Sets/src/mage/cards/f/FiligreeFracture.java b/Mage.Sets/src/mage/cards/f/FiligreeFracture.java index 0ca22a469f..6b3033faf9 100644 --- a/Mage.Sets/src/mage/cards/f/FiligreeFracture.java +++ b/Mage.Sets/src/mage/cards/f/FiligreeFracture.java @@ -27,22 +27,19 @@ */ package mage.cards.f; +import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.constants.Zone; import mage.filter.common.FilterArtifactOrEnchantmentPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; -import java.util.UUID; - /** * * @author North @@ -50,11 +47,10 @@ import java.util.UUID; public class FiligreeFracture extends CardImpl { public FiligreeFracture(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{G}"); // Destroy target artifact or enchantment. If that permanent was blue or black, draw a card. this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); - this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new FiligreeFractureEffect()); } @@ -71,8 +67,8 @@ public class FiligreeFracture extends CardImpl { class FiligreeFractureEffect extends OneShotEffect { public FiligreeFractureEffect() { - super(Outcome.DrawCard); - this.staticText = "If that permanent was blue or black, draw a card"; + super(Outcome.DestroyPermanent); + this.staticText = "Destroy target artifact or enchantment. If that permanent was blue or black, draw a card"; } public FiligreeFractureEffect(final FiligreeFractureEffect effect) { @@ -87,10 +83,13 @@ class FiligreeFractureEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = (Permanent) game.getLastKnownInformation(source.getFirstTarget(), Zone.BATTLEFIELD); - if (player != null && permanent != null - && (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue())) { - player.drawCards(1, game); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (player != null && permanent != null) { + permanent.destroy(source.getSourceId(), game, true); + game.applyEffects(); + if (permanent.getColor(game).isBlack() || permanent.getColor(game).isBlue()) { + player.drawCards(1, game); + } return true; } return false; diff --git a/Mage.Sets/src/mage/cards/f/FleshCarver.java b/Mage.Sets/src/mage/cards/f/FleshCarver.java index 156563f1d5..ccde49e610 100644 --- a/Mage.Sets/src/mage/cards/f/FleshCarver.java +++ b/Mage.Sets/src/mage/cards/f/FleshCarver.java @@ -45,8 +45,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; @@ -60,12 +59,6 @@ import mage.target.common.TargetControlledPermanent; */ public class FleshCarver extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public FleshCarver(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Human"); @@ -78,7 +71,7 @@ public class FleshCarver extends CardImpl { this.addAbility(IntimidateAbility.getInstance()); // {1}{B}, Sacrifice another creature: Put two +1/+1 counters on Flesh Carver. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), new ManaCostsImpl("{1}{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); // When Flesh Carver dies, create an X/X black Horror creature token, where X is Flesh Carver's power. diff --git a/Mage.Sets/src/mage/cards/g/GhoulcallerGisa.java b/Mage.Sets/src/mage/cards/g/GhoulcallerGisa.java index 8d84ca91fb..e9e76db1fd 100644 --- a/Mage.Sets/src/mage/cards/g/GhoulcallerGisa.java +++ b/Mage.Sets/src/mage/cards/g/GhoulcallerGisa.java @@ -42,13 +42,12 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SuperType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.game.permanent.token.Token; import mage.game.permanent.token.ZombieToken; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -56,14 +55,8 @@ import java.util.UUID; */ public class GhoulcallerGisa extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public GhoulcallerGisa(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Human"); this.subtype.add("Wizard"); @@ -79,7 +72,7 @@ public class GhoulcallerGisa extends CardImpl { effect.setText("create X 2/2 black Zombie creature tokens, where X is the sacrificed creature's power"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{B}")); ability.addCost(new TapSourceCost()); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GobblingOoze.java b/Mage.Sets/src/mage/cards/g/GobblingOoze.java index 3609400edb..8e47aa8ff7 100644 --- a/Mage.Sets/src/mage/cards/g/GobblingOoze.java +++ b/Mage.Sets/src/mage/cards/g/GobblingOoze.java @@ -38,34 +38,27 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * * @author LevelX2 */ public class GobblingOoze extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public GobblingOoze(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.subtype.add("Ooze"); this.power = new MageInt(3); this.toughness = new MageInt(3); // {G}, Sacrifice another creature: Put a +1/+1 counter on Gobbling Ooze. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)),new ManaCostsImpl("{G}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)), new ManaCostsImpl("{G}")); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GoldnightCommander.java b/Mage.Sets/src/mage/cards/g/GoldnightCommander.java index 0371c8f3ed..c660f321b7 100644 --- a/Mage.Sets/src/mage/cards/g/GoldnightCommander.java +++ b/Mage.Sets/src/mage/cards/g/GoldnightCommander.java @@ -27,6 +27,7 @@ */ package mage.cards.g; +import java.util.UUID; import mage.MageInt; import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; import mage.abilities.effects.common.continuous.BoostControlledEffect; @@ -35,22 +36,13 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; - -import java.util.UUID; +import mage.filter.StaticFilters; /** * @author Loki */ public class GoldnightCommander extends CardImpl { - private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public GoldnightCommander(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add("Human"); @@ -61,7 +53,8 @@ public class GoldnightCommander extends CardImpl { this.toughness = new MageInt(2); // Whenever another creature enters the battlefield under your control, creatures you control get +1/+1 until end of turn. - this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.EndOfTurn), filter, false, null, true)); + this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, + new BoostControlledEffect(1, 1, Duration.EndOfTurn), StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false, null, true)); } public GoldnightCommander(final GoldnightCommander card) { diff --git a/Mage.Sets/src/mage/cards/g/GriffinProtector.java b/Mage.Sets/src/mage/cards/g/GriffinProtector.java index f6a9af33f4..fb63c10eb2 100644 --- a/Mage.Sets/src/mage/cards/g/GriffinProtector.java +++ b/Mage.Sets/src/mage/cards/g/GriffinProtector.java @@ -36,10 +36,9 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -47,12 +46,6 @@ import java.util.UUID; */ public class GriffinProtector extends CardImpl { - private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public GriffinProtector(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add("Griffin"); @@ -64,7 +57,8 @@ public class GriffinProtector extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Whenever another creature enters the battlefield under your control, Griffin Protector gets +1/+1 until end of turn. - this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), filter, false, null, true)); + this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false, null, true)); } diff --git a/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java b/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java index 70f5cd9a8d..bb5480a4dd 100644 --- a/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java +++ b/Mage.Sets/src/mage/cards/g/GrimgrinCorpseBorn.java @@ -43,9 +43,7 @@ import mage.constants.CardType; import mage.constants.SuperType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; @@ -54,6 +52,7 @@ import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -61,13 +60,8 @@ import java.util.UUID; */ public class GrimgrinCorpseBorn extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public GrimgrinCorpseBorn(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{B}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Zombie"); this.subtype.add("Warrior"); @@ -80,10 +74,10 @@ public class GrimgrinCorpseBorn extends CardImpl { "{this} enters the battlefield tapped and doesn't untap during your untap step."); ability.addEffect(new DontUntapInControllersUntapStepSourceEffect()); this.addAbility(ability); - + // Sacrifice another creature: Untap Grimgrin and put a +1/+1 counter on it. ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), - new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); ability.addEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance())); this.addAbility(ability); // Whenever Grimgrin attacks, destroy target creature defending player controls, then put a +1/+1 counter on Grimgrin. @@ -140,4 +134,4 @@ class GrimgrinCorpseBornAbility extends TriggeredAbilityImpl { public GrimgrinCorpseBornAbility copy() { return new GrimgrinCorpseBornAbility(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/h/HealerOfThePride.java b/Mage.Sets/src/mage/cards/h/HealerOfThePride.java index eed2676f4f..42a0dca5f6 100644 --- a/Mage.Sets/src/mage/cards/h/HealerOfThePride.java +++ b/Mage.Sets/src/mage/cards/h/HealerOfThePride.java @@ -35,8 +35,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; /** * @@ -44,12 +43,6 @@ import mage.filter.predicate.permanent.AnotherPredicate; */ public class HealerOfThePride extends CardImpl { - private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public HealerOfThePride(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add("Cat"); @@ -59,7 +52,8 @@ public class HealerOfThePride extends CardImpl { this.toughness = new MageInt(3); // Whenever another creature enters the battlefield under your control, you gain 2 life. - this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(2), filter, false, null, true)); + this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(2), + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false, null, true)); } diff --git a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java index 393e4d6e5a..0ec3b29b51 100644 --- a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java +++ b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java @@ -43,8 +43,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; @@ -91,12 +90,6 @@ public class HeartPiercerManticore extends CardImpl { class HeartPiercerManticoreSacrificeEffect extends OneShotEffect { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public HeartPiercerManticoreSacrificeEffect() { super(Outcome.Damage); this.staticText = "you may sacrifice another creature"; @@ -115,7 +108,7 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Target target = new TargetControlledCreaturePermanent(1, 1, filter, true); + Target target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true); if (controller.choose(outcome, target, source.getSourceId(), game)) { Permanent toSacrifice = game.getPermanent(target.getFirstTarget()); if (toSacrifice != null) { diff --git a/Mage.Sets/src/mage/cards/h/HourOfGlory.java b/Mage.Sets/src/mage/cards/h/HourOfGlory.java new file mode 100644 index 0000000000..d46951839b --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HourOfGlory.java @@ -0,0 +1,113 @@ +/* + * 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.cards.h; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ +public class HourOfGlory extends CardImpl { + + public HourOfGlory(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}"); + + // Exile target creature. If that creature was a God, its controller reveals his or her hand and exiles all cards with the same name as that creature. + this.getSpellAbility().addEffect(new HourOfGloryEffect()); + } + + public HourOfGlory(final HourOfGlory card) { + super(card); + } + + @Override + public HourOfGlory copy() { + return new HourOfGlory(this); + } +} + +class HourOfGloryEffect extends OneShotEffect { + + public HourOfGloryEffect() { + super(Outcome.Exile); + this.staticText = "Exile target creature. If that creature was a God, its controller reveals his or her hand and exiles all cards with the same name as that creature"; + } + + public HourOfGloryEffect(final HourOfGloryEffect effect) { + super(effect); + } + + @Override + public HourOfGloryEffect copy() { + return new HourOfGloryEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = source.getSourceObject(game); + if (controller != null && sourceObject != null) { + Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (targetCreature != null) { + controller.moveCards(targetCreature, Zone.EXILED, source, game); + if (targetCreature.hasSubtype(SubType.GOD.getDescription(), game)) { + game.applyEffects(); + Player targetController = game.getPlayer(targetCreature.getControllerId()); + if (targetController != null) { + targetController.revealCards(sourceObject.getIdName(), targetController.getHand(), game); + Set toExile = new HashSet<>(); + for (Card card : targetController.getHand().getCards(game)) { + if (card.getName().equals(targetCreature.getName())) { + toExile.add(card); + } + } + targetController.moveCards(toExile, Zone.EXILED, source, game); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/h/HowlpackWolf.java b/Mage.Sets/src/mage/cards/h/HowlpackWolf.java index 7f380773e3..e48fee85f2 100644 --- a/Mage.Sets/src/mage/cards/h/HowlpackWolf.java +++ b/Mage.Sets/src/mage/cards/h/HowlpackWolf.java @@ -29,21 +29,17 @@ package mage.cards.h; import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.CantBlockUnlessYouControlSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -51,14 +47,21 @@ import mage.game.permanent.Permanent; */ public class HowlpackWolf extends CardImpl { + private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Wolf or Werewolf"); + + static { + filter.add(Predicates.or(new SubtypePredicate(SubType.WOLF), new SubtypePredicate(SubType.WEREWOLF))); + filter.add(new AnotherPredicate()); + } + public HowlpackWolf(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); this.subtype.add("Wolf"); this.power = new MageInt(3); this.toughness = new MageInt(3); // Howlpack Wolf can't block unless you control another Wolf or Werewolf. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HowlpackWolfRestrictionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockUnlessYouControlSourceEffect(filter))); } public HowlpackWolf(final HowlpackWolf card) { @@ -70,39 +73,3 @@ public class HowlpackWolf extends CardImpl { return new HowlpackWolf(this); } } - -class HowlpackWolfRestrictionEffect extends RestrictionEffect { - - private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Wolf or Werewolf"); - - static { - filter.add(Predicates.or(new SubtypePredicate(SubType.WOLF), new SubtypePredicate(SubType.WEREWOLF))); - filter.add(new AnotherPredicate()); - } - - public HowlpackWolfRestrictionEffect() { - super(Duration.WhileOnBattlefield); - - staticText = "{this} can't block unless you control another Wolf or Werewolf"; - } - - public HowlpackWolfRestrictionEffect(final HowlpackWolfRestrictionEffect effect) { - super(effect); - } - - @Override - public HowlpackWolfRestrictionEffect copy() { - return new HowlpackWolfRestrictionEffect(this); - } - - @Override - public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { - return false; - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getId().equals(source.getSourceId()) - && game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) == 0; - } -} diff --git a/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java b/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java index 81553a7661..b5526b1b33 100644 --- a/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java +++ b/Mage.Sets/src/mage/cards/j/JaliraMasterPolymorphist.java @@ -39,14 +39,13 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SuperType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.SupertypePredicate; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -55,10 +54,8 @@ import java.util.UUID; public class JaliraMasterPolymorphist extends CardImpl { private static final FilterCreatureCard filterCard = new FilterCreatureCard("nonlegendary creature card"); - private static final FilterControlledCreaturePermanent filterPermanent = new FilterControlledCreaturePermanent("another creature"); static { - filterPermanent.add(new AnotherPredicate()); filterCard.add(Predicates.not(new SupertypePredicate(SuperType.LEGENDARY))); } @@ -75,7 +72,7 @@ public class JaliraMasterPolymorphist extends CardImpl { // Put that card onto the battlefield and the rest on the bottom of your library in a random order. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RevealCardsFromLibraryUntilEffect(filterCard, Zone.BATTLEFIELD, Zone.LIBRARY), new ManaCostsImpl("{2}{U}")); ability.addCost(new TapSourceCost()); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filterPermanent, true))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JaradGolgariLichLord.java b/Mage.Sets/src/mage/cards/j/JaradGolgariLichLord.java index c4a8e2d663..334edb009a 100644 --- a/Mage.Sets/src/mage/cards/j/JaradGolgariLichLord.java +++ b/Mage.Sets/src/mage/cards/j/JaradGolgariLichLord.java @@ -42,15 +42,14 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterCreatureCard; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledPermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -60,22 +59,18 @@ public class JaradGolgariLichLord extends CardImpl { private static final FilterControlledPermanent filterSwamp = new FilterControlledPermanent("a Swamp"); private static final FilterControlledPermanent filterForest = new FilterControlledPermanent("a Forest"); - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); static { - filter.add(new AnotherPredicate()); filterSwamp.add(new SubtypePredicate(SubType.SWAMP)); filterForest.add(new SubtypePredicate(SubType.FOREST)); } public JaradGolgariLichLord(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{B}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}{G}{G}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Zombie"); this.subtype.add("Elf"); - - this.power = new MageInt(2); this.toughness = new MageInt(2); @@ -83,12 +78,12 @@ public class JaradGolgariLichLord extends CardImpl { DynamicValue amount = new CardsInControllerGraveyardCount(new FilterCreatureCard()); Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(amount, amount, Duration.WhileOnBattlefield)); this.addAbility(ability); - + // {1}{B}{G}, Sacrifice another creature: Each opponent loses life equal to the sacrificed creature's power. - ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseLifeOpponentsEffect(new SacrificeCostCreaturesPower()),new ManaCostsImpl("{1}{B}{G}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseLifeOpponentsEffect(new SacrificeCostCreaturesPower()), new ManaCostsImpl("{1}{B}{G}")); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); this.addAbility(ability); - + // Sacrifice a Swamp and a Forest: Return Jarad from your graveyard to your hand. ability = new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new SacrificeTargetCost(new TargetControlledPermanent(filterSwamp))); diff --git a/Mage.Sets/src/mage/cards/k/KheruBloodsucker.java b/Mage.Sets/src/mage/cards/k/KheruBloodsucker.java index bbd7f0d24d..9c445dce9e 100644 --- a/Mage.Sets/src/mage/cards/k/KheruBloodsucker.java +++ b/Mage.Sets/src/mage/cards/k/KheruBloodsucker.java @@ -44,33 +44,29 @@ import mage.constants.CardType; import mage.constants.TargetController; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ToughnessPredicate; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.ControllerPredicate; import mage.target.common.TargetControlledPermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * * @author emerald000 */ public class KheruBloodsucker extends CardImpl { - - private static final FilterControlledPermanent anotherFilter = new FilterControlledCreaturePermanent("another creature"); + private static final FilterCreaturePermanent toughnessFilter = new FilterCreaturePermanent("a creature you control with toughness 4 or greater"); static { - anotherFilter.add(new AnotherPredicate()); toughnessFilter.add(new ControllerPredicate(TargetController.YOU)); toughnessFilter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 3)); } public KheruBloodsucker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Vampire"); this.power = new MageInt(2); @@ -82,10 +78,10 @@ public class KheruBloodsucker extends CardImpl { effect.setText("and you gain 2 life"); ability.addEffect(effect); this.addAbility(ability); - + // {2}{B}, Sacrifice another creature: Put a +1/+1 counter on Kheru Bloodsucker. ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl<>("{2}{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(anotherFilter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KheruDreadmaw.java b/Mage.Sets/src/mage/cards/k/KheruDreadmaw.java index f5d94f6294..4b8e881ca9 100644 --- a/Mage.Sets/src/mage/cards/k/KheruDreadmaw.java +++ b/Mage.Sets/src/mage/cards/k/KheruDreadmaw.java @@ -41,9 +41,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledPermanent; /** @@ -51,14 +49,9 @@ import mage.target.common.TargetControlledPermanent; * @author emerald000 */ public class KheruDreadmaw extends CardImpl { - - private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } public KheruDreadmaw(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}"); this.subtype.add("Zombie"); this.subtype.add("Crocodile"); @@ -67,12 +60,12 @@ public class KheruDreadmaw extends CardImpl { // Defender this.addAbility(DefenderAbility.getInstance()); - + // {1}{G}, Sacrifice another creature: You gain life equal to the sacrificed creature's toughness. Effect effect = new GainLifeEffect(new SacrificeCostCreaturesToughness()); effect.setText("You gain life equal to the sacrificed creature's toughness"); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{1}{G}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KruinStriker.java b/Mage.Sets/src/mage/cards/k/KruinStriker.java index 3381801151..3b5f291c21 100644 --- a/Mage.Sets/src/mage/cards/k/KruinStriker.java +++ b/Mage.Sets/src/mage/cards/k/KruinStriker.java @@ -38,9 +38,7 @@ import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; /** * @@ -48,13 +46,8 @@ import mage.filter.predicate.permanent.AnotherPredicate; */ public class KruinStriker extends CardImpl { - private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public KruinStriker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.subtype.add("Human"); this.subtype.add("Warrior"); @@ -62,7 +55,7 @@ public class KruinStriker extends CardImpl { this.toughness = new MageInt(1); // Whenever another creature enters the battlefield under your control, Kruin Striker gets +1/+0 and gains trample until end of turn. - Ability ability = new EntersBattlefieldAllTriggeredAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn), filter, + Ability ability = new EntersBattlefieldAllTriggeredAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn), StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, "Whenever another creature enters the battlefield under your control, Kruin Striker gets +1/+0 and gains trample until end of turn."); ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/l/LilianasDefeat.java b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java new file mode 100644 index 0000000000..0a2fbb3d4d --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LilianasDefeat.java @@ -0,0 +1,105 @@ +/* + * 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.cards.l; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +/** + * + * @author LevelX2 + */ +public class LilianasDefeat extends CardImpl { + + public LilianasDefeat(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}"); + + FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent("black creature or black planeswalker"); + filter.add(new ColorPredicate(ObjectColor.BLACK)); + // Destroy target black creature or black planeswalker. If that permanent was a Liliana planeswalker, her controller loses 3 life. + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + } + + public LilianasDefeat(final LilianasDefeat card) { + super(card); + } + + @Override + public LilianasDefeat copy() { + return new LilianasDefeat(this); + } +} + +class LilianasDefeatEffect extends OneShotEffect { + + public LilianasDefeatEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "Destroy target black creature or black planeswalker. If that permanent was a Liliana planeswalker, her controller loses 3 life"; + } + + public LilianasDefeatEffect(final LilianasDefeatEffect effect) { + super(effect); + } + + @Override + public LilianasDefeatEffect copy() { + return new LilianasDefeatEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (player != null && permanent != null) { + permanent.destroy(source.getSourceId(), game, true); + game.applyEffects(); + if (permanent.isPlaneswalker() && permanent.getSubtype(game).contains(SubType.LILIANA.getDescription())) { + Player permanentController = game.getPlayer(permanent.getControllerId()); + if (permanentController != null) { + permanentController.loseLife(3, game, false); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/l/LukeSkywalker.java b/Mage.Sets/src/mage/cards/l/LukeSkywalker.java index cb0dfa4e72..5db1df1b12 100644 --- a/Mage.Sets/src/mage/cards/l/LukeSkywalker.java +++ b/Mage.Sets/src/mage/cards/l/LukeSkywalker.java @@ -1,134 +1,129 @@ -/* - * 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.cards.l; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; -import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.Cost; -import mage.abilities.costs.CostImpl; -import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; -import mage.abilities.effects.common.counter.AddCountersSourceEffect; -import mage.abilities.keyword.HexproofAbility; -import mage.abilities.keyword.LifelinkAbility; -import mage.abilities.keyword.VigilanceAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.SuperType; -import mage.constants.Zone; -import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; - -/** - * - * @author Styxo - */ -public class LukeSkywalker extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - - public LukeSkywalker(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}{U}"); - this.addSuperType(SuperType.LEGENDARY); - this.subtype.add("Human"); - this.subtype.add("Jedi"); - this.power = new MageInt(2); - this.toughness = new MageInt(2); - - // Lifelink - this.addAbility(LifelinkAbility.getInstance()); - - // Vigilance - this.addAbility(VigilanceAbility.getInstance()); - - // Whenever another creature enters the battlefield under your conrol, put a +1/+1 counter on Luke Skywalker. - this.addAbility(new EntersBattlefieldAllTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new FilterControlledCreaturePermanent(filter))); - - // Remove all +1/+1 counters from Luke Skywalker: Luke gains hexproof until end of turn. Activate this ability only if at least one +1/+1 counter is removed this way. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(HexproofAbility.getInstance(), Duration.EndOfTurn), new LukeSkywalkerCost())); - } - - public LukeSkywalker(final LukeSkywalker card) { - super(card); - } - - @Override - public LukeSkywalker copy() { - return new LukeSkywalker(this); - } -} - -class LukeSkywalkerCost extends CostImpl { - - public LukeSkywalkerCost() { - super(); - this.text = "Remove all +1/+1 counters from {this}"; - } - - public LukeSkywalkerCost(LukeSkywalkerCost cost) { - super(cost); - } - - @Override - public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { - Permanent permanent = game.getPermanent(ability.getSourceId()); - if (permanent != null) { - return (permanent.getCounters(game).getCount(CounterType.P1P1)) > 0; - } - return false; - } - - @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - Permanent permanent = game.getPermanent(ability.getSourceId()); - if (permanent != null) { - int countersCount = permanent.getCounters(game).getCount(CounterType.P1P1); - permanent.removeCounters(CounterType.P1P1.createInstance(countersCount), game); - this.paid = true; - return true; - } - return false; - } - - @Override - public LukeSkywalkerCost copy() { - return new LukeSkywalkerCost(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.cards.l; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.CostImpl; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.HexproofAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author Styxo + */ +public class LukeSkywalker extends CardImpl { + + public LukeSkywalker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}{U}"); + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add("Human"); + this.subtype.add("Jedi"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Lifelink + this.addAbility(LifelinkAbility.getInstance()); + + // Vigilance + this.addAbility(VigilanceAbility.getInstance()); + + // Whenever another creature enters the battlefield under your conrol, put a +1/+1 counter on Luke Skywalker. + this.addAbility(new EntersBattlefieldAllTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), + new FilterControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); + + // Remove all +1/+1 counters from Luke Skywalker: Luke gains hexproof until end of turn. Activate this ability only if at least one +1/+1 counter is removed this way. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(HexproofAbility.getInstance(), Duration.EndOfTurn), new LukeSkywalkerCost())); + } + + public LukeSkywalker(final LukeSkywalker card) { + super(card); + } + + @Override + public LukeSkywalker copy() { + return new LukeSkywalker(this); + } +} + +class LukeSkywalkerCost extends CostImpl { + + public LukeSkywalkerCost() { + super(); + this.text = "Remove all +1/+1 counters from {this}"; + } + + public LukeSkywalkerCost(LukeSkywalkerCost cost) { + super(cost); + } + + @Override + public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + Permanent permanent = game.getPermanent(ability.getSourceId()); + if (permanent != null) { + return (permanent.getCounters(game).getCount(CounterType.P1P1)) > 0; + } + return false; + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + Permanent permanent = game.getPermanent(ability.getSourceId()); + if (permanent != null) { + int countersCount = permanent.getCounters(game).getCount(CounterType.P1P1); + permanent.removeCounters(CounterType.P1P1.createInstance(countersCount), game); + this.paid = true; + return true; + } + return false; + } + + @Override + public LukeSkywalkerCost copy() { + return new LukeSkywalkerCost(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/m/MauraudingBoneslasher.java b/Mage.Sets/src/mage/cards/m/MauraudingBoneslasher.java new file mode 100644 index 0000000000..a4dc03a4c2 --- /dev/null +++ b/Mage.Sets/src/mage/cards/m/MauraudingBoneslasher.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.cards.m; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.combat.CantBlockUnlessYouControlSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; + +/** + * + * @author LevelX2 + */ +public class MauraudingBoneslasher extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("another Zombie"); + + static { + filter.add(new SubtypePredicate(SubType.ZOMBIE)); + filter.add(new AnotherPredicate()); + } + + public MauraudingBoneslasher(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add("Zombie"); + this.subtype.add("Minotaur"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Marauding Boneslasher can't block unless you control another Zombie. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockUnlessYouControlSourceEffect(filter))); + + } + + public MauraudingBoneslasher(final MauraudingBoneslasher card) { + super(card); + } + + @Override + public MauraudingBoneslasher copy() { + return new MauraudingBoneslasher(this); + } +} diff --git a/Mage.Sets/src/mage/cards/m/MindlessNull.java b/Mage.Sets/src/mage/cards/m/MindlessNull.java index 3b0469029d..da1476bcfb 100644 --- a/Mage.Sets/src/mage/cards/m/MindlessNull.java +++ b/Mage.Sets/src/mage/cards/m/MindlessNull.java @@ -29,19 +29,13 @@ package mage.cards.m; import java.util.UUID; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.SubType; import mage.constants.Zone; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.RestrictionEffect; +import mage.abilities.effects.common.combat.CantBlockUnlessYouControlSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.filter.common.FilterControlledPermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -50,13 +44,13 @@ import mage.game.permanent.Permanent; public class MindlessNull extends CardImpl { public MindlessNull(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Zombie"); this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MindlessNullEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockUnlessYouControlSourceEffect(new FilterControlledPermanent("Vampire")))); } public MindlessNull(final MindlessNull card) { @@ -68,33 +62,3 @@ public class MindlessNull extends CardImpl { return new MindlessNull(this); } } - -class MindlessNullEffect extends RestrictionEffect { - - private final FilterControlledPermanent filter = new FilterControlledPermanent("Vampire"); - - public MindlessNullEffect() { - super(Duration.WhileOnBattlefield); - filter.add(new SubtypePredicate(SubType.VAMPIRE)); - staticText = "{this} can't block unless you control a Vampire"; - } - - public MindlessNullEffect(final MindlessNullEffect effect) { - super(effect); - } - - @Override - public MindlessNullEffect copy() { - return new MindlessNullEffect(this); - } - - @Override - public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { - return game.getBattlefield().countAll(filter, source.getControllerId(), game) != 0; - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - return permanent.getId().equals(source.getSourceId()); - } -} diff --git a/Mage.Sets/src/mage/cards/o/OliviaMobilizedForWar.java b/Mage.Sets/src/mage/cards/o/OliviaMobilizedForWar.java index 2f9ff781c7..db3d667e09 100644 --- a/Mage.Sets/src/mage/cards/o/OliviaMobilizedForWar.java +++ b/Mage.Sets/src/mage/cards/o/OliviaMobilizedForWar.java @@ -41,13 +41,11 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.counters.CounterType; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import java.util.ArrayList; import java.util.Collections; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -55,14 +53,8 @@ import java.util.UUID; */ public class OliviaMobilizedForWar extends CardImpl { - private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public OliviaMobilizedForWar(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{R}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Vampire"); this.subtype.add("Knight"); @@ -83,7 +75,8 @@ public class OliviaMobilizedForWar extends CardImpl { effect = new BecomesCreatureTypeTargetEffect(Duration.WhileOnBattlefield, new ArrayList<>(Collections.singletonList("Vampire")), false); effect.setText("and it becomes a Vampire in addition to its other types"); doIfCostPaid.addEffect(effect); - this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaid, filter, false, SetTargetPointer.PERMANENT, null)); + this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaid, + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false, SetTargetPointer.PERMANENT, null)); } public OliviaMobilizedForWar(final OliviaMobilizedForWar card) { diff --git a/Mage.Sets/src/mage/cards/p/ProsshSkyraiderOfKher.java b/Mage.Sets/src/mage/cards/p/ProsshSkyraiderOfKher.java index 48e6b838c8..8aa5f1d31c 100644 --- a/Mage.Sets/src/mage/cards/p/ProsshSkyraiderOfKher.java +++ b/Mage.Sets/src/mage/cards/p/ProsshSkyraiderOfKher.java @@ -42,8 +42,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SuperType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.permanent.token.ProsshKoboldToken; import mage.target.common.TargetControlledCreaturePermanent; @@ -53,12 +52,6 @@ import mage.target.common.TargetControlledCreaturePermanent; */ public class ProsshSkyraiderOfKher extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public ProsshSkyraiderOfKher(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{R}{G}"); addSuperType(SuperType.LEGENDARY); @@ -72,7 +65,8 @@ public class ProsshSkyraiderOfKher extends CardImpl { // When you cast Prossh, Skyraider of Kher, create X 0/1 red Kobold creature tokens named Kobolds of Kher Keep, where X is the amount of mana spent to cast Prossh. this.addAbility(new CastSourceTriggeredAbility(new CreateTokenEffect(new ProsshKoboldToken(), new ManaSpentToCastCount()), false)); // Sacrifice another creature: Prossh gets +1/+0 until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)))); } public ProsshSkyraiderOfKher(final ProsshSkyraiderOfKher card) { diff --git a/Mage.Sets/src/mage/cards/q/QarsiHighPriest.java b/Mage.Sets/src/mage/cards/q/QarsiHighPriest.java index 9faff9c1de..20bb8b19ef 100644 --- a/Mage.Sets/src/mage/cards/q/QarsiHighPriest.java +++ b/Mage.Sets/src/mage/cards/q/QarsiHighPriest.java @@ -39,8 +39,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -48,25 +47,18 @@ import mage.target.common.TargetControlledCreaturePermanent; * @author fireshoes */ public class QarsiHighPriest extends CardImpl { - - -private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public QarsiHighPriest(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}"); this.subtype.add("Human"); this.subtype.add("Cleric"); this.power = new MageInt(0); this.toughness = new MageInt(2); // {1}{B}, {t}, Sacrifice another creature: Manifest the top card of your library. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ManifestEffect(1),new ManaCostsImpl("{1}{B}")); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ManifestEffect(1), new ManaCostsImpl("{1}{B}")); ability.addCost(new TapSourceCost()); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RavenousWampa.java b/Mage.Sets/src/mage/cards/r/RavenousWampa.java index e846012d99..9ccc7334f2 100644 --- a/Mage.Sets/src/mage/cards/r/RavenousWampa.java +++ b/Mage.Sets/src/mage/cards/r/RavenousWampa.java @@ -1,150 +1,143 @@ -/* - * 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.cards.r; - -import java.util.UUID; -import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility; -import mage.abilities.costs.Cost; -import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.keyword.MonstrosityAbility; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Outcome; -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.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetControlledPermanent; - -import static mage.cards.r.RavenousWampa.RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX; - -/** - * - * @author Styxo - */ -public class RavenousWampa extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - - static final String RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX = "TOU_SAC_CRE"; - - public RavenousWampa(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R/W}{R/W}"); - this.subtype.add("Beast"); - this.power = new MageInt(4); - this.toughness = new MageInt(4); - - // {2}{G}, Sacrifice another creature: Monstrosity 2. - Ability ability = new MonstrosityAbility("{2}{G}", 2); - ability.addCost(new RavenousWampaSacrificeTargetCost(new TargetControlledCreaturePermanent(filter))); - this.addAbility(ability); - - // When Ravenous Wampa becomes monstrous, you gain life equal to the sacrificied creature's toughness. - this.addAbility(new BecomesMonstrousSourceTriggeredAbility(new RavenousWampaEffect())); - } - - public RavenousWampa(final RavenousWampa card) { - super(card); - } - - @Override - public RavenousWampa copy() { - return new RavenousWampa(this); - } -} - -class RavenousWampaEffect extends OneShotEffect { - - public RavenousWampaEffect() { - super(Outcome.GainLife); - this.staticText = "you gain life equal to the sacrificied creature's toughness"; - } - - public RavenousWampaEffect(final RavenousWampaEffect effect) { - super(effect); - } - - @Override - public RavenousWampaEffect copy() { - return new RavenousWampaEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); - if (controller != null && sourceObject != null) { - Integer toughness = (Integer) game.getState().getValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + source.getSourceId() + sourceObject.getZoneChangeCounter(game)); - if (toughness != null) { - controller.gainLife(toughness, game); - } - return true; - } - return false; - } -} - -class RavenousWampaSacrificeTargetCost extends SacrificeTargetCost { - - public RavenousWampaSacrificeTargetCost(TargetControlledPermanent target) { - super(target); - } - - public RavenousWampaSacrificeTargetCost(RavenousWampaSacrificeTargetCost cost) { - super(cost); - } - - @Override - public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { - boolean result = super.pay(ability, game, sourceId, controllerId, noMana, costToPay); - if (paid && !getPermanents().isEmpty()) { - Permanent sacrificedPermanen = getPermanents().get(0); - Permanent sourcePermanent = game.getPermanent(sourceId); - if (sourcePermanent != null && sacrificedPermanen != null) { - game.getState().setValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + sourceId + sourcePermanent.getZoneChangeCounter(game), sacrificedPermanen.getToughness().getValue()); - } - } - return result; - } - - @Override - public RavenousWampaSacrificeTargetCost copy() { - return new RavenousWampaSacrificeTargetCost(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.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.MonstrosityAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import static mage.cards.r.RavenousWampa.RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX; +import mage.filter.StaticFilters; + +/** + * + * @author Styxo + */ +public class RavenousWampa extends CardImpl { + + static final String RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX = "TOU_SAC_CRE"; + + public RavenousWampa(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R/W}{R/W}"); + this.subtype.add("Beast"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // {2}{G}, Sacrifice another creature: Monstrosity 2. + Ability ability = new MonstrosityAbility("{2}{G}", 2); + ability.addCost(new RavenousWampaSacrificeTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); + this.addAbility(ability); + + // When Ravenous Wampa becomes monstrous, you gain life equal to the sacrificied creature's toughness. + this.addAbility(new BecomesMonstrousSourceTriggeredAbility(new RavenousWampaEffect())); + } + + public RavenousWampa(final RavenousWampa card) { + super(card); + } + + @Override + public RavenousWampa copy() { + return new RavenousWampa(this); + } +} + +class RavenousWampaEffect extends OneShotEffect { + + public RavenousWampaEffect() { + super(Outcome.GainLife); + this.staticText = "you gain life equal to the sacrificied creature's toughness"; + } + + public RavenousWampaEffect(final RavenousWampaEffect effect) { + super(effect); + } + + @Override + public RavenousWampaEffect copy() { + return new RavenousWampaEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (controller != null && sourceObject != null) { + Integer toughness = (Integer) game.getState().getValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + source.getSourceId() + sourceObject.getZoneChangeCounter(game)); + if (toughness != null) { + controller.gainLife(toughness, game); + } + return true; + } + return false; + } +} + +class RavenousWampaSacrificeTargetCost extends SacrificeTargetCost { + + public RavenousWampaSacrificeTargetCost(TargetControlledPermanent target) { + super(target); + } + + public RavenousWampaSacrificeTargetCost(RavenousWampaSacrificeTargetCost cost) { + super(cost); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) { + boolean result = super.pay(ability, game, sourceId, controllerId, noMana, costToPay); + if (paid && !getPermanents().isEmpty()) { + Permanent sacrificedPermanen = getPermanents().get(0); + Permanent sourcePermanent = game.getPermanent(sourceId); + if (sourcePermanent != null && sacrificedPermanen != null) { + game.getState().setValue(RAVENOUS_WAMPA_STATE_VALUE_KEY_PREFIX + sourceId + sourcePermanent.getZoneChangeCounter(game), sacrificedPermanen.getToughness().getValue()); + } + } + return result; + } + + @Override + public RavenousWampaSacrificeTargetCost copy() { + return new RavenousWampaSacrificeTargetCost(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/r/RazakethTheFoulblooded.java b/Mage.Sets/src/mage/cards/r/RazakethTheFoulblooded.java new file mode 100644 index 0000000000..e7f603b99b --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RazakethTheFoulblooded.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.cards.r; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.target.common.TargetCardInLibrary; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class RazakethTheFoulblooded extends CardImpl { + + public RazakethTheFoulblooded(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}{B}"); + + addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.DEMON.getDescription()); + this.power = new MageInt(8); + this.toughness = new MageInt(8); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Pay 2 life, Sacrifice another creature: Search your library for a card and put that card into your hand. Then shuffle your library. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new SearchLibraryPutInHandEffect(new TargetCardInLibrary(), false, true), new PayLifeCost(2)); + ability.addCost(new SacrificeTargetCost( + new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); + this.addAbility(ability); + } + + public RazakethTheFoulblooded(final RazakethTheFoulblooded card) { + super(card); + } + + @Override + public RazakethTheFoulblooded copy() { + return new RazakethTheFoulblooded(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/RubblebackRhino.java b/Mage.Sets/src/mage/cards/r/RubblebackRhino.java index 4648cf8c60..4bfc5a4c7f 100644 --- a/Mage.Sets/src/mage/cards/r/RubblebackRhino.java +++ b/Mage.Sets/src/mage/cards/r/RubblebackRhino.java @@ -33,23 +33,15 @@ import mage.MageInt; import mage.abilities.keyword.HexproofAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; /** * * @author LevelX2 */ public class RubblebackRhino extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public RubblebackRhino(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}"); this.subtype.add("Rhino"); this.power = new MageInt(3); diff --git a/Mage.Sets/src/mage/cards/s/ScourgeOfSkolaVale.java b/Mage.Sets/src/mage/cards/s/ScourgeOfSkolaVale.java index 52a56a669c..ded35306c3 100644 --- a/Mage.Sets/src/mage/cards/s/ScourgeOfSkolaVale.java +++ b/Mage.Sets/src/mage/cards/s/ScourgeOfSkolaVale.java @@ -45,8 +45,7 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetControlledPermanent; @@ -57,14 +56,8 @@ import mage.target.common.TargetControlledPermanent; */ public class ScourgeOfSkolaVale extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public ScourgeOfSkolaVale(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); this.subtype.add("Hydra"); this.power = new MageInt(0); @@ -78,7 +71,7 @@ public class ScourgeOfSkolaVale extends CardImpl { this.addAbility(new EntersBattlefieldAbility(effect)); // {T}, Sacrifice another creature: Put a number of +1/+1 counters on Scourge of Skola Vale equal to the sacrificed creature's toughness. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ScourgeOfSkolaValeEffect(), new TapSourceCost()); - ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SuturePriest.java b/Mage.Sets/src/mage/cards/s/SuturePriest.java index 4ef303d7af..a88faa982a 100644 --- a/Mage.Sets/src/mage/cards/s/SuturePriest.java +++ b/Mage.Sets/src/mage/cards/s/SuturePriest.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.cards.s; import java.util.UUID; @@ -40,9 +39,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.EntersTheBattlefieldEvent; import mage.game.events.GameEvent; @@ -55,27 +52,23 @@ import mage.target.targetpointer.FixedTarget; */ public class SuturePriest extends CardImpl { - private static final FilterPermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - - public SuturePriest (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); + public SuturePriest(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.subtype.add("Cleric"); this.power = new MageInt(1); this.toughness = new MageInt(1); // Whenever another creature enters the battlefield under your control, you may gain 1 life. - this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(1), filter, true)); + this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(1), + StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)); // Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life. this.addAbility(new SuturePriestSecondTriggeredAbility()); } - public SuturePriest (final SuturePriest card) { + public SuturePriest(final SuturePriest card) { super(card); } @@ -86,6 +79,7 @@ public class SuturePriest extends CardImpl { } class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl { + SuturePriestSecondTriggeredAbility() { super(Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), true); } @@ -107,11 +101,11 @@ class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { - EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent)event; + EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent) event; Card card = zEvent.getTarget(); if (card != null && card.isCreature()) { for (Effect effect : this.getEffects()) { - effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); } return true; } @@ -123,4 +117,4 @@ class SuturePriestSecondTriggeredAbility extends TriggeredAbilityImpl { public String getRule() { return "Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life."; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/t/TymaretTheMurderKing.java b/Mage.Sets/src/mage/cards/t/TymaretTheMurderKing.java index 915f587fea..fd209cf7eb 100644 --- a/Mage.Sets/src/mage/cards/t/TymaretTheMurderKing.java +++ b/Mage.Sets/src/mage/cards/t/TymaretTheMurderKing.java @@ -40,11 +40,11 @@ import mage.constants.CardType; import mage.constants.SuperType; import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.TargetPlayer; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -52,13 +52,8 @@ import java.util.UUID; */ public class TymaretTheMurderKing extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public TymaretTheMurderKing(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{R}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Zombie"); this.subtype.add("Warrior"); @@ -68,12 +63,12 @@ public class TymaretTheMurderKing extends CardImpl { // {1}{R}, Sacrifice another creature: Tymaret, the Murder King deals 2 damage to target player. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new ManaCostsImpl("{1}{R}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1, filter, false))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); ability.addTarget(new TargetPlayer()); this.addAbility(ability); // {1}{B}, Sacrifice a creature: Return Tymaret from your graveyard to your hand. ability = new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new ManaCostsImpl("{1}{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1,1, new FilterControlledCreaturePermanent("a creature"), false))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("a creature"), false))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/v/VampireWarlord.java b/Mage.Sets/src/mage/cards/v/VampireWarlord.java index 3cac6b6528..8eee32e2df 100644 --- a/Mage.Sets/src/mage/cards/v/VampireWarlord.java +++ b/Mage.Sets/src/mage/cards/v/VampireWarlord.java @@ -36,8 +36,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -46,13 +45,8 @@ import mage.target.common.TargetControlledCreaturePermanent; */ public class VampireWarlord extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - static { - filter.add(new AnotherPredicate()); - } - public VampireWarlord(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}"); this.subtype.add("Vampire"); this.subtype.add("Warrior"); @@ -60,7 +54,7 @@ public class VampireWarlord extends CardImpl { this.toughness = new MageInt(2); // Sacrifice another creature: Regenerate Vampire Warlord. - TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1,1, filter, false); + TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new SacrificeTargetCost(target))); } diff --git a/Mage.Sets/src/mage/cards/v/VarolzTheScarStriped.java b/Mage.Sets/src/mage/cards/v/VarolzTheScarStriped.java index bc89c12ad0..0e0d459c51 100644 --- a/Mage.Sets/src/mage/cards/v/VarolzTheScarStriped.java +++ b/Mage.Sets/src/mage/cards/v/VarolzTheScarStriped.java @@ -42,8 +42,7 @@ import mage.abilities.keyword.ScavengeAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; @@ -53,15 +52,9 @@ import mage.target.common.TargetControlledCreaturePermanent; * @author jeffwadsworth */ public class VarolzTheScarStriped extends CardImpl { - - private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } public VarolzTheScarStriped(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}"); addSuperType(SuperType.LEGENDARY); this.subtype.add("Troll"); this.subtype.add("Warrior"); @@ -73,7 +66,8 @@ public class VarolzTheScarStriped extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VarolzTheScarStripedEffect())); // Sacrifice another creature: Regenerate Varolz, the Scar-Striped. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), + new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true)))); } public VarolzTheScarStriped(final VarolzTheScarStriped card) { diff --git a/Mage.Sets/src/mage/cards/v/VoraciousNull.java b/Mage.Sets/src/mage/cards/v/VoraciousNull.java index 5cb049f613..2db34dae12 100644 --- a/Mage.Sets/src/mage/cards/v/VoraciousNull.java +++ b/Mage.Sets/src/mage/cards/v/VoraciousNull.java @@ -39,8 +39,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -49,21 +48,15 @@ import mage.target.common.TargetControlledCreaturePermanent; */ public class VoraciousNull extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public VoraciousNull(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); this.subtype.add("Zombie"); this.power = new MageInt(2); this.toughness = new MageInt(2); // {1}{B}, Sacrifice another creature: Put two +1/+1 counters on Voracious Null. Activate this ability only any time you could cast a sorcery. Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), new ManaCostsImpl("{1}{B}")); - ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, false))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/y/YahenniUndyingPartisan.java b/Mage.Sets/src/mage/cards/y/YahenniUndyingPartisan.java index 0e8bcfdaf3..1096dacbc4 100644 --- a/Mage.Sets/src/mage/cards/y/YahenniUndyingPartisan.java +++ b/Mage.Sets/src/mage/cards/y/YahenniUndyingPartisan.java @@ -42,12 +42,11 @@ import mage.constants.Duration; import mage.constants.SuperType; import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterOpponentsCreaturePermanent; -import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.common.TargetControlledPermanent; import java.util.UUID; +import mage.filter.StaticFilters; /** * @@ -55,12 +54,6 @@ import java.util.UUID; */ public class YahenniUndyingPartisan extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another creature"); - - static { - filter.add(new AnotherPredicate()); - } - public YahenniUndyingPartisan(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); @@ -80,7 +73,7 @@ public class YahenniUndyingPartisan extends CardImpl { this.addAbility(new SimpleActivatedAbility( Zone.BATTLEFIELD, new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.EndOfTurn), - new SacrificeTargetCost(new TargetControlledPermanent(filter))) + new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE))) ); } diff --git a/Mage.Sets/src/mage/sets/HourOfDevastation.java b/Mage.Sets/src/mage/sets/HourOfDevastation.java index 936414f908..43c2e08323 100644 --- a/Mage.Sets/src/mage/sets/HourOfDevastation.java +++ b/Mage.Sets/src/mage/sets/HourOfDevastation.java @@ -78,15 +78,20 @@ public class HourOfDevastation extends ExpansionSet { cards.add(new SetCardInfo("Desert of the Mindful", 173, Rarity.COMMON, mage.cards.d.DesertOfTheMindful.class)); cards.add(new SetCardInfo("Desert of the True", 174, Rarity.COMMON, mage.cards.d.DesertOfTheTrue.class)); cards.add(new SetCardInfo("Doomfall", 62, Rarity.UNCOMMON, mage.cards.d.Doomfall.class)); + cards.add(new SetCardInfo("Dreamstealer", 63, Rarity.RARE, mage.cards.d.Dreamstealer.class)); + cards.add(new SetCardInfo("Hour of Glory", 065, Rarity.RARE, mage.cards.h.HourOfGlory.class)); cards.add(new SetCardInfo("Hour of Revelation", 15, Rarity.RARE, mage.cards.h.HourOfRevelation.class)); cards.add(new SetCardInfo("Inferno Jet", 99, Rarity.UNCOMMON, mage.cards.i.InfernoJet.class)); cards.add(new SetCardInfo("Khenra Eternal", 66, Rarity.COMMON, mage.cards.k.KhenraEternal.class)); cards.add(new SetCardInfo("Khenra Scrapper", 100, Rarity.COMMON, mage.cards.k.KhenraScrapper.class)); + cards.add(new SetCardInfo("Liliana's Defeat", 68, Rarity.UNCOMMON, mage.cards.l.LilianasDefeat.class)); cards.add(new SetCardInfo("Marauding Boneslasher", 70, Rarity.COMMON, mage.cards.m.MaraudingBoneslasher.class)); + cards.add(new SetCardInfo("Maurauding Boneslasher", 70, Rarity.COMMON, mage.cards.m.MauraudingBoneslasher.class)); cards.add(new SetCardInfo("Nicol Bolas, God-Pharaoh", 140, Rarity.MYTHIC, mage.cards.n.NicolBolasGodPharaoh.class)); cards.add(new SetCardInfo("Open Fire", 105, Rarity.COMMON, mage.cards.o.OpenFire.class)); cards.add(new SetCardInfo("Proven Combatant", 42, Rarity.COMMON, mage.cards.p.ProvenCombatant.class)); cards.add(new SetCardInfo("Ramunap Excavator", 129, Rarity.RARE, mage.cards.r.RamunapExcavator.class)); + cards.add(new SetCardInfo("Razaketh, the Foulblooded", 73, Rarity.MYTHIC, mage.cards.r.RazakethTheFoulblooded.class)); cards.add(new SetCardInfo("Samut, the Tested", 144, Rarity.MYTHIC, mage.cards.s.SamutTheTested.class)); cards.add(new SetCardInfo("Sinuous Striker", 45, Rarity.UNCOMMON, mage.cards.s.SinuousStriker.class)); cards.add(new SetCardInfo("Solemnity", 22, Rarity.RARE, mage.cards.s.Solemnity.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockUnlessYouControlSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockUnlessYouControlSourceEffect.java new file mode 100644 index 0000000000..5014071c68 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/CantBlockUnlessYouControlSourceEffect.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.abilities.effects.common.combat; + +import mage.abilities.Ability; +import mage.abilities.effects.RestrictionEffect; +import mage.constants.Duration; +import mage.filter.common.FilterControlledPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class CantBlockUnlessYouControlSourceEffect extends RestrictionEffect { + + private final FilterControlledPermanent filter; + + public CantBlockUnlessYouControlSourceEffect(FilterControlledPermanent filter) { + super(Duration.WhileOnBattlefield); + this.filter = filter; + staticText = "{this} can't block unless you control" + filter.getMessage(); + } + + public CantBlockUnlessYouControlSourceEffect(final CantBlockUnlessYouControlSourceEffect effect) { + super(effect); + this.filter = effect.filter; + } + + @Override + public CantBlockUnlessYouControlSourceEffect copy() { + return new CantBlockUnlessYouControlSourceEffect(this); + } + + @Override + public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) { + return false; + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + return permanent.getId().equals(source.getSourceId()) + && game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game) == 0; + } +} diff --git a/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java b/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java index a5fb3f57c8..28d9aec01c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/EternalizeAbility.java @@ -117,7 +117,7 @@ class EternalizeEffect extends OneShotEffect { token.getToughness().modifyBaseValue(4); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EMBALMED_CREATURE, token.getId(), source.getSourceId(), controller.getId())); token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId(), false, false, null); - // Probably it makes sense to remove also the Embalm ability (it's not shown on the token cards). + // Probably it makes sense to remove also the Eternalize ability (it's not shown on the token cards). // Also it can never get active or? But it's not mentioned in the reminder text. return true; } diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 945b5ff965..d6146142c0 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -17,6 +17,7 @@ import mage.filter.common.FilterCreatureSpell; import mage.filter.common.FilterNonlandCard; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.AnotherPredicate; import mage.filter.predicate.permanent.AttackingPredicate; import mage.filter.predicate.permanent.TokenPredicate; @@ -30,6 +31,7 @@ public final 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_A_CREATURE = new FilterControlledCreaturePermanent("a creature you control"); + public static final FilterControlledCreaturePermanent FILTER_CONTROLLED_ANOTHER_CREATURE = new FilterControlledCreaturePermanent("another creature"); public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent(); public static final FilterArtifactCard FILTER_CARD_ARTIFACT = new FilterArtifactCard(); public static final FilterNonlandCard FILTER_CARD_NON_LAND = new FilterNonlandCard(); @@ -63,6 +65,8 @@ public final class StaticFilters { new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE) )); + FILTER_CONTROLLED_ANOTHER_CREATURE.add(new AnotherPredicate()); + FILTER_CARD_ARTIFACT_OR_CREATURE.add(Predicates.or( new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE) diff --git a/Utils/keywords.txt b/Utils/keywords.txt index b20f2558f2..cd343ae4ff 100644 --- a/Utils/keywords.txt +++ b/Utils/keywords.txt @@ -24,6 +24,7 @@ Echo|manaString| Embalm|cost, card| Enchant|type| Entwine|manaString| +Eternalize|cost, card| Evoke|card, manaString| Evolve|new| Exalted|new| diff --git a/Utils/mtg-cards-data.txt b/Utils/mtg-cards-data.txt index 78c53bd673..a6b12a3a96 100644 --- a/Utils/mtg-cards-data.txt +++ b/Utils/mtg-cards-data.txt @@ -31657,7 +31657,7 @@ Hour of Glory|Hour of Devastation|065|R|{3}{B}|Instant|||Exile target creature. Khenra Eternal|Hour of Devastation|66|C|{1}{B}|Creature - Zombie Jackal Warrior|2|2|Afflict 1 (Whenever this creature becomes blocked, defending player loses 1 life.)| Liliana's Defeat|Hour of Devastation|68|U|{B}|Sorcery|||Destroy target black creature or black planeswalker. If that permanent was a Liliana planeswalker, her controller loses 3 life.| Maurauding Boneslasher|Hour of Devastation|70|C|{2}{B}|Creature - Zombie Minotaur|3|3|Marauding Boneslasher can't block unless you control another Zombie.| -Razaketh the Foulblooded|Hour of Devastation|73|M|{5}{B}{B}{B}|Legendary Creature - Demon|8|8|Flying, trample$Pay 2 life, Sacrifice another creature: Search your library for a card and put that card into your hand. Then shuffle your library.| +Razaketh, the Foulblooded|Hour of Devastation|73|M|{5}{B}{B}{B}|Legendary Creature - Demon|8|8|Flying, trample$Pay 2 life, Sacrifice another creature: Search your library for a card and put that card into your hand. Then shuffle your library.| Torment of Hailfire|Hour of Devastation|077|R|{X}{B}{B}|Sorcery|||Repeat the following process X times. Each opponent loses 3 life unless he or she sacrifices a nonland permanent or discards a card.| Torment of Scarabs|Hour of Devastation|078|U|{3}{B}|Enchantment - Aura Curse|||Enchant player$At the beginning of enchanted player's upkeep, that player loses 3 life unless he or she sacrifices a nonland permanent or discards a card.| Torment of Venom|Hour of Devastation|079|C|{2}{B}{B}|Instant|||Put three -1/-1 counters on target creature. Its controller loses 3 life unless he or she sacrifices another nonland permanent or discards a card.|