From badb0ede21e623c121fdbe7fdfb40fde663094fb Mon Sep 17 00:00:00 2001 From: North Date: Sun, 22 Jul 2012 13:48:14 +0300 Subject: [PATCH] [filters] added Attacking and Blocking predicates --- .../sets/dissension/FreewindEquenaut.java | 13 +---- .../mage/sets/magic2010/DivineVerdict.java | 10 ---- .../mage/sets/mirrodin/SoldierReplica.java | 11 +---- .../riseoftheeldrazi/HarmlessAssault.java | 11 +---- .../riseoftheeldrazi/PuncturingLight.java | 7 +-- .../sets/scarsofmirrodin/DispenseJustice.java | 10 +--- .../src/mage/sets/urzassaga/AngelicPage.java | 13 +---- .../common/FilterAttackingCreature.java | 5 +- .../FilterAttackingOrBlockingCreature.java | 11 +++-- .../filter/common/FilterBlockingCreature.java | 5 +- .../common/FilterCreatureForAttack.java | 8 +-- .../common/FilterCreatureForCombat.java | 24 ++++----- .../common/FilterCreaturePermanent.java | 43 ---------------- .../permanent/AttackingPredicate.java | 49 +++++++++++++++++++ .../permanent/BlockingPredicate.java | 49 +++++++++++++++++++ 15 files changed, 139 insertions(+), 130 deletions(-) create mode 100644 Mage/src/mage/filter/predicate/permanent/AttackingPredicate.java create mode 100644 Mage/src/mage/filter/predicate/permanent/BlockingPredicate.java diff --git a/Mage.Sets/src/mage/sets/dissension/FreewindEquenaut.java b/Mage.Sets/src/mage/sets/dissension/FreewindEquenaut.java index 4ea8e2e6826..eda0df5cb8e 100644 --- a/Mage.Sets/src/mage/sets/dissension/FreewindEquenaut.java +++ b/Mage.Sets/src/mage/sets/dissension/FreewindEquenaut.java @@ -42,7 +42,7 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.continious.GainAbilitySourceEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterAttackingOrBlockingCreature; import mage.target.common.TargetCreaturePermanent; /** @@ -51,15 +51,6 @@ import mage.target.common.TargetCreaturePermanent; */ public class FreewindEquenaut extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking or blocking creature"); - - static { - filter.setAttacking(true); - filter.setUseAttacking(true); - filter.setBlocking(true); - filter.setUseBlocking(true); - } - public FreewindEquenaut(UUID ownerId) { super(ownerId, 9, "Freewind Equenaut", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); this.expansionSetCode = "DIS"; @@ -74,7 +65,7 @@ public class FreewindEquenaut extends CardImpl { SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost()); - ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addTarget(new TargetCreaturePermanent(new FilterAttackingOrBlockingCreature())); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect( new GainAbilitySourceEffect(ability, Duration.WhileOnBattlefield), diff --git a/Mage.Sets/src/mage/sets/magic2010/DivineVerdict.java b/Mage.Sets/src/mage/sets/magic2010/DivineVerdict.java index 1ccd48c2457..24cf4c90173 100644 --- a/Mage.Sets/src/mage/sets/magic2010/DivineVerdict.java +++ b/Mage.Sets/src/mage/sets/magic2010/DivineVerdict.java @@ -33,7 +33,6 @@ import mage.Constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.filter.common.FilterAttackingOrBlockingCreature; -import mage.filter.common.FilterCreaturePermanent; import mage.target.common.TargetCreaturePermanent; /** @@ -42,15 +41,6 @@ import mage.target.common.TargetCreaturePermanent; */ public class DivineVerdict extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking or blocking creature"); - - static { - filter.setAttacking(true); - filter.setUseAttacking(true); - filter.setBlocking(true); - filter.setUseBlocking(true); - } - public DivineVerdict(UUID ownerId) { super(ownerId, 8, "Divine Verdict", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); this.expansionSetCode = "M10"; diff --git a/Mage.Sets/src/mage/sets/mirrodin/SoldierReplica.java b/Mage.Sets/src/mage/sets/mirrodin/SoldierReplica.java index 5cb9c18da7e..fc0d4c6751a 100644 --- a/Mage.Sets/src/mage/sets/mirrodin/SoldierReplica.java +++ b/Mage.Sets/src/mage/sets/mirrodin/SoldierReplica.java @@ -39,7 +39,7 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterAttackingOrBlockingCreature; import mage.target.common.TargetCreaturePermanent; /** @@ -48,13 +48,6 @@ import mage.target.common.TargetCreaturePermanent; */ public class SoldierReplica extends CardImpl { - private final static FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking or blocking creature"); - - static { - filter.setBlocking(true); - filter.setAttacking(true); - } - public SoldierReplica(UUID ownerId) { super(ownerId, 244, "Soldier Replica", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); this.expansionSetCode = "MRD"; @@ -63,7 +56,7 @@ public class SoldierReplica extends CardImpl { this.toughness = new MageInt(3); Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new DamageTargetEffect(3), new ManaCostsImpl("{1}{W}")); ability.addCost(new SacrificeSourceCost()); - ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addTarget(new TargetCreaturePermanent(new FilterAttackingOrBlockingCreature())); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HarmlessAssault.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HarmlessAssault.java index 464bcb7fc27..4763cd35509 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/HarmlessAssault.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/HarmlessAssault.java @@ -33,7 +33,7 @@ import mage.Constants.Duration; import mage.Constants.Rarity; import mage.abilities.effects.common.PreventAllDamageEffect; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterAttackingCreature; /** * @@ -41,13 +41,6 @@ import mage.filter.common.FilterCreaturePermanent; */ public class HarmlessAssault extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking creatures"); - - static { - filter.setAttacking(true); - filter.setUseAttacking(true); - } - public HarmlessAssault(UUID ownerId) { super(ownerId, 24, "Harmless Assault", Rarity.COMMON, new CardType[] { CardType.INSTANT }, "{2}{W}{W}"); @@ -58,7 +51,7 @@ public class HarmlessAssault extends CardImpl { // Prevent all combat damage that would be dealt this turn by attacking // creatures. this.getSpellAbility().addEffect( - new PreventAllDamageEffect(filter, Duration.EndOfTurn, true)); + new PreventAllDamageEffect(new FilterAttackingCreature(), Duration.EndOfTurn, true)); } public HarmlessAssault(final HarmlessAssault card) { diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/PuncturingLight.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/PuncturingLight.java index c8e7a8b1d50..243021b1104 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/PuncturingLight.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/PuncturingLight.java @@ -33,6 +33,7 @@ import mage.Constants.Rarity; import mage.abilities.effects.common.DestroyTargetEffect; import mage.cards.CardImpl; import mage.filter.Filter.ComparisonType; +import mage.filter.common.FilterAttackingOrBlockingCreature; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.PowerPredicate; import mage.target.common.TargetCreaturePermanent; @@ -43,13 +44,9 @@ import mage.target.common.TargetCreaturePermanent; */ public class PuncturingLight extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking or blocking creature with power 3 or less"); + private static final FilterCreaturePermanent filter = new FilterAttackingOrBlockingCreature("attacking or blocking creature with power 3 or less"); static { - filter.setAttacking(true); - filter.setUseAttacking(true); - filter.setBlocking(true); - filter.setUseBlocking(true); filter.add(new PowerPredicate(ComparisonType.LessThan, 4)); } diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/DispenseJustice.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/DispenseJustice.java index ca1eec18709..b19f4be8e3e 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/DispenseJustice.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/DispenseJustice.java @@ -37,7 +37,7 @@ import mage.abilities.condition.common.MetalcraftCondition; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SacrificeEffect; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterAttackingCreature; import mage.game.Game; import mage.target.TargetPlayer; @@ -73,13 +73,7 @@ class DispenseJusticeEffect extends OneShotEffect { private static final String effectText = "Target player sacrifices an attacking creature.\r\n\r\n" + "Metalcraft - That player sacrifices two attacking creatures instead if you control three or more artifacts"; - private static final FilterCreaturePermanent filter; - - static { - filter = new FilterCreaturePermanent(); - filter.setUseAttacking(true); - filter.setAttacking(true); - } + private static final FilterAttackingCreature filter = new FilterAttackingCreature(); DispenseJusticeEffect ( ) { super(Outcome.Sacrifice); diff --git a/Mage.Sets/src/mage/sets/urzassaga/AngelicPage.java b/Mage.Sets/src/mage/sets/urzassaga/AngelicPage.java index a1298f6bd98..1a48fdbe284 100644 --- a/Mage.Sets/src/mage/sets/urzassaga/AngelicPage.java +++ b/Mage.Sets/src/mage/sets/urzassaga/AngelicPage.java @@ -39,7 +39,7 @@ import mage.abilities.costs.common.TapSourceCost; import mage.abilities.effects.common.continious.BoostTargetEffect; import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.common.FilterAttackingOrBlockingCreature; import mage.target.common.TargetCreaturePermanent; /** @@ -48,15 +48,6 @@ import mage.target.common.TargetCreaturePermanent; */ public class AngelicPage extends CardImpl { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("attacking or blocking creature"); - - static { - filter.setAttacking(true); - filter.setUseAttacking(true); - filter.setBlocking(true); - filter.setUseBlocking(true); - } - public AngelicPage(UUID ownerId) { super(ownerId, 4, "Angelic Page", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.expansionSetCode = "USG"; @@ -70,7 +61,7 @@ public class AngelicPage extends CardImpl { //{T}: Target attacking or blocking creature gets +1/+1 until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new TapSourceCost()); - ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addTarget(new TargetCreaturePermanent(new FilterAttackingOrBlockingCreature())); this.addAbility(ability); } diff --git a/Mage/src/mage/filter/common/FilterAttackingCreature.java b/Mage/src/mage/filter/common/FilterAttackingCreature.java index 18753dd6157..a6851c9451b 100644 --- a/Mage/src/mage/filter/common/FilterAttackingCreature.java +++ b/Mage/src/mage/filter/common/FilterAttackingCreature.java @@ -28,6 +28,8 @@ package mage.filter.common; +import mage.filter.predicate.permanent.AttackingPredicate; + /** * * @author BetaSteward_at_googlemail.com @@ -40,8 +42,7 @@ public class FilterAttackingCreature extends FilterCreaturePermanent { public FilterAttackingCreature(String name) { super(name); - this.attacking = true; - this.useAttacking = true; + this.add(new AttackingPredicate()); } public FilterAttackingCreature(final FilterAttackingCreature filter) { diff --git a/Mage/src/mage/filter/common/FilterAttackingOrBlockingCreature.java b/Mage/src/mage/filter/common/FilterAttackingOrBlockingCreature.java index 9d434e591bf..ad2e6753ed1 100644 --- a/Mage/src/mage/filter/common/FilterAttackingOrBlockingCreature.java +++ b/Mage/src/mage/filter/common/FilterAttackingOrBlockingCreature.java @@ -28,6 +28,10 @@ package mage.filter.common; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.filter.predicate.permanent.BlockingPredicate; + /** * * @author nantuko @@ -40,10 +44,9 @@ public class FilterAttackingOrBlockingCreature extends FilterCreaturePermanent { public FilterAttackingOrBlockingCreature(String name) { super(name); - this.attacking = true; - this.useAttacking = true; - this.blocking = true; - this.useBlocking = true; + this.add(Predicates.or( + new AttackingPredicate(), + new BlockingPredicate())); } public FilterAttackingOrBlockingCreature(final FilterAttackingOrBlockingCreature filter) { diff --git a/Mage/src/mage/filter/common/FilterBlockingCreature.java b/Mage/src/mage/filter/common/FilterBlockingCreature.java index e94ba3b1066..95d0caf2254 100644 --- a/Mage/src/mage/filter/common/FilterBlockingCreature.java +++ b/Mage/src/mage/filter/common/FilterBlockingCreature.java @@ -28,6 +28,8 @@ package mage.filter.common; +import mage.filter.predicate.permanent.BlockedPredicate; + /** * * @author BetaSteward_at_googlemail.com @@ -40,8 +42,7 @@ public class FilterBlockingCreature extends FilterCreaturePermanent { public FilterBlockingCreature(String name) { super(name); - this.blocking = true; - this.useBlocking = true; + this.add(new BlockedPredicate()); } public FilterBlockingCreature(final FilterBlockingCreature filter) { diff --git a/Mage/src/mage/filter/common/FilterCreatureForAttack.java b/Mage/src/mage/filter/common/FilterCreatureForAttack.java index 592759a365d..9f2fd7f19e1 100644 --- a/Mage/src/mage/filter/common/FilterCreatureForAttack.java +++ b/Mage/src/mage/filter/common/FilterCreatureForAttack.java @@ -31,6 +31,8 @@ package mage.filter.common; import mage.abilities.keyword.DefenderAbility; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.AbilityPredicate; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.filter.predicate.permanent.BlockingPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -47,10 +49,8 @@ public class FilterCreatureForAttack extends FilterCreaturePermanent { public FilterCreatureForAttack(String name) { super(name); - this.attacking = false; - this.useAttacking = true; - this.blocking = false; - this.useBlocking = true; + this.add(Predicates.not(new AttackingPredicate())); + this.add(Predicates.not(new BlockingPredicate())); this.add(Predicates.not(new TappedPredicate())); this.add(Predicates.not(new AbilityPredicate(DefenderAbility.class))); } diff --git a/Mage/src/mage/filter/common/FilterCreatureForCombat.java b/Mage/src/mage/filter/common/FilterCreatureForCombat.java index 4c5bf12d34b..fb7091cfad3 100644 --- a/Mage/src/mage/filter/common/FilterCreatureForCombat.java +++ b/Mage/src/mage/filter/common/FilterCreatureForCombat.java @@ -30,6 +30,7 @@ package mage.filter.common; import mage.filter.predicate.Predicate; import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AttackingPredicate; import mage.filter.predicate.permanent.TappedPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -46,10 +47,9 @@ public class FilterCreatureForCombat extends FilterCreaturePermanent { public FilterCreatureForCombat(String name) { super(name); - this.attacking = false; - this.useAttacking = true; - this.add(new PhasedInPredicate()); + this.add(Predicates.not(new AttackingPredicate())); this.add(Predicates.not(new TappedPredicate())); + this.add(new PhasedInPredicate()); } public FilterCreatureForCombat(final FilterCreatureForCombat filter) { @@ -68,17 +68,17 @@ public class FilterCreatureForCombat extends FilterCreaturePermanent { public FilterCreatureForCombat copy() { return new FilterCreatureForCombat(this); } +} - private static final class PhasedInPredicate implements Predicate{ +class PhasedInPredicate implements Predicate { - @Override - public boolean apply(Permanent input, Game game) { - return input.isPhasedIn(); - } + @Override + public boolean apply(Permanent input, Game game) { + return input.isPhasedIn(); + } - @Override - public String toString() { - return "PhasedIn"; - } + @Override + public String toString() { + return "PhasedIn"; } } diff --git a/Mage/src/mage/filter/common/FilterCreaturePermanent.java b/Mage/src/mage/filter/common/FilterCreaturePermanent.java index 0e16863d039..a9e7cd3cd27 100644 --- a/Mage/src/mage/filter/common/FilterCreaturePermanent.java +++ b/Mage/src/mage/filter/common/FilterCreaturePermanent.java @@ -40,10 +40,6 @@ import mage.game.permanent.Permanent; */ public class FilterCreaturePermanent extends FilterPermanent { - protected boolean useAttacking; - protected boolean attacking; - protected boolean useBlocking; - protected boolean blocking; protected boolean useDamageDealt; protected boolean damageDealt; @@ -58,10 +54,6 @@ public class FilterCreaturePermanent extends FilterPermanent { public FilterCreaturePermanent(final FilterCreaturePermanent filter) { super(filter); - this.useAttacking = filter.useAttacking; - this.attacking = filter.attacking; - this.useBlocking = filter.useBlocking; - this.blocking = filter.blocking; this.useDamageDealt = filter.useDamageDealt; this.damageDealt = filter.damageDealt; } @@ -71,25 +63,6 @@ public class FilterCreaturePermanent extends FilterPermanent { if (!super.match(permanent, game)) return notFilter; - if (useAttacking) { - if (permanent.isAttacking() != attacking) { // failed checking - // for "target attacking OR blocking" filters - // we have to make sure it is not blocking before returning false - if (useBlocking) { - if ((permanent.getBlocking() > 0) != blocking) { - return notFilter; - } - } else { - // filter doesn't use 'blocking', so as checking for attacking failed return false - return notFilter; - } - } - return !notFilter; - } - - if (useBlocking && (permanent.getBlocking() > 0) != blocking) - return notFilter; - if (useDamageDealt) { // use this instead of getDamage() because damage is reset in case of regeneration if (permanent.getDealtDamageByThisTurn().isEmpty()) { @@ -99,22 +72,6 @@ public class FilterCreaturePermanent extends FilterPermanent { return !notFilter; } - public void setUseAttacking ( boolean useAttacking ) { - this.useAttacking = useAttacking; - } - - public void setAttacking ( boolean attacking ) { - this.attacking = attacking; - } - - public void setUseBlocking ( boolean useBlocking ) { - this.useBlocking = useBlocking; - } - - public void setBlocking ( boolean blocking ) { - this.blocking = blocking; - } - /** * Select creatures dependant if they already got damage during the current turn. Works also if the creature was * meanwhile regenerated during the turn. diff --git a/Mage/src/mage/filter/predicate/permanent/AttackingPredicate.java b/Mage/src/mage/filter/predicate/permanent/AttackingPredicate.java new file mode 100644 index 00000000000..2ce9eea92ae --- /dev/null +++ b/Mage/src/mage/filter/predicate/permanent/AttackingPredicate.java @@ -0,0 +1,49 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.filter.predicate.permanent; + +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author North + */ +public class AttackingPredicate implements Predicate { + + @Override + public boolean apply(Permanent input, Game game) { + return input.isAttacking(); + } + + @Override + public String toString() { + return "Attacking"; + } +} diff --git a/Mage/src/mage/filter/predicate/permanent/BlockingPredicate.java b/Mage/src/mage/filter/predicate/permanent/BlockingPredicate.java new file mode 100644 index 00000000000..c8a89c50fa2 --- /dev/null +++ b/Mage/src/mage/filter/predicate/permanent/BlockingPredicate.java @@ -0,0 +1,49 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.filter.predicate.permanent; + +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author North + */ +public class BlockingPredicate implements Predicate { + + @Override + public boolean apply(Permanent input, Game game) { + return input.getBlocking() > 0; + } + + @Override + public String toString() { + return "Blocking"; + } +}