* Rampart Crawler, Juggernaut - Fixed can't be blocked by walls ability.

This commit is contained in:
LevelX2 2013-10-13 11:01:26 +02:00
parent 60336cbc4b
commit c0ade21efe
3 changed files with 85 additions and 103 deletions

View file

@ -33,12 +33,12 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.effects.common.combat.CantBlockSourceEffect;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -46,6 +46,11 @@ import mage.game.permanent.Permanent;
*/
public class RampartCrawler extends CardImpl<RampartCrawler> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Walls");
static {
filter.add(new SubtypePredicate("Wall"));
}
public RampartCrawler(UUID ownerId) {
super(ownerId, 156, "Rampart Crawler", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}");
this.expansionSetCode = "MMQ";
@ -56,7 +61,7 @@ public class RampartCrawler extends CardImpl<RampartCrawler> {
this.toughness = new MageInt(1);
// Rampart Crawler can't be blocked by Walls.
this.addAbility(new RampartCrawlerAbility());
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public RampartCrawler(final RampartCrawler card) {
@ -69,47 +74,3 @@ public class RampartCrawler extends CardImpl<RampartCrawler> {
}
}
class RampartCrawlerAbility extends EvasionAbility<RampartCrawlerAbility> {
public RampartCrawlerAbility() {
this.addEffect(new RampartCrawlerEffect());
}
public RampartCrawlerAbility(final RampartCrawlerAbility ability) {
super(ability);
}
@Override
public String getRule() {
return "{this} can't be blocked by Walls.";
}
@Override
public RampartCrawlerAbility copy() {
return new RampartCrawlerAbility(this);
}
}
class RampartCrawlerEffect extends CantBlockSourceEffect {
public RampartCrawlerEffect() {
super(Duration.WhileOnBattlefield);
}
public RampartCrawlerEffect(final RampartCrawlerEffect effect) {
super(effect);
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return !blocker.hasSubtype("Wall");
}
@Override
public RampartCrawlerEffect copy() {
return new RampartCrawlerEffect(this);
}
}

View file

@ -29,17 +29,16 @@
package mage.sets.tenth;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.AttacksEachTurnStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.common.AttacksEachTurnStaticAbility;
import mage.abilities.effects.common.combat.CantBlockSourceEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
@ -47,6 +46,11 @@ import mage.game.permanent.Permanent;
*/
public class Juggernaut extends CardImpl<Juggernaut> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Walls");
static {
filter.add(new SubtypePredicate("Wall"));
}
public Juggernaut(UUID ownerId) {
super(ownerId, 328, "Juggernaut", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{4}");
this.expansionSetCode = "10E";
@ -54,8 +58,10 @@ public class Juggernaut extends CardImpl<Juggernaut> {
this.power = new MageInt(5);
this.toughness = new MageInt(3);
// Juggernaut attacks each turn if able.
this.addAbility(new AttacksEachTurnStaticAbility());
this.addAbility(new JuggernautAbility());
// Juggernaut can't be blocked by Walls.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public Juggernaut(final Juggernaut card) {
@ -68,47 +74,3 @@ public class Juggernaut extends CardImpl<Juggernaut> {
}
}
class JuggernautAbility extends EvasionAbility<JuggernautAbility> {
public JuggernautAbility() {
this.addEffect(new JuggernautEffect());
}
public JuggernautAbility(final JuggernautAbility ability) {
super(ability);
}
@Override
public String getRule() {
return "{this} can't be blocked by Walls.";
}
@Override
public JuggernautAbility copy() {
return new JuggernautAbility(this);
}
}
class JuggernautEffect extends CantBlockSourceEffect {
public JuggernautEffect() {
super(Duration.WhileOnBattlefield);
}
public JuggernautEffect(final JuggernautEffect effect) {
super(effect);
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return !blocker.hasSubtype("Wall");
}
@Override
public JuggernautEffect copy() {
return new JuggernautEffect(this);
}
}

View file

@ -0,0 +1,59 @@
/*
* 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.common;
import mage.abilities.EvasionAbility;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class SimpleEvasionAbility extends EvasionAbility<SimpleEvasionAbility> {
public SimpleEvasionAbility(Effect effect) {
super();
if (effect != null) {
this.addEffect(effect);
}
}
public SimpleEvasionAbility(SimpleEvasionAbility ability) {
super(ability);
}
@Override
public SimpleEvasionAbility copy() {
return new SimpleEvasionAbility(this);
}
}