* War's Toll - fixed that is applies restriction attack effect from any zone (from command, hand, etc);

This commit is contained in:
Oleg Agafonov 2020-01-22 12:33:03 +04:00
parent 7fcd4abcc8
commit cf759e0443
11 changed files with 25 additions and 55 deletions

View file

@ -34,9 +34,7 @@ public final class ArlinnsWolf extends CardImpl {
this.toughness = new MageInt(2);
// Arlinn's Wolf can't be blocked by creatures with power 2 or less.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(
filter, Duration.WhileOnBattlefield
)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
private ArlinnsWolf(final ArlinnsWolf card) {

View file

@ -35,9 +35,7 @@ public final class DuskmantleOperative extends CardImpl {
this.toughness = new MageInt(2);
// Duskmantle Operative can't be blocked by creatures with power 4 or greater.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(
filter, Duration.WhileOnBattlefield
)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
private DuskmantleOperative(final DuskmantleOperative card) {

View file

@ -34,9 +34,7 @@ public final class EnragedCeratok extends CardImpl {
this.toughness = new MageInt(4);
// Enraged Ceratok can't be blocked by creatures with power 2 or less.
this.addAbility(new SimpleEvasionAbility(
new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
private EnragedCeratok(final EnragedCeratok card) {

View file

@ -47,9 +47,7 @@ public final class GarenbrigPaladin extends CardImpl {
), new ManaSpentToCastWatcher());
// Garenbrig Paladin can't be blocked by creatures with power 2 or less.
this.addAbility(new SimpleEvasionAbility(
new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
private GarenbrigPaladin(final GarenbrigPaladin card) {

View file

@ -1,6 +1,5 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleEvasionAbility;
@ -8,14 +7,9 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
@ -25,8 +19,9 @@ import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class RavenousSlime extends CardImpl {
@ -46,11 +41,7 @@ public final class RavenousSlime extends CardImpl {
this.toughness = new MageInt(1);
// Ravenous Slime can't be blocked by creatures with power 2 or less.
this.addAbility(new SimpleEvasionAbility(
new CantBeBlockedByCreaturesSourceEffect(
filter, Duration.WhileOnBattlefield
)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
// If a creature an opponent controls would die, instead exile it and put a number of +1/+1 counters equal to that creature's power on Ravenous Slime.
this.addAbility(new SimpleStaticAbility(
@ -130,12 +121,7 @@ class RavenousSlimeEffect extends ReplacementEffectImpl {
return false;
}
if (zEvent.getTarget() != null) { // if it comes from permanent, check if it was a creature on the battlefield
if (zEvent.getTarget().isCreature()) {
return true;
}
} else if (permanent.isCreature()) {
return true;
}
return false;
return zEvent.getTarget().isCreature();
} else return permanent.isCreature();
}
}

View file

@ -1,7 +1,5 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
@ -12,8 +10,9 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class RiverDarter extends CardImpl {
@ -27,8 +26,7 @@ public final class RiverDarter extends CardImpl {
this.toughness = new MageInt(3);
// River Darter can't be blocked by Dinosaurs.
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(
new FilterCreaturePermanent(SubType.DINOSAUR, "Dinosaurs"), Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.DINOSAUR, "Dinosaurs"), Duration.WhileOnBattlefield)));
}
public RiverDarter(final RiverDarter card) {

View file

@ -34,9 +34,7 @@ public final class RubblebeltRunner extends CardImpl {
this.toughness = new MageInt(3);
// Rubblebelt Runner can't be blocked by creature tokens.
this.addAbility(new SimpleEvasionAbility(
new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
private RubblebeltRunner(final RubblebeltRunner card) {

View file

@ -29,8 +29,8 @@ public final class StromkirkNoble extends CardImpl {
this.toughness = new MageInt(1);
// Stromkirk Noble can't be blocked by Humans.
this.addAbility(new SimpleEvasionAbility(
new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.HUMAN, "Humans"), Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(new FilterCreaturePermanent(SubType.HUMAN, "Humans"), Duration.WhileOnBattlefield)));
// Whenever Stromkirk Noble deals combat damage to a player, put a +1/+1 counter on it.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false));
}

View file

@ -1,6 +1,5 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.common.TapForManaAllTriggeredAbility;
@ -8,11 +7,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.RestrictionEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
@ -20,8 +15,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*/
public final class WarsToll extends CardImpl {
@ -42,7 +38,6 @@ public final class WarsToll extends CardImpl {
// If a creature an opponent controls attacks, all creatures that opponent controls attack if able.
this.addAbility(new SimpleEvasionAbility(new WarsTollAttackRestrictionEffect()));
}
public WarsToll(final WarsToll card) {
@ -97,7 +92,10 @@ class WarsTollAttackRestrictionEffect extends RestrictionEffect {
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
Player controller = game.getPlayer(permanent.getControllerId());
return controller != null && controller.hasOpponent(source.getControllerId(), game);
if (controller != null) {
return controller.hasOpponent(source.getControllerId(), game);
}
return false;
}
@Override

View file

@ -4,13 +4,12 @@ import mage.constants.AbilityType;
import mage.constants.Zone;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public abstract class EvasionAbility extends StaticAbility {
public EvasionAbility() {
this(Zone.ALL);
this(Zone.BATTLEFIELD);
}
public EvasionAbility(Zone zone) {

View file

@ -5,13 +5,12 @@ import mage.abilities.effects.Effect;
import mage.constants.Zone;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class SimpleEvasionAbility extends EvasionAbility {
public SimpleEvasionAbility(Effect effect) {
this(effect, Zone.ALL);
this(effect, Zone.BATTLEFIELD);
}
public SimpleEvasionAbility(Effect effect, Zone zone) {