diff --git a/Mage.Sets/src/mage/cards/a/AcidicSliver.java b/Mage.Sets/src/mage/cards/a/AcidicSliver.java index 1840ab91be..f2aaca177f 100644 --- a/Mage.Sets/src/mage/cards/a/AcidicSliver.java +++ b/Mage.Sets/src/mage/cards/a/AcidicSliver.java @@ -41,8 +41,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; import mage.target.common.TargetCreatureOrPlayer; /** @@ -51,14 +50,8 @@ import mage.target.common.TargetCreatureOrPlayer; */ public class AcidicSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public AcidicSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(2); @@ -70,7 +63,7 @@ public class AcidicSliver extends CardImpl { ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, filter, + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "All Slivers have \"{2}, Sacrifice this permanent: This permanent deals 2 damage to target creature or player.\""))); } diff --git a/Mage.Sets/src/mage/cards/a/ArmorSliver.java b/Mage.Sets/src/mage/cards/a/ArmorSliver.java index a0b8d90571..c836d8af65 100644 --- a/Mage.Sets/src/mage/cards/a/ArmorSliver.java +++ b/Mage.Sets/src/mage/cards/a/ArmorSliver.java @@ -28,8 +28,6 @@ package mage.cards.a; import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -38,10 +36,10 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @@ -49,19 +47,15 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class ArmorSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public ArmorSliver(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("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(0, 1, Duration.EndOfTurn), new GenericManaCost(2)), Duration.WhileOnBattlefield, filter, false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect( + new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(0, 1, Duration.EndOfTurn), + new GenericManaCost(2)), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public ArmorSliver(final ArmorSliver card) { diff --git a/Mage.Sets/src/mage/cards/a/AsylumVisitor.java b/Mage.Sets/src/mage/cards/a/AsylumVisitor.java index 16b938057d..124d7e988c 100644 --- a/Mage.Sets/src/mage/cards/a/AsylumVisitor.java +++ b/Mage.Sets/src/mage/cards/a/AsylumVisitor.java @@ -30,35 +30,39 @@ package mage.cards.a; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.common.CardsInHandCondition; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.abilities.keyword.MadnessAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.players.Player; +import mage.constants.TargetController; /** * * @author escplan9 (Derek Monturo - dmontur1 at gmail dot com) */ public class AsylumVisitor extends CardImpl { - + public AsylumVisitor(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add("Vampire"); this.subtype.add("Wizard"); this.power = new MageInt(3); this.toughness = new MageInt(1); // At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life. - this.addAbility(new AsylumVisitorTriggeredAbility()); + Ability ability = new ConditionalTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.ANY, false), + new CardsInHandCondition(CardsInHandCondition.CountType.EQUAL_TO, 0, null, TargetController.ACTIVE), + "At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life."); + Effect effect = new LoseLifeSourceControllerEffect(1); + effect.setText("and you lose 1 life"); + this.addAbility(ability); // Madness {1}{B} this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{1}{B}"))); @@ -73,67 +77,3 @@ public class AsylumVisitor extends CardImpl { return new AsylumVisitor(this); } } - -class AsylumVisitorTriggeredAbility extends TriggeredAbilityImpl { - - public AsylumVisitorTriggeredAbility() { - super(Zone.BATTLEFIELD, new AsylumVisitorEffect()); - } - - public AsylumVisitorTriggeredAbility(final AsylumVisitorTriggeredAbility ability) { - super(ability); - } - - @Override - public AsylumVisitorTriggeredAbility copy() { - return new AsylumVisitorTriggeredAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - return event.getType() == EventType.UPKEEP_STEP_PRE; - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - Player upkeepPlayer = game.getPlayer(event.getPlayerId()); - if (upkeepPlayer != null && upkeepPlayer.getHand().isEmpty()) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life."; - } -} - -class AsylumVisitorEffect extends OneShotEffect { - - public AsylumVisitorEffect() { - super(Outcome.DrawCard); - this.staticText = "you draw a card and you lose 1 life"; - } - - public AsylumVisitorEffect(final AsylumVisitorEffect effect) { - super(effect); - } - - @Override - public AsylumVisitorEffect copy() { - return new AsylumVisitorEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player you = game.getPlayer(source.getControllerId()); - Player upkeepPlayer = game.getPlayer(game.getActivePlayerId()); - if (you != null && upkeepPlayer != null && upkeepPlayer.getHand().isEmpty()) { - you.drawCards(1, game); - you.loseLife(1, game, false); - return true; - } - return false; - } -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/a/AweStrike.java b/Mage.Sets/src/mage/cards/a/AweStrike.java index b1a1326de0..e8f508960f 100755 --- a/Mage.Sets/src/mage/cards/a/AweStrike.java +++ b/Mage.Sets/src/mage/cards/a/AweStrike.java @@ -28,17 +28,16 @@ package mage.cards.a; import java.util.UUID; - -import mage.MageObject; import mage.abilities.Ability; -import mage.abilities.effects.*; +import mage.abilities.effects.PreventionEffectData; +import mage.abilities.effects.PreventionEffectImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.constants.Outcome; import mage.game.Game; import mage.game.events.GameEvent; +import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.common.TargetCreaturePermanent; @@ -79,22 +78,21 @@ class AweStrikeEffect extends PreventionEffectImpl { @Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { - this.used = true; - this.discard(); - PreventionEffectData preventionData = preventDamageAction(event, source, game); Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(preventionData.getPreventedDamage(), game); } + this.used = true; + this.discard(); return true; } @Override public boolean applies(GameEvent event, Ability source, Game game) { if (!this.used && super.applies(event, source, game)) { - MageObject mageObject = game.getObject(event.getSourceId()); - return this.getTargetPointer().getFirst(game, source).equals(mageObject.getId()); + Permanent targetCreature = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source)); + return targetCreature != null && targetCreature.getId().equals(event.getSourceId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/b/BarbedSliver.java b/Mage.Sets/src/mage/cards/b/BarbedSliver.java index 36e89c2ccf..55ac72c06e 100644 --- a/Mage.Sets/src/mage/cards/b/BarbedSliver.java +++ b/Mage.Sets/src/mage/cards/b/BarbedSliver.java @@ -28,8 +28,6 @@ package mage.cards.b; import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; @@ -38,10 +36,10 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @@ -49,19 +47,14 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class BarbedSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public BarbedSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new GenericManaCost(2)), Duration.WhileOnBattlefield, filter, false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), + new GenericManaCost(2)), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public BarbedSliver(final BarbedSliver card) { diff --git a/Mage.Sets/src/mage/cards/b/BattleSliver.java b/Mage.Sets/src/mage/cards/b/BattleSliver.java index 002a7d1dd9..4d7556ccb1 100644 --- a/Mage.Sets/src/mage/cards/b/BattleSliver.java +++ b/Mage.Sets/src/mage/cards/b/BattleSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,16 +45,16 @@ import mage.filter.common.FilterCreaturePermanent; public class BattleSliver extends CardImpl { public BattleSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(3); this.toughness = new MageInt(3); // Sliver creatures you control get +2/+0. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); - + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new BoostControlledEffect(2, 0, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); + } public BattleSliver(final BattleSliver card) { diff --git a/Mage.Sets/src/mage/cards/b/BladeSliver.java b/Mage.Sets/src/mage/cards/b/BladeSliver.java index 62bce896f0..f9d682b0c2 100644 --- a/Mage.Sets/src/mage/cards/b/BladeSliver.java +++ b/Mage.Sets/src/mage/cards/b/BladeSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,14 +45,15 @@ import mage.filter.common.FilterCreaturePermanent; public class BladeSliver extends CardImpl { public BladeSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); // All Sliver creatures get +1/+0. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures"), false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new BoostAllEffect(1, 0, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public BladeSliver(final BladeSliver card) { diff --git a/Mage.Sets/src/mage/cards/b/BonescytheSliver.java b/Mage.Sets/src/mage/cards/b/BonescytheSliver.java index 3d91279b62..0b094aebe7 100644 --- a/Mage.Sets/src/mage/cards/b/BonescytheSliver.java +++ b/Mage.Sets/src/mage/cards/b/BonescytheSliver.java @@ -37,16 +37,16 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * * @author jeffwadsworth */ public class BonescytheSliver extends CardImpl { - + public BonescytheSliver(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("Sliver"); this.power = new MageInt(2); @@ -55,7 +55,7 @@ public class BonescytheSliver extends CardImpl { // Sliver creatures you control have double strike. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(DoubleStrikeAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public BonescytheSliver(final BonescytheSliver card) { diff --git a/Mage.Sets/src/mage/cards/b/BonesplitterSliver.java b/Mage.Sets/src/mage/cards/b/BonesplitterSliver.java index 98bda01d17..b6348ad778 100644 --- a/Mage.Sets/src/mage/cards/b/BonesplitterSliver.java +++ b/Mage.Sets/src/mage/cards/b/BonesplitterSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,18 +45,14 @@ import mage.filter.common.FilterCreaturePermanent; public class BonesplitterSliver extends CardImpl { public BonesplitterSliver(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("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); // All Sliver creatures get +2/+0. - this.addAbility( - new SimpleStaticAbility( - Zone.BATTLEFIELD, - new BoostAllEffect(2, 0, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures"), false) - ) - ); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new BoostAllEffect(2, 0, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public BonesplitterSliver(final BonesplitterSliver card) { diff --git a/Mage.Sets/src/mage/cards/c/ConstrictingSliver.java b/Mage.Sets/src/mage/cards/c/ConstrictingSliver.java index 7bc21ba095..591a4c3159 100644 --- a/Mage.Sets/src/mage/cards/c/ConstrictingSliver.java +++ b/Mage.Sets/src/mage/cards/c/ConstrictingSliver.java @@ -44,7 +44,7 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.TargetController; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.Game; @@ -65,7 +65,7 @@ public class ConstrictingSliver extends CardImpl { } public ConstrictingSliver(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("Sliver"); this.power = new MageInt(3); @@ -78,7 +78,7 @@ public class ConstrictingSliver extends CardImpl { ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new OnLeaveReturnExiledToBattlefieldAbility())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Sliver", "Sliver creatures"), + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "Sliver creatures you control have \"When this creature enters the battlefield, you may exile target creature an opponent controls until this creature leaves the battlefield.\""))); } diff --git a/Mage.Sets/src/mage/cards/c/CryptSliver.java b/Mage.Sets/src/mage/cards/c/CryptSliver.java index e1e191bbf4..4d2f3b5c15 100644 --- a/Mage.Sets/src/mage/cards/c/CryptSliver.java +++ b/Mage.Sets/src/mage/cards/c/CryptSliver.java @@ -40,6 +40,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.target.common.TargetCreaturePermanent; @@ -50,7 +51,7 @@ import mage.target.common.TargetCreaturePermanent; public class CryptSliver extends CardImpl { public CryptSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}"); this.subtype.add("Sliver"); this.power = new MageInt(1); @@ -59,7 +60,7 @@ public class CryptSliver extends CardImpl { // All Slivers have "{tap}: Regenerate target Sliver." Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateTargetEffect(), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("Sliver", "Sliver"))); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public CryptSliver(final CryptSliver card) { diff --git a/Mage.Sets/src/mage/cards/d/DarkheartSliver.java b/Mage.Sets/src/mage/cards/d/DarkheartSliver.java index 01ff2d1d01..92efb96f2f 100644 --- a/Mage.Sets/src/mage/cards/d/DarkheartSliver.java +++ b/Mage.Sets/src/mage/cards/d/DarkheartSliver.java @@ -40,8 +40,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @@ -49,14 +48,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class DarkheartSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public DarkheartSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{G}"); this.subtype.add("Sliver"); this.power = new MageInt(2); @@ -66,7 +59,7 @@ public class DarkheartSliver extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainLifeEffect(3), new SacrificeSourceCost()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, filter, + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "All Slivers have \"Sacrifice this permanent: You gain 3 life.\""))); } diff --git a/Mage.Sets/src/mage/cards/f/FurySliver.java b/Mage.Sets/src/mage/cards/f/FurySliver.java index 0a7ebc5112..4ae3869fc2 100644 --- a/Mage.Sets/src/mage/cards/f/FurySliver.java +++ b/Mage.Sets/src/mage/cards/f/FurySliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class FurySliver extends CardImpl { public FurySliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(3); this.toughness = new MageInt(3); @@ -55,7 +55,7 @@ public class FurySliver extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(DoubleStrikeAbility.getInstance(), Duration.WhileOnBattlefield, - new FilterCreaturePermanent("Sliver","Sliver creatures") + StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS ) )); } diff --git a/Mage.Sets/src/mage/cards/g/GaleriderSliver.java b/Mage.Sets/src/mage/cards/g/GaleriderSliver.java index 74ed6ddd0a..a02809d7a8 100644 --- a/Mage.Sets/src/mage/cards/g/GaleriderSliver.java +++ b/Mage.Sets/src/mage/cards/g/GaleriderSliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class GaleriderSliver extends CardImpl { public GaleriderSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}"); this.subtype.add("Sliver"); this.power = new MageInt(1); @@ -55,7 +55,7 @@ public class GaleriderSliver extends CardImpl { // Sliver creatures you control have flying. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(FlyingAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public GaleriderSliver(final GaleriderSliver card) { diff --git a/Mage.Sets/src/mage/cards/g/GroundshakerSliver.java b/Mage.Sets/src/mage/cards/g/GroundshakerSliver.java index a74c537997..68e51292e0 100644 --- a/Mage.Sets/src/mage/cards/g/GroundshakerSliver.java +++ b/Mage.Sets/src/mage/cards/g/GroundshakerSliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class GroundshakerSliver extends CardImpl { public GroundshakerSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{G}"); this.subtype.add("Sliver"); this.power = new MageInt(5); @@ -55,7 +55,7 @@ public class GroundshakerSliver extends CardImpl { // Sliver creatures you control have trample. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(TrampleAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public GroundshakerSliver(final GroundshakerSliver card) { diff --git a/Mage.Sets/src/mage/cards/h/HunterSliver.java b/Mage.Sets/src/mage/cards/h/HunterSliver.java index 12b25c2ce2..d71bb05087 100644 --- a/Mage.Sets/src/mage/cards/h/HunterSliver.java +++ b/Mage.Sets/src/mage/cards/h/HunterSliver.java @@ -37,7 +37,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class HunterSliver extends CardImpl { public HunterSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(1); @@ -54,7 +54,7 @@ public class HunterSliver extends CardImpl { // All Sliver creatures have provoke. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new ProvokeAbility(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public HunterSliver(final HunterSliver card) { diff --git a/Mage.Sets/src/mage/cards/m/MagmaSliver.java b/Mage.Sets/src/mage/cards/m/MagmaSliver.java index 44d2575691..cc8fc203a1 100644 --- a/Mage.Sets/src/mage/cards/m/MagmaSliver.java +++ b/Mage.Sets/src/mage/cards/m/MagmaSliver.java @@ -42,6 +42,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.target.Target; import mage.target.common.TargetCreaturePermanent; @@ -51,19 +52,19 @@ import mage.target.common.TargetCreaturePermanent; * @author cbt33 */ public class MagmaSliver extends CardImpl { - + public MagmaSliver(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("Sliver"); this.power = new MageInt(3); this.toughness = new MageInt(3); // All Slivers have "{tap}: Target Sliver creature gets +X/+0 until end of turn, where X is the number of Slivers on the battlefield." - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(new PermanentsOnBattlefieldCount(new FilterCreaturePermanent("Sliver", "Sliver creatures")), new StaticValue(0), Duration.EndOfTurn), new TapSourceCost()); - Target target = new TargetCreaturePermanent(new FilterCreaturePermanent("Sliver", "Sliver creature")); - ability.addTarget(target); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(new PermanentsOnBattlefieldCount(StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS), new StaticValue(0), Duration.EndOfTurn), new TapSourceCost()); + Target target = new TargetCreaturePermanent(new FilterCreaturePermanent("Sliver", "Sliver creature")); + ability.addTarget(target); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public MagmaSliver(final MagmaSliver card) { diff --git a/Mage.Sets/src/mage/cards/m/ManaweftSliver.java b/Mage.Sets/src/mage/cards/m/ManaweftSliver.java index 36329de85b..f3f3a298fc 100644 --- a/Mage.Sets/src/mage/cards/m/ManaweftSliver.java +++ b/Mage.Sets/src/mage/cards/m/ManaweftSliver.java @@ -38,7 +38,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -47,7 +47,7 @@ import mage.filter.common.FilterControlledCreaturePermanent; public class ManaweftSliver extends CardImpl { public ManaweftSliver(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("Sliver"); this.power = new MageInt(1); @@ -57,8 +57,8 @@ public class ManaweftSliver extends CardImpl { Ability ability = new AnyColorManaAbility(); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Sliver","Sliver creatures"), - "Sliver creatures you control have \"{T}: Add one mana of any color to your mana pool.\""))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, + "Sliver creatures you control have \"{T}: Add one mana of any color to your mana pool.\""))); } public ManaweftSliver(final ManaweftSliver card) { diff --git a/Mage.Sets/src/mage/cards/m/MeganticSliver.java b/Mage.Sets/src/mage/cards/m/MeganticSliver.java index 671c3d5df6..0df67e37f4 100644 --- a/Mage.Sets/src/mage/cards/m/MeganticSliver.java +++ b/Mage.Sets/src/mage/cards/m/MeganticSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,15 +45,15 @@ import mage.filter.common.FilterCreaturePermanent; public class MeganticSliver extends CardImpl { public MeganticSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{G}"); this.subtype.add("Sliver"); this.power = new MageInt(3); this.toughness = new MageInt(3); // Sliver creatures you control get +3/+3. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BoostControlledEffect(3,3, Duration.WhileInGraveyard, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new BoostControlledEffect(3, 3, Duration.WhileInGraveyard, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public MeganticSliver(final MeganticSliver card) { diff --git a/Mage.Sets/src/mage/cards/m/MistformSliver.java b/Mage.Sets/src/mage/cards/m/MistformSliver.java index 43b2b00d00..e94d22927a 100644 --- a/Mage.Sets/src/mage/cards/m/MistformSliver.java +++ b/Mage.Sets/src/mage/cards/m/MistformSliver.java @@ -46,7 +46,7 @@ import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; @@ -59,7 +59,7 @@ import mage.target.targetpointer.FixedTarget; public class MistformSliver extends CardImpl { public MistformSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}"); this.subtype.add("Illusion"); this.subtype.add("Sliver"); @@ -68,7 +68,7 @@ public class MistformSliver extends CardImpl { // All Slivers have "{1}: This permanent becomes the creature type of your choice in addition to its other types until end of turn." Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MistformSliverEffect(), new ManaCostsImpl("{1}")); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public MistformSliver(final MistformSliver card) { @@ -81,41 +81,41 @@ public class MistformSliver extends CardImpl { } } - class MistformSliverEffect extends OneShotEffect { - - public MistformSliverEffect() { - super(Outcome.Benefit); - staticText = "This permanent becomes the creature type of your choice in addition to its other types until end of turn"; - } - - public MistformSliverEffect(final MistformSliverEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getPermanent(source.getSourceId()); - if (player != null && permanent != null) { - Choice typeChoice = new ChoiceImpl(true); - typeChoice.setMessage("Choose creature type"); - typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); - while (!player.choose(Outcome.Detriment, typeChoice, game)) { - if (!player.canRespond()) { - return false; - } - } - game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); - ContinuousEffect effect = new AddCardSubTypeTargetEffect(typeChoice.getChoice(), Duration.EndOfTurn); - effect.setTargetPointer(new FixedTarget(permanent.getId())); - game.addEffect(effect, source); - } - return false; - } - - @Override - public MistformSliverEffect copy() { - return new MistformSliverEffect(this); - } +class MistformSliverEffect extends OneShotEffect { + public MistformSliverEffect() { + super(Outcome.Benefit); + staticText = "This permanent becomes the creature type of your choice in addition to its other types until end of turn"; } + + public MistformSliverEffect(final MistformSliverEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (player != null && permanent != null) { + Choice typeChoice = new ChoiceImpl(true); + typeChoice.setMessage("Choose creature type"); + typeChoice.setChoices(CardRepository.instance.getCreatureTypes()); + while (!player.choose(Outcome.Detriment, typeChoice, game)) { + if (!player.canRespond()) { + return false; + } + } + game.informPlayers(permanent.getName() + ": " + player.getLogName() + " has chosen " + typeChoice.getChoice()); + ContinuousEffect effect = new AddCardSubTypeTargetEffect(typeChoice.getChoice(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(permanent.getId())); + game.addEffect(effect, source); + } + return false; + } + + @Override + public MistformSliverEffect copy() { + return new MistformSliverEffect(this); + } + +} diff --git a/Mage.Sets/src/mage/cards/m/MnemonicSliver.java b/Mage.Sets/src/mage/cards/m/MnemonicSliver.java index f811821f12..113887afd9 100644 --- a/Mage.Sets/src/mage/cards/m/MnemonicSliver.java +++ b/Mage.Sets/src/mage/cards/m/MnemonicSliver.java @@ -28,8 +28,6 @@ package mage.cards.m; import java.util.UUID; - -import mage.constants.CardType; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -40,31 +38,26 @@ import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @author Loki */ public class MnemonicSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public MnemonicSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}"); this.subtype.add("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); Ability gainedAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2)); gainedAbility.addCost(new SacrificeSourceCost()); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(gainedAbility, Duration.WhileOnBattlefield, filter, false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + new GainAbilityAllEffect(gainedAbility, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public MnemonicSliver(final MnemonicSliver card) { diff --git a/Mage.Sets/src/mage/cards/n/NecroticSliver.java b/Mage.Sets/src/mage/cards/n/NecroticSliver.java index a2bba52f00..546ea5e95f 100644 --- a/Mage.Sets/src/mage/cards/n/NecroticSliver.java +++ b/Mage.Sets/src/mage/cards/n/NecroticSliver.java @@ -41,8 +41,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; import mage.target.TargetPermanent; /** @@ -51,14 +50,8 @@ import mage.target.TargetPermanent; */ public class NecroticSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public NecroticSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{B}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}"); this.subtype.add("Sliver"); this.power = new MageInt(2); @@ -70,7 +63,7 @@ public class NecroticSliver extends CardImpl { ability.addTarget(new TargetPermanent()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, filter, + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "All Slivers have \"{3}, Sacrifice this permanent: Destroy target permanent.\""))); } diff --git a/Mage.Sets/src/mage/cards/p/PlatedSliver.java b/Mage.Sets/src/mage/cards/p/PlatedSliver.java index df4966da44..44313d9eb6 100644 --- a/Mage.Sets/src/mage/cards/p/PlatedSliver.java +++ b/Mage.Sets/src/mage/cards/p/PlatedSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,14 +45,14 @@ import mage.filter.common.FilterCreaturePermanent; public class PlatedSliver extends CardImpl { public PlatedSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}"); this.subtype.add("Sliver"); this.power = new MageInt(1); this.toughness = new MageInt(1); // All Sliver creatures get +0/+1. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(0, 1, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures"), false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(0, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public PlatedSliver(final PlatedSliver card) { diff --git a/Mage.Sets/src/mage/cards/p/PoulticeSliver.java b/Mage.Sets/src/mage/cards/p/PoulticeSliver.java index da2c892d5a..86e389d9ba 100644 --- a/Mage.Sets/src/mage/cards/p/PoulticeSliver.java +++ b/Mage.Sets/src/mage/cards/p/PoulticeSliver.java @@ -41,8 +41,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; import mage.target.TargetPermanent; /** @@ -51,14 +50,8 @@ import mage.target.TargetPermanent; */ public class PoulticeSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public PoulticeSliver(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("Sliver"); this.power = new MageInt(2); @@ -67,11 +60,11 @@ public class PoulticeSliver extends CardImpl { // All Slivers have "{2}, {tap}: Regenerate target Sliver." Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateTargetEffect(), new GenericManaCost(2)); ability.addCost(new TapSourceCost()); - ability.addTarget(new TargetPermanent(filter)); + ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS)); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, filter, + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "Slivers have \"{2}, {T}: Regenerate target Sliver.\""))); } diff --git a/Mage.Sets/src/mage/cards/p/PredatorySliver.java b/Mage.Sets/src/mage/cards/p/PredatorySliver.java index 749195e585..13008c45ff 100644 --- a/Mage.Sets/src/mage/cards/p/PredatorySliver.java +++ b/Mage.Sets/src/mage/cards/p/PredatorySliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,7 +45,7 @@ import mage.filter.common.FilterCreaturePermanent; public class PredatorySliver extends CardImpl { public PredatorySliver(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("Sliver"); this.power = new MageInt(1); @@ -53,7 +53,7 @@ public class PredatorySliver extends CardImpl { // Sliver creatures you control get +1/+1. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, - new BoostControlledEffect(1,1, Duration.WhileInGraveyard, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + new BoostControlledEffect(1, 1, Duration.WhileInGraveyard, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public PredatorySliver(final PredatorySliver card) { diff --git a/Mage.Sets/src/mage/cards/s/SliverHivelord.java b/Mage.Sets/src/mage/cards/s/SliverHivelord.java index 99ebac2a80..36a97d4acf 100644 --- a/Mage.Sets/src/mage/cards/s/SliverHivelord.java +++ b/Mage.Sets/src/mage/cards/s/SliverHivelord.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class SliverHivelord extends CardImpl { public SliverHivelord(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{U}{B}{R}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}{G}"); this.supertype.add("Legendary"); this.subtype.add("Sliver"); @@ -56,7 +56,7 @@ public class SliverHivelord extends CardImpl { // Sliver creatures you control have indestructible. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(IndestructibleAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } diff --git a/Mage.Sets/src/mage/cards/s/SpectralSliver.java b/Mage.Sets/src/mage/cards/s/SpectralSliver.java index 1e15856cbe..61d42f9bcc 100644 --- a/Mage.Sets/src/mage/cards/s/SpectralSliver.java +++ b/Mage.Sets/src/mage/cards/s/SpectralSliver.java @@ -40,17 +40,16 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * * @author cbt33 */ - public class SpectralSliver extends CardImpl { public SpectralSliver(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("Sliver"); this.subtype.add("Spirit"); @@ -58,8 +57,8 @@ public class SpectralSliver extends CardImpl { this.toughness = new MageInt(2); // All Sliver creatures have "{2}: This creature gets +1/+1 until end of turn." - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1,1,Duration.EndOfTurn), new ManaCostsImpl("{2}")); - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures")))); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{2}")); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public SpectralSliver(final SpectralSliver card) { diff --git a/Mage.Sets/src/mage/cards/s/SpinedSliver.java b/Mage.Sets/src/mage/cards/s/SpinedSliver.java index 414ef9adbd..9b34e7b5d0 100644 --- a/Mage.Sets/src/mage/cards/s/SpinedSliver.java +++ b/Mage.Sets/src/mage/cards/s/SpinedSliver.java @@ -38,11 +38,9 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; import mage.game.Game; import mage.game.combat.CombatGroup; -import mage.target.targetpointer.TargetPointer; /** * @@ -50,14 +48,8 @@ import mage.target.targetpointer.TargetPointer; */ public class SpinedSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public SpinedSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{G}"); this.subtype.add("Sliver"); this.power = new MageInt(2); @@ -67,7 +59,7 @@ public class SpinedSliver extends CardImpl { BlockersCount value = new BlockersCount(); Effect effect = new BoostTargetEffect(value, value, Duration.EndOfTurn, true); effect.setText("it gets +1/+1 until end of turn for each creature blocking it"); - this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, filter, true)); + this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, true)); } public SpinedSliver(final SpinedSliver card) { @@ -82,7 +74,7 @@ public class SpinedSliver extends CardImpl { class BlockersCount implements DynamicValue { - private String message; + private final String message; public BlockersCount() { this.message = "each creature blocking it"; @@ -95,8 +87,7 @@ class BlockersCount implements DynamicValue { @Override public int calculate(Game game, Ability sourceAbility, Effect effect) { - TargetPointer attacker = effect.getTargetPointer(); - UUID attackerId = attacker.getFirst(game, sourceAbility); + UUID attackerId = effect.getTargetPointer().getFirst(game, sourceAbility); for (CombatGroup combatGroup : game.getCombat().getGroups()) { if (combatGroup.getAttackers().contains(attackerId)) { return combatGroup.getBlockers().size(); diff --git a/Mage.Sets/src/mage/cards/s/SteelformSliver.java b/Mage.Sets/src/mage/cards/s/SteelformSliver.java index f2e215717c..818c6011d5 100644 --- a/Mage.Sets/src/mage/cards/s/SteelformSliver.java +++ b/Mage.Sets/src/mage/cards/s/SteelformSliver.java @@ -36,7 +36,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -45,16 +45,16 @@ import mage.filter.common.FilterCreaturePermanent; public class SteelformSliver extends CardImpl { public SteelformSliver(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("Sliver"); this.power = new MageInt(2); this.toughness = new MageInt(2); // Sliver creatures you control get +0/+1. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.WhileOnBattlefield, - new FilterCreaturePermanent("Sliver", "Sliver creatures"), false))); + StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, false))); } public SteelformSliver(final SteelformSliver card) { diff --git a/Mage.Sets/src/mage/cards/s/StrikingSliver.java b/Mage.Sets/src/mage/cards/s/StrikingSliver.java index d3e25b3086..5ab1c591e4 100644 --- a/Mage.Sets/src/mage/cards/s/StrikingSliver.java +++ b/Mage.Sets/src/mage/cards/s/StrikingSliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class StrikingSliver extends CardImpl { public StrikingSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}"); this.subtype.add("Sliver"); this.power = new MageInt(1); @@ -55,7 +55,7 @@ public class StrikingSliver extends CardImpl { // Sliver creatures you control have first strike. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public StrikingSliver(final StrikingSliver card) { diff --git a/Mage.Sets/src/mage/cards/s/SyphonSliver.java b/Mage.Sets/src/mage/cards/s/SyphonSliver.java index c3dbcfeb6e..62d6a0aa6a 100644 --- a/Mage.Sets/src/mage/cards/s/SyphonSliver.java +++ b/Mage.Sets/src/mage/cards/s/SyphonSliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class SyphonSliver extends CardImpl { public SyphonSliver(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("Sliver"); this.power = new MageInt(2); @@ -55,7 +55,7 @@ public class SyphonSliver extends CardImpl { // Sliver creatures you control have lifelink. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(LifelinkAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public SyphonSliver(final SyphonSliver card) { diff --git a/Mage.Sets/src/mage/cards/t/ThorncasterSliver.java b/Mage.Sets/src/mage/cards/t/ThorncasterSliver.java index 36c06161e4..0049cb16c6 100644 --- a/Mage.Sets/src/mage/cards/t/ThorncasterSliver.java +++ b/Mage.Sets/src/mage/cards/t/ThorncasterSliver.java @@ -39,7 +39,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.StaticFilters; import mage.target.common.TargetCreatureOrPlayer; /** @@ -49,7 +49,7 @@ import mage.target.common.TargetCreatureOrPlayer; public class ThorncasterSliver extends CardImpl { public ThorncasterSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(2); @@ -60,8 +60,8 @@ public class ThorncasterSliver extends CardImpl { ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, new FilterControlledCreaturePermanent("Sliver","Sliver creatures"), - "Sliver creatures you control have \"Whenever this creature attacks, it deals 1 damage to target creature or player.\""))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, + "Sliver creatures you control have \"Whenever this creature attacks, it deals 1 damage to target creature or player.\""))); } public ThorncasterSliver(final ThorncasterSliver card) { diff --git a/Mage.Sets/src/mage/cards/t/TwoHeadedSliver.java b/Mage.Sets/src/mage/cards/t/TwoHeadedSliver.java index 38aad040bb..b5d5ab6e88 100644 --- a/Mage.Sets/src/mage/cards/t/TwoHeadedSliver.java +++ b/Mage.Sets/src/mage/cards/t/TwoHeadedSliver.java @@ -38,8 +38,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @@ -47,14 +46,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class TwoHeadedSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public TwoHeadedSliver(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.subtype.add("Sliver"); this.power = new MageInt(1); @@ -63,8 +56,8 @@ public class TwoHeadedSliver extends CardImpl { // All Sliver creatures have menace. (They can't be blocked except by two or more creatures.) this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect( new MenaceAbility(), - Duration.WhileOnBattlefield, filter, - "All Sliver creatures have menace. (They can't be blocked except by two or more creatures.)"))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, + "All Sliver creatures have menace. (They can't be blocked except by two or more creatures.)"))); } public TwoHeadedSliver(final TwoHeadedSliver card) { diff --git a/Mage.Sets/src/mage/cards/v/VenomSliver.java b/Mage.Sets/src/mage/cards/v/VenomSliver.java index f6ea273897..a27f419857 100644 --- a/Mage.Sets/src/mage/cards/v/VenomSliver.java +++ b/Mage.Sets/src/mage/cards/v/VenomSliver.java @@ -37,7 +37,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.StaticFilters; /** * @@ -46,7 +46,7 @@ import mage.filter.common.FilterCreaturePermanent; public class VenomSliver extends CardImpl { public VenomSliver(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("Sliver"); this.power = new MageInt(1); @@ -55,7 +55,7 @@ public class VenomSliver extends CardImpl { // Sliver creatures you control have deathtouch. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(DeathtouchAbility.getInstance(), - Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS))); } public VenomSliver(final VenomSliver card) { diff --git a/Mage.Sets/src/mage/cards/v/VictualSliver.java b/Mage.Sets/src/mage/cards/v/VictualSliver.java index 23acbda5c2..b0222e70c5 100644 --- a/Mage.Sets/src/mage/cards/v/VictualSliver.java +++ b/Mage.Sets/src/mage/cards/v/VictualSliver.java @@ -41,8 +41,7 @@ import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.filter.StaticFilters; /** * @@ -50,14 +49,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate; */ public class VictualSliver extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Sliver creatures"); - - static { - filter.add(new SubtypePredicate("Sliver")); - } - public VictualSliver(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("Sliver"); this.power = new MageInt(2); @@ -69,7 +62,7 @@ public class VictualSliver extends CardImpl { this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, - Duration.WhileOnBattlefield, filter, + Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_SLIVERS, "All Slivers have \"{2}, Sacrifice this permanent: You gain 4 life.\""))); } diff --git a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java index d4b74cce61..34fa110bb9 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/CardsInHandCondition.java @@ -91,12 +91,28 @@ public class CardsInHandCondition implements Condition { break; } break; + case ACTIVE: + Player player = game.getPlayer(game.getActivePlayerId()); + if (player != null) { + switch (this.type) { + case FEWER_THAN: + conditionApplies = player.getHand().size() < this.count; + break; + case MORE_THAN: + conditionApplies = player.getHand().size() > this.count; + break; + case EQUAL_TO: + conditionApplies = player.getHand().size() == this.count; + break; + } + } + break; case ANY: boolean conflict = false; switch (this.type) { case FEWER_THAN: for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); + player = game.getPlayer(playerId); if (player != null) { if (player.getHand().size() >= this.count) { conflict = true; @@ -107,7 +123,7 @@ public class CardsInHandCondition implements Condition { break; case MORE_THAN: for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); + player = game.getPlayer(playerId); if (player != null) { if (player.getHand().size() <= this.count) { conflict = true; @@ -118,7 +134,7 @@ public class CardsInHandCondition implements Condition { break; case EQUAL_TO: for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { - Player player = game.getPlayer(playerId); + player = game.getPlayer(playerId); if (player != null) { if (player.getHand().size() != this.count) { conflict = true; diff --git a/Mage/src/main/java/mage/filter/StaticFilters.java b/Mage/src/main/java/mage/filter/StaticFilters.java index 519066df04..c92cdf1ab4 100644 --- a/Mage/src/main/java/mage/filter/StaticFilters.java +++ b/Mage/src/main/java/mage/filter/StaticFilters.java @@ -30,6 +30,7 @@ public class StaticFilters { public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card"); public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_GOBLINS = new FilterCreaturePermanent("Goblin", "Goblin creatures"); + public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_SLIVERS = new FilterCreaturePermanent("Sliver", "Sliver creatures"); static { FILTER_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or(