diff --git a/Mage.Sets/src/mage/cards/a/AcesBaseballBat.java b/Mage.Sets/src/mage/cards/a/AcesBaseballBat.java index 0a54026f17a..2eca11d118b 100644 --- a/Mage.Sets/src/mage/cards/a/AcesBaseballBat.java +++ b/Mage.Sets/src/mage/cards/a/AcesBaseballBat.java @@ -15,7 +15,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -60,7 +60,7 @@ public final class AcesBaseballBat extends CardImpl { // Equip legendary creature (1) this.addAbility(new EquipAbility( Outcome.AddAbility, new GenericManaCost(1), - new TargetControlledCreaturePermanent(filterLegendary), false + new TargetPermanent(filterLegendary), false )); // Equip {3} diff --git a/Mage.Sets/src/mage/cards/a/AegisAutomaton.java b/Mage.Sets/src/mage/cards/a/AegisAutomaton.java index db0ea3472ea..ee80a59768b 100644 --- a/Mage.Sets/src/mage/cards/a/AegisAutomaton.java +++ b/Mage.Sets/src/mage/cards/a/AegisAutomaton.java @@ -1,6 +1,5 @@ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -10,12 +9,12 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author fireshoes */ public final class AegisAutomaton extends CardImpl { @@ -29,7 +28,7 @@ public final class AegisAutomaton extends CardImpl { // {4}{W}: Return another target creature you control to its owner's hand. Ability ability = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new ManaCostsImpl<>("{4}{W}")); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AethershieldArtificer.java b/Mage.Sets/src/mage/cards/a/AethershieldArtificer.java index 834f30d8126..381028cfea3 100644 --- a/Mage.Sets/src/mage/cards/a/AethershieldArtificer.java +++ b/Mage.Sets/src/mage/cards/a/AethershieldArtificer.java @@ -1,22 +1,22 @@ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.IndestructibleAbility; -import mage.constants.SubType; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; +import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class AethershieldArtificer extends CardImpl { @@ -45,7 +45,7 @@ public final class AethershieldArtificer extends CardImpl { IndestructibleAbility.getInstance(), Duration.EndOfTurn ).setText("and gains indestructible until end of turn")); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AltarGolem.java b/Mage.Sets/src/mage/cards/a/AltarGolem.java index 31b8571ab1a..403b8c6e9c1 100644 --- a/Mage.Sets/src/mage/cards/a/AltarGolem.java +++ b/Mage.Sets/src/mage/cards/a/AltarGolem.java @@ -1,7 +1,6 @@ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -17,24 +16,17 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** - * * @author jeffwadsworth - * */ public final class AltarGolem extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public AltarGolem(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{7}"); this.subtype.add(SubType.GOLEM); @@ -53,7 +45,7 @@ public final class AltarGolem extends CardImpl { this.addAbility(new SimpleStaticAbility(new DontUntapInControllersUntapStepSourceEffect())); // Tap five untapped creatures you control: Untap Altar Golem. - this.addAbility(new SimpleActivatedAbility(new UntapSourceEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(5, 5, filter, true)))); + this.addAbility(new SimpleActivatedAbility(new UntapSourceEffect(), new TapTargetCost(new TargetControlledPermanent(5, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)))); } diff --git a/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java b/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java index 0dc09db1b19..6c90ec2fa41 100644 --- a/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java +++ b/Mage.Sets/src/mage/cards/a/AnafenzaTheForemost.java @@ -21,7 +21,7 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -48,7 +48,7 @@ public final class AnafenzaTheForemost extends CardImpl { // Whenever Anafenza, the Foremost attacks, put a +1/+1 counter on another target tapped creature you control. Ability ability = new AttacksTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); // If a nontoken creature an opponent owns would die or a creature card not on the battlefield would be put into an opponent's graveyard, exile that card instead. diff --git a/Mage.Sets/src/mage/cards/a/AnotherRound.java b/Mage.Sets/src/mage/cards/a/AnotherRound.java index 8353ebb028f..4ede5800889 100644 --- a/Mage.Sets/src/mage/cards/a/AnotherRound.java +++ b/Mage.Sets/src/mage/cards/a/AnotherRound.java @@ -9,9 +9,9 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.filter.StaticFilters; import mage.game.Game; import mage.players.Player; +import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.targetpointer.FixedTargets; @@ -61,12 +61,8 @@ class AnotherRoundEffect extends OneShotEffect { } int xValue = GetXValue.instance.calculate(game, source, this); - TargetControlledCreaturePermanent target = - new TargetControlledCreaturePermanent( - 0, Integer.MAX_VALUE, - StaticFilters.FILTER_CONTROLLED_CREATURE, true - ); - + TargetPermanent target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE); + target.withNotTarget(true); for (int i = 0; i <= xValue; ++i) { target.clearChosen(); controller.chooseTarget(Outcome.Benefit, target, source, game); diff --git a/Mage.Sets/src/mage/cards/a/ArashinForemost.java b/Mage.Sets/src/mage/cards/a/ArashinForemost.java index 943af6b4556..64e6a20e7a0 100644 --- a/Mage.Sets/src/mage/cards/a/ArashinForemost.java +++ b/Mage.Sets/src/mage/cards/a/ArashinForemost.java @@ -1,7 +1,6 @@ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; @@ -14,10 +13,11 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author fireshoes */ public final class ArashinForemost extends CardImpl { @@ -41,7 +41,7 @@ public final class ArashinForemost extends CardImpl { // Whenever Arashin Foremost enters the battlefield or attacks, another target Warrior creature you control gains double strike until end of turn. Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn)); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/ArcticMerfolk.java b/Mage.Sets/src/mage/cards/a/ArcticMerfolk.java index 87c0e234f97..e55cbf13bf8 100644 --- a/Mage.Sets/src/mage/cards/a/ArcticMerfolk.java +++ b/Mage.Sets/src/mage/cards/a/ArcticMerfolk.java @@ -12,7 +12,6 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.counters.CounterType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -30,9 +29,9 @@ public final class ArcticMerfolk extends CardImpl { this.toughness = new MageInt(1); // Kicker—Return a creature you control to its owner's hand. (You may return a creature you control to its owner's hand in addition to any other costs as you cast this spell.) - this.addAbility(new KickerAbility(new ReturnToHandChosenControlledPermanentCost( - new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE, true) - ))); + this.addAbility(new KickerAbility( + new ReturnToHandChosenControlledPermanentCost(new TargetControlledCreaturePermanent()) + )); // If Arctic Merfolk was kicked, it enters with a +1/+1 counter on it. this.addAbility(new EntersBattlefieldAbility( diff --git a/Mage.Sets/src/mage/cards/a/AshrootAnimist.java b/Mage.Sets/src/mage/cards/a/AshrootAnimist.java index 7de59b0f0a3..e7cabaea139 100644 --- a/Mage.Sets/src/mage/cards/a/AshrootAnimist.java +++ b/Mage.Sets/src/mage/cards/a/AshrootAnimist.java @@ -14,19 +14,17 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.filter.StaticFilters; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; /** - * * @author ciaccona007 */ public final class AshrootAnimist extends CardImpl { public AshrootAnimist(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}"); - + this.subtype.add(SubType.LIZARD); this.subtype.add(SubType.DRUID); this.power = new MageInt(4); @@ -40,9 +38,9 @@ public final class AshrootAnimist extends CardImpl { new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn).setText("another target creature you control gains trample"), false ); - ability.addEffect( new BoostTargetEffect(SourcePermanentPowerValue.NOT_NEGATIVE, SourcePermanentPowerValue.NOT_NEGATIVE, Duration.EndOfTurn) + ability.addEffect(new BoostTargetEffect(SourcePermanentPowerValue.NOT_NEGATIVE, SourcePermanentPowerValue.NOT_NEGATIVE, Duration.EndOfTurn) .setText("and gets +X/+X until end of turn, where X is this creature's power")); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/a/AuraOfDominion.java b/Mage.Sets/src/mage/cards/a/AuraOfDominion.java index 9b68395a9f7..33795e7c34a 100644 --- a/Mage.Sets/src/mage/cards/a/AuraOfDominion.java +++ b/Mage.Sets/src/mage/cards/a/AuraOfDominion.java @@ -1,8 +1,5 @@ - - package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -15,35 +12,29 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; +import mage.filter.StaticFilters; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * @author Loki */ public final class AuraOfDominion extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - - public AuraOfDominion(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Untap)); this.addAbility(new EnchantAbility(auraTarget)); + Ability ability = new SimpleActivatedAbility(new UntapAttachedEffect(), new GenericManaCost(1)); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability.addCost(new TapTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BattleScreech.java b/Mage.Sets/src/mage/cards/b/BattleScreech.java index feb673697ce..5e3273f9b47 100644 --- a/Mage.Sets/src/mage/cards/b/BattleScreech.java +++ b/Mage.Sets/src/mage/cards/b/BattleScreech.java @@ -1,7 +1,5 @@ - package mage.cards.b; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.effects.common.CreateTokenEffect; @@ -9,15 +7,15 @@ import mage.abilities.keyword.FlashbackAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TimingRule; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.permanent.token.BirdToken; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class BattleScreech extends CardImpl { @@ -30,14 +28,13 @@ public final class BattleScreech extends CardImpl { } public BattleScreech(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{W}{W}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}{W}"); // Create two 1/1 white Bird creature tokens with flying. this.getSpellAbility().addEffect(new CreateTokenEffect(new BirdToken(), 2)); // Flashback-Tap three untapped white creatures you control. - this.addAbility(new FlashbackAbility(this, new TapTargetCost(new TargetControlledCreaturePermanent(3,3, filter, true)))); + this.addAbility(new FlashbackAbility(this, new TapTargetCost(new TargetControlledPermanent(3, filter)))); } private BattleScreech(final BattleScreech card) { diff --git a/Mage.Sets/src/mage/cards/b/BetorAncestorsVoice.java b/Mage.Sets/src/mage/cards/b/BetorAncestorsVoice.java index 88e1cac8d2a..fece40d434f 100644 --- a/Mage.Sets/src/mage/cards/b/BetorAncestorsVoice.java +++ b/Mage.Sets/src/mage/cards/b/BetorAncestorsVoice.java @@ -1,6 +1,5 @@ package mage.cards.b; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -8,27 +7,28 @@ import mage.abilities.dynamicvalue.common.ControllerGainedLifeCount; import mage.abilities.dynamicvalue.common.ControllerLostLifeCount; import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; -import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; -import mage.constants.SubType; -import mage.constants.SuperType; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.counters.CounterType; import mage.filter.FilterCard; import mage.filter.StaticFilters; import mage.filter.predicate.ObjectSourcePlayer; import mage.filter.predicate.ObjectSourcePlayerPredicate; import mage.game.Game; +import mage.target.TargetPermanent; import mage.target.common.TargetCardInGraveyard; -import mage.target.common.TargetControlledCreaturePermanent; import mage.target.targetpointer.SecondTargetPointer; import mage.watchers.common.PlayerGainedLifeWatcher; +import java.util.UUID; + /** - * * @author Grath */ public final class BetorAncestorsVoice extends CardImpl { @@ -43,7 +43,7 @@ public final class BetorAncestorsVoice extends CardImpl { public BetorAncestorsVoice(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}{G}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.SPIRIT); this.subtype.add(SubType.DRAGON); @@ -64,7 +64,7 @@ public final class BetorAncestorsVoice extends CardImpl { .setText("put a number of +1/+1 counters on up to one other target creature you " + "control equal to the amount of life you gained this turn.") ); - ability.addTarget(new TargetControlledCreaturePermanent(0, 1, StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL, false)); + ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); ability.addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect().setTargetPointer(new SecondTargetPointer()) .setText("Return up to one target creature card with mana value less than or equal to the amount of " + "life you lost this turn from your graveyard to the battlefield.")); @@ -96,4 +96,4 @@ enum BetorPredicate implements ObjectSourcePlayerPredicate { public String toString() { return "mana value less than or equal to the amount of life you lost this turn"; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/b/BirchloreRangers.java b/Mage.Sets/src/mage/cards/b/BirchloreRangers.java index 0ef117efbe6..b50024b3bde 100644 --- a/Mage.Sets/src/mage/cards/b/BirchloreRangers.java +++ b/Mage.Sets/src/mage/cards/b/BirchloreRangers.java @@ -1,8 +1,5 @@ package mage.cards.b; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.Mana; import mage.abilities.Ability; @@ -15,19 +12,27 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; /** - * * @author LevelX2 */ public final class BirchloreRangers extends CardImpl { + private static final FilterControlledPermanent filter = new FilterControlledPermanent(SubType.ELF, "untapped Elves you control"); + + static { + filter.add(TappedPredicate.UNTAPPED); + } + public BirchloreRangers(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}"); this.subtype.add(SubType.ELF, SubType.DRUID, SubType.RANGER); @@ -36,14 +41,11 @@ public final class BirchloreRangers extends CardImpl { this.toughness = new MageInt(1); // Tap two untapped Elves you control: Add one mana of any color. - FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Elves you control"); - filter.add(TappedPredicate.UNTAPPED); - filter.add(SubType.ELF.getPredicate()); this.addAbility(new SimpleManaAbility( - Zone.BATTLEFIELD, new BirchloreRangersManaEffect(filter), - new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false)))); - + new TapTargetCost(new TargetControlledPermanent(2, filter)) + )); + // Morph {G} this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{G}"))); } @@ -90,4 +92,4 @@ class BirchloreRangersManaEffect extends AddManaOfAnyColorEffect { return super.getNetMana(game, source); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/b/BlackOakOfOdunos.java b/Mage.Sets/src/mage/cards/b/BlackOakOfOdunos.java index ba97419e572..4a52644b3a5 100644 --- a/Mage.Sets/src/mage/cards/b/BlackOakOfOdunos.java +++ b/Mage.Sets/src/mage/cards/b/BlackOakOfOdunos.java @@ -1,7 +1,5 @@ - package mage.cards.b; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -14,27 +12,28 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** - * * @author Quercitron */ public final class BlackOakOfOdunos extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another untapped creature you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("another untapped creature you control"); static { filter.add(AnotherPredicate.instance); filter.add(TappedPredicate.UNTAPPED); } - + public BlackOakOfOdunos(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(SubType.ZOMBIE, SubType.TREEFOLK); this.power = new MageInt(0); @@ -42,9 +41,12 @@ public final class BlackOakOfOdunos extends CardImpl { // Defender this.addAbility(DefenderAbility.getInstance()); + // {B}, Tap another untapped creature you control: Black Oak of Odunos gets +1/+1 until end of turn. - Ability ability = new SimpleActivatedAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl<>("{B}")); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))); + Ability ability = new SimpleActivatedAbility( + new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl<>("{B}") + ); + ability.addCost(new TapTargetCost(new TargetControlledPermanent(filter))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java b/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java index 4cf85be7bfe..9321dafa470 100644 --- a/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java +++ b/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java @@ -9,12 +9,15 @@ import mage.abilities.hint.ValueHint; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.SuperType; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; -import mage.target.common.TargetControlledCreaturePermanent; /** * @author Rystan @@ -39,7 +42,7 @@ public final class BlackbladeReforged extends CardImpl { this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(count, count)).addHint(new ValueHint("Lands you control", count))); // Equip legendary creature (3) - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), new TargetControlledCreaturePermanent(filter), false)); + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), new TargetPermanent(filter), false)); // Equip {7} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(7), false)); diff --git a/Mage.Sets/src/mage/cards/b/BreachingHippocamp.java b/Mage.Sets/src/mage/cards/b/BreachingHippocamp.java index 69ec028f5f4..4cf6bc6a89e 100644 --- a/Mage.Sets/src/mage/cards/b/BreachingHippocamp.java +++ b/Mage.Sets/src/mage/cards/b/BreachingHippocamp.java @@ -1,6 +1,5 @@ package mage.cards.b; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -11,16 +10,17 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class BreachingHippocamp extends CardImpl { public BreachingHippocamp(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.subtype.add(SubType.HORSE, SubType.FISH); this.power = new MageInt(3); @@ -28,9 +28,10 @@ public final class BreachingHippocamp extends CardImpl { // Flash this.addAbility(FlashAbility.getInstance()); + // When Breaching Hippocamp enters the battlefield, untap another target creature you control. Ability ability = new EntersBattlefieldTriggeredAbility(new UntapTargetEffect(), false); - ability.addTarget(new TargetControlledCreaturePermanent(1,1, StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL, false)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/b/BreathOfFury.java b/Mage.Sets/src/mage/cards/b/BreathOfFury.java index f1f676514f3..01a40680699 100644 --- a/Mage.Sets/src/mage/cards/b/BreathOfFury.java +++ b/Mage.Sets/src/mage/cards/b/BreathOfFury.java @@ -1,7 +1,6 @@ package mage.cards.b; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.effects.Effect; @@ -23,6 +22,8 @@ import mage.target.Target; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** * @author duncant */ @@ -119,7 +120,7 @@ class BreathOfFuryEffect extends OneShotEffect { Player controller = game.getPlayer(source.getControllerId()); FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control that could be enchanted by " + enchantment.getName()); filter.add(new CanBeEnchantedByPredicate(enchantment)); - Target target = new TargetControlledCreaturePermanent(filter); + Target target = new TargetPermanent(filter); target.withNotTarget(true); // It's important to check that the creature was successfully sacrificed here. Effects that prevent sacrifice will also prevent Breath of Fury's effect from working. // Commanders going to the command zone and Rest in Peace style replacement effects don't make Permanent.sacrifice return false. diff --git a/Mage.Sets/src/mage/cards/b/BrotherhoodRegalia.java b/Mage.Sets/src/mage/cards/b/BrotherhoodRegalia.java index 59b49b5e15c..e7dd7f1df12 100644 --- a/Mage.Sets/src/mage/cards/b/BrotherhoodRegalia.java +++ b/Mage.Sets/src/mage/cards/b/BrotherhoodRegalia.java @@ -12,7 +12,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -23,6 +23,7 @@ public final class BrotherhoodRegalia extends CardImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("legendary creature"); + static { filter.add(SuperType.LEGENDARY.getPredicate()); } @@ -44,7 +45,7 @@ public final class BrotherhoodRegalia extends CardImpl { this.addAbility(ability); // Equip legendary creature {1} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetControlledCreaturePermanent(filter), false)); + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetPermanent(filter), false)); // Equip {3} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), true)); diff --git a/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java b/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java index 838c8c189ce..747fec5217c 100644 --- a/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java +++ b/Mage.Sets/src/mage/cards/b/BruseTarlBoorishHerder.java @@ -1,11 +1,8 @@ - package mage.cards.b; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.DoubleStrikeAbility; import mage.abilities.keyword.LifelinkAbility; @@ -16,11 +13,11 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; import mage.constants.SuperType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author spjspj */ public final class BruseTarlBoorishHerder extends CardImpl { @@ -34,14 +31,13 @@ public final class BruseTarlBoorishHerder extends CardImpl { this.toughness = new MageInt(3); // Whenever Bruse Tarl, Boorish Herder enters the battlefield or attacks, target creature you control gains double strike and lifelink until end of turn. - Effect effect = new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn); - effect.setText("target creature you control gains double strike"); - Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(effect); - effect = new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn); - effect.setText("and lifelink until end of turn"); - ability.addEffect(effect); - ability.addTarget(new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("target creature you control"))); - + Ability ability = new EntersBattlefieldOrAttacksSourceTriggeredAbility(new GainAbilityTargetEffect( + DoubleStrikeAbility.getInstance(), Duration.EndOfTurn + ).setText("target creature you control gains double strike")); + ability.addEffect(new GainAbilityTargetEffect( + LifelinkAbility.getInstance(), Duration.EndOfTurn + ).setText("and lifelink until end of turn")); + ability.addTarget(new TargetControlledCreaturePermanent()); this.addAbility(ability); // Partner diff --git a/Mage.Sets/src/mage/cards/c/Camouflage.java b/Mage.Sets/src/mage/cards/c/Camouflage.java index d192d4edc66..1e86a48d31e 100644 --- a/Mage.Sets/src/mage/cards/c/Camouflage.java +++ b/Mage.Sets/src/mage/cards/c/Camouflage.java @@ -1,12 +1,5 @@ package mage.cards.c; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility; import mage.abilities.condition.common.MyTurnCondition; @@ -17,9 +10,9 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.PhaseStep; -import mage.filter.predicate.Predicates; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; import mage.filter.predicate.permanent.PermanentReferenceInCollectionPredicate; import mage.game.Game; import mage.game.combat.CombatGroup; @@ -28,11 +21,12 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.util.RandomUtil; +import java.util.*; + /** - * * @author L_J */ public final class Camouflage extends CardImpl { @@ -121,7 +115,7 @@ class CamouflageEffect extends ContinuousRuleModifyingEffectImpl { filter.add(Predicates.not(new PermanentReferenceInCollectionPredicate(spentBlockers, game))); } if (defender.chooseUse(Outcome.Neutral, "Make a new blocker pile? If not, all remaining piles stay empty. (remaining piles: " + (attackerCount - masterList.size()) + ')', source, game)) { - Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true); + Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); if (target.canChoose(defenderId, source, game)) { if (defender.chooseTarget(Outcome.Neutral, target, source, game)) { for (UUID creatureId : target.getTargets()) { @@ -171,7 +165,7 @@ class CamouflageEffect extends ContinuousRuleModifyingEffectImpl { } } } - + List> allPiles = masterMap.get(playerId); Set blockerIds = new HashSet<>(); for (List pile : allPiles) { diff --git a/Mage.Sets/src/mage/cards/c/Chewbacca.java b/Mage.Sets/src/mage/cards/c/Chewbacca.java index 964513320ee..c740c9ea95b 100644 --- a/Mage.Sets/src/mage/cards/c/Chewbacca.java +++ b/Mage.Sets/src/mage/cards/c/Chewbacca.java @@ -1,6 +1,5 @@ package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksOrBlocksTriggeredAbility; @@ -9,20 +8,21 @@ import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.constants.SuperType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author Styxo */ public final class Chewbacca extends CardImpl { public Chewbacca(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{G}{W}"); this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.WOOKIEE); this.subtype.add(SubType.WARRIOR); @@ -34,7 +34,7 @@ public final class Chewbacca extends CardImpl { // Whenever Chewbacca attacks or blocks, another target creature you control gets +3/+3 until end of turn. Ability ability = new AttacksOrBlocksTriggeredAbility(new BoostTargetEffect(3, 3, Duration.EndOfTurn), false); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/ChiefChirpa.java b/Mage.Sets/src/mage/cards/c/ChiefChirpa.java index 2866aa9ba93..ac3d8d8d8f5 100644 --- a/Mage.Sets/src/mage/cards/c/ChiefChirpa.java +++ b/Mage.Sets/src/mage/cards/c/ChiefChirpa.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -19,13 +17,14 @@ import mage.constants.TargetController; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.permanent.token.EwokToken; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author Styxo */ public final class ChiefChirpa extends CardImpl { @@ -42,7 +41,7 @@ public final class ChiefChirpa extends CardImpl { } public ChiefChirpa(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}{W}"); this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.EWOK); this.subtype.add(SubType.WARRIOR); @@ -54,7 +53,7 @@ public final class ChiefChirpa extends CardImpl { // Whenever a green creature you control dies, you may put a +1/+1 counter on another target Ewok creature you control. Ability ability = new DiesCreatureTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), true, diedFilter); - ability.addTarget(new TargetControlledCreaturePermanent(ewokFilter)); + ability.addTarget(new TargetPermanent(ewokFilter)); this.addAbility(ability); // When Chief Chirpa become monstrous, create three 1/1 green Ewok creature tokens. diff --git a/Mage.Sets/src/mage/cards/c/CityOfShadows.java b/Mage.Sets/src/mage/cards/c/CityOfShadows.java index f67dc011964..ae9a711c8ba 100644 --- a/Mage.Sets/src/mage/cards/c/CityOfShadows.java +++ b/Mage.Sets/src/mage/cards/c/CityOfShadows.java @@ -1,6 +1,5 @@ package mage.cards.c; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -12,13 +11,13 @@ import mage.abilities.mana.DynamicManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** - * * @author Luna Skyrise */ public final class CityOfShadows extends CardImpl { @@ -28,7 +27,7 @@ public final class CityOfShadows extends CardImpl { // {T}, Exile a creature you control: Put a storage counter on City of Shadows. Ability ability = new SimpleActivatedAbility(new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new TapSourceCost()); - ability.addCost(new ExileTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE))); + ability.addCost(new ExileTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE))); this.addAbility(ability); // {T}: Add {C} for each storage counter on City of Shadows. diff --git a/Mage.Sets/src/mage/cards/c/CoilingStalker.java b/Mage.Sets/src/mage/cards/c/CoilingStalker.java index 4990d4c8845..701ad3b8e89 100644 --- a/Mage.Sets/src/mage/cards/c/CoilingStalker.java +++ b/Mage.Sets/src/mage/cards/c/CoilingStalker.java @@ -1,24 +1,24 @@ package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersTargetEffect; -import mage.constants.SubType; import mage.abilities.keyword.NinjutsuAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicate; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class CoilingStalker extends CardImpl { @@ -43,7 +43,7 @@ public final class CoilingStalker extends CardImpl { // Whenever Coiling Stalker deals combat damage to a player, put a +1/+1 counter on target creature you control that doesn't have a +1/+1 counter on it. Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/c/CollectiveEffort.java b/Mage.Sets/src/mage/cards/c/CollectiveEffort.java index ccff1b45ca4..c8fff3117b6 100644 --- a/Mage.Sets/src/mage/cards/c/CollectiveEffort.java +++ b/Mage.Sets/src/mage/cards/c/CollectiveEffort.java @@ -21,7 +21,6 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPlayer; -import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetEnchantmentPermanent; @@ -43,7 +42,7 @@ public final class CollectiveEffort extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{W}{W}"); // Escalate — Tap an untapped creature you control. - this.addAbility(new EscalateAbility(new TapTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)))); + this.addAbility(new EscalateAbility(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE))); // Choose one or more — this.getSpellAbility().getModes().setMinModes(1); diff --git a/Mage.Sets/src/mage/cards/c/CoralReef.java b/Mage.Sets/src/mage/cards/c/CoralReef.java index 46bd9d0d43e..a8935d15e9b 100644 --- a/Mage.Sets/src/mage/cards/c/CoralReef.java +++ b/Mage.Sets/src/mage/cards/c/CoralReef.java @@ -1,7 +1,6 @@ package mage.cards.c; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -17,25 +16,23 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.counters.CounterType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class CoralReef extends CardImpl { - + private static final FilterControlledPermanent islandFilter = new FilterControlledPermanent("an Island"); private static final FilterControlledCreaturePermanent untappedBlueCreatureFilter = new FilterControlledCreaturePermanent("an untapped blue creature you control"); - + static { islandFilter.add(SubType.ISLAND.getPredicate()); untappedBlueCreatureFilter.add(TappedPredicate.UNTAPPED); @@ -43,22 +40,22 @@ public final class CoralReef extends CardImpl { } public CoralReef(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}"); // Coral Reef enters the battlefield with four polyp counters on it. Effect effect = new AddCountersSourceEffect(CounterType.POLYP.createInstance(4)); effect.setText("with four polyp counters on it"); this.addAbility(new EntersBattlefieldAbility(effect)); - + // Sacrifice an Island: Put two polyp counters on Coral Reef. effect = new AddCountersSourceEffect(CounterType.POLYP.createInstance(2), true); effect.setText("Put two polyp counters on {this}"); this.addAbility(new SimpleActivatedAbility(effect, new SacrificeTargetCost(islandFilter))); - + // {U}, Tap an untapped blue creature you control, Remove a polyp counter from Coral Reef: Put a +0/+1 counter on target creature. Ability ability = new SimpleActivatedAbility(new AddCountersTargetEffect(CounterType.P0P1.createInstance()), new ManaCostsImpl<>("{U}")); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(untappedBlueCreatureFilter))); + ability.addCost(new TapTargetCost(untappedBlueCreatureFilter)); ability.addCost(new RemoveCountersSourceCost(CounterType.POLYP.createInstance())); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/c/Crackleburr.java b/Mage.Sets/src/mage/cards/c/Crackleburr.java index 861aecc1944..9674500e9a2 100644 --- a/Mage.Sets/src/mage/cards/c/Crackleburr.java +++ b/Mage.Sets/src/mage/cards/c/Crackleburr.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -17,34 +15,34 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetAnyTarget; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; -/** - * - * @author jeffwadsworth +import java.util.UUID; +/** + * @author jeffwadsworth */ public final class Crackleburr extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped red creatures you control"); - private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("tapped blue creature you control"); - + + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped red creatures you control"); + private static final FilterControlledPermanent filter2 = new FilterControlledCreaturePermanent("tapped blue creature you control"); + static { filter.add(new ColorPredicate(ObjectColor.RED)); filter.add(TappedPredicate.UNTAPPED); - + filter2.add(new ColorPredicate(ObjectColor.BLUE)); filter2.add(TappedPredicate.TAPPED); } public Crackleburr(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U/R}{U/R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U/R}{U/R}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(2); @@ -53,17 +51,16 @@ public final class Crackleburr extends CardImpl { // {UR}{UR}, {tap}, Tap two untapped red creatures you control: Crackleburr deals 3 damage to any target. Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(3), new ManaCostsImpl<>("{U/R}{U/R}")); ability.addCost(new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true))); + ability.addCost(new TapTargetCost(new TargetControlledPermanent(2, filter))); ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); - + // {UR}{UR}, {untap}, Untap two tapped blue creatures you control: Return target creature to its owner's hand. Ability ability2 = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new ManaCostsImpl<>("{U/R}{U/R}")); ability2.addCost(new UntapSourceCost()); - ability2.addCost(new UntapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter2, true))); + ability2.addCost(new UntapTargetCost(new TargetControlledPermanent(2, filter2))); ability2.addTarget(new TargetCreaturePermanent()); this.addAbility(ability2); - } private Crackleburr(final Crackleburr card) { diff --git a/Mage.Sets/src/mage/cards/c/CracklingDoom.java b/Mage.Sets/src/mage/cards/c/CracklingDoom.java index 107510d19af..5b00be3738d 100644 --- a/Mage.Sets/src/mage/cards/c/CracklingDoom.java +++ b/Mage.Sets/src/mage/cards/c/CracklingDoom.java @@ -15,14 +15,13 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.ArrayList; import java.util.List; import java.util.UUID; /** - * * @author LevelX2 */ public final class CracklingDoom extends CardImpl { @@ -49,9 +48,11 @@ public final class CracklingDoom extends CardImpl { class CracklingDoomEffect extends OneShotEffect { static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with the greatest power among creatures you control"); + static { filter.add(GreatestPowerControlledPredicate.instance); } + public CracklingDoomEffect() { super(Outcome.Sacrifice); this.staticText = "Each opponent sacrifices a creature with the greatest power among creatures that player controls"; @@ -75,7 +76,7 @@ class CracklingDoomEffect extends OneShotEffect { if (controller.hasOpponent(playerId, game)) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - Target target = new TargetControlledCreaturePermanent(filter); + Target target = new TargetPermanent(filter); target.withNotTarget(true); if (opponent.choose(outcome, target, source, game)) { Permanent permanent = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/c/CrashingBoars.java b/Mage.Sets/src/mage/cards/c/CrashingBoars.java index 87806c9607b..375dc6f7763 100644 --- a/Mage.Sets/src/mage/cards/c/CrashingBoars.java +++ b/Mage.Sets/src/mage/cards/c/CrashingBoars.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; @@ -11,25 +9,28 @@ import mage.abilities.effects.common.combat.MustBeBlockedByTargetSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; import mage.constants.SetTargetPointer; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author emerald000 */ public final class CrashingBoars extends CardImpl { public CrashingBoars(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.subtype.add(SubType.BOAR); this.power = new MageInt(4); this.toughness = new MageInt(4); @@ -49,38 +50,42 @@ public final class CrashingBoars extends CardImpl { } class CrashingBoarsEffect extends OneShotEffect { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); + static { filter.add(TappedPredicate.UNTAPPED); } - + CrashingBoarsEffect() { super(Outcome.Benefit); this.staticText = "defending player chooses an untapped creature they control. That creature blocks {this} this turn if able"; } - + private CrashingBoarsEffect(final CrashingBoarsEffect effect) { super(effect); } - + @Override public CrashingBoarsEffect copy() { return new CrashingBoarsEffect(this); } - + @Override public boolean apply(Game game, Ability source) { Player defendingPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); - if (defendingPlayer != null) { - Target target = new TargetControlledCreaturePermanent(1, 1, filter, true); - if (target.choose(Outcome.Neutral, defendingPlayer.getId(), source.getSourceId(), source, game)) { - RequirementEffect effect = new MustBeBlockedByTargetSourceEffect(); - effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game)); - game.addEffect(effect, source); - } - return true; + if (defendingPlayer == null || !game.getBattlefield().contains( + StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE, + defendingPlayer.getId(), source, game, 1 + )) { + return false; } - return false; + Target target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE); + target.withNotTarget(true); + defendingPlayer.choose(Outcome.Neutral, target, source, game); + RequirementEffect effect = new MustBeBlockedByTargetSourceEffect(); + effect.setTargetPointer(new FixedTarget(target.getFirstTarget(), game)); + game.addEffect(effect, source); + return true; } } diff --git a/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java b/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java index 1df8a71620c..f802c195bf0 100644 --- a/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java +++ b/Mage.Sets/src/mage/cards/c/CrushUnderfoot.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; @@ -9,30 +7,29 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class CrushUnderfoot extends CardImpl { public CrushUnderfoot(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.KINDRED,CardType.INSTANT},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.KINDRED, CardType.INSTANT}, "{1}{R}"); this.subtype.add(SubType.GIANT); - // Choose a Giant creature you control. It deals damage equal to its power to target creature. this.getSpellAbility().addEffect(new CrushUnderfootEffect()); - this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature damage is dealt to"))); - + this.getSpellAbility().addTarget(new TargetCreaturePermanent().withChooseHint("to deal damage to")); } private CrushUnderfoot(final CrushUnderfoot card) { @@ -47,10 +44,7 @@ public final class CrushUnderfoot extends CardImpl { class CrushUnderfootEffect extends OneShotEffect { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Giant creature you control"); - static { - filter.add(SubType.GIANT.getPredicate()); - } + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(SubType.GIANT, "Giant creature you control"); public CrushUnderfootEffect() { super(Outcome.Damage); @@ -69,22 +63,24 @@ class CrushUnderfootEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - // Choose a Giant creature you control (not targeted, happens during effect resolving ) - Target target = new TargetControlledCreaturePermanent(1,1, filter,false); - if (target.canChoose(controller.getId(), source, game) - && controller.chooseTarget(outcome, target, source, game)) { - Permanent giant = game.getPermanent(target.getFirstTarget()); - if (giant != null) { - game.informPlayers("Crush Underfoot: Chosen Giant is " + giant.getName()); - Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); - if (targetCreature != null) { - targetCreature.damage(giant.getPower().getValue(), source.getSourceId(), source, game, false, true); - return true; - } - } - } + if (controller == null) { + return false; } - return false; + // Choose a Giant creature you control (not targeted, happens during effect resolving ) + Target target = new TargetPermanent(filter); + target.withNotTarget(true); + if (!target.canChoose(controller.getId(), source, game) + || !controller.chooseTarget(outcome, target, source, game)) { + return false; + } + Permanent giant = game.getPermanent(target.getFirstTarget()); + if (giant == null) { + return false; + } + game.informPlayers("Crush Underfoot: Chosen Giant is " + giant.getName()); + Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source)); + return targetCreature != null && targetCreature.damage( + giant.getPower().getValue(), source.getSourceId(), source, game, false, true + ) > 0; } } diff --git a/Mage.Sets/src/mage/cards/c/Curfew.java b/Mage.Sets/src/mage/cards/c/Curfew.java index bfcb760aa8c..903e3720e0a 100644 --- a/Mage.Sets/src/mage/cards/c/Curfew.java +++ b/Mage.Sets/src/mage/cards/c/Curfew.java @@ -1,7 +1,5 @@ - package mage.cards.c; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; @@ -13,10 +11,12 @@ import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; +import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author maxlebedev */ public final class Curfew extends CardImpl { @@ -51,16 +51,17 @@ class CurfewEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - game.informPlayers("Each player returns a creature they control to its owner's hand"); for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { Player player = game.getPlayer(playerId); - if (player != null && game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game) > 0) { - TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE, true); - player.choose(Outcome.ReturnToHand, target, source, game); - Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null) { - player.moveCards(permanent, Zone.HAND, source, game); - } + if (player == null || game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURE, playerId, game) <= 0) { + continue; + } + TargetPermanent target = new TargetControlledCreaturePermanent(); + target.withNotTarget(true); + player.choose(Outcome.ReturnToHand, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null) { + player.moveCards(permanent, Zone.HAND, source, game); } } return true; diff --git a/Mage.Sets/src/mage/cards/d/DepartedDeckhand.java b/Mage.Sets/src/mage/cards/d/DepartedDeckhand.java index eb731ca38e6..1d26fc870d3 100644 --- a/Mage.Sets/src/mage/cards/d/DepartedDeckhand.java +++ b/Mage.Sets/src/mage/cards/d/DepartedDeckhand.java @@ -1,6 +1,6 @@ package mage.cards.d; -import java.util.UUID; +import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BecomesTargetSourceTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; @@ -9,20 +9,19 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; -import mage.constants.SubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.MageInt; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class DepartedDeckhand extends CardImpl { @@ -63,7 +62,7 @@ public final class DepartedDeckhand extends CardImpl { ).setText("Another target creature you control can't be blocked this turn except by Spirits"), new ManaCostsImpl<>("{3}{U}") ); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java index 9add46c6857..83228895223 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfBolas.java @@ -1,25 +1,23 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.filter.StaticFilters; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author jeffwadsworth */ public final class DiscipleOfBolas extends CardImpl { @@ -65,21 +63,24 @@ class DiscipleOfBolasEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Target target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true); - target.setRequired(true); - if (target.canChoose(source.getControllerId(), source, game)) { - controller.chooseTarget(outcome, target, source, game); - Permanent sacrificed = game.getPermanent(target.getFirstTarget()); - if (sacrificed != null) { - sacrificed.sacrifice(source, game); - int power = sacrificed.getPower().getValue(); - controller.gainLife(power, game, source); - controller.drawCards(power, source, game); - } - } - return true; + if (controller == null) { + return false; } - return false; + SacrificeTargetCost cost = new SacrificeTargetCost(StaticFilters.FILTER_ANOTHER_CREATURE); + if (!cost.canPay(source, source, source.getControllerId(), game) + || !cost.pay(source, game, source, source.getControllerId(), true)) { + return false; + } + int power = cost + .getPermanents() + .stream() + .map(MageObject::getPower) + .mapToInt(MageInt::getValue) + .sum(); + if (power > 0) { + controller.gainLife(power, game, source); + controller.drawCards(power, source, game); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/d/Displace.java b/Mage.Sets/src/mage/cards/d/Displace.java index fe45adc664d..00715cdc183 100644 --- a/Mage.Sets/src/mage/cards/d/Displace.java +++ b/Mage.Sets/src/mage/cards/d/Displace.java @@ -4,7 +4,6 @@ import mage.abilities.effects.common.ExileThenReturnTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -18,8 +17,8 @@ public final class Displace extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}"); // Exile up to two target creatures you control, then return those cards to the battlefield under their owner's control. - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2, StaticFilters.FILTER_CONTROLLED_CREATURES, false)); this.getSpellAbility().addEffect(new ExileThenReturnTargetEffect(false, true)); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2)); } private Displace(final Displace card) { diff --git a/Mage.Sets/src/mage/cards/d/DistinguishedConjurer.java b/Mage.Sets/src/mage/cards/d/DistinguishedConjurer.java index 3054e46f84f..8f8c8f9b45d 100644 --- a/Mage.Sets/src/mage/cards/d/DistinguishedConjurer.java +++ b/Mage.Sets/src/mage/cards/d/DistinguishedConjurer.java @@ -15,7 +15,7 @@ import mage.constants.SubType; import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -45,7 +45,7 @@ public final class DistinguishedConjurer extends CardImpl { // {4}{W}, {T}: Exile another target creature you control, then return it to the battlefield under its owner’s control. Ability ability = new SimpleActivatedAbility(new ExileThenReturnTargetEffect(false, false), new ManaCostsImpl<>("{4}{W}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DiversionaryTactics.java b/Mage.Sets/src/mage/cards/d/DiversionaryTactics.java index 3cf25dae0ff..a988dfc5ef3 100644 --- a/Mage.Sets/src/mage/cards/d/DiversionaryTactics.java +++ b/Mage.Sets/src/mage/cards/d/DiversionaryTactics.java @@ -1,7 +1,5 @@ - package mage.cards.d; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -9,30 +7,28 @@ import mage.abilities.effects.common.TapTargetEffect; 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.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** * @author Loki */ public final class DiversionaryTactics extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public DiversionaryTactics(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); - Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + Ability ability = new SimpleActivatedAbility( + new TapTargetEffect(), + new TapTargetCost( + new TargetControlledPermanent(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES) + ) + ); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); - } private DiversionaryTactics(final DiversionaryTactics card) { diff --git a/Mage.Sets/src/mage/cards/d/DivineResilience.java b/Mage.Sets/src/mage/cards/d/DivineResilience.java index 58b3d0b1272..9c7cd13dd52 100644 --- a/Mage.Sets/src/mage/cards/d/DivineResilience.java +++ b/Mage.Sets/src/mage/cards/d/DivineResilience.java @@ -7,21 +7,18 @@ import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.targetadjustment.ConditionalTargetAdjuster; import java.util.UUID; /** - * * @author ciaccona007 */ public final class DivineResilience extends CardImpl { public DivineResilience(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); - // Kicker {2}{W} this.addAbility(new KickerAbility("{2}{W}")); @@ -34,7 +31,7 @@ public final class DivineResilience extends CardImpl { this.getSpellAbility().setTargetAdjuster(new ConditionalTargetAdjuster( KickedCondition.ONCE, new TargetControlledCreaturePermanent(), - new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_CREATURES, false) + new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE) )); } diff --git a/Mage.Sets/src/mage/cards/d/DreamTides.java b/Mage.Sets/src/mage/cards/d/DreamTides.java index 72ba7428972..bf72a5e91b0 100644 --- a/Mage.Sets/src/mage/cards/d/DreamTides.java +++ b/Mage.Sets/src/mage/cards/d/DreamTides.java @@ -2,14 +2,17 @@ package mage.cards.d; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.Cost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; @@ -19,7 +22,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.util.ManaUtil; import java.util.UUID; @@ -74,25 +77,25 @@ class DreamTidesEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (player != null && sourcePermanent != null) { - int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); - while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.AIDontUseIt, "Pay {2} and untap a tapped nongreen creature under your control?", source, game)) { - Target tappedCreatureTarget = new TargetControlledCreaturePermanent(1, 1, filter, true); - if (player.choose(Outcome.Detriment, tappedCreatureTarget, source, game)) { - Cost cost = ManaUtil.createManaCost(2, false); - Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - - if (cost.pay(source, game, source, player.getId(), false)) { - tappedCreature.untap(game); - } - } - countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); - } - return true; + if (player == null || sourcePermanent == null) { + return false; } - return false; + int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); + while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.AIDontUseIt, "Pay {2} and untap a tapped nongreen creature under your control?", source, game)) { + Target tappedCreatureTarget = new TargetPermanent(filter); + tappedCreatureTarget.withNotTarget(true); + if (player.choose(Outcome.Detriment, tappedCreatureTarget, source, game)) { + Cost cost = ManaUtil.createManaCost(2, false); + Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); + + if (cost.pay(source, game, source, player.getId(), false)) { + tappedCreature.untap(game); + } + } + countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/d/DropkickBomber.java b/Mage.Sets/src/mage/cards/d/DropkickBomber.java index 9d9a949ec8e..13086554ec7 100644 --- a/Mage.Sets/src/mage/cards/d/DropkickBomber.java +++ b/Mage.Sets/src/mage/cards/d/DropkickBomber.java @@ -15,16 +15,14 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; /** - * * @author ciaccona007 */ public final class DropkickBomber extends CardImpl { @@ -41,7 +39,7 @@ public final class DropkickBomber extends CardImpl { public DropkickBomber(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); - + this.subtype.add(SubType.GOBLIN); this.subtype.add(SubType.WARRIOR); this.power = new MageInt(2); @@ -67,7 +65,7 @@ public final class DropkickBomber extends CardImpl { Duration.EndOfTurn ).setText("and \"When this creature deals combat damage, sacrifice it.\"") ); - ability.addTarget(new TargetControlledCreaturePermanent(filter2)); + ability.addTarget(new TargetPermanent(filter2)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/d/DungeonDescent.java b/Mage.Sets/src/mage/cards/d/DungeonDescent.java index 265a5dde952..0598a7bd3c4 100644 --- a/Mage.Sets/src/mage/cards/d/DungeonDescent.java +++ b/Mage.Sets/src/mage/cards/d/DungeonDescent.java @@ -1,7 +1,5 @@ package mage.cards.d; -import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.common.ActivateAsSorceryActivatedAbility; import mage.abilities.common.EntersBattlefieldTappedAbility; @@ -17,10 +15,10 @@ import mage.constants.CardType; import mage.constants.SuperType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class DungeonDescent extends CardImpl { @@ -45,7 +43,7 @@ public final class DungeonDescent extends CardImpl { // {4}, {T}, Tap an untapped legendary creature you control: Venture into the dungeon. Activate only as a sorcery. Ability ability = new ActivateAsSorceryActivatedAbility(new VentureIntoTheDungeonEffect(), new GenericManaCost(4)); ability.addCost(new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(filter))); + ability.addCost(new TapTargetCost(filter)); ability.addHint(CurrentDungeonHint.instance); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/e/EagleOfDeliverance.java b/Mage.Sets/src/mage/cards/e/EagleOfDeliverance.java index 71c58d6f990..450ea1ab8cf 100644 --- a/Mage.Sets/src/mage/cards/e/EagleOfDeliverance.java +++ b/Mage.Sets/src/mage/cards/e/EagleOfDeliverance.java @@ -17,7 +17,7 @@ import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -41,7 +41,7 @@ public final class EagleOfDeliverance extends CardImpl { TriggeredAbility trigger = new EntersBattlefieldTriggeredAbility( new AddCountersTargetEffect(CounterType.INDESTRUCTIBLE.createInstance()) ); - trigger.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + trigger.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); trigger.addEffect(new EagleOfDeliveranceEffect()); this.addAbility(trigger); } @@ -80,4 +80,4 @@ class EagleOfDeliveranceEffect extends OneShotEffect { } return new DrawCardSourceControllerEffect(1).apply(game, source); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/e/Earthcraft.java b/Mage.Sets/src/mage/cards/e/Earthcraft.java index 730000169af..325992325aa 100644 --- a/Mage.Sets/src/mage/cards/e/Earthcraft.java +++ b/Mage.Sets/src/mage/cards/e/Earthcraft.java @@ -1,7 +1,5 @@ - package mage.cards.e; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -10,24 +8,22 @@ import mage.cards.CardImpl; 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.TappedPredicate; +import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; +import mage.filter.common.FilterLandPermanent; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** * @author Loki */ public final class Earthcraft extends CardImpl { - private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("untapped creature you control"); - private static final FilterControlledPermanent filterLand = new FilterControlledPermanent("basic land"); + private static final FilterPermanent filterLand = new FilterLandPermanent("basic land"); static { - filterCreature.add(TappedPredicate.UNTAPPED); - filterLand.add(CardType.LAND.getPredicate()); filterLand.add(SuperType.BASIC.getPredicate()); } @@ -35,7 +31,10 @@ public final class Earthcraft extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); // Tap an untapped creature you control: Untap target basic land. - Ability ability = new SimpleActivatedAbility(new UntapTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filterCreature, true))); + Ability ability = new SimpleActivatedAbility( + new UntapTargetEffect(), + new TapTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)) + ); ability.addTarget(new TargetPermanent(filterLand)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/e/EerieInterlude.java b/Mage.Sets/src/mage/cards/e/EerieInterlude.java index d4268449675..72d7698beb5 100644 --- a/Mage.Sets/src/mage/cards/e/EerieInterlude.java +++ b/Mage.Sets/src/mage/cards/e/EerieInterlude.java @@ -4,7 +4,6 @@ import mage.abilities.effects.common.ExileReturnBattlefieldNextEndStepTargetEffe import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -15,12 +14,12 @@ import java.util.UUID; public final class EerieInterlude extends CardImpl { public EerieInterlude(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[] {CardType.INSTANT}, "{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{W}"); // Exile any number of target creatures you control. Return those cards to the // battlefield under their owner's control at the beginning of the next end step. this.getSpellAbility().addEffect(new ExileReturnBattlefieldNextEndStepTargetEffect()); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_CREATURES, false)); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE)); } private EerieInterlude(final EerieInterlude card) { diff --git a/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java b/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java index d166d5247b4..1f98778f5d2 100644 --- a/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java +++ b/Mage.Sets/src/mage/cards/e/EfreetWeaponmaster.java @@ -13,7 +13,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -37,7 +37,7 @@ public final class EfreetWeaponmaster extends CardImpl { Ability ability = new EntersBattlefieldOrTurnedFaceUpTriggeredAbility( new BoostTargetEffect(3, 0, Duration.EndOfTurn) ); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); // Morph {2}{U}{R}{W} diff --git a/Mage.Sets/src/mage/cards/e/ElvishScout.java b/Mage.Sets/src/mage/cards/e/ElvishScout.java index 9c5a2d865b4..5528ae94f66 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishScout.java +++ b/Mage.Sets/src/mage/cards/e/ElvishScout.java @@ -1,40 +1,38 @@ - package mage.cards.e; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.PreventDamageByTargetEffect; import mage.abilities.effects.common.PreventDamageToTargetEffect; import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AttackingPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LoneFox */ public final class ElvishScout extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("attacking creature you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("attacking creature you control"); static { filter.add(AttackingPredicate.instance); } public ElvishScout(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.SCOUT); this.power = new MageInt(1); @@ -43,13 +41,12 @@ public final class ElvishScout extends CardImpl { // {G}, {tap}: Untap target attacking creature you control. Prevent all combat damage that would be dealt to and dealt by it this turn. Ability ability = new SimpleActivatedAbility(new UntapTargetEffect(), new ManaCostsImpl<>("{G}")); ability.addCost(new TapSourceCost()); - Effect effect = new PreventDamageByTargetEffect(Duration.EndOfTurn, true); - effect.setText("Prevent all combat damage that would be dealt to"); - ability.addEffect(effect); - effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE, true); - effect.setText("and dealt by it this turn"); - ability.addEffect(effect); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addEffect(new PreventDamageByTargetEffect(Duration.EndOfTurn, true) + .setText("Prevent all combat damage that would be dealt to")); + ability.addEffect(new PreventDamageToTargetEffect( + Duration.EndOfTurn, Integer.MAX_VALUE, true + ).setText("and dealt by it this turn")); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/e/EnergyTap.java b/Mage.Sets/src/mage/cards/e/EnergyTap.java index a1c89e44828..aa7f0c0d602 100644 --- a/Mage.Sets/src/mage/cards/e/EnergyTap.java +++ b/Mage.Sets/src/mage/cards/e/EnergyTap.java @@ -1,6 +1,5 @@ package mage.cards.e; -import java.util.UUID; import mage.Mana; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; @@ -13,10 +12,11 @@ import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author spjspj */ public final class EnergyTap extends CardImpl { @@ -31,7 +31,7 @@ public final class EnergyTap extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}"); // Tap target untapped creature you control. If you do, add an amount of {C} equal to that creature's converted mana cost. - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); this.getSpellAbility().addEffect(new EnergyTapEffect()); } diff --git a/Mage.Sets/src/mage/cards/e/EscapeDetection.java b/Mage.Sets/src/mage/cards/e/EscapeDetection.java index ff81d39f7c4..b18be14ef75 100644 --- a/Mage.Sets/src/mage/cards/e/EscapeDetection.java +++ b/Mage.Sets/src/mage/cards/e/EscapeDetection.java @@ -1,13 +1,8 @@ package mage.cards.e; -import java.util.UUID; - import mage.ObjectColor; -import mage.abilities.Ability; -import mage.abilities.costs.Cost; import mage.abilities.costs.common.ReturnToHandChosenControlledPermanentCost; import mage.abilities.effects.common.DrawCardSourceControllerEffect; -import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.abilities.keyword.FreerunningAbility; import mage.cards.CardImpl; @@ -16,16 +11,17 @@ import mage.constants.CardType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author grimreap124 */ public final class EscapeDetection extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("blue creature you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("blue creature you control"); static { filter.add(new ColorPredicate(ObjectColor.BLUE)); @@ -33,16 +29,14 @@ public final class EscapeDetection extends CardImpl { public EscapeDetection(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}{U}"); - // Freerunning--Return a blue creature you control to its owner's hand. - Cost cost = new ReturnToHandChosenControlledPermanentCost( - new TargetControlledCreaturePermanent(1, 1, filter, true)); - this.addAbility(new FreerunningAbility(cost)); + this.addAbility(new FreerunningAbility(new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))); // Return target creature to its owner's hand. this.getSpellAbility().addEffect(new ReturnToHandTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + // Draw a card. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("
")); } diff --git a/Mage.Sets/src/mage/cards/e/ExcaliburSwordOfEden.java b/Mage.Sets/src/mage/cards/e/ExcaliburSwordOfEden.java index 40a00e27ba1..a9e1f68ac46 100644 --- a/Mage.Sets/src/mage/cards/e/ExcaliburSwordOfEden.java +++ b/Mage.Sets/src/mage/cards/e/ExcaliburSwordOfEden.java @@ -1,7 +1,5 @@ package mage.cards.e; -import java.util.UUID; - import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -11,18 +9,17 @@ import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect; import mage.abilities.keyword.EquipAbility; import mage.abilities.keyword.VigilanceAbility; -import mage.constants.*; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.filter.FilterPermanent; -import mage.filter.StaticFilters; +import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.HistoricPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author grimreap124 */ public final class ExcaliburSwordOfEden extends CardImpl { @@ -35,12 +32,12 @@ public final class ExcaliburSwordOfEden extends CardImpl { filterLegendary.add(SuperType.LEGENDARY.getPredicate()); historicFilter.add(HistoricPredicate.instance); } - + private static final TotalPermanentsManaValue xValue = new TotalPermanentsManaValue(historicFilter); public ExcaliburSwordOfEden(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{12}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.EQUIPMENT); @@ -57,7 +54,7 @@ public final class ExcaliburSwordOfEden extends CardImpl { this.addAbility(ability); // Equip legendary creature {2} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), new TargetControlledCreaturePermanent(filterLegendary), false)); + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), new TargetPermanent(filterLegendary), false)); } diff --git a/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java b/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java index bbb08650196..0211ca6618b 100644 --- a/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java +++ b/Mage.Sets/src/mage/cards/f/FallOfTheHammer.java @@ -1,52 +1,34 @@ - package mage.cards.f; -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageWithPowerFromOneToAnotherTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.other.AnotherTargetPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; /** - * - * * As Fall of the Hammer tries to resolve, if only one of the targets is legal, * Fall of the Hammer will still resolve but will have no effect: If the first * target creature is illegal, it can't deal damage to anything. If the second * target creature is illegal, it can't be dealt damage. - * + *

* The amount of damage dealt is based on the first target creature's power as Fall of the Hammer resolves. - - + * * @author LevelX2 */ public final class FallOfTheHammer extends CardImpl { public FallOfTheHammer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}"); - + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}"); // Target creature you control deals damage equal to its power to another target creature. - this.getSpellAbility().addEffect(new FallOfTheHammerDamageEffect()); - TargetControlledCreaturePermanent target = - new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("Target creature: deals damage")); - target.setTargetTag(1); - this.getSpellAbility().addTarget(target); - - FilterCreaturePermanent filter = new FilterCreaturePermanent("Another creature: damage dealt to"); - filter.add(new AnotherTargetPredicate(2)); - TargetCreaturePermanent target2 = new TargetCreaturePermanent(filter); - target2.setTargetTag(2); - this.getSpellAbility().addTarget(target2); + this.getSpellAbility().addEffect(new DamageWithPowerFromOneToAnotherTargetEffect()); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().withChooseHint("to deal damage").setTargetTag(1)); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).withChooseHint("to receive damage").setTargetTag(2)); } private FallOfTheHammer(final FallOfTheHammer card) { @@ -58,34 +40,3 @@ public final class FallOfTheHammer extends CardImpl { return new FallOfTheHammer(this); } } - -class FallOfTheHammerDamageEffect extends OneShotEffect { - - FallOfTheHammerDamageEffect() { - super(Outcome.Damage); - this.staticText = "Target creature you control deals damage equal to its power to another target creature"; - } - - private FallOfTheHammerDamageEffect(final FallOfTheHammerDamageEffect effect) { - super(effect); - } - - @Override - public FallOfTheHammerDamageEffect copy() { - return new FallOfTheHammerDamageEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent ownCreature = game.getPermanent(source.getFirstTarget()); - if (ownCreature != null) { - int damage = ownCreature.getPower().getValue(); - Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); - if (targetCreature != null) { - targetCreature.damage(damage, ownCreature.getId(), source, game, false, true); - return true; - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/f/FamiliarsRuse.java b/Mage.Sets/src/mage/cards/f/FamiliarsRuse.java index 7a5bf7a937c..320219f4ee2 100644 --- a/Mage.Sets/src/mage/cards/f/FamiliarsRuse.java +++ b/Mage.Sets/src/mage/cards/f/FamiliarsRuse.java @@ -1,28 +1,26 @@ - package mage.cards.f; -import java.util.UUID; import mage.abilities.costs.common.ReturnToHandChosenControlledPermanentCost; import mage.abilities.effects.common.CounterTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.target.TargetSpell; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author Loki */ public final class FamiliarsRuse extends CardImpl { public FamiliarsRuse(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U}{U}"); // As an additional cost to cast Familiar's Ruse, return a creature you control to its owner's hand. - this.getSpellAbility().addCost(new ReturnToHandChosenControlledPermanentCost( - new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("creature"), true))); + this.getSpellAbility().addCost(new ReturnToHandChosenControlledPermanentCost(new TargetControlledCreaturePermanent())); + // Counter target spell. this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addTarget(new TargetSpell()); diff --git a/Mage.Sets/src/mage/cards/f/FangOfThePack.java b/Mage.Sets/src/mage/cards/f/FangOfThePack.java index 3f5c064dfba..9f7e2b608ef 100644 --- a/Mage.Sets/src/mage/cards/f/FangOfThePack.java +++ b/Mage.Sets/src/mage/cards/f/FangOfThePack.java @@ -1,21 +1,21 @@ package mage.cards.f; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.MeleeAbility; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author Styxo */ public final class FangOfThePack extends CardImpl { @@ -32,7 +32,7 @@ public final class FangOfThePack extends CardImpl { // At the beginning of combat on your turn, another target creature you control gains melee until end of turn. Ability ability = new BeginningOfCombatTriggeredAbility(new GainAbilityTargetEffect(new MeleeAbility(), Duration.EndOfTurn)); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/FieldSurgeon.java b/Mage.Sets/src/mage/cards/f/FieldSurgeon.java index 32e91858a89..11a8dceb448 100644 --- a/Mage.Sets/src/mage/cards/f/FieldSurgeon.java +++ b/Mage.Sets/src/mage/cards/f/FieldSurgeon.java @@ -1,4 +1,3 @@ - package mage.cards.f; import mage.MageInt; @@ -11,10 +10,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; @@ -24,12 +20,6 @@ import java.util.UUID; */ public final class FieldSurgeon extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public FieldSurgeon(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.HUMAN); @@ -38,8 +28,10 @@ public final class FieldSurgeon extends CardImpl { this.toughness = new MageInt(1); // Tap an untapped creature you control: Prevent the next 1 damage that would be dealt to target creature this turn. - Ability ability = new SimpleActivatedAbility(new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), - new TapTargetCost(new TargetControlledCreaturePermanent(filter))); + Ability ability = new SimpleActivatedAbility( + new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), + new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) + ); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/f/FoodChain.java b/Mage.Sets/src/mage/cards/f/FoodChain.java index b7d07f21a25..70e19426fdd 100644 --- a/Mage.Sets/src/mage/cards/f/FoodChain.java +++ b/Mage.Sets/src/mage/cards/f/FoodChain.java @@ -15,12 +15,11 @@ import mage.cards.CardSetInfo; import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Outcome; -import mage.constants.Zone; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import java.util.ArrayList; import java.util.List; @@ -35,9 +34,10 @@ public final class FoodChain extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); // Exile a creature you control: Add X mana of any one color, where X is the exiled creature's converted mana cost plus one. Spend this mana only to cast creature spells. - Ability ability = new SimpleManaAbility(Zone.BATTLEFIELD, new FoodChainManaEffect(), - new ExileTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE))); - this.addAbility(ability); + this.addAbility(new SimpleManaAbility( + new FoodChainManaEffect(), + new ExileTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE)) + )); } private FoodChain(final FoodChain card) { diff --git a/Mage.Sets/src/mage/cards/f/FriendlyRivalry.java b/Mage.Sets/src/mage/cards/f/FriendlyRivalry.java index 892eed11554..c9748da9aaf 100644 --- a/Mage.Sets/src/mage/cards/f/FriendlyRivalry.java +++ b/Mage.Sets/src/mage/cards/f/FriendlyRivalry.java @@ -7,13 +7,14 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SuperType; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.other.AnotherTargetPredicate; import mage.game.Game; import mage.game.permanent.Permanent; +import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; import java.util.ArrayList; import java.util.List; @@ -25,7 +26,7 @@ import java.util.UUID; */ public final class FriendlyRivalry extends CardImpl { - private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("other target legendary creature you control"); + private static final FilterPermanent filter2 = new FilterControlledCreaturePermanent("other target legendary creature you control"); static { filter2.add(new AnotherTargetPredicate(2)); @@ -37,15 +38,9 @@ public final class FriendlyRivalry extends CardImpl { // Target creature you control and up to one other target legendary creature you control each deal damage equal to their power to target creature you don't control. this.getSpellAbility().addEffect(new FriendlyRivalryEffect()); - - TargetControlledCreaturePermanent target1 = new TargetControlledCreaturePermanent(); - this.getSpellAbility().addTarget(target1.setTargetTag(1).withChooseHint("to deal damage")); - - TargetControlledCreaturePermanent target2 = new TargetControlledCreaturePermanent(0, 1, filter2, false); - this.getSpellAbility().addTarget(target2.setTargetTag(2).withChooseHint("to deal damage")); - - TargetCreaturePermanent target3 = new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL); - this.getSpellAbility().addTarget(target3.setTargetTag(3).withChooseHint("to take damage")); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1).withChooseHint("to deal damage")); + this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter2).setTargetTag(2).withChooseHint("to deal damage")); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL).setTargetTag(3).withChooseHint("to take damage")); } private FriendlyRivalry(final FriendlyRivalry card) { diff --git a/Mage.Sets/src/mage/cards/g/GallifreyFallsNoMore.java b/Mage.Sets/src/mage/cards/g/GallifreyFallsNoMore.java index 239abcb8d91..f4c0f6e8631 100644 --- a/Mage.Sets/src/mage/cards/g/GallifreyFallsNoMore.java +++ b/Mage.Sets/src/mage/cards/g/GallifreyFallsNoMore.java @@ -1,11 +1,5 @@ - package mage.cards.g; -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.DamageAllEffect; import mage.abilities.effects.common.PhaseOutTargetEffect; import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies; @@ -13,40 +7,34 @@ import mage.cards.CardSetInfo; import mage.cards.SplitCard; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.constants.SpellAbilityType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.game.permanent.token.CentaurToken; -import mage.players.Player; import mage.target.common.TargetControlledCreaturePermanent; import mage.watchers.common.DamagedByWatcher; +import java.util.UUID; + /** - * * @author dragonfyre23 */ public final class GallifreyFallsNoMore extends SplitCard { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("target creatures you control"); public GallifreyFallsNoMore(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{4}{R}{R}", "{2}{W}", SpellAbilityType.SPLIT_FUSED); // Gallifrey Falls // Gallifrey Falls deals 4 damage to each creature. - getLeftHalfCard().getSpellAbility().addEffect(new DamageAllEffect(4, new FilterCreaturePermanent())); + this.getLeftHalfCard().getSpellAbility().addEffect(new DamageAllEffect(4, new FilterCreaturePermanent())); //If a creature dealt damage this way would die this turn, exile it instead. - getLeftHalfCard().getSpellAbility().addEffect(new DealtDamageToCreatureBySourceDies(getLeftHalfCard(), Duration.EndOfTurn)); - getLeftHalfCard().getSpellAbility().addWatcher(new DamagedByWatcher(false)); + this.getLeftHalfCard().getSpellAbility().addEffect(new DealtDamageToCreatureBySourceDies(this.getLeftHalfCard(), Duration.EndOfTurn)); + this.getLeftHalfCard().getSpellAbility().addWatcher(new DamagedByWatcher(false)); // No More // Any number of target creatures you control phase out. - getRightHalfCard().getSpellAbility().addEffect(new PhaseOutTargetEffect()); - getRightHalfCard().getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, false)); - + this.getRightHalfCard().getSpellAbility().addEffect(new PhaseOutTargetEffect()); + this.getRightHalfCard().getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE)); } private GallifreyFallsNoMore(final GallifreyFallsNoMore card) { diff --git a/Mage.Sets/src/mage/cards/g/GateSmasher.java b/Mage.Sets/src/mage/cards/g/GateSmasher.java index add5d33975e..276d48bc734 100644 --- a/Mage.Sets/src/mage/cards/g/GateSmasher.java +++ b/Mage.Sets/src/mage/cards/g/GateSmasher.java @@ -1,12 +1,8 @@ - package mage.cards.g; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.AttachableToRestrictedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; @@ -15,22 +11,21 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.AttachmentType; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.ComparisonType; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ToughnessPredicate; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class GateSmasher extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with toughness 4 or greater"); + private static final FilterPermanent filter = new FilterCreaturePermanent("creature with toughness 4 or greater"); static { filter.add(new ToughnessPredicate(ComparisonType.MORE_THAN, 3)); @@ -40,22 +35,18 @@ public final class GateSmasher extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); this.subtype.add(SubType.EQUIPMENT); - Target target = new TargetControlledCreaturePermanent(1, 1, filter, false); // Gate Smasher can be attached only to a creature with toughness 4 or greater. - this.addAbility(new AttachableToRestrictedAbility(target)); + this.addAbility(new AttachableToRestrictedAbility(new TargetPermanent(filter))); // Equipped creature gets +3/+0 and has trample. - Effect effect = new BoostEquippedEffect(3, 0); - effect.setText("Equipped creature gets +3/+0"); - Ability ability = new SimpleStaticAbility(effect); - effect = new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT); - effect.setText("and has trample"); - ability.addEffect(effect); + Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(3, 0)); + ability.addEffect(new GainAbilityAttachedEffect( + TrampleAbility.getInstance(), AttachmentType.EQUIPMENT + ).setText("and has trample")); this.addAbility(ability); // Equip {3} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3), target, false)); - + this.addAbility(new EquipAbility(3, false)); } private GateSmasher(final GateSmasher card) { diff --git a/Mage.Sets/src/mage/cards/g/GazeOfJustice.java b/Mage.Sets/src/mage/cards/g/GazeOfJustice.java index eb15c2a56cb..988ddebe374 100644 --- a/Mage.Sets/src/mage/cards/g/GazeOfJustice.java +++ b/Mage.Sets/src/mage/cards/g/GazeOfJustice.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -10,20 +8,21 @@ import mage.abilities.keyword.FlashbackAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.TimingRule; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class GazeOfJustice extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creatures you control"); + + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped white creatures you control"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); @@ -31,15 +30,15 @@ public final class GazeOfJustice extends CardImpl { } public GazeOfJustice(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{W}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{W}"); // As an additional cost to cast Gaze of Justice, tap three untapped white creatures you control. - this.getSpellAbility().addCost(new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true))); - + this.getSpellAbility().addCost(new TapTargetCost(new TargetControlledPermanent(3, filter))); + // Exile target creature. this.getSpellAbility().addEffect(new ExileTargetEffect()); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); - + // Flashback {5}{W} this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{5}{W}"))); } diff --git a/Mage.Sets/src/mage/cards/g/GlareOfSubdual.java b/Mage.Sets/src/mage/cards/g/GlareOfSubdual.java index ccecee5f520..64e746b7b43 100644 --- a/Mage.Sets/src/mage/cards/g/GlareOfSubdual.java +++ b/Mage.Sets/src/mage/cards/g/GlareOfSubdual.java @@ -7,33 +7,25 @@ import mage.abilities.effects.common.TapTargetEffect; 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.TappedPredicate; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import java.util.UUID; /** - * * @author Loki */ public final class GlareOfSubdual extends CardImpl { - private static final FilterControlledCreaturePermanent filterCost = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filterCost.add(TappedPredicate.UNTAPPED); - } - public GlareOfSubdual(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}{W}"); - + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}{W}"); // Tap an untapped creature you control: Tap target artifact or creature. - Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filterCost, true))); + Ability ability = new SimpleActivatedAbility( + new TapTargetEffect(), + new TapTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)) + ); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GlyphOfDestruction.java b/Mage.Sets/src/mage/cards/g/GlyphOfDestruction.java index ddfb5909c3b..ccb4409e045 100644 --- a/Mage.Sets/src/mage/cards/g/GlyphOfDestruction.java +++ b/Mage.Sets/src/mage/cards/g/GlyphOfDestruction.java @@ -1,26 +1,26 @@ - package mage.cards.g; -import java.util.UUID; import mage.abilities.effects.common.DestroyTargetAtBeginningOfNextEndStepEffect; import mage.abilities.effects.common.PreventDamageToTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.BlockingPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author L_J */ public final class GlyphOfDestruction extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("blocking Wall you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("blocking Wall you control"); static { filter.add(SubType.WALL.getPredicate()); @@ -28,13 +28,13 @@ public final class GlyphOfDestruction extends CardImpl { } public GlyphOfDestruction(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}"); // Target blocking Wall you control gets +10/+0 until end of combat. Prevent all damage that would be dealt to it this turn. Destroy it at the beginning of the next end step. this.getSpellAbility().addEffect(new BoostTargetEffect(10, 0, Duration.EndOfCombat)); this.getSpellAbility().addEffect(new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE).setText("Prevent all damage that would be dealt to it this turn")); this.getSpellAbility().addEffect(new DestroyTargetAtBeginningOfNextEndStepEffect().setText("Destroy it at the beginning of the next end step")); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); } private GlyphOfDestruction(final GlyphOfDestruction card) { diff --git a/Mage.Sets/src/mage/cards/g/GoldenGuardian.java b/Mage.Sets/src/mage/cards/g/GoldenGuardian.java index d04e4c4c767..af1a5657715 100644 --- a/Mage.Sets/src/mage/cards/g/GoldenGuardian.java +++ b/Mage.Sets/src/mage/cards/g/GoldenGuardian.java @@ -1,6 +1,5 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -8,26 +7,23 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.FightTargetSourceEffect; import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.TransformAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.Zone; +import mage.constants.*; 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.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class GoldenGuardian extends CardImpl { @@ -46,11 +42,10 @@ public final class GoldenGuardian extends CardImpl { // {2}: Golden Guardian fights another target creature you control. When Golden Guardian dies this turn, return it to the battlefield transformed under your control. this.addAbility(new TransformAbility()); - Ability ability = new SimpleActivatedAbility(new GoldenGuardianEffect(), new GenericManaCost(2)); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + Ability ability = new SimpleActivatedAbility(new FightTargetSourceEffect(), new GenericManaCost(2)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new GoldenGuardianDelayedTriggeredAbility(), false)); this.addAbility(ability); - } private GoldenGuardian(final GoldenGuardian card) { @@ -63,36 +58,6 @@ public final class GoldenGuardian extends CardImpl { } } -class GoldenGuardianEffect extends OneShotEffect { - - GoldenGuardianEffect() { - super(Outcome.Damage); - this.staticText = "{this} fights another target creature you control"; - } - - private GoldenGuardianEffect(final GoldenGuardianEffect effect) { - super(effect); - } - - @Override - public GoldenGuardianEffect copy() { - return new GoldenGuardianEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent creature1 = game.getPermanent(source.getSourceId()); - Permanent creature2 = game.getPermanent(source.getFirstTarget()); - // 20110930 - 701.10 - if (creature1 != null && creature2 != null) { - if (creature1.isCreature(game) && creature2.isCreature(game)) { - return creature1.fight(creature2, source, game); - } - } - return false; - } -} - class GoldenGuardianDelayedTriggeredAbility extends DelayedTriggeredAbility { public GoldenGuardianDelayedTriggeredAbility() { diff --git a/Mage.Sets/src/mage/cards/g/GrandArchitect.java b/Mage.Sets/src/mage/cards/g/GrandArchitect.java index e21d3124bc3..99f2d0e2372 100644 --- a/Mage.Sets/src/mage/cards/g/GrandArchitect.java +++ b/Mage.Sets/src/mage/cards/g/GrandArchitect.java @@ -17,13 +17,13 @@ import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -33,7 +33,7 @@ import java.util.UUID; public final class GrandArchitect extends CardImpl { private static final FilterCreaturePermanent boostFilter = new FilterCreaturePermanent("blue creatures"); - private static final FilterControlledCreaturePermanent tapFilter = new FilterControlledCreaturePermanent("untapped blue creature you control"); + private static final FilterControlledPermanent tapFilter = new FilterControlledCreaturePermanent("untapped blue creature you control"); static { boostFilter.add(new ColorPredicate(ObjectColor.BLUE)); @@ -108,9 +108,8 @@ class GrandArchitectManaAbility extends ActivatedManaAbilityImpl { private final FilterPermanent filter; - GrandArchitectManaAbility(FilterControlledCreaturePermanent filter) { - super(Zone.BATTLEFIELD, new BasicManaEffect(new GrandArchitectConditionalMana()), - new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))); + GrandArchitectManaAbility(FilterControlledPermanent filter) { + super(Zone.BATTLEFIELD, new BasicManaEffect(new GrandArchitectConditionalMana()), new TapTargetCost(filter)); this.netMana.add(new GrandArchitectConditionalMana()); this.filter = filter; } diff --git a/Mage.Sets/src/mage/cards/g/GravespawnSovereign.java b/Mage.Sets/src/mage/cards/g/GravespawnSovereign.java index 126f0f857cf..fd0955b3970 100644 --- a/Mage.Sets/src/mage/cards/g/GravespawnSovereign.java +++ b/Mage.Sets/src/mage/cards/g/GravespawnSovereign.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -11,21 +9,20 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreatureCard; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.common.TargetCardInGraveyard; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class GravespawnSovereign extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Zombies you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped Zombies you control"); static { filter.add(SubType.ZOMBIE.getPredicate()); @@ -39,10 +36,11 @@ public final class GravespawnSovereign extends CardImpl { this.toughness = new MageInt(3); // Tap five untapped Zombies you control: Put target creature card from a graveyard onto the battlefield under your control. - Ability ability = new SimpleActivatedAbility(new ReturnFromGraveyardToBattlefieldTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(5, 5, filter, true))); + Ability ability = new SimpleActivatedAbility( + new ReturnFromGraveyardToBattlefieldTargetEffect(), new TapTargetCost(5, filter) + ); ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_A_GRAVEYARD)); this.addAbility(ability); - } private GravespawnSovereign(final GravespawnSovereign card) { diff --git a/Mage.Sets/src/mage/cards/g/GroveOfTheGuardian.java b/Mage.Sets/src/mage/cards/g/GroveOfTheGuardian.java index d2623292303..1da7365b6c4 100644 --- a/Mage.Sets/src/mage/cards/g/GroveOfTheGuardian.java +++ b/Mage.Sets/src/mage/cards/g/GroveOfTheGuardian.java @@ -13,10 +13,8 @@ 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.TappedPredicate; +import mage.filter.StaticFilters; import mage.game.permanent.token.GreenAndWhiteElementalToken; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -25,12 +23,6 @@ import java.util.UUID; */ public final class GroveOfTheGuardian extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public GroveOfTheGuardian(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); @@ -40,7 +32,7 @@ public final class GroveOfTheGuardian extends CardImpl { // {3}{G}{W}, {T}, Tap two untapped creatures you control, Sacrifice Grove of the Guardian: Create an 8/8 green and white Elemental creature token with vigilance. Ability ability = new SimpleActivatedAbility(new CreateTokenEffect(new GreenAndWhiteElementalToken(), 1), new ManaCostsImpl<>("{3}{G}{W}")); ability.addCost(new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + ability.addCost(new TapTargetCost(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); ability.addCost(new SacrificeSourceCost()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GuardianOfFaith.java b/Mage.Sets/src/mage/cards/g/GuardianOfFaith.java index 4d39ff349a1..52c49e1dd2a 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianOfFaith.java +++ b/Mage.Sets/src/mage/cards/g/GuardianOfFaith.java @@ -1,27 +1,28 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.common.PhaseOutTargetEffect; -import mage.constants.SubType; import mage.abilities.keyword.FlashAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class GuardianOfFaith extends CardImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("other target creatures you control"); + static { filter.add(AnotherPredicate.instance); } @@ -42,7 +43,7 @@ public final class GuardianOfFaith extends CardImpl { // When Guardian of Faith enters the battlefield, any number of other target creatures you control phase out. Ability ability = new EntersBattlefieldTriggeredAbility(new PhaseOutTargetEffect()); - ability.addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, false)); + ability.addTarget(new TargetPermanent(0, Integer.MAX_VALUE, filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/g/GuardianShieldBearer.java b/Mage.Sets/src/mage/cards/g/GuardianShieldBearer.java index 949b4d244a8..7c8187d8ffd 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianShieldBearer.java +++ b/Mage.Sets/src/mage/cards/g/GuardianShieldBearer.java @@ -1,6 +1,5 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.TurnedFaceUpSourceTriggeredAbility; @@ -13,16 +12,17 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class GuardianShieldBearer extends CardImpl { public GuardianShieldBearer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SOLDIER); this.power = new MageInt(2); @@ -33,9 +33,8 @@ public final class GuardianShieldBearer extends CardImpl { // When Guardian Shield-Bearer is turned face up, put a +1/+1 counter on another target creature you control. Ability ability = new TurnedFaceUpSourceTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance()), false); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); - } private GuardianShieldBearer(final GuardianShieldBearer card) { diff --git a/Mage.Sets/src/mage/cards/h/HairStrungKoto.java b/Mage.Sets/src/mage/cards/h/HairStrungKoto.java index 9c339dd0103..01e67622f1e 100644 --- a/Mage.Sets/src/mage/cards/h/HairStrungKoto.java +++ b/Mage.Sets/src/mage/cards/h/HairStrungKoto.java @@ -1,39 +1,38 @@ package mage.cards.h; -import java.util.UUID; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.effects.common.MillCardsTargetEffect; 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.common.FilterControlledPermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.TargetPlayer; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author LevelX */ public final class HairStrungKoto extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); static { filter.add(TappedPredicate.UNTAPPED); } - public HairStrungKoto (UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}"); + public HairStrungKoto(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}"); - /* Tap an untapped creature you control: Target player puts the top - * card of their library into their graveyard. - */ + // Tap an untapped creature you control: Target player puts the top card of their library into their graveyard. SimpleActivatedAbility ability = new SimpleActivatedAbility( new MillCardsTargetEffect(1), - new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) + ); ability.addTarget(new TargetPlayer()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/h/HakbalOfTheSurgingSoul.java b/Mage.Sets/src/mage/cards/h/HakbalOfTheSurgingSoul.java index 91580715647..16665e4b411 100644 --- a/Mage.Sets/src/mage/cards/h/HakbalOfTheSurgingSoul.java +++ b/Mage.Sets/src/mage/cards/h/HakbalOfTheSurgingSoul.java @@ -1,35 +1,35 @@ package mage.cards.h; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AttacksTriggeredAbility; -import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.keyword.ExploreSourceEffect; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.cards.Card; -import mage.constants.*; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.*; import mage.filter.FilterCard; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCardInHand; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.List; +import java.util.UUID; /** - * * @author Grath */ public final class HakbalOfTheSurgingSoul extends CardImpl { public HakbalOfTheSurgingSoul(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.MERFOLK); this.subtype.add(SubType.SCOUT); @@ -55,24 +55,24 @@ public final class HakbalOfTheSurgingSoul extends CardImpl { class HakbalOfTheSurgingSoulExploreEffect extends OneShotEffect { - HakbalOfTheSurgingSoulExploreEffect( ) { + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(SubType.MERFOLK); + + HakbalOfTheSurgingSoulExploreEffect() { super(Outcome.Benefit); staticText = "each Merfolk creature you control explores"; } - HakbalOfTheSurgingSoulExploreEffect(HakbalOfTheSurgingSoulExploreEffect effect ) { + HakbalOfTheSurgingSoulExploreEffect(HakbalOfTheSurgingSoulExploreEffect effect) { super(effect); } @Override public boolean apply(Game game, Ability source) { - FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(SubType.MERFOLK); - List creatures = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game); Player player = game.getPlayer(source.getControllerId()); if (player != null && player.chooseUse(Outcome.AIDontUseIt, "Choose order for Merfolk to explore? (Note: You will need to set \"Auto-choose targets for player:\" to \"Off\" in Preferences.)", source, game)) { - TargetPermanent target = new TargetControlledCreaturePermanent(creatures.size(), creatures.size(), filter, true); + TargetPermanent target = new TargetPermanent(creatures.size(), creatures.size(), filter, true); target.withChooseHint("the order in which to explore (first selected will explore first)"); player.choose(outcome, target, source, game); for (UUID targetId : target.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/h/HanSoloScrumrat.java b/Mage.Sets/src/mage/cards/h/HanSoloScrumrat.java index b0b9a81407d..5baa79e3b64 100644 --- a/Mage.Sets/src/mage/cards/h/HanSoloScrumrat.java +++ b/Mage.Sets/src/mage/cards/h/HanSoloScrumrat.java @@ -1,33 +1,34 @@ package mage.cards.h; -import java.util.UUID; import mage.MageInt; -import mage.abilities.*; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.PartnerWithAbility; -import mage.constants.*; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author NinthWorld */ public final class HanSoloScrumrat extends CardImpl { public HanSoloScrumrat(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.ROGUE); @@ -38,11 +39,13 @@ public final class HanSoloScrumrat extends CardImpl { this.addAbility(new PartnerWithAbility("Chewbacca, the Beast")); // R: Han Solo, Scrumrat gains first strike until end of turn. - this.addAbility(new SimpleActivatedAbility(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{R}"))); + this.addAbility(new SimpleActivatedAbility(new GainAbilitySourceEffect( + FirstStrikeAbility.getInstance(), Duration.EndOfTurn + ), new ManaCostsImpl<>("{R}"))); // Whenever Han Solo, Scrumrat deals damage during your turn, put a +1/+1 counter on another target creature you control. Ability ability = new HanSoloScrumratTriggeredAbility(); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } @@ -75,7 +78,7 @@ class HanSoloScrumratTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT - || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + || event.getType() == GameEvent.EventType.DAMAGED_PLAYER; } @Override diff --git a/Mage.Sets/src/mage/cards/h/HandOfJustice.java b/Mage.Sets/src/mage/cards/h/HandOfJustice.java index 251edadb036..d3a534e4fb1 100644 --- a/Mage.Sets/src/mage/cards/h/HandOfJustice.java +++ b/Mage.Sets/src/mage/cards/h/HandOfJustice.java @@ -1,7 +1,5 @@ - package mage.cards.h; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -13,20 +11,20 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class HandOfJustice extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creatures you control"); + + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped white creatures you control"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); @@ -34,14 +32,14 @@ public final class HandOfJustice extends CardImpl { } public HandOfJustice(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}"); this.subtype.add(SubType.AVATAR); this.power = new MageInt(2); this.toughness = new MageInt(6); // {tap}, Tap three untapped white creatures you control: Destroy target creature. Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true))); + ability.addCost(new TapTargetCost(3, filter)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/h/HavengulSkaab.java b/Mage.Sets/src/mage/cards/h/HavengulSkaab.java index fcdede83ef3..445ced869f9 100644 --- a/Mage.Sets/src/mage/cards/h/HavengulSkaab.java +++ b/Mage.Sets/src/mage/cards/h/HavengulSkaab.java @@ -1,27 +1,23 @@ package mage.cards.h; -import java.util.UUID; import mage.MageInt; -import mage.abilities.TriggeredAbilityImpl; -import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.ReturnToHandChosenControlledPermanentEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author noxx */ public final class HavengulSkaab extends CardImpl { public HavengulSkaab(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}"); this.subtype.add(SubType.ZOMBIE); this.subtype.add(SubType.HORROR); @@ -29,7 +25,7 @@ public final class HavengulSkaab extends CardImpl { this.toughness = new MageInt(5); // Whenever Havengul Skaab attacks, return another creature you control to its owner's hand. - this.addAbility(new HavengulSkaabAbility()); + this.addAbility(new AttacksTriggeredAbility(new ReturnToHandChosenControlledPermanentEffect(StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL))); } private HavengulSkaab(final HavengulSkaab card) { @@ -41,39 +37,3 @@ public final class HavengulSkaab extends CardImpl { return new HavengulSkaab(this); } } - -class HavengulSkaabAbility extends TriggeredAbilityImpl { - - public HavengulSkaabAbility() { - super(Zone.BATTLEFIELD, new ReturnToHandTargetEffect()); - } - - private HavengulSkaabAbility(final HavengulSkaabAbility ability) { - super(ability); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.ATTACKER_DECLARED; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getSourceId().equals(this.getSourceId())) { - TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL, true); - this.addTarget(target); - return true; - } - return false; - } - - @Override - public String getRule() { - return "Whenever {this} attacks, return another creature you control to its owner's hand."; - } - - @Override - public HavengulSkaabAbility copy() { - return new HavengulSkaabAbility(this); - } -} diff --git a/Mage.Sets/src/mage/cards/h/HazduhrTheAbbot.java b/Mage.Sets/src/mage/cards/h/HazduhrTheAbbot.java index cc5bae4eb23..24692c5aced 100644 --- a/Mage.Sets/src/mage/cards/h/HazduhrTheAbbot.java +++ b/Mage.Sets/src/mage/cards/h/HazduhrTheAbbot.java @@ -1,4 +1,3 @@ - package mage.cards.h; import mage.MageInt; @@ -10,25 +9,27 @@ import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.RedirectionEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; import mage.util.CardUtil; import java.util.UUID; /** - * * @author TheElk801 & L_J */ public final class HazduhrTheAbbot extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("white creature you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("white creature you control"); static { filter.add(new ColorPredicate(ObjectColor.WHITE)); @@ -45,7 +46,7 @@ public final class HazduhrTheAbbot extends CardImpl { // {X}, {T}: The next X damage that would be dealt this turn to target white creature you control is dealt to Hazduhr the Abbot instead. Ability ability = new SimpleActivatedAbility(new HazduhrTheAbbotRedirectDamageEffect(Duration.EndOfTurn), new ManaCostsImpl<>("{X}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } @@ -61,8 +62,6 @@ public final class HazduhrTheAbbot extends CardImpl { class HazduhrTheAbbotRedirectDamageEffect extends RedirectionEffect { - private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent(); - public HazduhrTheAbbotRedirectDamageEffect(Duration duration) { super(duration, 0, UsageType.ACCORDING_DURATION); this.staticText = "The next X damage that would be dealt this turn to target white creature you control is dealt to {this} instead"; @@ -85,19 +84,15 @@ class HazduhrTheAbbotRedirectDamageEffect extends RedirectionEffect { @Override public boolean applies(GameEvent event, Ability source, Game game) { - Permanent permanent = game.getPermanent(source.getSourceId()); - if (permanent != null) { - if (filter.match(permanent, permanent.getControllerId(), source, game)) { - if (event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { - if (event.getTargetId() != null) { - TargetPermanent target = new TargetPermanent(); - target.add(source.getSourceId(), game); - redirectTarget = target; - return true; - } - } - } + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (permanent == null + || !event.getTargetId().equals(getTargetPointer().getFirst(game, source)) + || event.getTargetId() == null) { + return false; } - return false; + TargetPermanent target = new TargetPermanent(); + target.add(source.getSourceId(), game); + redirectTarget = target; + return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java index 0a17b5860db..9e9efc8e9f2 100644 --- a/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java +++ b/Mage.Sets/src/mage/cards/h/HeartPiercerManticore.java @@ -1,9 +1,11 @@ package mage.cards.h; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.costs.common.SacrificeTargetCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageTargetEffect; @@ -15,11 +17,7 @@ import mage.constants.Outcome; import mage.constants.SubType; import mage.filter.StaticFilters; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.Target; -import mage.target.common.TargetAnyTarget; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -36,7 +34,7 @@ public final class HeartPiercerManticore extends CardImpl { this.toughness = new MageInt(3); // When Heart-Piercer Manticore enters the battlefield, you may sacrifice another creature. When you do, Heart-Piercer Manticore deals damage equal to that creature's power to any target. - this.addAbility(new EntersBattlefieldTriggeredAbility(new HeartPiercerManticoreSacrificeEffect(), true)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new HeartPiercerManticoreEffect())); // Embalm {5}{R} this.addAbility(new EmbalmAbility(new ManaCostsImpl<>("{5}{R}"), this)); @@ -52,21 +50,21 @@ public final class HeartPiercerManticore extends CardImpl { } } -class HeartPiercerManticoreSacrificeEffect extends OneShotEffect { +class HeartPiercerManticoreEffect extends OneShotEffect { - HeartPiercerManticoreSacrificeEffect() { + HeartPiercerManticoreEffect() { super(Outcome.Damage); - this.staticText = "sacrifice another creature. When you do, " + this.staticText = "you may sacrifice another creature. When you do, " + "{this} deals damage equal to that creature's power to any target"; } - private HeartPiercerManticoreSacrificeEffect(final HeartPiercerManticoreSacrificeEffect effect) { + private HeartPiercerManticoreEffect(final HeartPiercerManticoreEffect effect) { super(effect); } @Override - public HeartPiercerManticoreSacrificeEffect copy() { - return new HeartPiercerManticoreSacrificeEffect(this); + public HeartPiercerManticoreEffect copy() { + return new HeartPiercerManticoreEffect(this); } @Override @@ -75,26 +73,22 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect { if (controller == null) { return false; } - Target target = new TargetControlledCreaturePermanent( - 1, 1, StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE, true - ); - if (!controller.choose(outcome, target, source, game)) { - return false; - } - Permanent toSacrifice = game.getPermanent(target.getFirstTarget()); - if (toSacrifice == null) { - return false; - } - int power = toSacrifice.getPower().getValue(); - if (!toSacrifice.sacrifice(source, game)) { + SacrificeTargetCost cost = new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE); + if (!cost.canPay(source, source, source.getControllerId(), game) + || !controller.chooseUse(outcome, "Sacrifice another creature?", source, game) + || !cost.pay(source, game, source, source.getControllerId(), false)) { return false; } + int power = cost + .getPermanents() + .stream() + .map(MageObject::getPower) + .mapToInt(MageInt::getValue) + .sum(); ReflexiveTriggeredAbility trigger = new ReflexiveTriggeredAbility( new DamageTargetEffect(power), false, "{this} deals damage equal to that creature's power to any target." ); - trigger.addTarget(new TargetAnyTarget()); - game.fireReflexiveTriggeredAbility(trigger, source); return true; } } diff --git a/Mage.Sets/src/mage/cards/h/HopefulInitiate.java b/Mage.Sets/src/mage/cards/h/HopefulInitiate.java index 01197fc5adf..9a2d8e2e2b7 100644 --- a/Mage.Sets/src/mage/cards/h/HopefulInitiate.java +++ b/Mage.Sets/src/mage/cards/h/HopefulInitiate.java @@ -1,24 +1,24 @@ package mage.cards.h; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.RemoveCounterCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DestroyTargetEffect; -import mage.constants.SubType; import mage.abilities.keyword.TrainingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; +import mage.constants.SubType; import mage.counters.CounterType; import mage.filter.StaticFilters; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author weirddan455 */ public final class HopefulInitiate extends CardImpl { @@ -37,8 +37,7 @@ public final class HopefulInitiate extends CardImpl { // {2}{W}, Remove two +1/+1 counters from among creatures you control: Destroy target artifact or enchantment. Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new ManaCostsImpl<>("{2}{W}")); ability.addCost(new RemoveCounterCost( - new TargetControlledCreaturePermanent(1, 2, StaticFilters.FILTER_CONTROLLED_CREATURES, true), - CounterType.P1P1, 2 + new TargetControlledCreaturePermanent(1, 2), CounterType.P1P1, 2 ).setText("Remove two +1/+1 counters from among creatures you control")); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT)); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/h/HundredTalonStrike.java b/Mage.Sets/src/mage/cards/h/HundredTalonStrike.java index 2868cdbf4c6..8eee68b787e 100644 --- a/Mage.Sets/src/mage/cards/h/HundredTalonStrike.java +++ b/Mage.Sets/src/mage/cards/h/HundredTalonStrike.java @@ -2,7 +2,6 @@ package mage.cards.h; import mage.ObjectColor; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -13,40 +12,40 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; /** - * * @author LevelX2 */ public final class HundredTalonStrike extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creature you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped white creature you control"); + static { filter.add(TappedPredicate.UNTAPPED); filter.add(new ColorPredicate(ObjectColor.WHITE)); } public HundredTalonStrike(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{W}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}"); this.subtype.add(SubType.ARCANE); // Target creature gets +1/+0 and gains first strike until end of turn. - Effect effect = new BoostTargetEffect(1,0, Duration.EndOfTurn); - effect.setText("Target creature gets +1/+0"); - this.getSpellAbility().addEffect(effect); - effect = new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn); - effect.setText("and gains first strike until end of turn"); - this.getSpellAbility().addEffect(effect); + this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0).setText("Target creature gets +1/+0")); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect( + FirstStrikeAbility.getInstance(), Duration.EndOfTurn + ).setText("and gains first strike until end of turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent().withChooseHint("+1/+0 and first strike")); + // Splice onto Arcane-Tap an untapped white creature you control. - this.addAbility(new SpliceAbility(SpliceAbility.ARCANE, new TapTargetCost(new TargetControlledCreaturePermanent(1,1,filter,false)))); + this.addAbility(new SpliceAbility(SpliceAbility.ARCANE, new TapTargetCost(new TargetControlledPermanent(filter)))); } private HundredTalonStrike(final HundredTalonStrike card) { diff --git a/Mage.Sets/src/mage/cards/h/HuntTheHunter.java b/Mage.Sets/src/mage/cards/h/HuntTheHunter.java index 8e17f86a2b8..dcaad9da873 100644 --- a/Mage.Sets/src/mage/cards/h/HuntTheHunter.java +++ b/Mage.Sets/src/mage/cards/h/HuntTheHunter.java @@ -1,35 +1,30 @@ - package mage.cards.h; -import java.util.UUID; import mage.ObjectColor; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.FightTargetsEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.TargetController; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.common.FilterOpponentsCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class HuntTheHunter extends CardImpl { - private static final FilterControlledCreaturePermanent filterControlledGreen = new FilterControlledCreaturePermanent("green creature you control"); - private static final FilterCreaturePermanent filterOpponentGreen = new FilterCreaturePermanent("green creature an opponent controls"); + private static final FilterControlledPermanent filterControlledGreen = new FilterControlledCreaturePermanent("green creature you control"); + private static final FilterPermanent filterOpponentGreen = new FilterOpponentsCreaturePermanent("green creature an opponent controls"); static { filterControlledGreen.add(new ColorPredicate(ObjectColor.GREEN)); - filterOpponentGreen.add(TargetController.OPPONENT.getControllerPredicate()); filterOpponentGreen.add(new ColorPredicate(ObjectColor.GREEN)); } @@ -37,15 +32,10 @@ public final class HuntTheHunter extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); // Target green creature you control gets +2/+2 until end of turn. It fights target green creature an opponent controls. - Effect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn); - this.getSpellAbility().addEffect(effect); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(1, 1, filterControlledGreen, false)); - - effect = new FightTargetsEffect(); - effect.setText("It fights target green creature an opponent controls"); - this.getSpellAbility().addEffect(effect); - Target target = new TargetCreaturePermanent(filterOpponentGreen); - this.getSpellAbility().addTarget(target); + this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2)); + this.getSpellAbility().addTarget(new TargetPermanent(filterControlledGreen)); + this.getSpellAbility().addEffect(new FightTargetsEffect().setText("It fights target green creature an opponent controls")); + this.getSpellAbility().addTarget(new TargetPermanent(filterOpponentGreen)); } private HuntTheHunter(final HuntTheHunter card) { diff --git a/Mage.Sets/src/mage/cards/i/IllusionistsStratagem.java b/Mage.Sets/src/mage/cards/i/IllusionistsStratagem.java index 5c4992102ba..139d721d8c0 100644 --- a/Mage.Sets/src/mage/cards/i/IllusionistsStratagem.java +++ b/Mage.Sets/src/mage/cards/i/IllusionistsStratagem.java @@ -5,7 +5,6 @@ import mage.abilities.effects.common.ExileThenReturnTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -20,8 +19,7 @@ public final class IllusionistsStratagem extends CardImpl { // Exile up to two target creatures you control, then return those cards to the battlefield under their owner's control. this.getSpellAbility().addEffect(new ExileThenReturnTargetEffect(false, true)); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2, - StaticFilters.FILTER_CONTROLLED_CREATURES, false)); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 2)); // Draw a card. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1).concatBy("
")); diff --git a/Mage.Sets/src/mage/cards/i/ImperialAerosaur.java b/Mage.Sets/src/mage/cards/i/ImperialAerosaur.java index 0a974072b93..f77cc637d2d 100644 --- a/Mage.Sets/src/mage/cards/i/ImperialAerosaur.java +++ b/Mage.Sets/src/mage/cards/i/ImperialAerosaur.java @@ -1,9 +1,7 @@ package mage.cards.i; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.FlyingAbility; @@ -13,10 +11,11 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class ImperialAerosaur extends CardImpl { @@ -32,13 +31,13 @@ public final class ImperialAerosaur extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // When Imperial Aerosaur enters the battlefield, another target creature you control gets +1/+1 and gains flying until end of turn. - Effect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn); - effect.setText("another target creature you control gets +1/+1"); - EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(effect); - effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn); - effect.setText("and gains flying until end of turn"); - ability.addEffect(effect); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL)); + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility( + new BoostTargetEffect(1, 1).setText("another target creature you control gets +1/+1") + ); + ability.addEffect(new GainAbilityTargetEffect( + FlyingAbility.getInstance(), Duration.EndOfTurn + ).setText("and gains flying until end of turn")); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JasperaSentinel.java b/Mage.Sets/src/mage/cards/j/JasperaSentinel.java index 3e6f97cf6e3..4c206e94aef 100644 --- a/Mage.Sets/src/mage/cards/j/JasperaSentinel.java +++ b/Mage.Sets/src/mage/cards/j/JasperaSentinel.java @@ -1,32 +1,23 @@ package mage.cards.j; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.mana.AnyColorManaAbility; -import mage.constants.SubType; import mage.abilities.keyword.ReachAbility; +import mage.abilities.mana.AnyColorManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.constants.SubType; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class JasperaSentinel extends CardImpl { - private static final FilterControlledCreaturePermanent filter - = new FilterControlledCreaturePermanent("an untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public JasperaSentinel(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}"); @@ -40,7 +31,7 @@ public final class JasperaSentinel extends CardImpl { // {T}, Tap an untapped creature you control: Add one mana of any color. Ability ability = new AnyColorManaAbility(); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(filter))); + ability.addCost(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JediSentinel.java b/Mage.Sets/src/mage/cards/j/JediSentinel.java index fdf53233d97..d2b02fb1428 100644 --- a/Mage.Sets/src/mage/cards/j/JediSentinel.java +++ b/Mage.Sets/src/mage/cards/j/JediSentinel.java @@ -11,7 +11,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.EachTargetPointer; @@ -35,7 +35,7 @@ public final class JediSentinel extends CardImpl { // When Jedi Sentinel enters the battlefield, return another target creature you control and target creature you don't control to their owners' hands. Effect effect = new ReturnToHandTargetEffect().setTargetPointer(new EachTargetPointer()); Ability ability = new EntersBattlefieldTriggeredAbility(effect); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); ability.addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/j/JennyFlint.java b/Mage.Sets/src/mage/cards/j/JennyFlint.java index 5a026b5706f..ded14374a75 100644 --- a/Mage.Sets/src/mage/cards/j/JennyFlint.java +++ b/Mage.Sets/src/mage/cards/j/JennyFlint.java @@ -1,7 +1,7 @@ package mage.cards.j; import mage.MageInt; -import mage.abilities.TriggeredAbility; +import mage.abilities.Ability; import mage.abilities.common.SacrificePermanentTriggeredAbility; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.FirstStrikeAbility; @@ -16,7 +16,7 @@ import mage.counters.CounterType; import mage.filter.FilterPermanent; import mage.filter.StaticFilters; import mage.filter.predicate.Predicates; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -53,12 +53,11 @@ public final class JennyFlint extends CardImpl { this.addAbility(new TrainingAbility()); // Whenever you sacrifice a Clue or Food, put a +1/+1 counter on another target creature you control. - TriggeredAbility trigger = new SacrificePermanentTriggeredAbility( - new AddCountersTargetEffect(CounterType.P1P1.createInstance()), - filter + Ability ability = new SacrificePermanentTriggeredAbility( + new AddCountersTargetEffect(CounterType.P1P1.createInstance()), filter ); - trigger.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); - this.addAbility(trigger); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + this.addAbility(ability); } private JennyFlint(final JennyFlint card) { diff --git a/Mage.Sets/src/mage/cards/j/JeskaiBarricade.java b/Mage.Sets/src/mage/cards/j/JeskaiBarricade.java index 4df70be8bff..7987818b455 100644 --- a/Mage.Sets/src/mage/cards/j/JeskaiBarricade.java +++ b/Mage.Sets/src/mage/cards/j/JeskaiBarricade.java @@ -1,4 +1,3 @@ - package mage.cards.j; import mage.MageInt; @@ -12,31 +11,30 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; /** - * * @author fireshoes */ public final class JeskaiBarricade extends CardImpl { public JeskaiBarricade(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.WALL); this.power = new MageInt(0); this.toughness = new MageInt(4); // Flash this.addAbility(FlashAbility.getInstance()); + // Defender this.addAbility(DefenderAbility.getInstance()); + // When Jeskai Barricade enters the battlefield, you may return another target creature you control to its owner's hand. Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true); - Target target = new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL); - ability.addTarget(target); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/k/KikiJikiMirrorBreaker.java b/Mage.Sets/src/mage/cards/k/KikiJikiMirrorBreaker.java index 321feeb05eb..bf78dba3fdd 100644 --- a/Mage.Sets/src/mage/cards/k/KikiJikiMirrorBreaker.java +++ b/Mage.Sets/src/mage/cards/k/KikiJikiMirrorBreaker.java @@ -1,37 +1,34 @@ - package mage.cards.k; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenCopyTargetEffect; -import mage.abilities.effects.common.SacrificeTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.SuperType; -import mage.constants.Zone; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author jonubuu */ public final class KikiJikiMirrorBreaker extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("nonlegendary creature you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("nonlegendary creature you control"); static { filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); @@ -48,11 +45,11 @@ public final class KikiJikiMirrorBreaker extends CardImpl { // Haste this.addAbility(HasteAbility.getInstance()); + // {T}: Create a token that's a copy of target nonlegendary creature you control, except it has haste. Sacrifice it at the beginning of the next end step. Ability ability = new SimpleActivatedAbility(new KikiJikiMirrorBreakerEffect(), new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(1, 1, filter, false)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); - } private KikiJikiMirrorBreaker(final KikiJikiMirrorBreaker card) { diff --git a/Mage.Sets/src/mage/cards/k/KondasBanner.java b/Mage.Sets/src/mage/cards/k/KondasBanner.java index 137f405895d..e706ee087a0 100644 --- a/Mage.Sets/src/mage/cards/k/KondasBanner.java +++ b/Mage.Sets/src/mage/cards/k/KondasBanner.java @@ -1,29 +1,31 @@ package mage.cards.k; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.AttachableToRestrictedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.continuous.BoostAllEffect; import mage.abilities.keyword.EquipAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.filter.FilterPermanent; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX */ public final class KondasBanner extends CardImpl { - private static final FilterControlledCreaturePermanent legendaryFilter = new FilterControlledCreaturePermanent("legendary creature"); + private static final FilterPermanent legendaryFilter = new FilterCreaturePermanent("legendary creature"); static { legendaryFilter.add(SuperType.LEGENDARY.getPredicate()); @@ -34,9 +36,8 @@ public final class KondasBanner extends CardImpl { this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.EQUIPMENT); - Target target = new TargetControlledCreaturePermanent(1, 1, legendaryFilter, false); // Konda's Banner can be attached only to a legendary creature. - this.addAbility(new AttachableToRestrictedAbility(target)); + this.addAbility(new AttachableToRestrictedAbility(new TargetPermanent(legendaryFilter))); // Creatures that share a color with equipped creature get +1/+1. this.addAbility(new SimpleStaticAbility(new KondasBannerColorBoostEffect())); @@ -45,8 +46,7 @@ public final class KondasBanner extends CardImpl { this.addAbility(new SimpleStaticAbility(new KondasBannerTypeBoostEffect())); // Equip {2} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), target, false)); - + this.addAbility(new EquipAbility(2, false)); } private KondasBanner(final KondasBanner card) { diff --git a/Mage.Sets/src/mage/cards/k/KoskunFalls.java b/Mage.Sets/src/mage/cards/k/KoskunFalls.java index 263c52f2a9e..085d753fb0e 100644 --- a/Mage.Sets/src/mage/cards/k/KoskunFalls.java +++ b/Mage.Sets/src/mage/cards/k/KoskunFalls.java @@ -1,51 +1,38 @@ - package mage.cards.k; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; +import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.abilities.effects.common.combat.CantAttackYouUnlessPayAllEffect; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SuperType; +import mage.filter.StaticFilters; import java.util.UUID; /** - * * @author fireshoes */ public final class KoskunFalls extends CardImpl { - - private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filterCreature.add(TappedPredicate.UNTAPPED); - } public KoskunFalls(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}{B}"); this.supertype.add(SuperType.WORLD); // At the beginning of your upkeep, sacrifice Koskun Falls unless you tap an untapped creature you control. - Effect effect = new SacrificeSourceUnlessPaysEffect(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filterCreature, true))); - effect.setText("sacrifice Koskun Falls unless you tap an untapped creature you control"); - this.addAbility(new BeginningOfUpkeepTriggeredAbility(effect)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new SacrificeSourceUnlessPaysEffect(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)) + )); // Creatures can't attack you unless their controller pays {2} for each creature they control that's attacking you. - this.addAbility(new SimpleStaticAbility( - Zone.BATTLEFIELD, - new CantAttackYouUnlessPayAllEffect( - Duration.WhileOnBattlefield, - new ManaCostsImpl<>("{2}") - ) - )); + this.addAbility(new SimpleStaticAbility(new CantAttackYouUnlessPayAllEffect( + Duration.WhileOnBattlefield, new GenericManaCost(2) + ))); } private KoskunFalls(final KoskunFalls card) { diff --git a/Mage.Sets/src/mage/cards/k/KyrenNegotiations.java b/Mage.Sets/src/mage/cards/k/KyrenNegotiations.java index 70b3f95e24e..a99463dd172 100644 --- a/Mage.Sets/src/mage/cards/k/KyrenNegotiations.java +++ b/Mage.Sets/src/mage/cards/k/KyrenNegotiations.java @@ -1,6 +1,5 @@ package mage.cards.k; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -8,31 +7,22 @@ import mage.abilities.effects.common.DamageTargetEffect; 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.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.target.common.TargetPlayerOrPlaneswalker; +import java.util.UUID; + /** - * * @author ingmargoudt */ public final class KyrenNegotiations extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public KyrenNegotiations(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}"); // Tap an untapped creature you control: Kyren Negotiations deals 1 damage to target player. Ability ability = new SimpleActivatedAbility( - new DamageTargetEffect(1), - new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)) + new DamageTargetEffect(1), new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) ); ability.addTarget(new TargetPlayerOrPlaneswalker()); this.addAbility(ability); diff --git a/Mage.Sets/src/mage/cards/l/LilysplashMentor.java b/Mage.Sets/src/mage/cards/l/LilysplashMentor.java index 68e008a0fa7..1a442a90862 100644 --- a/Mage.Sets/src/mage/cards/l/LilysplashMentor.java +++ b/Mage.Sets/src/mage/cards/l/LilysplashMentor.java @@ -19,20 +19,19 @@ import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.util.CardUtil; import java.util.UUID; /** - * * @author notgreat */ public final class LilysplashMentor extends CardImpl { public LilysplashMentor(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); - + this.subtype.add(SubType.FROG); this.subtype.add(SubType.DRUID); this.power = new MageInt(4); @@ -43,7 +42,7 @@ public final class LilysplashMentor extends CardImpl { // {1}{G}{U}: Exile another target creature you control, then return it to the battlefield under its owner's control with a +1/+1 counter on it. Activate only as a sorcery. Ability ability = new ActivateAsSorceryActivatedAbility(new LilysplashMentorEffect(), new ManaCostsImpl<>("{1}{G}{U}")); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } @@ -56,6 +55,7 @@ public final class LilysplashMentor extends CardImpl { return new LilysplashMentor(this); } } + //Copied from Planar Incision class LilysplashMentorEffect extends OneShotEffect { diff --git a/Mage.Sets/src/mage/cards/l/LlanowarBehemoth.java b/Mage.Sets/src/mage/cards/l/LlanowarBehemoth.java index c5264808242..f22a89318d5 100644 --- a/Mage.Sets/src/mage/cards/l/LlanowarBehemoth.java +++ b/Mage.Sets/src/mage/cards/l/LlanowarBehemoth.java @@ -1,7 +1,5 @@ - package mage.cards.l; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -9,33 +7,29 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.constants.SubType; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author Plopman */ public final class LlanowarBehemoth extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - static { - filter.add(TappedPredicate.UNTAPPED); - } - public LlanowarBehemoth(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.subtype.add(SubType.ELEMENTAL); this.power = new MageInt(4); this.toughness = new MageInt(4); // Tap an untapped creature you control: Llanowar Behemoth gets +1/+1 until end of turn. - this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)))); + this.addAbility(new SimpleActivatedAbility( + new BoostSourceEffect(1, 1, Duration.EndOfTurn), + new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) + )); } private LlanowarBehemoth(final LlanowarBehemoth card) { diff --git a/Mage.Sets/src/mage/cards/l/LoamDryad.java b/Mage.Sets/src/mage/cards/l/LoamDryad.java index 510ba342a9e..d2859b1c33b 100644 --- a/Mage.Sets/src/mage/cards/l/LoamDryad.java +++ b/Mage.Sets/src/mage/cards/l/LoamDryad.java @@ -1,7 +1,6 @@ package mage.cards.l; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.costs.common.TapTargetCost; @@ -10,24 +9,17 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class LoamDryad extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public LoamDryad(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}"); this.subtype.add(SubType.DRYAD); this.subtype.add(SubType.HORROR); this.power = new MageInt(1); @@ -35,7 +27,7 @@ public final class LoamDryad extends CardImpl { // {T}, Tap an untapped creature you control: Add one mana of any color. Ability ability = new AnyColorManaAbility(); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability.addCost(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/l/LothlorienBlade.java b/Mage.Sets/src/mage/cards/l/LothlorienBlade.java index bb1dbec9197..ceb04010815 100644 --- a/Mage.Sets/src/mage/cards/l/LothlorienBlade.java +++ b/Mage.Sets/src/mage/cards/l/LothlorienBlade.java @@ -15,7 +15,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.DefendingPlayerControlsAttachedAttackingPredicate; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; @@ -34,7 +34,7 @@ public final class LothlorienBlade extends CardImpl { public LothlorienBlade(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); - + this.subtype.add(SubType.EQUIPMENT); // Whenever equipped creature attacks, it deals damage equal to its power to target creature defending player controls. @@ -43,7 +43,7 @@ public final class LothlorienBlade extends CardImpl { this.addAbility(ability); // Equip Elf {2} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), new TargetControlledCreaturePermanent(filterElf), false)); + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), new TargetPermanent(filterElf), false)); // Equip {5} this.addAbility(new EquipAbility(5, false)); diff --git a/Mage.Sets/src/mage/cards/m/MagneticMountain.java b/Mage.Sets/src/mage/cards/m/MagneticMountain.java index bc2aa00d7f2..69cfeeb18ca 100644 --- a/Mage.Sets/src/mage/cards/m/MagneticMountain.java +++ b/Mage.Sets/src/mage/cards/m/MagneticMountain.java @@ -1,16 +1,19 @@ - package mage.cards.m; import mage.ObjectColor; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.Cost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.ColorPredicate; @@ -19,7 +22,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.util.ManaUtil; import java.util.UUID; @@ -29,7 +32,7 @@ import java.util.UUID; */ public final class MagneticMountain extends CardImpl { - static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures"); + static final FilterPermanent filter = new FilterCreaturePermanent("blue creatures"); static { filter.add(new ColorPredicate(ObjectColor.BLUE)); @@ -80,28 +83,27 @@ class MagneticMountainEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - - Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); - Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - if (player != null && sourcePermanent != null) { - int countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size(); - while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Pay {4} and untap a tapped blue creature under your control?", source, game)) { - Target tappedCreatureTarget = new TargetControlledCreaturePermanent(1, 1, filter2, true); - if (player.choose(Outcome.Untap, tappedCreatureTarget, source, game)) { - Cost cost = ManaUtil.createManaCost(4, false); - Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - if (tappedCreature != null && cost.pay(source, game, source, player.getId(), false)) { - tappedCreature.untap(game); - } else { - break; - } + Player player = game.getPlayer(game.getActivePlayerId()); + if (player == null) { + return false; + } + int countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size(); + while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Pay {4} and untap a tapped blue creature under your control?", source, game)) { + Target tappedCreatureTarget = new TargetControlledPermanent(filter2); + tappedCreatureTarget.withNotTarget(true); + if (player.choose(Outcome.Untap, tappedCreatureTarget, source, game)) { + Cost cost = ManaUtil.createManaCost(4, false); + Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); + if (tappedCreature != null && cost.pay(source, game, source, player.getId(), false)) { + tappedCreature.untap(game); } else { break; } - countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size(); + } else { + break; } - return true; + countBattlefield = game.getBattlefield().getAllActivePermanents(filter2, game.getActivePlayerId(), game).size(); } - return false; + return true; } } diff --git a/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java b/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java index cd63deca655..ac1e44e7b7a 100644 --- a/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java +++ b/Mage.Sets/src/mage/cards/m/MossbridgeTroll.java @@ -18,7 +18,7 @@ import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import java.util.UUID; @@ -108,7 +108,7 @@ class MossbridgeTrollCost extends CostImpl { } public MossbridgeTrollCost() { - this.addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true)); + this.addTarget(new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true)); this.text = "tap any number of untapped creatures you control other than {this} with total power 10 or greater"; } diff --git a/Mage.Sets/src/mage/cards/m/Mudslide.java b/Mage.Sets/src/mage/cards/m/Mudslide.java index 90e7097ea6d..6429d26d481 100644 --- a/Mage.Sets/src/mage/cards/m/Mudslide.java +++ b/Mage.Sets/src/mage/cards/m/Mudslide.java @@ -1,15 +1,18 @@ package mage.cards.m; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.Cost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DontUntapInControllersUntapStepAllEffect; import mage.abilities.keyword.FlyingAbility; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.TargetController; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; @@ -19,7 +22,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.util.ManaUtil; import java.util.UUID; @@ -86,7 +89,8 @@ class MudslideEffect extends OneShotEffect { if (player != null && sourcePermanent != null) { int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.Benefit, "Pay {2} and untap a tapped creature without flying under your control?", source, game)) { - Target tappedCreatureTarget = new TargetControlledCreaturePermanent(1, 1, filter, true); + Target tappedCreatureTarget = new TargetControlledPermanent(filter); + tappedCreatureTarget.withNotTarget(true); if (player.choose(Outcome.Untap, tappedCreatureTarget, source, game)) { Cost cost = ManaUtil.createManaCost(2, false); Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/m/MutantsPrey.java b/Mage.Sets/src/mage/cards/m/MutantsPrey.java index bad72bb85fa..a05b6763b25 100644 --- a/Mage.Sets/src/mage/cards/m/MutantsPrey.java +++ b/Mage.Sets/src/mage/cards/m/MutantsPrey.java @@ -1,15 +1,13 @@ - - package mage.cards.m; -import java.util.UUID; import mage.abilities.effects.common.FightTargetsEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; -import mage.target.common.TargetCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** * @author LevelX2 @@ -17,12 +15,12 @@ import mage.target.common.TargetCreaturePermanent; public final class MutantsPrey extends CardImpl { public MutantsPrey(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}"); // Target creature you control with a +1/+1 counter on it fights target creature an opponent controls. this.getSpellAbility().addEffect(new FightTargetsEffect()); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_P1P1)); - this.getSpellAbility().addTarget(new TargetCreaturePermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_P1P1)); + this.getSpellAbility().addTarget(new TargetPermanent(StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)); } private MutantsPrey(final MutantsPrey card) { diff --git a/Mage.Sets/src/mage/cards/n/N1Starfighter.java b/Mage.Sets/src/mage/cards/n/N1Starfighter.java index 2d7997412ad..807950858b7 100644 --- a/Mage.Sets/src/mage/cards/n/N1Starfighter.java +++ b/Mage.Sets/src/mage/cards/n/N1Starfighter.java @@ -13,6 +13,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; +import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -37,7 +38,7 @@ public final class N1Starfighter extends CardImpl { doIfCostPaid.addEffect(new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false).concatBy(", then")); Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(doIfCostPaid, false); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/n/NephaliaSmuggler.java b/Mage.Sets/src/mage/cards/n/NephaliaSmuggler.java index 42bb23a4cad..02aa626caeb 100644 --- a/Mage.Sets/src/mage/cards/n/NephaliaSmuggler.java +++ b/Mage.Sets/src/mage/cards/n/NephaliaSmuggler.java @@ -10,9 +10,8 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -32,7 +31,7 @@ public final class NephaliaSmuggler extends CardImpl { // {3}{U}, {tap}: Exile another target creature you control, then return that card to the battlefield under your control. Ability ability = new SimpleActivatedAbility(new ExileThenReturnTargetEffect(true, true), new ManaCostsImpl<>("{3}{U}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/n/NikoLightOfHope.java b/Mage.Sets/src/mage/cards/n/NikoLightOfHope.java index 3422ccb86fc..654f6be857e 100644 --- a/Mage.Sets/src/mage/cards/n/NikoLightOfHope.java +++ b/Mage.Sets/src/mage/cards/n/NikoLightOfHope.java @@ -1,9 +1,7 @@ package mage.cards.n; -import java.util.UUID; - -import mage.abilities.Ability; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; @@ -14,9 +12,9 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.ReturnToBattlefieldUnderOwnerControlTargetEffect; import mage.cards.Card; -import mage.constants.*; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; @@ -25,17 +23,18 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.ShardToken; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; import mage.util.functions.EmptyCopyApplier; +import java.util.UUID; + /** - * * @author Grath */ public final class NikoLightOfHope extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("nonlegendary creature you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("nonlegendary creature you control"); static { filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate())); @@ -43,7 +42,7 @@ public final class NikoLightOfHope extends CardImpl { public NikoLightOfHope(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{U}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -56,7 +55,7 @@ public final class NikoLightOfHope extends CardImpl { // {2}, {T}: Exile target nonlegendary creature you control. Shards you control become copies of it until the beginning of the next end step. Return it to the battlefield under its owner's control at the beginning of the next end step. Ability ability = new SimpleActivatedAbility(new NikoLightOfHopeEffect(), new GenericManaCost(2)); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(1, 1, filter, false)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } @@ -90,26 +89,27 @@ class NikoLightOfHopeEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent permanent = game.getPermanent(source.getFirstTarget()); - if (permanent != null && controller != null) { - if (permanent.moveToExile(source.getSourceId(), "Niko, Light of Hope", source, game)) { - FilterPermanent filter = new FilterPermanent("shards"); - filter.add(SubType.SHARD.getPredicate()); - for (Permanent copyTo : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) { - game.copyPermanent(Duration.UntilNextEndStep, permanent, copyTo.getId(), source, new EmptyCopyApplier()); - } - ExileZone exile = game.getExile().getExileZone(source.getSourceId()); - if (exile != null && !exile.isEmpty()) { - Card card = game.getCard(permanent.getId()); - if (card != null) { - Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); - effect.setTargetPointer(new FixedTarget(card.getId())); - game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source); - } - } - return true; - } + if (permanent == null || controller == null + || !permanent.moveToExile(source.getSourceId(), "Niko, Light of Hope", source, game)) { + return false; } - return false; + FilterPermanent filter = new FilterPermanent("shards"); + filter.add(SubType.SHARD.getPredicate()); + for (Permanent copyTo : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) { + game.copyPermanent(Duration.UntilNextEndStep, permanent, copyTo.getId(), source, new EmptyCopyApplier()); + } + ExileZone exile = game.getExile().getExileZone(source.getSourceId()); + if (exile == null || exile.isEmpty()) { + return true; + } + Card card = game.getCard(permanent.getId()); + if (card == null) { + return true; + } + Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(false, false); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source); + return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NobleHeritage.java b/Mage.Sets/src/mage/cards/n/NobleHeritage.java index 34827c2dc04..39734f0f957 100644 --- a/Mage.Sets/src/mage/cards/n/NobleHeritage.java +++ b/Mage.Sets/src/mage/cards/n/NobleHeritage.java @@ -14,7 +14,6 @@ import mage.constants.*; import mage.counters.CounterType; import mage.filter.FilterPlayer; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.other.PlayerIdPredicate; import mage.game.Game; import mage.game.events.GameEvent; @@ -25,7 +24,7 @@ import mage.target.common.TargetControlledCreaturePermanent; import java.util.ArrayList; import java.util.List; -import java.util.Objects; +import java.util.Optional; import java.util.UUID; /** @@ -40,7 +39,8 @@ public final class NobleHeritage extends CardImpl { this.subtype.add(SubType.BACKGROUND); // Commander creatures you own have “When this creature enters the battlefield and at the beginning of your upkeep, each player may put two +1/+1 counters on a creature they control. For each opponent who does, you gain protection from that player until your next turn.” (You can’t be targeted, dealt damage, or enchanted by anything controlled by that player.) - this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect(new NobleHeritageTriggeredAbility(), Duration.WhileOnBattlefield, + this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect( + new NobleHeritageTriggeredAbility(), Duration.WhileOnBattlefield, StaticFilters.FILTER_CREATURES_OWNED_COMMANDER ))); } @@ -122,39 +122,44 @@ class NobleHeritageEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - List players = new ArrayList<>(); - List creatures = new ArrayList<>(); - for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - if (player.chooseUse(outcome, "Put two +1/+1 counters on a creature you control?", source, game)) { - Target target = new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature you control (to add two +1/+1 counters on it)")); - if (player.choose(outcome, target, source, game)) { - creatures.add(target.getFirstTarget()); - players.add(player.getId()); - } - - } - } - } - for (UUID creatureId : creatures) { - Permanent creature = game.getPermanent(creatureId); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(2), creature.getControllerId(), source, game); - } - } - for (UUID playerId : players) { - if (!Objects.equals(playerId, source.getControllerId())) { - FilterPlayer filter = new FilterPlayer(); - filter.add(new PlayerIdPredicate(playerId)); - game.addEffect(new GainAbilityControllerEffect( - new ProtectionAbility(filter), Duration.UntilYourNextTurn - ), source); - } - } - return true; + if (controller == null) { + return false; } - return false; + List players = new ArrayList<>(); + List creatures = new ArrayList<>(); + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null || !player.chooseUse(outcome, "Put two +1/+1 counters on a creature you control?", source, game)) { + continue; + } + Target target = new TargetControlledCreaturePermanent(0, 1); + target.withNotTarget(true); + target.withChooseHint("to add counters to"); + player.choose(outcome, target, source, game); + Optional.ofNullable(target) + .map(Target::getFirstTarget) + .map(game::getPermanent) + .ifPresent(permanent -> { + creatures.add(permanent.getId()); + players.add(player.getId()); + }); + } + for (UUID creatureId : creatures) { + Permanent creature = game.getPermanent(creatureId); + if (creature != null) { + creature.addCounters(CounterType.P1P1.createInstance(2), creature.getControllerId(), source, game); + } + } + for (UUID playerId : players) { + if (source.isControlledBy(playerId)) { + continue; + } + FilterPlayer filter = new FilterPlayer(); + filter.add(new PlayerIdPredicate(playerId)); + game.addEffect(new GainAbilityControllerEffect( + new ProtectionAbility(filter), Duration.UntilYourNextTurn + ), source); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/n/NullmageShepherd.java b/Mage.Sets/src/mage/cards/n/NullmageShepherd.java index 1918253be4c..e70d5b0d187 100644 --- a/Mage.Sets/src/mage/cards/n/NullmageShepherd.java +++ b/Mage.Sets/src/mage/cards/n/NullmageShepherd.java @@ -1,4 +1,3 @@ - package mage.cards.n; import mage.MageInt; @@ -10,28 +9,18 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; /** - * * @author Loki */ public final class NullmageShepherd extends CardImpl { - private static final FilterControlledCreaturePermanent filterCost = new FilterControlledCreaturePermanent("untapped creatures you control"); - static { - filterCost.add(TappedPredicate.UNTAPPED); - } - public NullmageShepherd(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.SHAMAN); @@ -39,7 +28,7 @@ public final class NullmageShepherd extends CardImpl { this.toughness = new MageInt(4); // Tap four untapped creatures you control: Destroy target artifact or enchantment. - Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(4, 4, filterCost, true))); + Ability ability = new SimpleActivatedAbility(new DestroyTargetEffect(), new TapTargetCost(4, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/o/ONaginata.java b/Mage.Sets/src/mage/cards/o/ONaginata.java index c34f02b7fd9..104488f9627 100644 --- a/Mage.Sets/src/mage/cards/o/ONaginata.java +++ b/Mage.Sets/src/mage/cards/o/ONaginata.java @@ -1,12 +1,8 @@ - package mage.cards.o; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.AttachableToRestrictedAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.keyword.EquipAbility; @@ -15,17 +11,15 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.AttachmentType; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.ComparisonType; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class ONaginata extends CardImpl { @@ -37,24 +31,21 @@ public final class ONaginata extends CardImpl { } public ONaginata(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); this.subtype.add(SubType.EQUIPMENT); - Target target = new TargetControlledCreaturePermanent(1, 1, filter, false); // O-Naginata can be attached only to a creature with 3 or more power. - this.addAbility(new AttachableToRestrictedAbility(target)); + this.addAbility(new AttachableToRestrictedAbility(new TargetPermanent(filter))); // Equipped creature gets +3/+0 and has trample. - Effect effect = new BoostEquippedEffect(3, 0); - effect.setText("Equipped creature gets +3/+0"); - Ability ability = new SimpleStaticAbility(effect); - effect = new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT); - effect.setText("and has trample"); - ability.addEffect(effect); + Ability ability = new SimpleStaticAbility(new BoostEquippedEffect(3, 0)); + ability.addEffect(new GainAbilityAttachedEffect( + TrampleAbility.getInstance(), AttachmentType.EQUIPMENT + ).setText("and has trample")); this.addAbility(ability); // Equip {2} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), target)); + this.addAbility(new EquipAbility(2)); } private ONaginata(final ONaginata card) { diff --git a/Mage.Sets/src/mage/cards/o/OlorinsSearingLight.java b/Mage.Sets/src/mage/cards/o/OlorinsSearingLight.java index a1b9cecdeba..e865251f5a0 100644 --- a/Mage.Sets/src/mage/cards/o/OlorinsSearingLight.java +++ b/Mage.Sets/src/mage/cards/o/OlorinsSearingLight.java @@ -14,12 +14,11 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.*; /** - * * @author notgreat */ public final class OlorinsSearingLight extends CardImpl { @@ -41,17 +40,20 @@ public final class OlorinsSearingLight extends CardImpl { return new OlorinsSearingLight(this); } } + //See Crackling Doom class OlorinsSearingLightEffect extends OneShotEffect { static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with the greatest power among creatures you control"); + static { filter.add(GreatestPowerControlledPredicate.instance); } + public OlorinsSearingLightEffect() { super(Outcome.Sacrifice); this.staticText = "Each opponent exiles a creature with the greatest power among creatures that player controls.
" - +"Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, {this} deals damage to each opponent equal to the power of the creature they exiled."; + + "Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, {this} deals damage to each opponent equal to the power of the creature they exiled."; } private OlorinsSearingLightEffect(final OlorinsSearingLightEffect effect) { @@ -72,7 +74,7 @@ class OlorinsSearingLightEffect extends OneShotEffect { if (controller.hasOpponent(playerId, game)) { Player opponent = game.getPlayer(playerId); if (opponent != null) { - Target target = new TargetControlledCreaturePermanent(filter); + Target target = new TargetPermanent(filter); target.withNotTarget(true); if (opponent.choose(outcome, target, source, game)) { Permanent permanentChosen = game.getPermanent(target.getFirstTarget()); @@ -91,7 +93,7 @@ class OlorinsSearingLightEffect extends OneShotEffect { opponent.moveCards(permanent, Zone.EXILED, source, game); } } - if (SpellMasteryCondition.instance.apply(game, source)){ + if (SpellMasteryCondition.instance.apply(game, source)) { game.processAction(); for (Map.Entry entry : damageList) { entry.getKey().damage(entry.getValue(), source, game); diff --git a/Mage.Sets/src/mage/cards/o/OracleEnVec.java b/Mage.Sets/src/mage/cards/o/OracleEnVec.java index 63e12f5061c..7a7802eb45d 100644 --- a/Mage.Sets/src/mage/cards/o/OracleEnVec.java +++ b/Mage.Sets/src/mage/cards/o/OracleEnVec.java @@ -83,25 +83,27 @@ class OracleEnVecEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source)); - if (opponent != null) { - Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), true); - if (target.choose(Outcome.Neutral, opponent.getId(), source.getSourceId(), source, game)) { - for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), opponent.getId(), source, game)) { - if (target.getTargets().contains(permanent.getId())) { - RequirementEffect effect = new OracleEnVecMustAttackRequirementEffect(); - effect.setTargetPointer(new FixedTarget(permanent, game)); - game.addEffect(effect, source); - } else { - RestrictionEffect effect = new OracleEnVecCantAttackRestrictionEffect(); - effect.setTargetPointer(new FixedTarget(permanent, game)); - game.addEffect(effect, source); - } - } - game.addDelayedTriggeredAbility(new OracleEnVecDelayedTriggeredAbility(game.getTurnNum(), target.getTargets()), source); - return true; + if (opponent == null) { + return false; + } + Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE); + target.withNotTarget(true); + if (!target.choose(Outcome.Neutral, opponent.getId(), source.getSourceId(), source, game)) { + return false; + } + for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), opponent.getId(), source, game)) { + if (target.getTargets().contains(permanent.getId())) { + RequirementEffect effect = new OracleEnVecMustAttackRequirementEffect(); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); + } else { + RestrictionEffect effect = new OracleEnVecCantAttackRestrictionEffect(); + effect.setTargetPointer(new FixedTarget(permanent, game)); + game.addEffect(effect, source); } } - return false; + game.addDelayedTriggeredAbility(new OracleEnVecDelayedTriggeredAbility(game.getTurnNum(), target.getTargets()), source); + return true; } } diff --git a/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java b/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java index 378703e74f0..b971ad23eed 100644 --- a/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java +++ b/Mage.Sets/src/mage/cards/o/OrzhovAdvokist.java @@ -3,17 +3,16 @@ package mage.cards.o; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.combat.CantAttackYouAllEffect; +import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.SubType; import mage.counters.CounterType; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; @@ -24,11 +23,10 @@ import mage.target.common.TargetControlledCreaturePermanent; import java.util.ArrayList; import java.util.List; -import java.util.Objects; +import java.util.Optional; import java.util.UUID; /** - * * @author LevelX2 */ public final class OrzhovAdvokist extends CardImpl { @@ -75,37 +73,42 @@ class OrzhovAdvokistEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - List players = new ArrayList<>(); - List creatures = new ArrayList<>(); - for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); - if (player != null) { - if (player.chooseUse(outcome, "Put two +1/+1 counters on a creature you control?", source, game)) { - Target target = new TargetControlledCreaturePermanent(new FilterControlledCreaturePermanent("a creature you control (to add two +1/+1 counters on it)")); - if (player.choose(outcome, target, source, game)) { - creatures.add(target.getFirstTarget()); - players.add(player.getId()); - } - - } - } - } - for (UUID creatureId : creatures) { - Permanent creature = game.getPermanent(creatureId); - if (creature != null) { - creature.addCounters(CounterType.P1P1.createInstance(2), creature.getControllerId(), source, game); - } - } - for (UUID playerId : players) { - if (!Objects.equals(playerId, source.getControllerId())) { - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - filter.add(new ControllerIdPredicate(playerId)); - game.addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter, true), source); - } - } - return true; + if (controller == null) { + return false; } - return false; + List players = new ArrayList<>(); + List creatures = new ArrayList<>(); + for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { + Player player = game.getPlayer(playerId); + if (player == null || !player.chooseUse(outcome, "Put two +1/+1 counters on a creature you control?", source, game)) { + continue; + } + Target target = new TargetControlledCreaturePermanent(0, 1); + target.withNotTarget(true); + target.withChooseHint("to add counters to"); + player.choose(outcome, target, source, game); + Optional.ofNullable(target) + .map(Target::getFirstTarget) + .map(game::getPermanent) + .ifPresent(permanent -> { + creatures.add(permanent.getId()); + players.add(player.getId()); + }); + } + for (UUID creatureId : creatures) { + Permanent creature = game.getPermanent(creatureId); + if (creature != null) { + creature.addCounters(CounterType.P1P1.createInstance(2), creature.getControllerId(), source, game); + } + } + for (UUID playerId : players) { + if (source.isControlledBy(playerId)) { + continue; + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + filter.add(new ControllerIdPredicate(playerId)); + game.addEffect(new CantAttackYouAllEffect(Duration.UntilYourNextTurn, filter, true), source); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/p/ParagonOfEternalWilds.java b/Mage.Sets/src/mage/cards/p/ParagonOfEternalWilds.java index f7f6694dad8..a049ed9bf0d 100644 --- a/Mage.Sets/src/mage/cards/p/ParagonOfEternalWilds.java +++ b/Mage.Sets/src/mage/cards/p/ParagonOfEternalWilds.java @@ -1,7 +1,5 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -15,34 +13,34 @@ import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.constants.TargetController; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class ParagonOfEternalWilds extends CardImpl { - + private static final FilterCreaturePermanent filterGreen = new FilterCreaturePermanent("green creatures you control"); private static final FilterControlledCreaturePermanent filterGreen2 = new FilterControlledCreaturePermanent("another target green creature you control"); static { filterGreen.add(new ColorPredicate(ObjectColor.GREEN)); filterGreen.add(TargetController.YOU.getControllerPredicate()); - filterGreen2.add(new ColorPredicate(ObjectColor.GREEN)); + filterGreen2.add(new ColorPredicate(ObjectColor.GREEN)); filterGreen2.add(AnotherPredicate.instance); } - + public ParagonOfEternalWilds(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.DRUID); @@ -51,10 +49,11 @@ public final class ParagonOfEternalWilds extends CardImpl { // Other green creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filterGreen, true))); + // {G}, {t}: Another target green creature you control gains trample until end of turn. - Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect(TrampleAbility.getInstance(),Duration.EndOfTurn), new ManaCostsImpl<>("{G}")); + Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{G}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(filterGreen2)); + ability.addTarget(new TargetPermanent(filterGreen2)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/ParagonOfFierceDefiance.java b/Mage.Sets/src/mage/cards/p/ParagonOfFierceDefiance.java index cae821f9fbc..51adc82758a 100644 --- a/Mage.Sets/src/mage/cards/p/ParagonOfFierceDefiance.java +++ b/Mage.Sets/src/mage/cards/p/ParagonOfFierceDefiance.java @@ -1,7 +1,5 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -15,32 +13,32 @@ import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author Quercitron */ public final class ParagonOfFierceDefiance extends CardImpl { private static final FilterCreaturePermanent filterCreatures = new FilterCreaturePermanent("red creatures"); private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("another target red creature you control"); - + static { filterCreatures.add(new ColorPredicate(ObjectColor.RED)); filterCreature.add(AnotherPredicate.instance); filterCreature.add(new ColorPredicate(ObjectColor.RED)); } - + public ParagonOfFierceDefiance(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WARRIOR); @@ -49,11 +47,11 @@ public final class ParagonOfFierceDefiance extends CardImpl { // Other red creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterCreatures, true))); - + // {R}, {T}: Another target red creature you control gains haste until end of turn. Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{R}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(filterCreature)); + ability.addTarget(new TargetPermanent(filterCreature)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/ParagonOfGatheringMists.java b/Mage.Sets/src/mage/cards/p/ParagonOfGatheringMists.java index 24f337a3faa..1a45a3ca9ac 100644 --- a/Mage.Sets/src/mage/cards/p/ParagonOfGatheringMists.java +++ b/Mage.Sets/src/mage/cards/p/ParagonOfGatheringMists.java @@ -1,7 +1,5 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -9,40 +7,39 @@ import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.common.continuous.BoostAllEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class ParagonOfGatheringMists extends CardImpl { - private static final FilterCreaturePermanent filterBlue = new FilterCreaturePermanent("blue creatures you control"); + private static final FilterPermanent filterBlue = new FilterCreaturePermanent("blue creatures"); private static final FilterControlledCreaturePermanent filterBlue2 = new FilterControlledCreaturePermanent("another target blue creature you control"); static { filterBlue.add(new ColorPredicate(ObjectColor.BLUE)); - filterBlue.add(TargetController.YOU.getControllerPredicate()); filterBlue2.add(new ColorPredicate(ObjectColor.BLUE)); filterBlue2.add(AnotherPredicate.instance); } public ParagonOfGatheringMists(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -50,12 +47,16 @@ public final class ParagonOfGatheringMists extends CardImpl { this.toughness = new MageInt(2); // Other blue creatures you control get +1/+1. - this.addAbility(new SimpleStaticAbility(new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filterBlue, true))); + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + 1, 1, Duration.WhileOnBattlefield, filterBlue, true + ))); // {U}, {T}: Another target blue creature you control gains flying until end of turn. - Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(),Duration.EndOfTurn), new ManaCostsImpl<>("{U}")); + Ability ability = new SimpleActivatedAbility( + new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{U}") + ); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(filterBlue2)); + ability.addTarget(new TargetPermanent(filterBlue2)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/ParagonOfOpenGraves.java b/Mage.Sets/src/mage/cards/p/ParagonOfOpenGraves.java index 6be69435b21..1be1d60379b 100644 --- a/Mage.Sets/src/mage/cards/p/ParagonOfOpenGraves.java +++ b/Mage.Sets/src/mage/cards/p/ParagonOfOpenGraves.java @@ -1,7 +1,5 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -15,22 +13,23 @@ import mage.abilities.keyword.DeathtouchAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class ParagonOfOpenGraves extends CardImpl { - private static final FilterCreaturePermanent filterCreatures = new FilterCreaturePermanent("black creatures"); + private static final FilterPermanent filterCreatures = new FilterCreaturePermanent("black creatures"); private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent("another target black creature you control"); static { @@ -40,7 +39,7 @@ public final class ParagonOfOpenGraves extends CardImpl { } public ParagonOfOpenGraves(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(SubType.SKELETON); this.subtype.add(SubType.WARRIOR); @@ -48,12 +47,16 @@ public final class ParagonOfOpenGraves extends CardImpl { this.toughness = new MageInt(2); // Other black creatures you control get +1/+1. - this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterCreatures, true))); + this.addAbility(new SimpleStaticAbility(new BoostControlledEffect( + 1, 1, Duration.WhileOnBattlefield, filterCreatures, true + ))); // {2}{B}, {T}: Another target black creature you control gains deathtouch until end of turn. - Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{2}{B}")); + Ability ability = new SimpleActivatedAbility(new GainAbilityTargetEffect( + DeathtouchAbility.getInstance(), Duration.EndOfTurn + ), new ManaCostsImpl<>("{2}{B}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetControlledCreaturePermanent(filterCreature)); + ability.addTarget(new TargetPermanent(filterCreature)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/p/PhantasmalMount.java b/Mage.Sets/src/mage/cards/p/PhantasmalMount.java index 886bc73d5f7..b09f34d1df7 100644 --- a/Mage.Sets/src/mage/cards/p/PhantasmalMount.java +++ b/Mage.Sets/src/mage/cards/p/PhantasmalMount.java @@ -1,6 +1,5 @@ package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; @@ -12,25 +11,21 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; -import mage.constants.SubType; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.ComparisonType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.ToughnessPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class PhantasmalMount extends CardImpl { @@ -54,9 +49,8 @@ public final class PhantasmalMount extends CardImpl { // {tap}: Target creature you control with toughness 2 or less gets +1/+1 and gains flying until end of turn. When Phantasmal Mount leaves the battlefield this turn, sacrifice that creature. When the creature leaves the battlefield this turn, sacrifice Phantasmal Mount. Ability activatedAbility = new SimpleActivatedAbility(new PhantasmalMountEffect(), new TapSourceCost()); - activatedAbility.addTarget(new TargetControlledCreaturePermanent(filter)); + activatedAbility.addTarget(new TargetPermanent(filter)); this.addAbility(activatedAbility); - } private PhantasmalMount(final PhantasmalMount card) { diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java b/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java index e82404b0646..e08c351495b 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianDreadnought.java @@ -1,7 +1,6 @@ package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -12,16 +11,17 @@ import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class PhyrexianDreadnought extends CardImpl { @@ -36,6 +36,7 @@ public final class PhyrexianDreadnought extends CardImpl { // Trample this.addAbility(TrampleAbility.getInstance()); + // When Phyrexian Dreadnought enters the battlefield, sacrifice it unless you sacrifice any number of creatures with total power 12 or greater. this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new PhyrexianDreadnoughtSacrificeCost()))); @@ -56,7 +57,7 @@ class PhyrexianDreadnoughtSacrificeCost extends CostImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("any number of creatures with total power 12 or greater"); public PhyrexianDreadnoughtSacrificeCost() { - this.addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true)); + this.addTarget(new TargetPermanent(0, Integer.MAX_VALUE, filter, true)); this.text = "sacrifice any number of creatures with total power 12 or greater"; } diff --git a/Mage.Sets/src/mage/cards/p/PlarggDeanOfChaos.java b/Mage.Sets/src/mage/cards/p/PlarggDeanOfChaos.java index 7d417ad9d62..2bd180fbff7 100644 --- a/Mage.Sets/src/mage/cards/p/PlarggDeanOfChaos.java +++ b/Mage.Sets/src/mage/cards/p/PlarggDeanOfChaos.java @@ -22,11 +22,12 @@ import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; +import mage.game.Controllable; import mage.game.Game; -import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; +import java.util.Optional; import java.util.UUID; /** @@ -167,13 +168,16 @@ class AugustaDeanOfOrderEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true); - Player controller = game.getPlayer(source.getControllerId()); - controller.chooseTarget(Outcome.Benefit, target, source, game); - target.getTargets().forEach(t -> { - Permanent permanent = game.getPermanent(t); - permanent.tap(source, game); - }); + TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); + Optional.ofNullable(source) + .map(Controllable::getControllerId) + .map(game::getPlayer) + .ifPresent(player -> player.chooseTarget(Outcome.Benefit, target, source, game)); + for (UUID targetId : target.getTargets()) { + Optional.ofNullable(targetId) + .map(game::getPermanent) + .ifPresent(permanent -> permanent.tap(source, game)); + } return true; } diff --git a/Mage.Sets/src/mage/cards/p/PrismaticStrands.java b/Mage.Sets/src/mage/cards/p/PrismaticStrands.java index b61bb5a328d..4c320f5e31c 100644 --- a/Mage.Sets/src/mage/cards/p/PrismaticStrands.java +++ b/Mage.Sets/src/mage/cards/p/PrismaticStrands.java @@ -1,7 +1,5 @@ - package mage.cards.p; -import java.util.UUID; import mage.MageObject; import mage.ObjectColor; import mage.abilities.Ability; @@ -15,22 +13,22 @@ import mage.choices.ChoiceColor; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; -import mage.constants.TimingRule; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class PrismaticStrands extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creature you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped white creature you control"); static { filter.add(TappedPredicate.UNTAPPED); @@ -44,7 +42,7 @@ public final class PrismaticStrands extends CardImpl { this.getSpellAbility().addEffect(new PrismaticStrandsEffect()); // Flashback-Tap an untapped white creature you control. - this.addAbility(new FlashbackAbility(this, new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)))); + this.addAbility(new FlashbackAbility(this, new TapTargetCost(filter))); } private PrismaticStrands(final PrismaticStrands card) { @@ -77,18 +75,17 @@ class PrismaticStrandsEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); MageObject sourceObject = game.getObject(source); - if (controller != null && sourceObject != null) { - ChoiceColor choice = new ChoiceColor(); - controller.choose(Outcome.PreventDamage, choice, game); - if (choice.isChosen()) { - if (!game.isSimulation()) { - game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen sources of the color " + choice.getChoice()); - } - game.addEffect(new PrismaticStrandsPreventionEffect(choice.getColor()), source); - return true; - } + if (controller == null || sourceObject == null) { + return false; } - return false; + ChoiceColor choice = new ChoiceColor(); + controller.choose(Outcome.PreventDamage, choice, game); + if (!choice.isChosen()) { + return false; + } + game.informPlayers(sourceObject.getLogName() + ": " + controller.getLogName() + " has chosen sources of the color " + choice.getChoice()); + game.addEffect(new PrismaticStrandsPreventionEffect(choice.getColor()), source); + return true; } } @@ -108,16 +105,13 @@ class PrismaticStrandsPreventionEffect extends PreventionEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (super.applies(event, source, game)) { - if (event.getType() == GameEvent.EventType.DAMAGE_PLAYER - || event.getType() == GameEvent.EventType.DAMAGE_PERMANENT) { - MageObject sourceObject = game.getObject(event.getSourceId()); - if (sourceObject != null && sourceObject.getColor(game).shares(this.color)) { - return true; - } - } + if (!super.applies(event, source, game) + || event.getType() != GameEvent.EventType.DAMAGE_PLAYER + && event.getType() != GameEvent.EventType.DAMAGE_PERMANENT) { + return false; } - return false; + MageObject sourceObject = game.getObject(event.getSourceId()); + return sourceObject != null && sourceObject.getColor(game).shares(this.color); } @Override diff --git a/Mage.Sets/src/mage/cards/q/QuilledGreatwurm.java b/Mage.Sets/src/mage/cards/q/QuilledGreatwurm.java index 5f5cf52e503..cebc2dd16f8 100644 --- a/Mage.Sets/src/mage/cards/q/QuilledGreatwurm.java +++ b/Mage.Sets/src/mage/cards/q/QuilledGreatwurm.java @@ -24,7 +24,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.CounterAnyPredicate; import mage.game.Game; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import java.util.UUID; @@ -102,7 +102,7 @@ class QuilledGreatwurmEffect extends AsThoughEffectImpl { return false; } Costs costs = new CostsImpl<>(); - costs.add(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 6, filter, true), null, 6)); + costs.add(new RemoveCounterCost(new TargetControlledPermanent(1, 6, filter, true), null, 6)); controller.setCastSourceIdWithAlternateMana( objectId, new ManaCostsImpl<>("{4}{G}{G}"), costs, MageIdentifier.QuilledGreatwurmAlternateCast diff --git a/Mage.Sets/src/mage/cards/r/RagingRiver.java b/Mage.Sets/src/mage/cards/r/RagingRiver.java index fffdfdc0d5a..0977d98abd8 100644 --- a/Mage.Sets/src/mage/cards/r/RagingRiver.java +++ b/Mage.Sets/src/mage/cards/r/RagingRiver.java @@ -12,6 +12,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; @@ -22,7 +23,7 @@ import mage.game.combat.CombatGroup; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTarget; import java.util.ArrayList; @@ -57,6 +58,12 @@ public final class RagingRiver extends CardImpl { class RagingRiverEffect extends OneShotEffect { + private static final FilterPermanent filterBlockers = new FilterControlledCreaturePermanent("creatures without flying you control to assign to the \"left\" pile (creatures not chosen will be assigned to the \"right\" pile)"); + + static { + filterBlockers.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + RagingRiverEffect() { super(Outcome.Detriment); staticText = "each defending player divides all creatures without flying they control into a \"left\" pile and a \"right\" pile. Then, for each attacking creature you control, choose \"left\" or \"right.\" That creature can't be blocked this combat except by creatures with flying and creatures in a pile with the chosen label"; @@ -74,84 +81,87 @@ class RagingRiverEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - List left = new ArrayList<>(); - List right = new ArrayList<>(); - - for (UUID defenderId : game.getCombat().getPlayerDefenders(game)) { - Player defender = game.getPlayer(defenderId); - if (defender != null) { - List leftLog = new ArrayList<>(); - List rightLog = new ArrayList<>(); - FilterControlledCreaturePermanent filterBlockers = new FilterControlledCreaturePermanent("creatures without flying you control to assign to the \"left\" pile (creatures not chosen will be assigned to the \"right\" pile)"); - filterBlockers.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); - Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filterBlockers, true); - if (target.canChoose(defenderId, source, game)) { - if (defender.chooseTarget(Outcome.Neutral, target, source, game)) { - for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), defenderId, game)) { - if (target.getTargets().contains(permanent.getId())) { - left.add(permanent); - leftLog.add(permanent); - } else if (filterBlockers.match(permanent, defenderId, source, game)) { - right.add(permanent); - rightLog.add(permanent); - } - } - } - - // it could be nice to invoke some graphic indicator of which creature is Left or Right in this spot - StringBuilder sb = new StringBuilder("Left pile of ").append(defender.getLogName()).append(": "); - sb.append(leftLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", "))); - - game.informPlayers(sb.toString()); - - sb = new StringBuilder("Right pile of ").append(defender.getLogName()).append(": "); - sb.append(rightLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", "))); - - game.informPlayers(sb.toString()); - } - } - } - - for (UUID attackers : game.getCombat().getAttackers()) { - Permanent attacker = game.getPermanent(attackers); - if (attacker != null && Objects.equals(attacker.getControllerId(), controller.getId())) { - CombatGroup combatGroup = game.getCombat().findGroup(attacker.getId()); - if (combatGroup != null) { - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - Player defender = game.getPlayer(combatGroup.getDefendingPlayerId()); - if (defender != null) { - if (left.isEmpty() && right.isEmpty()) { - // shortcut in case of no labeled blockers available - filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); - } else { - List leftLog = left.stream() - .filter(permanent -> permanent.getControllerId() != null) - .filter(permanent -> permanent.isControlledBy(defender.getId())) - .collect(Collectors.toList()); - List rightLog = right.stream() - .filter(permanent -> permanent.getControllerId() != null) - .filter(permanent -> permanent.isControlledBy(defender.getId())) - .collect(Collectors.toList()); - - - if (controller.choosePile(outcome, attacker.getName() + ": attacking " + defender.getName(), leftLog, rightLog, game)) { - filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentReferenceInCollectionPredicate(left, game)))); - game.informPlayers(attacker.getLogName() + ": attacks left (" + defender.getLogName() + ")"); - } else { - filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentReferenceInCollectionPredicate(right, game)))); - game.informPlayers(attacker.getLogName() + ": attacks right (" + defender.getLogName() + ")"); - } - } - RestrictionEffect effect = new CantBeBlockedByAllTargetEffect(filter, Duration.EndOfCombat); - effect.setTargetPointer(new FixedTarget(attacker.getId(), game)); - game.addEffect(effect, source); - } - } - } - } - return true; + if (controller == null) { + return false; } - return false; + List left = new ArrayList<>(); + List right = new ArrayList<>(); + + for (UUID defenderId : game.getCombat().getPlayerDefenders(game)) { + Player defender = game.getPlayer(defenderId); + if (defender == null) { + continue; + } + List leftLog = new ArrayList<>(); + List rightLog = new ArrayList<>(); + Target target = new TargetPermanent(0, Integer.MAX_VALUE, filterBlockers, true); + if (!target.canChoose(defenderId, source, game)) { + continue; + } + if (defender.chooseTarget(Outcome.Neutral, target, source, game)) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), defenderId, game)) { + if (target.getTargets().contains(permanent.getId())) { + left.add(permanent); + leftLog.add(permanent); + } else if (filterBlockers.match(permanent, defenderId, source, game)) { + right.add(permanent); + rightLog.add(permanent); + } + } + } + + // it could be nice to invoke some graphic indicator of which creature is Left or Right in this spot + StringBuilder sb = new StringBuilder("Left pile of ").append(defender.getLogName()).append(": "); + sb.append(leftLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", "))); + + game.informPlayers(sb.toString()); + + sb = new StringBuilder("Right pile of ").append(defender.getLogName()).append(": "); + sb.append(rightLog.stream().map(MageObject::getLogName).collect(Collectors.joining(", "))); + + game.informPlayers(sb.toString()); + } + + for (UUID attackers : game.getCombat().getAttackers()) { + Permanent attacker = game.getPermanent(attackers); + if (attacker == null || !Objects.equals(attacker.getControllerId(), controller.getId())) { + continue; + } + CombatGroup combatGroup = game.getCombat().findGroup(attacker.getId()); + if (combatGroup == null) { + continue; + } + FilterCreaturePermanent filter = new FilterCreaturePermanent(); + Player defender = game.getPlayer(combatGroup.getDefendingPlayerId()); + if (defender == null) { + continue; + } + if (left.isEmpty() && right.isEmpty()) { + // shortcut in case of no labeled blockers available + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } else { + List leftLog = left.stream() + .filter(permanent -> permanent.getControllerId() != null) + .filter(permanent -> permanent.isControlledBy(defender.getId())) + .collect(Collectors.toList()); + List rightLog = right.stream() + .filter(permanent -> permanent.getControllerId() != null) + .filter(permanent -> permanent.isControlledBy(defender.getId())) + .collect(Collectors.toList()); + + + if (controller.choosePile(outcome, attacker.getName() + ": attacking " + defender.getName(), leftLog, rightLog, game)) { + filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentReferenceInCollectionPredicate(left, game)))); + game.informPlayers(attacker.getLogName() + ": attacks left (" + defender.getLogName() + ")"); + } else { + filter.add(Predicates.not(Predicates.or(new AbilityPredicate(FlyingAbility.class), new PermanentReferenceInCollectionPredicate(right, game)))); + game.informPlayers(attacker.getLogName() + ": attacks right (" + defender.getLogName() + ")"); + } + } + RestrictionEffect effect = new CantBeBlockedByAllTargetEffect(filter, Duration.EndOfCombat); + effect.setTargetPointer(new FixedTarget(attacker.getId(), game)); + game.addEffect(effect, source); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/r/RaidingParty.java b/Mage.Sets/src/mage/cards/r/RaidingParty.java index 4284c5b0a1a..21aa94e0f14 100644 --- a/Mage.Sets/src/mage/cards/r/RaidingParty.java +++ b/Mage.Sets/src/mage/cards/r/RaidingParty.java @@ -1,9 +1,6 @@ package mage.cards.r; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -17,9 +14,8 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.FilterStackObject; import mage.filter.FilterPermanent; +import mage.filter.FilterStackObject; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; @@ -29,27 +25,29 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; /** - * * @author L_J */ public final class RaidingParty extends CardImpl { - + private static final FilterStackObject filterWhite = new FilterStackObject("white spells or abilities from white sources"); private static final FilterControlledPermanent filterOrc = new FilterControlledPermanent(SubType.ORC, "an Orc"); - + static { filterWhite.add(new ColorPredicate(ObjectColor.WHITE)); } public RaidingParty(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}"); // Raiding Party can't be the target of white spells or abilities from white sources. this.addAbility(new SimpleStaticAbility(new CantBeTargetedSourceEffect(filterWhite, Duration.WhileOnBattlefield))); - + // Sacrifice an Orc: Each player may tap any number of untapped white creatures they control. For each creature tapped this way, that player chooses up to two Plains. Then destroy all Plains that weren't chosen this way by any player. this.addAbility(new SimpleActivatedAbility(new RaidingPartyEffect(), new SacrificeTargetCost(filterOrc))); } @@ -66,7 +64,7 @@ public final class RaidingParty extends CardImpl { class RaidingPartyEffect extends OneShotEffect { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creatures"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("untapped white creatures"); private static final FilterPermanent filter2 = new FilterPermanent("Plains"); static { @@ -99,7 +97,7 @@ class RaidingPartyEffect extends OneShotEffect { if (player != null) { int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); int tappedCount = 0; - Target untappedCreatureTarget = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true); + Target untappedCreatureTarget = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); if (player.choose(Outcome.Benefit, untappedCreatureTarget, source, game)) { tappedCount = untappedCreatureTarget.getTargets().size(); for (UUID creatureId : untappedCreatureTarget.getTargets()) { diff --git a/Mage.Sets/src/mage/cards/r/RallyTheMonastery.java b/Mage.Sets/src/mage/cards/r/RallyTheMonastery.java index 7867c2c0c48..dae91cbf035 100644 --- a/Mage.Sets/src/mage/cards/r/RallyTheMonastery.java +++ b/Mage.Sets/src/mage/cards/r/RallyTheMonastery.java @@ -1,7 +1,5 @@ package mage.cards.r; -import java.util.UUID; - import mage.abilities.Mode; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.CastAnotherSpellThisTurnCondition; @@ -14,13 +12,14 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.ComparisonType; import mage.constants.Zone; -import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.game.permanent.token.MonasteryMentorToken; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** * @author balazskristof */ @@ -44,16 +43,16 @@ public final class RallyTheMonastery extends CardImpl { // Choose one — this.getSpellAbility().getModes().setMinModes(1); this.getSpellAbility().getModes().setMaxModes(1); + // • Create two 1/1 white Monk creature tokens with prowess. this.getSpellAbility().addEffect(new CreateTokenEffect(new MonasteryMentorToken(), 2)); + // • Up to two target creatures you control each get +2/+2 until end of turn. - Mode mode = new Mode(new BoostTargetEffect(2, 2)); - mode.addTarget(new TargetControlledCreaturePermanent(0, 2, StaticFilters.FILTER_CONTROLLED_CREATURES, false)); - this.getSpellAbility().getModes().addMode(mode); + this.getSpellAbility().getModes().addMode(new Mode(new BoostTargetEffect(2, 2)) + .addTarget(new TargetControlledCreaturePermanent(0, 2))); + // • Destroy target creature with power 4 or greater. - Mode mode2 = new Mode(new DestroyTargetEffect()); - mode2.addTarget(new TargetPermanent(filter)); - this.getSpellAbility().getModes().addMode(mode2); + this.getSpellAbility().getModes().addMode(new Mode(new DestroyTargetEffect()).addTarget(new TargetPermanent(filter))); } private RallyTheMonastery(final RallyTheMonastery card) { @@ -65,4 +64,3 @@ public final class RallyTheMonastery extends CardImpl { return new RallyTheMonastery(this); } } - diff --git a/Mage.Sets/src/mage/cards/r/Reconnaissance.java b/Mage.Sets/src/mage/cards/r/Reconnaissance.java index 3c0555a76d0..a84ef28130c 100644 --- a/Mage.Sets/src/mage/cards/r/Reconnaissance.java +++ b/Mage.Sets/src/mage/cards/r/Reconnaissance.java @@ -1,41 +1,38 @@ - package mage.cards.r; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.RemoveFromCombatTargetEffect; +import mage.abilities.effects.common.UntapTargetEffect; import mage.cards.CardImpl; 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.AttackingPredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author spjspj */ public final class Reconnaissance extends CardImpl { - private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("attacking creature controlled by you"); + private static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("attacking creature you control"); static { filter.add(AttackingPredicate.instance); } public Reconnaissance(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{W}"); // {0}: Remove target attacking creature you control from combat and untap it. - Ability ability = new SimpleActivatedAbility(new ReconnaissanceRemoveFromCombatEffect(), new ManaCostsImpl<>("{0}")); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + Ability ability = new SimpleActivatedAbility(new RemoveFromCombatTargetEffect() + .setText("remove target attacking creature you control from combat"), new GenericManaCost(0)); + ability.addEffect(new UntapTargetEffect("and untap it")); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } @@ -48,33 +45,3 @@ public final class Reconnaissance extends CardImpl { return new Reconnaissance(this); } } - -class ReconnaissanceRemoveFromCombatEffect extends OneShotEffect { - - ReconnaissanceRemoveFromCombatEffect() { - super(Outcome.Benefit); - this.staticText = "Remove target attacking creature you control from combat and untap it"; - } - - private ReconnaissanceRemoveFromCombatEffect(final ReconnaissanceRemoveFromCombatEffect effect) { - super(effect); - } - - @Override - public ReconnaissanceRemoveFromCombatEffect copy() { - return new ReconnaissanceRemoveFromCombatEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Permanent creature = game.getPermanent(source.getFirstTarget()); - Player player = game.getPlayer(source.getControllerId()); - - if (creature != null && player != null && creature.isAttacking()) { - creature.removeFromCombat(game); - creature.untap(game); - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/r/ReservoirKraken.java b/Mage.Sets/src/mage/cards/r/ReservoirKraken.java index 82207a22f4f..1f57e43a487 100644 --- a/Mage.Sets/src/mage/cards/r/ReservoirKraken.java +++ b/Mage.Sets/src/mage/cards/r/ReservoirKraken.java @@ -14,13 +14,14 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.TargetController; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.FishToken; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -85,15 +86,19 @@ class ReservoirKrakenEffect extends OneShotEffect { boolean opponentTapped = false; for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); - if (opponent != null) { - TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent(1, 1, filter, true); - if (target.canChoose(opponentId, source, game) && opponent.chooseUse(Outcome.AIDontUseIt, "Tap an untapped creature you control?", source, game)) { - opponent.chooseTarget(Outcome.Tap, target, source, game); - Permanent permanent = game.getPermanent(target.getFirstTarget()); - if (permanent != null && permanent.tap(source, game)) { - opponentTapped = true; - } - } + if (opponent == null) { + continue; + } + TargetPermanent target = new TargetPermanent(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE); + target.withNotTarget(true); + if (!target.canChoose(opponentId, source, game) + || !opponent.chooseUse(Outcome.AIDontUseIt, "Tap an untapped creature you control?", source, game)) { + continue; + } + opponent.chooseTarget(Outcome.Tap, target, source, game); + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null && permanent.tap(source, game)) { + opponentTapped = true; } } if (opponentTapped) { diff --git a/Mage.Sets/src/mage/cards/r/RootKinAlly.java b/Mage.Sets/src/mage/cards/r/RootKinAlly.java index a3ae36850e9..f4e8e217bed 100644 --- a/Mage.Sets/src/mage/cards/r/RootKinAlly.java +++ b/Mage.Sets/src/mage/cards/r/RootKinAlly.java @@ -1,7 +1,5 @@ - package mage.cards.r; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -10,26 +8,27 @@ import mage.abilities.keyword.ConvokeAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; +import mage.constants.SubType; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author emerald000 */ public final class RootKinAlly extends CardImpl { - + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); + static { filter.add(TappedPredicate.UNTAPPED); } public RootKinAlly(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}"); this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.WARRIOR); this.power = new MageInt(3); @@ -37,9 +36,12 @@ public final class RootKinAlly extends CardImpl { // Convoke this.addAbility(new ConvokeAbility()); - + // Tap two untapped creatures you control: Root-Kin Ally gets +2/+2 until end of turn. - this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(2, 2, Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true)))); + this.addAbility(new SimpleActivatedAbility( + new BoostSourceEffect(2, 2, Duration.EndOfTurn), + new TapTargetCost(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES) + )); } private RootKinAlly(final RootKinAlly card) { diff --git a/Mage.Sets/src/mage/cards/s/SalvationSwan.java b/Mage.Sets/src/mage/cards/s/SalvationSwan.java index 18ede9d824b..9b5b56c967d 100644 --- a/Mage.Sets/src/mage/cards/s/SalvationSwan.java +++ b/Mage.Sets/src/mage/cards/s/SalvationSwan.java @@ -19,6 +19,7 @@ import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.Zone; import mage.counters.CounterType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; @@ -26,7 +27,7 @@ import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.ExileZone; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTargets; import mage.util.CardUtil; @@ -39,8 +40,8 @@ public final class SalvationSwan extends CardImpl { static final String VALUE_PREFIX = "SalvationSwanExile"; - private static final FilterControlledPermanent filterBird = new FilterControlledPermanent(SubType.BIRD, "Bird you control"); - private static final FilterControlledCreaturePermanent filterWithoutFlying = new FilterControlledCreaturePermanent("creature you control without flying"); + private static final FilterPermanent filterBird = new FilterControlledPermanent(SubType.BIRD, "Bird you control"); + private static final FilterPermanent filterWithoutFlying = new FilterControlledCreaturePermanent("creature you control without flying"); static { filterWithoutFlying.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); @@ -64,7 +65,7 @@ public final class SalvationSwan extends CardImpl { Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility( new SalvationSwanTargetEffect(), filterBird, false, false ); - ability.addTarget(new TargetControlledCreaturePermanent(0, 1, filterWithoutFlying, false)); + ability.addTarget(new TargetPermanent(0, 1, filterWithoutFlying)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/Sandsower.java b/Mage.Sets/src/mage/cards/s/Sandsower.java index 6f66eef7c64..be864f27821 100644 --- a/Mage.Sets/src/mage/cards/s/Sandsower.java +++ b/Mage.Sets/src/mage/cards/s/Sandsower.java @@ -1,7 +1,5 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -11,33 +9,25 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author Loki */ public final class Sandsower extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public Sandsower(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.SPIRIT); this.power = new MageInt(1); this.toughness = new MageInt(3); // Tap three untapped creatures you control: Tap target creature. - Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true))); + Ability ability = new SimpleActivatedAbility(new TapTargetEffect(), new TapTargetCost(3, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SatyaAetherfluxGenius.java b/Mage.Sets/src/mage/cards/s/SatyaAetherfluxGenius.java index f0e2d33d364..cf7c2f0b135 100644 --- a/Mage.Sets/src/mage/cards/s/SatyaAetherfluxGenius.java +++ b/Mage.Sets/src/mage/cards/s/SatyaAetherfluxGenius.java @@ -23,7 +23,7 @@ import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.permanent.TokenPredicate; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.target.targetpointer.FixedTargets; import java.util.List; @@ -61,7 +61,7 @@ public final class SatyaAetherfluxGenius extends CardImpl { // Whenever Satya, Aetherflux Genius attacks, create a tapped and attacking token that's a copy of up to one other target nontoken creature you control. You get {E}{E}. At the beginning of the next end step, sacrifice that token unless you pay an amount of {E} equal to its mana value. Ability ability = new AttacksTriggeredAbility(new SatyaAetherfluxGeniusEffect()); - ability.addTarget(new TargetControlledCreaturePermanent(0, 1, filter, false)); + ability.addTarget(new TargetPermanent(0, 1, filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/Scapegoat.java b/Mage.Sets/src/mage/cards/s/Scapegoat.java index dc129403607..1cb7a414ed5 100644 --- a/Mage.Sets/src/mage/cards/s/Scapegoat.java +++ b/Mage.Sets/src/mage/cards/s/Scapegoat.java @@ -1,19 +1,16 @@ - package mage.cards.s; -import java.util.UUID; import mage.abilities.costs.common.SacrificeTargetCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent; +import java.util.UUID; + /** - * * @author emerald000 */ public final class Scapegoat extends CardImpl { @@ -25,10 +22,8 @@ public final class Scapegoat extends CardImpl { this.getSpellAbility().addCost(new SacrificeTargetCost(StaticFilters.FILTER_PERMANENT_CREATURE)); // Return any number of target creatures you control to their owner's hand. - Effect effect = new ReturnToHandTargetEffect(); - effect.setText("Return any number of target creatures you control to their owner's hand"); - this.getSpellAbility().addEffect(effect); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), false)); + this.getSpellAbility().addEffect(new ReturnToHandTargetEffect().setText("Return any number of target creatures you control to their owner's hand")); + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE)); } private Scapegoat(final Scapegoat card) { diff --git a/Mage.Sets/src/mage/cards/s/SelesnyaEvangel.java b/Mage.Sets/src/mage/cards/s/SelesnyaEvangel.java index 228442bf655..759efd76f6e 100644 --- a/Mage.Sets/src/mage/cards/s/SelesnyaEvangel.java +++ b/Mage.Sets/src/mage/cards/s/SelesnyaEvangel.java @@ -1,7 +1,5 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -13,26 +11,18 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; +import mage.filter.StaticFilters; import mage.game.permanent.token.SaprolingToken; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author Loki */ public final class SelesnyaEvangel extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public SelesnyaEvangel(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{G}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}"); this.subtype.add(SubType.ELF); this.subtype.add(SubType.SHAMAN); @@ -42,7 +32,7 @@ public final class SelesnyaEvangel extends CardImpl { // {1}, {tap}, Tap an untapped creature you control: Create a 1/1 green Saproling creature token. Ability ability = new SimpleActivatedAbility(new CreateTokenEffect(new SaprolingToken()), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))); + ability.addCost(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/ShadowgrangeArchfiend.java b/Mage.Sets/src/mage/cards/s/ShadowgrangeArchfiend.java index b6d68eb9440..ede974a47e9 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowgrangeArchfiend.java +++ b/Mage.Sets/src/mage/cards/s/ShadowgrangeArchfiend.java @@ -20,7 +20,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.ArrayList; import java.util.List; @@ -47,10 +47,14 @@ public final class ShadowgrangeArchfiend extends CardImpl { this.addAbility(madnessAbility); } - private ShadowgrangeArchfiend(final ShadowgrangeArchfiend card) { super(card); } + private ShadowgrangeArchfiend(final ShadowgrangeArchfiend card) { + super(card); + } @Override - public ShadowgrangeArchfiend copy() { return new ShadowgrangeArchfiend(this); } + public ShadowgrangeArchfiend copy() { + return new ShadowgrangeArchfiend(this); + } } class ShadowgrangeArchfiendEffect extends OneShotEffect { @@ -61,10 +65,14 @@ class ShadowgrangeArchfiendEffect extends OneShotEffect { "You gain life equal to the greatest power among creatures sacrificed this way"; } - private ShadowgrangeArchfiendEffect(final ShadowgrangeArchfiendEffect effect) { super(effect); } + private ShadowgrangeArchfiendEffect(final ShadowgrangeArchfiendEffect effect) { + super(effect); + } @Override - public ShadowgrangeArchfiendEffect copy() { return new ShadowgrangeArchfiendEffect(this); } + public ShadowgrangeArchfiendEffect copy() { + return new ShadowgrangeArchfiendEffect(this); + } @Override public boolean apply(Game game, Ability source) { @@ -77,10 +85,14 @@ class ShadowgrangeArchfiendEffect extends OneShotEffect { // Iterate through each opponent for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - if (!controller.hasOpponent(playerId, game)) { continue; } + if (!controller.hasOpponent(playerId, game)) { + continue; + } Player opponent = game.getPlayer(playerId); - if (opponent == null) { continue; } + if (opponent == null) { + continue; + } int greatestPower = Integer.MIN_VALUE; int numberOfCreatures = 0; @@ -102,7 +114,7 @@ class ShadowgrangeArchfiendEffect extends OneShotEffect { FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent( "creature to sacrifice with power equal to " + greatestPower); filter.add(new PowerPredicate(ComparisonType.EQUAL_TO, greatestPower)); - Target target = new TargetControlledCreaturePermanent(filter); + Target target = new TargetPermanent(filter); if (opponent.choose(outcome, target, source, game)) { creatureToSacrifice = game.getPermanent(target.getFirstTarget()); } diff --git a/Mage.Sets/src/mage/cards/s/SharedDiscovery.java b/Mage.Sets/src/mage/cards/s/SharedDiscovery.java index c3d2d72d5d7..4f30bdc11ca 100644 --- a/Mage.Sets/src/mage/cards/s/SharedDiscovery.java +++ b/Mage.Sets/src/mage/cards/s/SharedDiscovery.java @@ -1,36 +1,27 @@ - package mage.cards.s; -import java.util.UUID; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author jeffwadsworth */ public final class SharedDiscovery extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } public SharedDiscovery(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{U}"); - + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{U}"); // As an additional cost to cast Shared Discovery, tap four untapped creatures you control. + this.getSpellAbility().addCost(new TapTargetCost(4, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); + // Draw three cards. this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(3)); - this.getSpellAbility().addCost(new TapTargetCost(new TargetControlledCreaturePermanent(4, 4, filter, true))); } private SharedDiscovery(final SharedDiscovery card) { diff --git a/Mage.Sets/src/mage/cards/s/SigilTracer.java b/Mage.Sets/src/mage/cards/s/SigilTracer.java index 3d1ca28e199..39be752fe18 100644 --- a/Mage.Sets/src/mage/cards/s/SigilTracer.java +++ b/Mage.Sets/src/mage/cards/s/SigilTracer.java @@ -1,7 +1,5 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -12,27 +10,27 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.permanent.TappedPredicate; import mage.target.TargetSpell; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** * @author Loki */ public final class SigilTracer extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Wizards you control"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent(SubType.WIZARD, "untapped Wizards you control"); static { filter.add(TappedPredicate.UNTAPPED); - filter.add(SubType.WIZARD.getPredicate()); } public SigilTracer(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); this.subtype.add(SubType.MERFOLK); this.subtype.add(SubType.WIZARD); @@ -42,7 +40,7 @@ public final class SigilTracer extends CardImpl { // {1}{U}, Tap two untapped Wizards you control: Copy target instant or sorcery spell. You may choose new targets for the copy. Ability ability = new SimpleActivatedAbility(new CopyTargetStackObjectEffect(), new ManaCostsImpl<>("{1}{U}")); ability.addTarget(new TargetSpell(StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY)); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + ability.addCost(new TapTargetCost(2, filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SkirsdagHighPriest.java b/Mage.Sets/src/mage/cards/s/SkirsdagHighPriest.java index d137341278e..7364d50e460 100644 --- a/Mage.Sets/src/mage/cards/s/SkirsdagHighPriest.java +++ b/Mage.Sets/src/mage/cards/s/SkirsdagHighPriest.java @@ -2,10 +2,10 @@ package mage.cards.s; import mage.MageInt; import mage.abilities.Ability; +import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.condition.common.MorbidCondition; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.common.ActivateIfConditionActivatedAbility; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.hint.common.MorbidHint; import mage.cards.CardImpl; @@ -13,10 +13,8 @@ import mage.cards.CardSetInfo; import mage.constants.AbilityWord; import mage.constants.CardType; import mage.constants.SubType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; +import mage.filter.StaticFilters; import mage.game.permanent.token.DemonToken; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -25,12 +23,6 @@ import java.util.UUID; */ public final class SkirsdagHighPriest extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public SkirsdagHighPriest(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add(SubType.HUMAN); @@ -43,7 +35,7 @@ public final class SkirsdagHighPriest extends CardImpl { Ability ability = new ActivateIfConditionActivatedAbility( new CreateTokenEffect(new DemonToken()), new TapSourceCost(), MorbidCondition.instance ); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + ability.addCost(new TapTargetCost(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); this.addAbility(ability.setAbilityWord(AbilityWord.MORBID).addHint(MorbidHint.instance)); } diff --git a/Mage.Sets/src/mage/cards/s/SkyHussar.java b/Mage.Sets/src/mage/cards/s/SkyHussar.java index 296144143f6..8a4f3b235dd 100644 --- a/Mage.Sets/src/mage/cards/s/SkyHussar.java +++ b/Mage.Sets/src/mage/cards/s/SkyHussar.java @@ -1,7 +1,5 @@ - package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -14,26 +12,32 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author emerald000 */ public final class SkyHussar extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white and/or blue creatures you control"); + + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("untapped white and/or blue creatures you control"); + static { - filter.add(Predicates.or(new ColorPredicate(ObjectColor.WHITE), new ColorPredicate(ObjectColor.BLUE))); + filter.add(Predicates.or( + new ColorPredicate(ObjectColor.WHITE), + new ColorPredicate(ObjectColor.BLUE) + )); filter.add(TappedPredicate.UNTAPPED); } public SkyHussar(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{U}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.KNIGHT); @@ -42,12 +46,17 @@ public final class SkyHussar extends CardImpl { // Flying this.addAbility(FlyingAbility.getInstance()); - + // When Sky Hussar enters the battlefield, untap all creatures you control. - this.addAbility(new EntersBattlefieldTriggeredAbility(new UntapAllControllerEffect(new FilterControlledCreaturePermanent(), "untap all creatures you control"), false)); + this.addAbility(new EntersBattlefieldTriggeredAbility(new UntapAllControllerEffect( + StaticFilters.FILTER_CONTROLLED_CREATURES, "untap all creatures you control" + ), false)); // Forecast - Tap two untapped white and/or blue creatures you control, Reveal Sky Hussar from your hand: Draw a card. - this.addAbility(new ForecastAbility(new DrawCardSourceControllerEffect(1), new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, true)))); + this.addAbility(new ForecastAbility( + new DrawCardSourceControllerEffect(1), + new TapTargetCost(2, filter) + )); } private SkyHussar(final SkyHussar card) { diff --git a/Mage.Sets/src/mage/cards/s/SnowHound.java b/Mage.Sets/src/mage/cards/s/SnowHound.java index eafb9f224bb..3d61ad59192 100644 --- a/Mage.Sets/src/mage/cards/s/SnowHound.java +++ b/Mage.Sets/src/mage/cards/s/SnowHound.java @@ -1,52 +1,48 @@ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; +import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.ReturnToHandSourceEffect; import mage.abilities.effects.common.ReturnToHandTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author fireshoes */ public final class SnowHound extends CardImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("green or blue creature"); + static { filter.add(Predicates.or( new ColorPredicate(ObjectColor.GREEN), - new ColorPredicate(ObjectColor.BLUE))); + new ColorPredicate(ObjectColor.BLUE) + )); } public SnowHound(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); this.subtype.add(SubType.DOG); this.power = new MageInt(1); this.toughness = new MageInt(1); // {1}, {tap}: Return Snow Hound and target green or blue creature you control to their owner's hand. - Effect effect = new ReturnToHandSourceEffect(true); - effect.setText("Return {this}"); - Ability ability = new SimpleActivatedAbility(effect, new ManaCostsImpl<>("{1}")); + Ability ability = new SimpleActivatedAbility(new ReturnToHandSourceEffect(true).setText("Return {this}"), new GenericManaCost(1)); ability.addCost(new TapSourceCost()); - effect = new ReturnToHandTargetEffect(); - effect.setText("and target green or blue creature you control to their owner's hand"); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); - ability.addEffect(effect); + ability.addEffect(new ReturnToHandTargetEffect().setText("and target green or blue creature you control to their owner's hand")); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SoulExchange.java b/Mage.Sets/src/mage/cards/s/SoulExchange.java index 5770ae38cda..a8882481600 100644 --- a/Mage.Sets/src/mage/cards/s/SoulExchange.java +++ b/Mage.Sets/src/mage/cards/s/SoulExchange.java @@ -1,6 +1,5 @@ package mage.cards.s; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.common.ExileTargetCost; @@ -16,7 +15,9 @@ import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetCardInYourGraveyard; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; + +import java.util.UUID; /** * @author MarcoMarin @@ -27,12 +28,11 @@ public final class SoulExchange extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{B}{B}"); // As an additional cost to cast Soul Exchange, exile a creature you control. - Cost cost = new ExileTargetCost(new TargetControlledCreaturePermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE)); - this.getSpellAbility().addCost(cost); + this.getSpellAbility().addCost(new ExileTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_A_CREATURE))); + // Return target creature card from your graveyard to the battlefield. Put a +2/+2 counter on that creature if the exiled creature was a Thrull. this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD)); this.getSpellAbility().addEffect(new SoulExchangeEffect()); - } private SoulExchange(final SoulExchange card) { diff --git a/Mage.Sets/src/mage/cards/s/Soulherder.java b/Mage.Sets/src/mage/cards/s/Soulherder.java index 57c5499b6a7..c26f70fec1c 100644 --- a/Mage.Sets/src/mage/cards/s/Soulherder.java +++ b/Mage.Sets/src/mage/cards/s/Soulherder.java @@ -2,10 +2,10 @@ package mage.cards.s; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; import mage.abilities.common.ZoneChangeTriggeredAbility; import mage.abilities.effects.common.ExileThenReturnTargetEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; @@ -18,7 +18,7 @@ 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.TargetPermanent; import java.util.UUID; @@ -41,7 +41,7 @@ public final class Soulherder extends CardImpl { Ability ability = new BeginningOfEndStepTriggeredAbility(TargetController.YOU, new ExileThenReturnTargetEffect(false, true), true ); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SpikeRogue.java b/Mage.Sets/src/mage/cards/s/SpikeRogue.java index 60054497861..0873b0b5323 100644 --- a/Mage.Sets/src/mage/cards/s/SpikeRogue.java +++ b/Mage.Sets/src/mage/cards/s/SpikeRogue.java @@ -1,6 +1,5 @@ package mage.cards.s; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldAbility; @@ -14,14 +13,13 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; import mage.counters.CounterType; -import mage.filter.StaticFilters; import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class SpikeRogue extends CardImpl { @@ -43,7 +41,7 @@ public final class SpikeRogue extends CardImpl { // {2}, Remove a +1/+1 counter from a creature you control: Put a +1/+1 counter on Spike Rogue. Ability ability2 = new SimpleActivatedAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1)), new GenericManaCost(2)); - ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(1, 1, StaticFilters.FILTER_CONTROLLED_CREATURE, true), CounterType.P1P1)); + ability2.addCost(new RemoveCounterCost(new TargetControlledCreaturePermanent(), CounterType.P1P1)); this.addAbility(ability2); } diff --git a/Mage.Sets/src/mage/cards/s/SplashySpellcaster.java b/Mage.Sets/src/mage/cards/s/SplashySpellcaster.java index 0bcdfb6ba40..c7ae29d71ab 100644 --- a/Mage.Sets/src/mage/cards/s/SplashySpellcaster.java +++ b/Mage.Sets/src/mage/cards/s/SplashySpellcaster.java @@ -12,12 +12,11 @@ import mage.constants.SubType; import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.AnotherPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; /** - * * @author Susucr */ public final class SplashySpellcaster extends CardImpl { @@ -31,7 +30,7 @@ public final class SplashySpellcaster extends CardImpl { public SplashySpellcaster(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); - + this.subtype.add(SubType.ELEMENTAL); this.subtype.add(SubType.WIZARD); this.power = new MageInt(2); @@ -42,8 +41,7 @@ public final class SplashySpellcaster extends CardImpl { new CreateRoleAttachedTargetEffect(RoleType.SORCERER), StaticFilters.FILTER_SPELL_AN_INSTANT_OR_SORCERY, false ); - ability.addTarget(new TargetControlledCreaturePermanent(0, 1, filter, false)); - + ability.addTarget(new TargetPermanent(0, 1, filter)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SpringleafDrum.java b/Mage.Sets/src/mage/cards/s/SpringleafDrum.java index 9a19176ec54..478c2a72f9a 100644 --- a/Mage.Sets/src/mage/cards/s/SpringleafDrum.java +++ b/Mage.Sets/src/mage/cards/s/SpringleafDrum.java @@ -1,33 +1,26 @@ - package mage.cards.s; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.common.TapTargetCost; import mage.abilities.mana.AnyColorManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; + +import java.util.UUID; /** * @author Loki */ public final class SpringleafDrum extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public SpringleafDrum(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); + // {T}, Tap an untapped creature you control: Add one mana of any color. Ability ability = new AnyColorManaAbility(); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false))); + ability.addCost(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SteelclawLance.java b/Mage.Sets/src/mage/cards/s/SteelclawLance.java index 733f9a55e64..b80874c09d7 100644 --- a/Mage.Sets/src/mage/cards/s/SteelclawLance.java +++ b/Mage.Sets/src/mage/cards/s/SteelclawLance.java @@ -9,17 +9,18 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; -import mage.target.common.TargetControlledCreaturePermanent; /** * @author TheElk801 */ public final class SteelclawLance extends CardImpl { - private static final FilterControlledCreaturePermanent filter + private static final FilterPermanent filter = new FilterControlledCreaturePermanent(SubType.KNIGHT, "Knight"); public SteelclawLance(UUID ownerId, CardSetInfo setInfo) { @@ -31,10 +32,10 @@ public final class SteelclawLance extends CardImpl { this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(2, 2))); // Equip Knight {1} - this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetControlledCreaturePermanent(filter), false)); + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(1), new TargetPermanent(filter), false)); // Equip {3} - this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3), new TargetControlledCreaturePermanent(), false)); + this.addAbility(new EquipAbility(3, false)); } diff --git a/Mage.Sets/src/mage/cards/s/SymbioticDeployment.java b/Mage.Sets/src/mage/cards/s/SymbioticDeployment.java index bae31e2a3b7..81c761cebf7 100644 --- a/Mage.Sets/src/mage/cards/s/SymbioticDeployment.java +++ b/Mage.Sets/src/mage/cards/s/SymbioticDeployment.java @@ -1,43 +1,33 @@ - package mage.cards.s; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapTargetCost; -import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.SkipDrawStepEffect; 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.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author fireshoes */ public final class SymbioticDeployment extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } public SymbioticDeployment(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}"); // Skip your draw step. this.addAbility(new SimpleStaticAbility(new SkipDrawStepEffect())); - + // {1}, Tap two untapped creatures you control: Draw a card. - Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new ManaCostsImpl<>("{1}")); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + Ability ability = new SimpleActivatedAbility(new DrawCardSourceControllerEffect(1), new GenericManaCost(1)); + ability.addCost(new TapTargetCost(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SyrGwynHeroOfAshvale.java b/Mage.Sets/src/mage/cards/s/SyrGwynHeroOfAshvale.java index 3af5f5c8d07..6680746e72c 100644 --- a/Mage.Sets/src/mage/cards/s/SyrGwynHeroOfAshvale.java +++ b/Mage.Sets/src/mage/cards/s/SyrGwynHeroOfAshvale.java @@ -15,10 +15,10 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.FilterPermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.permanent.EquippedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -27,11 +27,9 @@ import java.util.UUID; */ public final class SyrGwynHeroOfAshvale extends CardImpl { - private static final FilterControlledCreaturePermanent filter + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("equipped creature you control"); private static final FilterPermanent filter2 - = new FilterControlledPermanent(SubType.EQUIPMENT); - private static final FilterControlledCreaturePermanent filter3 = new FilterControlledCreaturePermanent(SubType.KNIGHT, "Knight"); static { @@ -63,9 +61,8 @@ public final class SyrGwynHeroOfAshvale extends CardImpl { // Equipment you control have equip Knight {0}. this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect( new EquipAbility( - Outcome.AddAbility, new GenericManaCost(0), - new TargetControlledCreaturePermanent(filter3) - ), Duration.WhileOnBattlefield, filter2 + Outcome.AddAbility, new GenericManaCost(0), new TargetPermanent(filter2) + ), Duration.WhileOnBattlefield, StaticFilters.FILTER_CONTROLLED_PERMANENT_EQUIPMENT ).setText("Equipment you control have equip Knight {0}."))); } diff --git a/Mage.Sets/src/mage/cards/t/TaleOfTinuviel.java b/Mage.Sets/src/mage/cards/t/TaleOfTinuviel.java index 436831ae34f..f5ccf51b009 100644 --- a/Mage.Sets/src/mage/cards/t/TaleOfTinuviel.java +++ b/Mage.Sets/src/mage/cards/t/TaleOfTinuviel.java @@ -48,7 +48,7 @@ public final class TaleOfTinuviel extends CardImpl { sagaAbility.addChapterEffect( this, SagaChapter.CHAPTER_III, SagaChapter.CHAPTER_III, new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn), - new TargetControlledCreaturePermanent(0, 2, StaticFilters.FILTER_CONTROLLED_CREATURES, false) + new TargetControlledCreaturePermanent(0, 2) ); this.addAbility(sagaAbility); } diff --git a/Mage.Sets/src/mage/cards/t/TeamPennant.java b/Mage.Sets/src/mage/cards/t/TeamPennant.java index db08dfa9020..c4a3a5fa169 100644 --- a/Mage.Sets/src/mage/cards/t/TeamPennant.java +++ b/Mage.Sets/src/mage/cards/t/TeamPennant.java @@ -14,23 +14,16 @@ import mage.constants.AttachmentType; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; -import mage.filter.predicate.permanent.TokenPredicate; +import mage.filter.StaticFilters; +import mage.target.TargetPermanent; import java.util.UUID; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.target.common.TargetControlledCreaturePermanent; /** * @author TheElk801 */ public final class TeamPennant extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature token"); - - static { - filter.add(TokenPredicate.TRUE); - } - public TeamPennant(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); @@ -48,11 +41,12 @@ public final class TeamPennant extends CardImpl { // Equip creature token {1} this.addAbility(new EquipAbility( - Outcome.BoostCreature, new GenericManaCost(1), new TargetControlledCreaturePermanent(filter), false + Outcome.BoostCreature, new GenericManaCost(1), + new TargetPermanent(StaticFilters.FILTER_CREATURE_TOKEN), false )); // Equip {3} - this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(3), new TargetControlledCreaturePermanent(), false)); + this.addAbility(new EquipAbility(3, false)); } private TeamPennant(final TeamPennant card) { diff --git a/Mage.Sets/src/mage/cards/t/TegwyllsScouring.java b/Mage.Sets/src/mage/cards/t/TegwyllsScouring.java index b01786f5bbe..f5b263069dc 100644 --- a/Mage.Sets/src/mage/cards/t/TegwyllsScouring.java +++ b/Mage.Sets/src/mage/cards/t/TegwyllsScouring.java @@ -16,7 +16,6 @@ import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.permanent.token.FaerieRogueToken; -import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; @@ -24,6 +23,7 @@ import java.util.UUID; * @author karapuzz14 */ public final class TegwyllsScouring extends CardImpl { + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control with flying"); static { @@ -34,11 +34,9 @@ public final class TegwyllsScouring extends CardImpl { public TegwyllsScouring(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}"); - // You may cast Tegwyll's Scouring as though it had flash by tapping three untapped creatures you control with flying in addition to paying its other costs. - Cost asThoughCost = new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true)).setText(""); CostsImpl costs = new CostsImpl<>().setText("tapping three untapped creatures you control with flying"); - costs.add(asThoughCost); + costs.add(new TapTargetCost(3, filter).setText("")); Ability ability = new PayMoreToCastAsThoughtItHadFlashAbility(this, costs); ability.addEffect(new DestroyAllEffect(StaticFilters.FILTER_PERMANENT_CREATURES)); @@ -60,4 +58,4 @@ public final class TegwyllsScouring extends CardImpl { public TegwyllsScouring copy() { return new TegwyllsScouring(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/t/Telethopter.java b/Mage.Sets/src/mage/cards/t/Telethopter.java index 14ffaeed362..b61ade45608 100644 --- a/Mage.Sets/src/mage/cards/t/Telethopter.java +++ b/Mage.Sets/src/mage/cards/t/Telethopter.java @@ -1,7 +1,5 @@ - package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -10,30 +8,27 @@ import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.constants.SubType; +import mage.filter.StaticFilters; + +import java.util.UUID; /** * @author Loki */ public final class Telethopter extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public Telethopter(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT,CardType.CREATURE},"{4}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}"); this.subtype.add(SubType.THOPTER); this.power = new MageInt(3); this.toughness = new MageInt(1); - this.addAbility(new SimpleActivatedAbility(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, false)))); + + this.addAbility(new SimpleActivatedAbility( + new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), + new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) + )); } private Telethopter(final Telethopter card) { diff --git a/Mage.Sets/src/mage/cards/t/TemmetVizierOfNaktamun.java b/Mage.Sets/src/mage/cards/t/TemmetVizierOfNaktamun.java index 98f060d1a8e..91a561a03d9 100644 --- a/Mage.Sets/src/mage/cards/t/TemmetVizierOfNaktamun.java +++ b/Mage.Sets/src/mage/cards/t/TemmetVizierOfNaktamun.java @@ -1,32 +1,30 @@ - package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; import mage.abilities.effects.common.continuous.BoostTargetEffect; import mage.abilities.keyword.EmbalmAbility; +import mage.abilities.triggers.BeginningOfCombatTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Duration; import mage.constants.SuperType; +import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.TokenPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author fireshoes */ public final class TemmetVizierOfNaktamun extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature token you control"); + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature token you control"); static { filter.add(TokenPredicate.TRUE); @@ -42,11 +40,9 @@ public final class TemmetVizierOfNaktamun extends CardImpl { this.toughness = new MageInt(2); // At the beginning of combat on your turn, target creature token you control gets +1/+1 until end of turn and can't be blocked this turn. - Ability ability = new BeginningOfCombatTriggeredAbility(new BoostTargetEffect(1, 1, Duration.EndOfTurn)); - Effect effect = new CantBeBlockedTargetEffect(); - effect.setText(" and can't be blocked this turn"); - ability.addEffect(effect); - ability.addTarget(new TargetControlledCreaturePermanent(filter)); + Ability ability = new BeginningOfCombatTriggeredAbility(new BoostTargetEffect(1, 1)); + ability.addEffect(new CantBeBlockedTargetEffect().setText("and can't be blocked this turn")); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); // Embalm {3}{W}{U} diff --git a/Mage.Sets/src/mage/cards/t/TheApprenticesFolly.java b/Mage.Sets/src/mage/cards/t/TheApprenticesFolly.java index d5c884bddb4..36ae2a78dd1 100644 --- a/Mage.Sets/src/mage/cards/t/TheApprenticesFolly.java +++ b/Mage.Sets/src/mage/cards/t/TheApprenticesFolly.java @@ -17,7 +17,7 @@ import mage.filter.predicate.mageobject.NamePredicate; import mage.filter.predicate.permanent.TokenPredicate; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -53,7 +53,7 @@ public final class TheApprenticesFolly extends CardImpl { .setText("choose target nontoken creature you control that doesn't have the same name as a " + "token you control. Create a token that's a copy of it, except it isn't legendary, " + "is a Reflection in addition to its other types, and has haste"), - new TargetControlledCreaturePermanent(filter) + new TargetPermanent(filter) ); // III -- Sacrifice all Reflections you control. @@ -88,4 +88,4 @@ enum TheApprenticesFollyPredicate implements ObjectSourcePlayerPredicate 0 && player.chooseUse(Outcome.AIDontUseIt, "Pay {U} and untap a tapped blue creature under your control?", source, game)) { - Target tappedCreatureTarget = new TargetControlledCreaturePermanent(1, 1, filter, true); - if (player.choose(Outcome.Detriment, tappedCreatureTarget, source, game)) { - Cost cost = new ManaCostsImpl<>("{U}"); - Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); - - if (cost.pay(source, game, source, player.getId(), false)) { - tappedCreature.untap(game); - } - } - countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); - } - return true; + if (player == null || sourcePermanent == null) { + return false; } - return false; + int countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); + while (player.canRespond() && countBattlefield > 0 && player.chooseUse(Outcome.AIDontUseIt, "Pay {U} and untap a tapped blue creature under your control?", source, game)) { + Target tappedCreatureTarget = new TargetPermanent(filter); + tappedCreatureTarget.withNotTarget(true); + if (player.choose(Outcome.Detriment, tappedCreatureTarget, source, game)) { + Cost cost = new ManaCostsImpl<>("{U}"); + Permanent tappedCreature = game.getPermanent(tappedCreatureTarget.getFirstTarget()); + + if (cost.pay(source, game, source, player.getId(), false)) { + tappedCreature.untap(game); + } + } + countBattlefield = game.getBattlefield().getAllActivePermanents(filter, game.getActivePlayerId(), game).size(); + } + return true; } } diff --git a/Mage.Sets/src/mage/cards/t/TopanAscetic.java b/Mage.Sets/src/mage/cards/t/TopanAscetic.java index 6343817994c..fd469d319a9 100644 --- a/Mage.Sets/src/mage/cards/t/TopanAscetic.java +++ b/Mage.Sets/src/mage/cards/t/TopanAscetic.java @@ -1,7 +1,5 @@ - package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.TapTargetCost; @@ -9,27 +7,19 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.constants.SubType; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author Plopman */ public final class TopanAscetic extends CardImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - static{ - filter.add(TappedPredicate.UNTAPPED); - } - public TopanAscetic(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(SubType.HUMAN); this.subtype.add(SubType.MONK); @@ -37,7 +27,10 @@ public final class TopanAscetic extends CardImpl { this.toughness = new MageInt(2); // Tap an untapped creature you control: Topan Ascetic gets +1/+1 until end of turn. - this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)))); + this.addAbility(new SimpleActivatedAbility( + new BoostSourceEffect(1, 1, Duration.EndOfTurn), + new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE) + )); } private TopanAscetic(final TopanAscetic card) { diff --git a/Mage.Sets/src/mage/cards/t/TotentanzSwarmPiper.java b/Mage.Sets/src/mage/cards/t/TotentanzSwarmPiper.java index ecbbdf204c0..b3104dc78ef 100644 --- a/Mage.Sets/src/mage/cards/t/TotentanzSwarmPiper.java +++ b/Mage.Sets/src/mage/cards/t/TotentanzSwarmPiper.java @@ -18,7 +18,7 @@ import mage.filter.StaticFilters; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.predicate.permanent.AttackingPredicate; import mage.game.permanent.token.RatCantBlockToken; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -55,7 +55,7 @@ public final class TotentanzSwarmPiper extends CardImpl { new GainAbilityTargetEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl<>("{1}{B}") ); - ability.addTarget(new TargetControlledCreaturePermanent(filterRat)); + ability.addTarget(new TargetPermanent(filterRat)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TownGossipmonger.java b/Mage.Sets/src/mage/cards/t/TownGossipmonger.java index 50cbd67ab97..1ebe153eed6 100644 --- a/Mage.Sets/src/mage/cards/t/TownGossipmonger.java +++ b/Mage.Sets/src/mage/cards/t/TownGossipmonger.java @@ -1,8 +1,5 @@ - package mage.cards.t; -import java.util.UUID; - import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -14,22 +11,15 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.filter.StaticFilters; + +import java.util.UUID; /** * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public final class TownGossipmonger extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creature you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public TownGossipmonger(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}"); this.subtype.add(SubType.HUMAN); @@ -41,7 +31,7 @@ public final class TownGossipmonger extends CardImpl { // {T}, Tap an untapped creature you control: Transform Town Gossipmonger. this.addAbility(new TransformAbility()); Ability ability = new SimpleActivatedAbility(new TransformSourceEffect(), new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))); + ability.addCost(new TapTargetCost(StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURE)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/TradewindRider.java b/Mage.Sets/src/mage/cards/t/TradewindRider.java index f4263b54f89..652ef4bf5ad 100644 --- a/Mage.Sets/src/mage/cards/t/TradewindRider.java +++ b/Mage.Sets/src/mage/cards/t/TradewindRider.java @@ -1,7 +1,5 @@ - package mage.cards.t; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -13,32 +11,27 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.permanent.TappedPredicate; +import mage.filter.StaticFilters; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** * @author Loki */ public final class TradewindRider extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped creatures you control"); - - static { - filter.add(TappedPredicate.UNTAPPED); - } - public TradewindRider(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}"); this.subtype.add(SubType.SPIRIT); this.power = new MageInt(1); this.toughness = new MageInt(4); + this.addAbility(FlyingAbility.getInstance()); + Ability ability = new SimpleActivatedAbility(new ReturnToHandTargetEffect(), new TapSourceCost()); - ability.addCost(new TapTargetCost(new TargetControlledCreaturePermanent(2, 2, filter, false))); + ability.addCost(new TapTargetCost(2, StaticFilters.FILTER_CONTROLLED_UNTAPPED_CREATURES)); ability.addTarget(new TargetPermanent()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/t/Twinflame.java b/Mage.Sets/src/mage/cards/t/Twinflame.java index c733b4fa07c..725090855ca 100644 --- a/Mage.Sets/src/mage/cards/t/Twinflame.java +++ b/Mage.Sets/src/mage/cards/t/Twinflame.java @@ -1,7 +1,6 @@ package mage.cards.t; import mage.abilities.Ability; -import mage.abilities.DelayedTriggeredAbility; import mage.abilities.abilityword.StriveAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -11,7 +10,6 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Outcome; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -36,8 +34,7 @@ public final class Twinflame extends CardImpl { // Choose any number of target creatures you control. For each of them, create a token that's a copy of that creature, except it has haste. Exile them at the beginning of the next end step. this.getSpellAbility().addEffect(new TwinflameCopyEffect()); - this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, new FilterControlledCreaturePermanent(), false)); - + this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE)); } private Twinflame(final Twinflame card) { @@ -69,23 +66,22 @@ class TwinflameCopyEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - List toExile = new ArrayList<>(); - for (UUID creatureId : this.getTargetPointer().getTargets(game, source)) { - Permanent creature = game.getPermanentOrLKIBattlefield(creatureId); - if (creature != null) { - CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true); - effect.setTargetPointer(new FixedTarget(creature, game)); - effect.apply(game, source); - toExile.addAll(effect.getAddedPermanents()); - } - } - ExileTargetEffect exileEffect = new ExileTargetEffect(); - exileEffect.setTargetPointer(new FixedTargets(toExile, game)); - DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect); - game.addDelayedTriggeredAbility(delayedAbility, source); - return true; + if (controller == null) { + return false; } - return false; + List toExile = new ArrayList<>(); + for (UUID creatureId : this.getTargetPointer().getTargets(game, source)) { + Permanent creature = game.getPermanentOrLKIBattlefield(creatureId); + if (creature != null) { + CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true); + effect.setTargetPointer(new FixedTarget(creature, game)); + effect.apply(game, source); + toExile.addAll(effect.getAddedPermanents()); + } + } + game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility( + new ExileTargetEffect().setTargetPointer(new FixedTargets(toExile, game)) + ), source); + return true; } } diff --git a/Mage.Sets/src/mage/cards/u/UnrulyKrasis.java b/Mage.Sets/src/mage/cards/u/UnrulyKrasis.java index b48ac0fe224..0b54128017f 100644 --- a/Mage.Sets/src/mage/cards/u/UnrulyKrasis.java +++ b/Mage.Sets/src/mage/cards/u/UnrulyKrasis.java @@ -17,7 +17,7 @@ import mage.constants.SubType; import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -40,7 +40,7 @@ public final class UnrulyKrasis extends CardImpl { // Whenever Unruly Krasis attacks, you may have the base power and toughness of another target creature you control become X/X until end of turn, where X is Unruly Krasis's power. Ability ability = new AttacksTriggeredAbility(new UnrulyKrasisEffect(), true); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); // {3}{G}{U}: Adapt 3. @@ -87,4 +87,4 @@ class UnrulyKrasisEffect extends OneShotEffect { game.addEffect(effect, source); return true; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/v/VassalsDuty.java b/Mage.Sets/src/mage/cards/v/VassalsDuty.java index f1844c0b0a5..c5ac751485c 100644 --- a/Mage.Sets/src/mage/cards/v/VassalsDuty.java +++ b/Mage.Sets/src/mage/cards/v/VassalsDuty.java @@ -1,7 +1,5 @@ - package mage.cards.v; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.GenericManaCost; @@ -10,32 +8,25 @@ 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.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.events.GameEvent; +import mage.target.TargetPermanent; import mage.target.TargetPlayer; -import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.UUID; /** - * * @author LevelX2 */ public final class VassalsDuty extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("legendary creature you control"); - - static { - filter.add(SuperType.LEGENDARY.getPredicate()); - } - public VassalsDuty(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}"); // {1}: The next 1 damage that would be dealt to target legendary creature you control this turn is dealt to you instead. - Ability ability = new SimpleActivatedAbility(new VassalsDutyPreventDamageTargetEffect(Duration.EndOfTurn, 1), new GenericManaCost(1)); - ability.addTarget(new TargetControlledCreaturePermanent(1, 1, filter, false)); + Ability ability = new SimpleActivatedAbility(new VassalsDutyPreventDamageTargetEffect(), new GenericManaCost(1)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE_LEGENDARY)); this.addAbility(ability); } @@ -51,9 +42,9 @@ public final class VassalsDuty extends CardImpl { class VassalsDutyPreventDamageTargetEffect extends RedirectionEffect { - VassalsDutyPreventDamageTargetEffect(Duration duration, int amount) { - super(duration, amount, UsageType.ONE_USAGE_ABSOLUTE); - staticText = "The next " + amount + " damage that would be dealt to target legendary creature you control this turn is dealt to you instead"; + VassalsDutyPreventDamageTargetEffect() { + super(Duration.EndOfTurn, 1, UsageType.ONE_USAGE_ABSOLUTE); + staticText = "The next 1 damage that would be dealt to target legendary creature you control this turn is dealt to you instead"; } private VassalsDutyPreventDamageTargetEffect(final VassalsDutyPreventDamageTargetEffect effect) { @@ -67,13 +58,13 @@ class VassalsDutyPreventDamageTargetEffect extends RedirectionEffect { @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { - TargetPlayer target = new TargetPlayer(); - target.add(source.getControllerId(), game); - redirectTarget = target; - return true; + if (!event.getTargetId().equals(getTargetPointer().getFirst(game, source))) { + return false; } - return false; + TargetPlayer target = new TargetPlayer(); + target.add(source.getControllerId(), game); + redirectTarget = target; + return true; } } diff --git a/Mage.Sets/src/mage/cards/v/VeilOfSecrecy.java b/Mage.Sets/src/mage/cards/v/VeilOfSecrecy.java index c4829438b5e..dbf44a7a14b 100644 --- a/Mage.Sets/src/mage/cards/v/VeilOfSecrecy.java +++ b/Mage.Sets/src/mage/cards/v/VeilOfSecrecy.java @@ -2,7 +2,6 @@ package mage.cards.v; import mage.ObjectColor; import mage.abilities.costs.common.ReturnToHandChosenControlledPermanentCost; -import mage.abilities.effects.Effect; import mage.abilities.effects.common.combat.CantBeBlockedTargetEffect; import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; import mage.abilities.keyword.ShroudAbility; @@ -10,42 +9,37 @@ import mage.abilities.keyword.SpliceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Duration; import mage.constants.SubType; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; import java.util.UUID; /** - * * @author LevelX2 */ public final class VeilOfSecrecy extends CardImpl { - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a blue creature"); + private static final FilterControlledPermanent filter = new FilterControlledCreaturePermanent("a blue creature"); static { filter.add(new ColorPredicate(ObjectColor.BLUE)); } public VeilOfSecrecy(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{U}"); this.subtype.add(SubType.ARCANE); // Target creature gains shroud until end of turn and can't be blocked this turn. - Effect effect = new GainAbilityTargetEffect(ShroudAbility.getInstance(), Duration.EndOfTurn); + this.getSpellAbility().addEffect(new GainAbilityTargetEffect(ShroudAbility.getInstance()).setText("target creature gains shroud until end of turn")); + this.getSpellAbility().addEffect(new CantBeBlockedTargetEffect().setText("and can't be blocked this turn")); this.getSpellAbility().addTarget(new TargetCreaturePermanent().withChooseHint("gains shroud and can't be blocked")); - effect.setText("Target creature gains shroud until end of turn"); - this.getSpellAbility().addEffect(effect); - effect = new CantBeBlockedTargetEffect(); - effect.setText("and can't be blocked this turn"); - this.getSpellAbility().addEffect(effect); - + // Splice onto Arcane-Return a blue creature you control to its owner's hand. - this.addAbility(new SpliceAbility(SpliceAbility.ARCANE, new ReturnToHandChosenControlledPermanentCost(new TargetControlledCreaturePermanent(filter)))); + this.addAbility(new SpliceAbility(SpliceAbility.ARCANE, new ReturnToHandChosenControlledPermanentCost(new TargetControlledPermanent(filter)))); } private VeilOfSecrecy(final VeilOfSecrecy card) { diff --git a/Mage.Sets/src/mage/cards/v/VoidGrafter.java b/Mage.Sets/src/mage/cards/v/VoidGrafter.java index c1113515201..0c06de0094a 100644 --- a/Mage.Sets/src/mage/cards/v/VoidGrafter.java +++ b/Mage.Sets/src/mage/cards/v/VoidGrafter.java @@ -1,6 +1,5 @@ package mage.cards.v; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; @@ -11,19 +10,20 @@ import mage.abilities.keyword.HexproofAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Duration; +import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; + +import java.util.UUID; /** - * * @author fireshoes */ public final class VoidGrafter extends CardImpl { public VoidGrafter(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}"); this.subtype.add(SubType.ELDRAZI); this.subtype.add(SubType.DRONE); this.power = new MageInt(2); @@ -36,8 +36,10 @@ public final class VoidGrafter extends CardImpl { this.addAbility(FlashAbility.getInstance()); // When Void Grafter enters the battlefield, another target creature you control gain hexproof until end of turn. - Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(HexproofAbility.getInstance(), Duration.EndOfTurn), false); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect( + HexproofAbility.getInstance(), Duration.EndOfTurn + ), false); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/w/WeightOfConscience.java b/Mage.Sets/src/mage/cards/w/WeightOfConscience.java index b7218100ba9..063c4dec9a6 100644 --- a/Mage.Sets/src/mage/cards/w/WeightOfConscience.java +++ b/Mage.Sets/src/mage/cards/w/WeightOfConscience.java @@ -14,6 +14,7 @@ import mage.cards.CardSetInfo; import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicate; import mage.filter.predicate.mageobject.SharesCreatureTypePredicate; import mage.filter.predicate.permanent.TappedPredicate; @@ -21,7 +22,7 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetControlledPermanent; import mage.target.common.TargetCreaturePermanent; import java.util.*; @@ -59,9 +60,9 @@ public final class WeightOfConscience extends CardImpl { } } -class WeightOfConscienceTarget extends TargetControlledCreaturePermanent { +class WeightOfConscienceTarget extends TargetControlledPermanent { - private static final FilterControlledCreaturePermanent filterUntapped = new FilterControlledCreaturePermanent("untapped creatures you control that share a creature type"); + private static final FilterControlledPermanent filterUntapped = new FilterControlledCreaturePermanent("untapped creatures you control that share a creature type"); static { filterUntapped.add(TappedPredicate.UNTAPPED); diff --git a/Mage.Sets/src/mage/cards/w/WispweaverAngel.java b/Mage.Sets/src/mage/cards/w/WispweaverAngel.java index 5a6cb31661f..02a0c380183 100644 --- a/Mage.Sets/src/mage/cards/w/WispweaverAngel.java +++ b/Mage.Sets/src/mage/cards/w/WispweaverAngel.java @@ -10,7 +10,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.filter.StaticFilters; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import java.util.UUID; @@ -30,7 +30,7 @@ public final class WispweaverAngel extends CardImpl { // When Wispweaver Angel enters the battlefield, you may exile another target creature you control, then return that card to the battlefield under its owner's control. Ability ability = new EntersBattlefieldTriggeredAbility(new ExileThenReturnTargetEffect(false, true), true); - ability.addTarget(new TargetControlledCreaturePermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_TARGET_CREATURE_YOU_CONTROL)); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java b/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java index d0d6d54b835..bec1a7bba71 100644 --- a/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java +++ b/Mage.Sets/src/mage/cards/z/ZephyrSentinel.java @@ -17,8 +17,9 @@ import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; +import java.util.Optional; import java.util.UUID; /** @@ -42,7 +43,7 @@ public final class ZephyrSentinel extends CardImpl { // When Zephyr Sentinel enters the battlefield, return up to one other target creature you control to its owner's hand. If it was a Soldier, put a +1/+1 counter on Zephyr Sentinel. Ability ability = new EntersBattlefieldTriggeredAbility(new ZephyrSentinelEffect()); - ability.addTarget(new TargetControlledCreaturePermanent(0, 1, StaticFilters.FILTER_OTHER_CONTROLLED_CREATURE, false)); + ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_OTHER_CONTROLLED_CREATURE)); this.addAbility(ability); } @@ -74,21 +75,16 @@ class ZephyrSentinelEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Permanent targetPermanent = game.getPermanent(source.getFirstTarget()); - if (targetPermanent == null) { - return false; - } Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { + Permanent targetPermanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (controller == null || targetPermanent == null) { return false; } boolean soldier = targetPermanent.hasSubtype(SubType.SOLDIER, game); controller.moveCards(targetPermanent, Zone.HAND, source, game); if (soldier) { - Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game); - if (sourcePermanent != null) { - sourcePermanent.addCounters(CounterType.P1P1.createInstance(), source, game); - } + Optional.ofNullable(source.getSourcePermanentIfItStillExists(game)) + .ifPresent(permanent -> permanent.addCounters(CounterType.P1P1.createInstance(), source, game)); } return true; } diff --git a/Mage.Sets/src/mage/cards/z/ZimoneParadoxSculptor.java b/Mage.Sets/src/mage/cards/z/ZimoneParadoxSculptor.java index 5f5ce39c441..2f5c267e606 100644 --- a/Mage.Sets/src/mage/cards/z/ZimoneParadoxSculptor.java +++ b/Mage.Sets/src/mage/cards/z/ZimoneParadoxSculptor.java @@ -17,30 +17,24 @@ import mage.constants.SuperType; import mage.counters.Counter; import mage.counters.CounterType; import mage.filter.FilterPermanent; -import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.Predicates; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.Target; import mage.target.TargetPermanent; import mage.target.common.TargetControlledCreaturePermanent; import java.util.UUID; /** - * * @author ciaccona007 */ public final class ZimoneParadoxSculptor extends CardImpl { - private static final FilterControlledCreaturePermanent filterCreature = new FilterControlledCreaturePermanent(); - private static final FilterPermanent filterArtifactOrCreature = new FilterControlledPermanent(); + private static final FilterPermanent filter = new FilterControlledPermanent("up to two artifacts and/or creatures you control"); static { - filterCreature.setMessage("up to two creatures you control"); - filterArtifactOrCreature.setMessage("up to two artifacts and/or creatures you control"); - filterArtifactOrCreature.add(Predicates.or( + filter.add(Predicates.or( CardType.ARTIFACT.getPredicate(), CardType.CREATURE.getPredicate() )); @@ -48,7 +42,7 @@ public final class ZimoneParadoxSculptor extends CardImpl { public ZimoneParadoxSculptor(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}"); - + this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -57,19 +51,15 @@ public final class ZimoneParadoxSculptor extends CardImpl { // At the beginning of combat on your turn, put a +1/+1 counter on each of up to two target creatures you control. Ability triggeredAbility = new BeginningOfCombatTriggeredAbility( - new AddCountersTargetEffect( - CounterType.P1P1.createInstance() - ).setText("put a +1/+1 counter on each of up to two target creatures you control") - ); - triggeredAbility.addTarget( - new TargetControlledCreaturePermanent(0, 2, filterCreature, false) + new AddCountersTargetEffect(CounterType.P1P1.createInstance()) ); + triggeredAbility.addTarget(new TargetControlledCreaturePermanent(0, 2)); this.addAbility(triggeredAbility); // {G}{U}, {T}: Double the number of each kind of counter on up to two target creatures and/or artifacts you control. Ability ability = new SimpleActivatedAbility(new ZimoneParadoxSculptorEffect(), new ManaCostsImpl<>("{G}{U}")); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetPermanent(0, 2, filterArtifactOrCreature)); + ability.addTarget(new TargetPermanent(0, 2, filter)); this.addAbility(ability); } @@ -102,20 +92,16 @@ class ZimoneParadoxSculptorEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - boolean didOne = false; - - for (Target target : source.getTargets()) { - for (UUID targetID : target.getTargets()) { - Permanent permanent = game.getPermanent(targetID); - if (permanent != null) { - for (Counter counter : permanent.getCounters(game).values()) { - Counter newCounter = new Counter(counter.getName(), counter.getCount()); - permanent.addCounters(newCounter, source.getControllerId(), source, game); - didOne = true; - } - } + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + Permanent permanent = game.getPermanent(targetId); + if (permanent == null) { + continue; + } + for (Counter counter : permanent.getCounters(game).values()) { + Counter newCounter = new Counter(counter.getName(), counter.getCount()); + permanent.addCounters(newCounter, source.getControllerId(), source, game); } } - return didOne; + return true; } } diff --git a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java index 0d8a5b77059..ea468535e43 100644 --- a/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java +++ b/Mage/src/main/java/mage/abilities/costs/common/TapTargetCost.java @@ -4,6 +4,7 @@ import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; import mage.constants.Outcome; +import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.common.TargetControlledPermanent; @@ -20,6 +21,18 @@ public class TapTargetCost extends CostImpl { TargetControlledPermanent target; + public TapTargetCost(FilterControlledPermanent filter) { + this(1, filter); + } + + public TapTargetCost(int amount, FilterControlledPermanent filter) { + this(amount, amount, filter); + } + + public TapTargetCost(int minAmount, int maxAmount, FilterControlledPermanent filter) { + this(new TargetControlledPermanent(minAmount, maxAmount, filter, true)); + } + public TapTargetCost(TargetControlledPermanent target) { this.target = target; this.target.withNotTarget(true); // costs are never targeted diff --git a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java index 134adc1f246..de792ae59e5 100644 --- a/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/ConvokeAbility.java @@ -29,7 +29,7 @@ import mage.game.stack.Spell; import mage.players.ManaPool; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.util.CardUtil; import java.util.*; @@ -131,7 +131,7 @@ public class ConvokeAbility extends SimpleStaticAbility implements AlternateMana } filter.add(Predicates.or(colorPredicates)); } - Target target = new TargetControlledCreaturePermanent(1, 1, filter, true); + Target target = new TargetPermanent(1, 1, filter, true); target.withTargetName("creature to tap for convoke"); specialAction.addTarget(target); if (specialAction.canActivate(source.getControllerId(), game).canActivate()) { diff --git a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java index eff1c18aa26..627f2f2756c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java @@ -22,7 +22,7 @@ import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.util.CardUtil; import java.awt.*; @@ -146,7 +146,7 @@ class CrewCost extends CostImpl { paid = true; return true; } - Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true) { + Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true) { @Override public String getMessage(Game game) { // shows selected power diff --git a/Mage/src/main/java/mage/abilities/keyword/SaddleAbility.java b/Mage/src/main/java/mage/abilities/keyword/SaddleAbility.java index a9b2d74730f..c187c930330 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SaddleAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SaddleAbility.java @@ -20,7 +20,7 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.permanent.Permanent; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.watchers.common.SaddledMountWatcher; import java.awt.*; @@ -128,7 +128,7 @@ class SaddleCost extends CostImpl { @Override public boolean pay(Ability ability, Game game, Ability source, UUID controllerId, boolean noMana, Cost costToPay) { - Target target = new TargetControlledCreaturePermanent(0, Integer.MAX_VALUE, filter, true) { + Target target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true) { @Override public String getMessage(Game game) { // shows selected power diff --git a/Mage/src/main/java/mage/game/command/planes/NayaPlane.java b/Mage/src/main/java/mage/game/command/planes/NayaPlane.java index c622443917b..2704ed07911 100644 --- a/Mage/src/main/java/mage/game/command/planes/NayaPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/NayaPlane.java @@ -23,7 +23,7 @@ import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.ColorPredicate; import mage.game.command.Plane; import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.TargetPermanent; import mage.watchers.common.PlanarRollWatcher; import java.util.ArrayList; @@ -50,7 +50,7 @@ public class NayaPlane extends Plane { // Active player can roll the planar die: Whenever you roll {CHAOS}, target red, green or white creature you control gets +1/+1 until end of turn for each land you control DynamicValue dynamicValue = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS); Effect chaosEffect = new BoostTargetEffect(dynamicValue, dynamicValue, Duration.EndOfTurn); - Target chaosTarget = new TargetControlledCreaturePermanent(1, 1, filter, false); + Target chaosTarget = new TargetPermanent(filter); List chaosEffects = new ArrayList<>(); chaosEffects.add(chaosEffect); diff --git a/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java b/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java index 784e5e3d2a0..caccb2487e2 100644 --- a/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetControlledCreaturePermanent.java @@ -1,7 +1,6 @@ package mage.target.common; import mage.filter.StaticFilters; -import mage.filter.common.FilterControlledCreaturePermanent; /** * @author BetaSteward_at_googlemail.com @@ -17,15 +16,7 @@ public class TargetControlledCreaturePermanent extends TargetControlledPermanent } public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets) { - this(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_CONTROLLED_CREATURES : StaticFilters.FILTER_CONTROLLED_CREATURE, false); - } - - public TargetControlledCreaturePermanent(FilterControlledCreaturePermanent filter) { - this(1, 1, filter, false); - } - - public TargetControlledCreaturePermanent(int minNumTargets, int maxNumTargets, FilterControlledCreaturePermanent filter, boolean notTarget) { - super(minNumTargets, maxNumTargets, filter, notTarget); + super(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_CONTROLLED_CREATURES : StaticFilters.FILTER_CONTROLLED_CREATURE, false); } protected TargetControlledCreaturePermanent(final TargetControlledCreaturePermanent target) {