diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AuraGnarlid.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AuraGnarlid.java index d341fee586e..4ec695438f7 100644 --- a/Mage.Sets/src/mage/sets/riseoftheeldrazi/AuraGnarlid.java +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/AuraGnarlid.java @@ -33,15 +33,12 @@ import mage.Constants.Duration; import mage.Constants.Rarity; import mage.Constants.Zone; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; -import mage.abilities.effects.RestrictionEffect; import mage.abilities.effects.common.continious.BoostSourceEffect; +import mage.abilities.effects.common.continious.CantBeBlockedByCreaturesWithLessPowerEffect; import mage.cards.CardImpl; import mage.filter.FilterPermanent; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -65,7 +62,7 @@ public class AuraGnarlid extends CardImpl { this.toughness = new MageInt(2); // Creatures with power less than Aura Gnarlid's power can't block it. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AuraGnarlidRestrictionEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesWithLessPowerEffect())); // Aura Gnarlid gets +1/+1 for each Aura on the battlefield. PermanentsOnBattlefieldCount count = new PermanentsOnBattlefieldCount(filter); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostSourceEffect(count, count, Duration.WhileOnBattlefield))); @@ -80,36 +77,3 @@ public class AuraGnarlid extends CardImpl { return new AuraGnarlid(this); } } - -class AuraGnarlidRestrictionEffect extends RestrictionEffect { - - public AuraGnarlidRestrictionEffect() { - super(Duration.WhileOnBattlefield); - staticText = "Creatures with power less than {this}'s power can't block it"; - } - - public AuraGnarlidRestrictionEffect(final AuraGnarlidRestrictionEffect effect) { - super(effect); - } - - @Override - public boolean applies(Permanent permanent, Ability source, Game game) { - if (permanent.getId().equals(source.getSourceId())) { - return true; - } - return false; - } - - @Override - public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { - if (blocker.getPower().getValue() < attacker.getPower().getValue()) { - return false; - } - return true; - } - - @Override - public AuraGnarlidRestrictionEffect copy() { - return new AuraGnarlidRestrictionEffect(this); - } -} diff --git a/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByCreaturesWithLessPowerEffect.java b/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByCreaturesWithLessPowerEffect.java new file mode 100644 index 00000000000..51bd1e39c0f --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/continious/CantBeBlockedByCreaturesWithLessPowerEffect.java @@ -0,0 +1,71 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.abilities.effects.common.continious; + +import mage.Constants.Duration; +import mage.abilities.Ability; +import mage.abilities.effects.RestrictionEffect; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author North + */ +public class CantBeBlockedByCreaturesWithLessPowerEffect extends RestrictionEffect { + + public CantBeBlockedByCreaturesWithLessPowerEffect() { + super(Duration.WhileOnBattlefield); + staticText = "Creatures with power less than {this}'s power can't block it"; + } + + public CantBeBlockedByCreaturesWithLessPowerEffect(final CantBeBlockedByCreaturesWithLessPowerEffect effect) { + super(effect); + } + + @Override + public boolean applies(Permanent permanent, Ability source, Game game) { + if (permanent.getId().equals(source.getSourceId())) { + return true; + } + return false; + } + + @Override + public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) { + if (blocker.getPower().getValue() < attacker.getPower().getValue()) { + return false; + } + return true; + } + + @Override + public CantBeBlockedByCreaturesWithLessPowerEffect copy() { + return new CantBeBlockedByCreaturesWithLessPowerEffect(this); + } +}