Merge origin/master

This commit is contained in:
fireshoes 2015-07-21 09:55:31 -05:00
commit a8e519d671
36 changed files with 422 additions and 921 deletions

View file

@ -28,18 +28,19 @@
package mage.sets.apocalypse;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
@ -54,12 +55,13 @@ public class CoastalDrake extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Flying
// Flying
this.addAbility(FlyingAbility.getInstance());
// {1}{U}, {T} : Return target Kavu to its owner's hand.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{1}{U}"));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true), new ManaCostsImpl("{1}{U}"));
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("Kavu", "Kavu")));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -30,7 +30,7 @@ package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
@ -40,12 +40,11 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.FilterSpell;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
@ -57,6 +56,7 @@ import mage.target.targetpointer.FixedTarget;
public class EndrekSahrMasterBreeder extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a creature spell");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
@ -74,7 +74,9 @@ public class EndrekSahrMasterBreeder extends CardImpl {
// Whenever you cast a creature spell, put X 1/1 black Thrull creature tokens onto the battlefield, where X is that spell's converted mana cost.
this.addAbility(new SpellCastControllerTriggeredAbility(new EndrekSahrMasterBreederEffect(), filter, false, true));
// When you control seven or more Thrulls, sacrifice Endrek Sahr, Master Breeder.
this.addAbility(new EndrekSahrMasterBreederTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterCreaturePermanent("Thrull", "seven or more Thrulls"), Filter.ComparisonType.GreaterThan, 6,
new SacrificeSourceEffect()));
}
public EndrekSahrMasterBreeder(final EndrekSahrMasterBreeder card) {
@ -87,37 +89,6 @@ public class EndrekSahrMasterBreeder extends CardImpl {
}
}
class EndrekSahrMasterBreederTriggeredAbility extends StateTriggeredAbility {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(new SubtypePredicate("Thrull"));
}
public EndrekSahrMasterBreederTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public EndrekSahrMasterBreederTriggeredAbility(final EndrekSahrMasterBreederTriggeredAbility ability) {
super(ability);
}
@Override
public EndrekSahrMasterBreederTriggeredAbility copy() {
return new EndrekSahrMasterBreederTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(filter, this.getControllerId(), game) >= 7);
}
@Override
public String getRule() {
return "When you control seven or more Thrulls, sacrifice {this}.";
}
}
class EndrekSahrMasterBreederEffect extends OneShotEffect {
public EndrekSahrMasterBreederEffect() {
@ -138,8 +109,8 @@ class EndrekSahrMasterBreederEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell == null) {
spell = (Spell) game.getLastKnownInformation(((FixedTarget)getTargetPointer()).getTarget(), Zone.STACK);
}
spell = (Spell) game.getLastKnownInformation(((FixedTarget) getTargetPointer()).getTarget(), Zone.STACK);
}
if (spell != null) {
int cmc = spell.getConvertedManaCost();
if (cmc > 0) {

View file

@ -30,13 +30,12 @@ package mage.sets.elvesvsgoblins;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
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.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -55,7 +54,7 @@ public class SkirkShaman extends CardImpl {
Predicates.or(
Predicates.and(new CardTypePredicate(CardType.ARTIFACT), new CardTypePredicate(CardType.CREATURE)),
Predicates.and(new CardTypePredicate(CardType.CREATURE), new ColorPredicate(ObjectColor.RED)
))));
))));
}
public SkirkShaman(UUID ownerId) {
@ -68,7 +67,7 @@ public class SkirkShaman extends CardImpl {
this.toughness = new MageInt(2);
// Skirk Shaman can't be blocked except by artifact creatures and/or red creatures.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}

View file

@ -29,14 +29,13 @@ package mage.sets.eventide;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -44,12 +43,12 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
/**
*
* @author jeffwadsworth
*
*/
public class NoggleBandit extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by creatures with defender");
static {
filter.add(Predicates.not(new AbilityPredicate(DefenderAbility.class)));
}
@ -64,8 +63,8 @@ public class NoggleBandit extends CardImpl {
this.toughness = new MageInt(2);
// Noggle Bandit can't be blocked except by creatures with defender.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public NoggleBandit(final NoggleBandit card) {

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SkipUntapOptionalAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
@ -42,13 +42,13 @@ import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.CardIdPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreaturePermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
@ -80,7 +80,9 @@ public class Seasinger extends CardImpl {
seasinger.add(new CardIdPredicate(this.getId()));
// When you control no Islands, sacrifice Seasinger.
this.addAbility(new SeasingerTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
// You may choose not to untap Seasinger during your untap step.
this.addAbility(new SkipUntapOptionalAbility());
@ -104,29 +106,3 @@ public class Seasinger extends CardImpl {
return new Seasinger(this);
}
}
class SeasingerTriggeredAbility extends StateTriggeredAbility {
public SeasingerTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public SeasingerTriggeredAbility(final SeasingerTriggeredAbility ability) {
super(ability);
}
@Override
public SeasingerTriggeredAbility copy() {
return new SeasingerTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -29,7 +29,7 @@ package mage.sets.fallenempires;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -43,10 +43,8 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -64,13 +62,15 @@ public class VodalianKnights extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Vodalian Knights can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// When you control no Islands, sacrifice Vodalian Knights.
this.addAbility(new VodalianKnightsTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
// {U}: Vodalian Knights gains flying until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{U}")));
}
@ -84,29 +84,3 @@ public class VodalianKnights extends CardImpl {
return new VodalianKnights(this);
}
}
class VodalianKnightsTriggeredAbility extends StateTriggeredAbility {
public VodalianKnightsTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public VodalianKnightsTriggeredAbility(final VodalianKnightsTriggeredAbility ability) {
super(ability);
}
@Override
public VodalianKnightsTriggeredAbility copy() {
return new VodalianKnightsTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -29,21 +29,19 @@ package mage.sets.fifthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author KholdFuzion
*
*/
public class Dandan extends CardImpl {
@ -56,10 +54,12 @@ public class Dandan extends CardImpl {
this.toughness = new MageInt(1);
// Dandan can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// When you control no Islands, sacrifice Dandan.
this.addAbility(new DandanTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public Dandan(final Dandan card) {
@ -71,29 +71,3 @@ public class Dandan extends CardImpl {
return new Dandan(this);
}
}
class DandanTriggeredAbility extends StateTriggeredAbility {
public DandanTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public DandanTriggeredAbility(final DandanTriggeredAbility ability) {
super(ability);
}
@Override
public DandanTriggeredAbility copy() {
return new DandanTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no Islands, sacrifice {this}.";
}
}

View file

@ -29,6 +29,7 @@ package mage.sets.fifthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.combat.CantAttackAnyPlayerAllEffect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
@ -70,7 +71,7 @@ public class EvilEyeOfOrmsByGore extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackAnyPlayerAllEffect(Duration.WhileOnBattlefield, cantAttackFilter)));
// Evil Eye of Orms-by-Gore can't be blocked except by Walls.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(cantBeBlockedByFilter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(cantBeBlockedByFilter, Duration.WhileOnBattlefield)));
}
public EvilEyeOfOrmsByGore(final EvilEyeOfOrmsByGore card) {

View file

@ -29,7 +29,7 @@ package mage.sets.iceage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
@ -37,10 +37,8 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -56,10 +54,12 @@ public class GorillaPack extends CardImpl {
this.toughness = new MageInt(3);
// Gorilla Pack can't attack unless defending player controls a Forest.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Forest","a Forest"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Forest", "a Forest"))));
// When you control no Forests, sacrifice Gorilla Pack.
this.addAbility(new GorillaPackTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Forest", "no Forests"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public GorillaPack(final GorillaPack card) {
@ -71,35 +71,3 @@ public class GorillaPack extends CardImpl {
return new GorillaPack(this);
}
}
class GorillaPackTriggeredAbility extends StateTriggeredAbility {
public static final FilterLandPermanent filter = new FilterLandPermanent("Forest");
{
filter.add(new SubtypePredicate("Forest"));
}
public GorillaPackTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public GorillaPackTriggeredAbility(final GorillaPackTriggeredAbility ability) {
super(ability);
}
@Override
public GorillaPackTriggeredAbility copy() {
return new GorillaPackTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no forests, sacrifice {this}.";
}
}

View file

@ -30,9 +30,8 @@ package mage.sets.khansoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.CantBeBlockedSourceAbility;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;

View file

@ -30,7 +30,7 @@ package mage.sets.khansoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.condition.common.RaidCondition;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
@ -38,7 +38,6 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
@ -50,8 +49,9 @@ import mage.watchers.common.PlayerAttackedWatcher;
* @author emerald000
*/
public class WarNameAspirant extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 1 or less");
static {
filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 2));
}
@ -66,15 +66,15 @@ public class WarNameAspirant extends CardImpl {
this.toughness = new MageInt(1);
// <i>Raid</i> - War-Name Aspirant enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1), false),
RaidCondition.getInstance(),
true,
"<i>Raid</i> - {this} enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn",
"{this} enters the battlefield with a +1/+1 counter"),
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(1), false),
RaidCondition.getInstance(),
true,
"<i>Raid</i> - {this} enters the battlefield with a +1/+1 counter on it if you attacked with a creature this turn",
"{this} enters the battlefield with a +1/+1 counter"),
new PlayerAttackedWatcher());
// War-Name Aspirant can't be blocked by creatures with power 1 or less.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public WarNameAspirant(final WarNameAspirant card) {

View file

@ -30,7 +30,7 @@ package mage.sets.limitedalpha;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -38,17 +38,17 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
import mage.cards.CardImpl;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author KholdFuzion
*
*/
public class PirateShip extends CardImpl {
@ -62,13 +62,15 @@ public class PirateShip extends CardImpl {
this.toughness = new MageInt(3);
// Pirate Ship can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// {tap}: Pirate Ship deals 1 damage to target creature or player.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
// When you control no Islands, sacrifice Pirate Ship.
this.addAbility(new PirateShipTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public PirateShip(final PirateShip card) {
@ -80,29 +82,3 @@ public class PirateShip extends CardImpl {
return new PirateShip(this);
}
}
class PirateShipTriggeredAbility extends StateTriggeredAbility {
public PirateShipTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public PirateShipTriggeredAbility(final PirateShipTriggeredAbility ability) {
super(ability);
}
@Override
public PirateShipTriggeredAbility copy() {
return new PirateShipTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -29,7 +29,7 @@ package mage.sets.limitedalpha;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
@ -37,16 +37,14 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
* @author KholdFuzion
*
*/
public class SeaSerpent extends CardImpl {
@ -67,7 +65,9 @@ public class SeaSerpent extends CardImpl {
// Sea Serpent can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(filter)));
// When you control no Islands, sacrifice Sea Serpent.
this.addAbility(new SeaSerpentTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public SeaSerpent(final SeaSerpent card) {
@ -79,29 +79,3 @@ public class SeaSerpent extends CardImpl {
return new SeaSerpent(this);
}
}
class SeaSerpentTriggeredAbility extends StateTriggeredAbility {
public SeaSerpentTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public SeaSerpentTriggeredAbility(final SeaSerpentTriggeredAbility ability) {
super(ability);
}
@Override
public SeaSerpentTriggeredAbility copy() {
return new SeaSerpentTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -29,13 +29,12 @@ package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
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.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
@ -51,7 +50,7 @@ public class GoldmeadowDodger extends CardImpl {
static {
filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 3));
}
public GoldmeadowDodger(UUID ownerId) {
super(ownerId, 16, "Goldmeadow Dodger", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "LRW";
@ -61,7 +60,7 @@ public class GoldmeadowDodger extends CardImpl {
this.toughness = new MageInt(1);
// Goldmeadow Dodger can't be blocked by creatures with power 4 or greater.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public GoldmeadowDodger(final GoldmeadowDodger card) {

View file

@ -28,16 +28,17 @@
package mage.sets.magic2010;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
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.effects.RestrictionEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
@ -45,6 +46,12 @@ import mage.game.permanent.Permanent;
*/
public class DreadWarlock extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by black creatures");
static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLACK)));
}
public DreadWarlock(UUID ownerId) {
super(ownerId, 94, "Dread Warlock", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
this.expansionSetCode = "M10";
@ -55,7 +62,7 @@ public class DreadWarlock extends CardImpl {
this.toughness = new MageInt(2);
// Dread Warlock can't be blocked except by black creatures.
this.addAbility(DreadWarlockAbility.getInstance());
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public DreadWarlock(final DreadWarlock card) {
@ -67,61 +74,3 @@ public class DreadWarlock extends CardImpl {
return new DreadWarlock(this);
}
}
class DreadWarlockAbility extends EvasionAbility {
private static DreadWarlockAbility instance;
public static DreadWarlockAbility getInstance() {
if (instance == null) {
instance = new DreadWarlockAbility();
}
return instance;
}
private DreadWarlockAbility() {
this.addEffect(new DreadWarlockEffect());
}
@Override
public String getRule() {
return "{this} can't be blocked except by black creatures.";
}
@Override
public DreadWarlockAbility copy() {
return getInstance();
}
}
class DreadWarlockEffect extends RestrictionEffect {
public DreadWarlockEffect() {
super(Duration.WhileOnBattlefield);
}
public DreadWarlockEffect(final DreadWarlockEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getAbilities().containsKey(DreadWarlockAbility.getInstance().getId())) {
return true;
}
return false;
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (blocker.getColor(game).isBlack()) {
return true;
}
return false;
}
@Override
public DreadWarlockEffect copy() {
return new DreadWarlockEffect(this);
}
}

View file

@ -122,10 +122,14 @@ class IsBeingCastFromHandCondition implements Condition {
UUID splitCardId = ((Card) object).getMainCard().getId();
object = game.getObject(splitCardId);
}
if (object instanceof Spell) {
if (object instanceof Spell) { // needed to check if it can be cast by alternate cost
Spell spell = (Spell) object;
return spell.getFromZone() == Zone.HAND;
}
if (object instanceof Card) { // needed for the check what's playable
Card card = (Card) object;
return game.getPlayer(card.getOwnerId()).getHand().get(card.getId(), game) != null;
}
return false;
}

View file

@ -148,7 +148,7 @@ class GarrukApexPredatorBeastToken extends Token {
public GarrukApexPredatorBeastToken() {
super("Beast", "3/3 black Beast creature token with deathtouch");
setOriginalExpansionSetCode("M15");
setTokenType(2);
setTokenType(1);
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add("Beast");

View file

@ -31,14 +31,13 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.DamageTargetEffect;
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.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
@ -49,14 +48,15 @@ import mage.target.common.TargetOpponent;
* @author emerald000
*/
public class ScuttlingDoomEngine extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 2 or less");
static {
filter.add(new PowerPredicate(Filter.ComparisonType.LessThan, 3));
}
public ScuttlingDoomEngine(UUID ownerId) {
super(ownerId, 229, "Scuttling Doom Engine", Rarity.RARE, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
this.expansionSetCode = "M15";
this.subtype.add("Construct");
@ -65,7 +65,7 @@ public class ScuttlingDoomEngine extends CardImpl {
this.toughness = new MageInt(6);
// Scuttling Doom Engine can't be blocked by creatures with power 2 or less.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
// When Scuttling Doom Engine dies, it deals 6 damage to target opponnent
Ability ability = new DiesTriggeredAbility(new DamageTargetEffect(6), false);
ability.addTarget(new TargetOpponent());

View file

@ -30,7 +30,7 @@ package mage.sets.masterseditionii;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.IsStepCondition;
@ -51,13 +51,11 @@ import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterAttackingCreature;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
@ -66,9 +64,9 @@ import mage.target.common.TargetCreaturePermanent;
* @author fireshoes
*/
public class Marjhan extends CardImpl {
private static final FilterAttackingCreature filter = new FilterAttackingCreature("attacking creature without flying");
static {
filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class)));
}
@ -82,25 +80,27 @@ public class Marjhan extends CardImpl {
// Marjhan doesn't untap during your untap step.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DontUntapInControllersUntapStepSourceEffect()));
// {U}{U}, Sacrifice a creature: Untap Marjhan. Activate this ability only during your upkeep.
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD,
new UntapSourceEffect(), new ManaCostsImpl("{U}{U}"), new IsStepCondition(PhaseStep.UPKEEP), null);
ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent()));
this.addAbility(ability);
// Marjhan can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// {U}{U}: Marjhan gets -1/-0 until end of turn and deals 1 damage to target attacking creature without flying.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(-1, 0, Duration.EndOfTurn), new ManaCostsImpl("{U}{U}"));
Effect effect = new DamageTargetEffect(1);
ability.addEffect(effect);
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
// When you control no Islands, sacrifice Marjhan.
this.addAbility(new MarjhanTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public Marjhan(final Marjhan card) {
@ -112,29 +112,3 @@ public class Marjhan extends CardImpl {
return new Marjhan(this);
}
}
class MarjhanTriggeredAbility extends StateTriggeredAbility {
public MarjhanTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public MarjhanTriggeredAbility(final MarjhanTriggeredAbility ability) {
super(ability);
}
@Override
public MarjhanTriggeredAbility copy() {
return new MarjhanTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -30,7 +30,7 @@ package mage.sets.mirage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
@ -44,13 +44,11 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetLandPermanent;
@ -59,7 +57,7 @@ import mage.target.common.TargetLandPermanent;
* @author fireshoes
*/
public class KukemssaSerpent extends CardImpl {
private static final FilterLandPermanent filterOpponentLand = new FilterLandPermanent("land an opponent controls");
private static final FilterControlledLandPermanent filterControlledLand = new FilterControlledLandPermanent("an Island");
@ -76,16 +74,18 @@ public class KukemssaSerpent extends CardImpl {
this.toughness = new MageInt(3);
// Kukemssa Serpent can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// {U}, Sacrifice an Island: Target land an opponent controls becomes an Island until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filterControlledLand, true)));
ability.addTarget(new TargetLandPermanent(filterOpponentLand));
this.addAbility(ability);
// When you control no Islands, sacrifice Kukemssa Serpent.
this.addAbility(new KukemssaSerpentTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public KukemssaSerpent(final KukemssaSerpent card) {
@ -97,29 +97,3 @@ public class KukemssaSerpent extends CardImpl {
return new KukemssaSerpent(this);
}
}
class KukemssaSerpentTriggeredAbility extends StateTriggeredAbility {
public KukemssaSerpentTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public KukemssaSerpentTriggeredAbility(final KukemssaSerpentTriggeredAbility ability) {
super(ability);
}
@Override
public KukemssaSerpentTriggeredAbility copy() {
return new KukemssaSerpentTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -30,14 +30,14 @@ package mage.sets.nemesis;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.effects.common.combat.CantBlockCreaturesSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.PowerPredicate;
@ -49,6 +49,7 @@ import mage.filter.predicate.mageobject.PowerPredicate;
public class SneakyHomunculus extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures with power 2 or greater");
static {
filter.add(new PowerPredicate(Filter.ComparisonType.GreaterThan, 1));
}
@ -63,8 +64,12 @@ public class SneakyHomunculus extends CardImpl {
this.toughness = new MageInt(1);
// Sneaky Homunculus can't block or be blocked by creatures with power 2 or greater.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield));
ability.addEffect(new CantBlockCreaturesSourceEffect(filter));
Effect effect = new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield);
effect.setText("{this} can't block");
Ability ability = new SimpleEvasionAbility(effect);
effect = new CantBlockCreaturesSourceEffect(filter);
effect.setText("or be blocked by creatures with power 2 or greater");
ability.addEffect(effect);
this.addAbility(ability);
}

View file

@ -29,14 +29,13 @@ package mage.sets.onslaught;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -53,7 +52,7 @@ public class ElvenRiders extends CardImpl {
static {
filter.add(Predicates.not(Predicates.or(new SubtypePredicate("Wall"), new AbilityPredicate(FlyingAbility.class))));
}
public ElvenRiders(UUID ownerId) {
super(ownerId, 254, "Elven Riders", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.expansionSetCode = "ONS";
@ -63,7 +62,7 @@ public class ElvenRiders extends CardImpl {
this.toughness = new MageInt(3);
// Elven Riders can't be blocked except by Walls and/or creatures with flying.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public ElvenRiders(final ElvenRiders card) {

View file

@ -29,7 +29,7 @@ package mage.sets.planarchaos;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
@ -37,10 +37,8 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -56,10 +54,12 @@ public class BogSerpent extends CardImpl {
this.toughness = new MageInt(5);
// Bog Serpent can't attack unless defending player controls a Swamp.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Swamp","a Swamp"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Swamp", "a Swamp"))));
// When you control no Swamps, sacrifice Bog Serpent.
this.addAbility(new BogSerpentTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Swamp", "no Swamps"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public BogSerpent(final BogSerpent card) {
@ -71,35 +71,3 @@ public class BogSerpent extends CardImpl {
return new BogSerpent(this);
}
}
class BogSerpentTriggeredAbility extends StateTriggeredAbility {
public static final FilterLandPermanent filter = new FilterLandPermanent("Swamp");
{
filter.add(new SubtypePredicate("Swamp"));
}
public BogSerpentTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public BogSerpentTriggeredAbility(final BogSerpentTriggeredAbility ability) {
super(ability);
}
@Override
public BogSerpentTriggeredAbility copy() {
return new BogSerpentTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no swamps, sacrifice {this}.";
}
}

View file

@ -30,14 +30,13 @@ package mage.sets.ravnica;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.SacrificeControllerEffect;
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.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -52,7 +51,7 @@ public class VindictiveMob extends CardImpl {
static {
filter.add(new SubtypePredicate("Saproling"));
}
public VindictiveMob(UUID ownerId) {
super(ownerId, 112, "Vindictive Mob", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.expansionSetCode = "RAV";
@ -63,9 +62,9 @@ public class VindictiveMob extends CardImpl {
// When Vindictive Mob enters the battlefield, sacrifice a creature.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeControllerEffect(new FilterCreaturePermanent(), 1, null)));
// Vindictive Mob can't be blocked by Saprolings.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public VindictiveMob(final VindictiveMob card) {

View file

@ -29,15 +29,13 @@ package mage.sets.scourge;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesAllEffect;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -64,9 +62,7 @@ public class TreetopScout extends CardImpl {
this.toughness = new MageInt(1);
// Treetop Scout can't be blocked except by creatures with flying.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(onlyFlyingCreatures, Duration.WhileOnBattlefield)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(onlyFlyingCreatures, Duration.WhileOnBattlefield)));
}
public TreetopScout(final TreetopScout card) {

View file

@ -30,13 +30,12 @@ package mage.sets.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
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.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -62,7 +61,7 @@ public class BarrentonCragtreads extends CardImpl {
this.toughness = new MageInt(3);
// Barrenton Cragtreads can't be blocked by red creatures.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}

View file

@ -64,7 +64,7 @@ public class LureboundScarecrow extends CardImpl {
// As Lurebound Scarecrow enters the battlefield, choose a color.
this.addAbility(new AsEntersBattlefieldAbility(new LureboundScarecrowChooseColorEffect()));
// When you control no permanents of the chosen color, sacrifice Lurebound Scarecrow.
this.addAbility(new LureboundScarecrowTriggeredAbility());
}
@ -80,7 +80,7 @@ public class LureboundScarecrow extends CardImpl {
}
class LureboundScarecrowChooseColorEffect extends OneShotEffect {
public LureboundScarecrowChooseColorEffect() {
super(Outcome.BoostCreature);
staticText = "choose a color";
@ -110,11 +110,11 @@ class LureboundScarecrowChooseColorEffect extends OneShotEffect {
public LureboundScarecrowChooseColorEffect copy() {
return new LureboundScarecrowChooseColorEffect(this);
}
}
class LureboundScarecrowTriggeredAbility extends StateTriggeredAbility {
private static final String staticText = "When you control no permanents of the chosen color, sacrifice {this}.";
public LureboundScarecrowTriggeredAbility() {
@ -127,16 +127,17 @@ class LureboundScarecrowTriggeredAbility extends StateTriggeredAbility {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL
if (event.getType() == GameEvent.EventType.ZONE_CHANGE || event.getType() == GameEvent.EventType.LOST_CONTROL
|| event.getType() == GameEvent.EventType.COLOR_CHANGED
|| event.getType() == GameEvent.EventType.SPELL_CAST) {
Card card = game.getCard(this.getSourceId());
if (card != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(card.getId() + "_color");
if (color != null) {
for (Permanent perm: game.getBattlefield().getAllActivePermanents(controllerId)) {
if (perm.getColor(game).contains(color))
for (Permanent perm : game.getBattlefield().getAllActivePermanents(controllerId)) {
if (perm.getColor(game).contains(color)) {
return false;
}
}
return true;
}

View file

@ -30,13 +30,12 @@ package mage.sets.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
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.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
@ -45,9 +44,9 @@ import mage.filter.predicate.mageobject.ColorPredicate;
* @author jeffwadsworth
*/
public class WanderbrineRootcutters extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("green creatures");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
@ -61,8 +60,8 @@ public class WanderbrineRootcutters extends CardImpl {
this.toughness = new MageInt(3);
// Wanderbrine Rootcutters can't be blocked by green creatures.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public WanderbrineRootcutters(final WanderbrineRootcutters card) {

View file

@ -29,17 +29,14 @@ package mage.sets.tempestremastered;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter.ComparisonType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ToughnessPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -47,6 +44,12 @@ import mage.game.events.GameEvent;
*/
public class EndangeredArmodon extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with toughness 2 or less");
static {
filter.add(new ToughnessPredicate(Filter.ComparisonType.LessThan, 3));
}
public EndangeredArmodon(UUID ownerId) {
super(ownerId, 171, "Endangered Armodon", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}");
this.expansionSetCode = "TPR";
@ -55,7 +58,9 @@ public class EndangeredArmodon extends CardImpl {
this.toughness = new MageInt(5);
// When you control a creature with toughness 2 or less, sacrifice Endangered Armodon.
this.addAbility(new EndangeredArmodonStateTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
filter, Filter.ComparisonType.GreaterThan, 0,
new SacrificeSourceEffect()));
}
public EndangeredArmodon(final EndangeredArmodon card) {
@ -67,34 +72,3 @@ public class EndangeredArmodon extends CardImpl {
return new EndangeredArmodon(this);
}
}
class EndangeredArmodonStateTriggeredAbility extends StateTriggeredAbility {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with toughness 2 or less");
static {
filter.add(new ToughnessPredicate(ComparisonType.LessThan, 3));
}
EndangeredArmodonStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
EndangeredArmodonStateTriggeredAbility(final EndangeredArmodonStateTriggeredAbility ability) {
super(ability);
}
@Override
public EndangeredArmodonStateTriggeredAbility copy() {
return new EndangeredArmodonStateTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return game.getBattlefield().contains(filter, this.getControllerId(), game, 1);
}
@Override
public String getRule() {
return "When you control a creature with toughness 2 or less, sacrifice {this}.";
}
}

View file

@ -29,13 +29,12 @@ package mage.sets.thedark;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
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.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -50,7 +49,7 @@ public class BogRats extends CardImpl {
static {
filter.add(new SubtypePredicate("Wall"));
}
public BogRats(UUID ownerId) {
super(ownerId, 4, "Bog Rats", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{B}");
this.expansionSetCode = "DRK";
@ -60,7 +59,7 @@ public class BogRats extends CardImpl {
this.toughness = new MageInt(1);
// Bog Rats can't be blocked by Walls.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
}
public BogRats(final BogRats card) {

View file

@ -32,7 +32,7 @@ import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
@ -77,7 +77,7 @@ public class DaxosOfMeletis extends CardImpl {
this.toughness = new MageInt(2);
// Daxos of Meletis can't be blocked by creatures with power 3 or greater.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
// Whenever Daxos of Meletis deals combat damage to a player, exile the top card of that player's library. You gain life equal to that card's converted mana cost. Until end of turn, you may cast that card and you may spend mana as though it were mana of any color to cast it.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DaxosOfMeletisEffect(), false, true));

View file

@ -29,7 +29,7 @@ package mage.sets.timespiral;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.StateTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.SacrificeSourceEffect;
@ -39,10 +39,8 @@ import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -58,11 +56,13 @@ public class SlipstreamSerpent extends CardImpl {
this.toughness = new MageInt(6);
// Slipstream Serpent can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// When you control no Islands, sacrifice Slipstream Serpent.
this.addAbility(new SlipstreamSerpentTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
// Morph {5}{U}
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{5}{U}")));
}
@ -76,29 +76,3 @@ public class SlipstreamSerpent extends CardImpl {
return new SlipstreamSerpent(this);
}
}
class SlipstreamSerpentTriggeredAbility extends StateTriggeredAbility {
public SlipstreamSerpentTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public SlipstreamSerpentTriggeredAbility(final SlipstreamSerpentTriggeredAbility ability) {
super(ability);
}
@Override
public SlipstreamSerpentTriggeredAbility copy() {
return new SlipstreamSerpentTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}

View file

@ -29,14 +29,13 @@ package mage.sets.urzassaga;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
@ -62,9 +61,7 @@ public class TreetopRangers extends CardImpl {
this.toughness = new MageInt(2);
// Treetop Rangers can't be blocked except by creatures with flying.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD, new CantBeBlockedByCreaturesSourceEffect(onlyFlyingCreatures, Duration.WhileOnBattlefield)
));
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(onlyFlyingCreatures, Duration.WhileOnBattlefield)));
}
public TreetopRangers(final TreetopRangers card) {

View file

@ -27,6 +27,8 @@
*/
package mage.sets.vintagemasters;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.StateTriggeredAbility;
@ -49,14 +51,13 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import static mage.sets.vintagemasters.CityInABottle.getArabianNightsNamePredicates;
/**
*
* @author emerald000
*/
public class CityInABottle extends CardImpl {
private static final FilterCard filterCard = new FilterCard("cards originally printed in the Arabian Nights expansion");
public CityInABottle(UUID ownerId) {
super(ownerId, 265, "City in a Bottle", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT}, "{2}");
@ -64,7 +65,7 @@ public class CityInABottle extends CardImpl {
// Whenever a nontoken permanent originally printed in the Arabian Nights expansion other than City in a Bottle is on the battlefield, its controller sacrifices it.
this.addAbility(new CityInABottleStateTriggeredAbility());
// Players can't play cards originally printed in the Arabian Nights expansion.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CityInABottleCantPlayEffect()));
}
@ -77,92 +78,99 @@ public class CityInABottle extends CardImpl {
public CityInABottle copy() {
return new CityInABottle(this);
}
static public List<NamePredicate> getArabianNightsNamePredicates() {
List<NamePredicate> namePredicatesArabianNights = new ArrayList<>();
namePredicatesArabianNights.add(new NamePredicate("Abu Ja'far"));
namePredicatesArabianNights.add(new NamePredicate("Aladdin"));
namePredicatesArabianNights.add(new NamePredicate("Aladdin's Lamp"));
namePredicatesArabianNights.add(new NamePredicate("Aladdin's Ring"));
namePredicatesArabianNights.add(new NamePredicate("Ali Baba"));
namePredicatesArabianNights.add(new NamePredicate("Ali from Cairo"));
namePredicatesArabianNights.add(new NamePredicate("Army of Allah"));
namePredicatesArabianNights.add(new NamePredicate("Bazaar of Baghdad"));
namePredicatesArabianNights.add(new NamePredicate("Bird Maiden"));
namePredicatesArabianNights.add(new NamePredicate("Bottle of Suleiman"));
namePredicatesArabianNights.add(new NamePredicate("Brass Man"));
namePredicatesArabianNights.add(new NamePredicate("Camel"));
namePredicatesArabianNights.add(new NamePredicate("City of Brass"));
namePredicatesArabianNights.add(new NamePredicate("Cuombajj Witches"));
namePredicatesArabianNights.add(new NamePredicate("Cyclone"));
namePredicatesArabianNights.add(new NamePredicate("Dancing Scimitar"));
namePredicatesArabianNights.add(new NamePredicate("Dandân"));
namePredicatesArabianNights.add(new NamePredicate("Desert"));
namePredicatesArabianNights.add(new NamePredicate("Desert Nomads"));
namePredicatesArabianNights.add(new NamePredicate("Desert Twister"));
namePredicatesArabianNights.add(new NamePredicate("Diamond Valley"));
namePredicatesArabianNights.add(new NamePredicate("Drop of Honey"));
namePredicatesArabianNights.add(new NamePredicate("Ebony Horse"));
namePredicatesArabianNights.add(new NamePredicate("El-Hajjâj"));
namePredicatesArabianNights.add(new NamePredicate("Elephant Graveyard"));
namePredicatesArabianNights.add(new NamePredicate("Erg Raiders"));
namePredicatesArabianNights.add(new NamePredicate("Erhnam Djinn"));
namePredicatesArabianNights.add(new NamePredicate("Eye for an Eye"));
namePredicatesArabianNights.add(new NamePredicate("Fishliver Oil"));
namePredicatesArabianNights.add(new NamePredicate("Flying Carpet"));
namePredicatesArabianNights.add(new NamePredicate("Flying Men"));
namePredicatesArabianNights.add(new NamePredicate("Ghazbán Ogre"));
namePredicatesArabianNights.add(new NamePredicate("Giant Tortoise"));
namePredicatesArabianNights.add(new NamePredicate("Guardian Beast"));
namePredicatesArabianNights.add(new NamePredicate("Hasran Ogress"));
namePredicatesArabianNights.add(new NamePredicate("Hurr Jackal"));
namePredicatesArabianNights.add(new NamePredicate("Ifh-Bíff Efreet"));
namePredicatesArabianNights.add(new NamePredicate("Island Fish Jasconius"));
namePredicatesArabianNights.add(new NamePredicate("Island of Wak-Wak"));
namePredicatesArabianNights.add(new NamePredicate("Jandor's Ring"));
namePredicatesArabianNights.add(new NamePredicate("Jandor's Saddlebags"));
namePredicatesArabianNights.add(new NamePredicate("Jeweled Bird"));
namePredicatesArabianNights.add(new NamePredicate("Jihad"));
namePredicatesArabianNights.add(new NamePredicate("Junún Efreet"));
namePredicatesArabianNights.add(new NamePredicate("Juzám Djinn"));
namePredicatesArabianNights.add(new NamePredicate("Khabál Ghoul"));
namePredicatesArabianNights.add(new NamePredicate("King Suleiman"));
namePredicatesArabianNights.add(new NamePredicate("Kird Ape"));
namePredicatesArabianNights.add(new NamePredicate("Library of Alexandria"));
namePredicatesArabianNights.add(new NamePredicate("Magnetic Mountain"));
namePredicatesArabianNights.add(new NamePredicate("Merchant Ship"));
namePredicatesArabianNights.add(new NamePredicate("Metamorphosis"));
namePredicatesArabianNights.add(new NamePredicate("Mijae Djinn"));
namePredicatesArabianNights.add(new NamePredicate("Moorish Cavalry"));
namePredicatesArabianNights.add(new NamePredicate("Nafs Asp"));
namePredicatesArabianNights.add(new NamePredicate("Oasis"));
namePredicatesArabianNights.add(new NamePredicate("Old Man of the Sea"));
namePredicatesArabianNights.add(new NamePredicate("Oubliette"));
namePredicatesArabianNights.add(new NamePredicate("Piety"));
namePredicatesArabianNights.add(new NamePredicate("Pyramids"));
namePredicatesArabianNights.add(new NamePredicate("Repentant Blacksmith"));
namePredicatesArabianNights.add(new NamePredicate("Ring of Ma'rûf"));
namePredicatesArabianNights.add(new NamePredicate("Rukh Egg"));
namePredicatesArabianNights.add(new NamePredicate("Sandals of Abdallah"));
namePredicatesArabianNights.add(new NamePredicate("Sandstorm"));
namePredicatesArabianNights.add(new NamePredicate("Serendib Djinn"));
namePredicatesArabianNights.add(new NamePredicate("Serendib Efreet"));
namePredicatesArabianNights.add(new NamePredicate("Shahrazad"));
namePredicatesArabianNights.add(new NamePredicate("Sindbad"));
namePredicatesArabianNights.add(new NamePredicate("Singing Tree"));
namePredicatesArabianNights.add(new NamePredicate("Sorceress Queen"));
namePredicatesArabianNights.add(new NamePredicate("Stone-Throwing Devils"));
namePredicatesArabianNights.add(new NamePredicate("Unstable Mutation"));
namePredicatesArabianNights.add(new NamePredicate("War Elephant"));
namePredicatesArabianNights.add(new NamePredicate("Wyluli Wolf"));
namePredicatesArabianNights.add(new NamePredicate("Ydwen Efreet"));
return namePredicatesArabianNights;
}
}
class CityInABottleStateTriggeredAbility extends StateTriggeredAbility {
private static final FilterPermanent filter = new FilterPermanent("a nontoken permanent originally printed in the Arabian Nights expansion other than City in a Bottle");
static {
filter.add(Predicates.not(new TokenPredicate()));
filter.add(Predicates.or(
new NamePredicate("Abu Ja'far"),
new NamePredicate("Aladdin"),
new NamePredicate("Aladdin's Lamp"),
new NamePredicate("Aladdin's Ring"),
new NamePredicate("Ali Baba"),
new NamePredicate("Ali from Cairo"),
new NamePredicate("Army of Allah"),
new NamePredicate("Bazaar of Baghdad"),
new NamePredicate("Bird Maiden"),
new NamePredicate("Bottle of Suleiman"),
new NamePredicate("Brass Man"),
new NamePredicate("Camel"),
new NamePredicate("City of Brass"),
new NamePredicate("Cuombajj Witches"),
new NamePredicate("Cyclone"),
new NamePredicate("Dancing Scimitar"),
new NamePredicate("Dandân"),
new NamePredicate("Desert"),
new NamePredicate("Desert Nomads"),
new NamePredicate("Desert Twister"),
new NamePredicate("Diamond Valley"),
new NamePredicate("Drop of Honey"),
new NamePredicate("Ebony Horse"),
new NamePredicate("El-Hajjâj"),
new NamePredicate("Elephant Graveyard"),
new NamePredicate("Erg Raiders"),
new NamePredicate("Erhnam Djinn"),
new NamePredicate("Eye for an Eye"),
new NamePredicate("Fishliver Oil"),
new NamePredicate("Flying Carpet"),
new NamePredicate("Flying Men"),
new NamePredicate("Ghazbán Ogre"),
new NamePredicate("Giant Tortoise"),
new NamePredicate("Guardian Beast"),
new NamePredicate("Hasran Ogress"),
new NamePredicate("Hurr Jackal"),
new NamePredicate("Ifh-Bíff Efreet"),
new NamePredicate("Island Fish Jasconius"),
new NamePredicate("Island of Wak-Wak"),
new NamePredicate("Jandor's Ring"),
new NamePredicate("Jandor's Saddlebags"),
new NamePredicate("Jeweled Bird"),
new NamePredicate("Jihad"),
new NamePredicate("Junún Efreet"),
new NamePredicate("Juzám Djinn"),
new NamePredicate("Khabál Ghoul"),
new NamePredicate("King Suleiman"),
new NamePredicate("Kird Ape"),
new NamePredicate("Library of Alexandria"),
new NamePredicate("Magnetic Mountain"),
new NamePredicate("Merchant Ship"),
new NamePredicate("Metamorphosis"),
new NamePredicate("Mijae Djinn"),
new NamePredicate("Moorish Cavalry"),
new NamePredicate("Nafs Asp"),
new NamePredicate("Oasis"),
new NamePredicate("Old Man of the Sea"),
new NamePredicate("Oubliette"),
new NamePredicate("Piety"),
new NamePredicate("Pyramids"),
new NamePredicate("Repentant Blacksmith"),
new NamePredicate("Ring of Ma'rûf"),
new NamePredicate("Rukh Egg"),
new NamePredicate("Sandals of Abdallah"),
new NamePredicate("Sandstorm"),
new NamePredicate("Serendib Djinn"),
new NamePredicate("Serendib Efreet"),
new NamePredicate("Shahrazad"),
new NamePredicate("Sindbad"),
new NamePredicate("Singing Tree"),
new NamePredicate("Sorceress Queen"),
new NamePredicate("Stone-Throwing Devils"),
new NamePredicate("Unstable Mutation"),
new NamePredicate("War Elephant"),
new NamePredicate("Wyluli Wolf"),
new NamePredicate("Ydwen Efreet")));
filter.add(Predicates.or(getArabianNightsNamePredicates()));
}
CityInABottleStateTriggeredAbility() {
super(Zone.BATTLEFIELD, new CityInABottleSacrificeEffect());
}
@ -188,103 +196,28 @@ class CityInABottleStateTriggeredAbility extends StateTriggeredAbility {
}
class CityInABottleSacrificeEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("a nontoken permanent originally printed in the Arabian Nights expansion other than City in a Bottle");
static {
filter.add(Predicates.not(new TokenPredicate()));
filter.add(Predicates.or(
new NamePredicate("Abu Ja'far"),
new NamePredicate("Aladdin"),
new NamePredicate("Aladdin's Lamp"),
new NamePredicate("Aladdin's Ring"),
new NamePredicate("Ali Baba"),
new NamePredicate("Ali from Cairo"),
new NamePredicate("Army of Allah"),
new NamePredicate("Bazaar of Baghdad"),
new NamePredicate("Bird Maiden"),
new NamePredicate("Bottle of Suleiman"),
new NamePredicate("Brass Man"),
new NamePredicate("Camel"),
new NamePredicate("City of Brass"),
new NamePredicate("Cuombajj Witches"),
new NamePredicate("Cyclone"),
new NamePredicate("Dancing Scimitar"),
new NamePredicate("Dandân"),
new NamePredicate("Desert"),
new NamePredicate("Desert Nomads"),
new NamePredicate("Desert Twister"),
new NamePredicate("Diamond Valley"),
new NamePredicate("Drop of Honey"),
new NamePredicate("Ebony Horse"),
new NamePredicate("El-Hajjâj"),
new NamePredicate("Elephant Graveyard"),
new NamePredicate("Erg Raiders"),
new NamePredicate("Erhnam Djinn"),
new NamePredicate("Eye for an Eye"),
new NamePredicate("Fishliver Oil"),
new NamePredicate("Flying Carpet"),
new NamePredicate("Flying Men"),
new NamePredicate("Ghazbán Ogre"),
new NamePredicate("Giant Tortoise"),
new NamePredicate("Guardian Beast"),
new NamePredicate("Hasran Ogress"),
new NamePredicate("Hurr Jackal"),
new NamePredicate("Ifh-Bíff Efreet"),
new NamePredicate("Island Fish Jasconius"),
new NamePredicate("Island of Wak-Wak"),
new NamePredicate("Jandor's Ring"),
new NamePredicate("Jandor's Saddlebags"),
new NamePredicate("Jeweled Bird"),
new NamePredicate("Jihad"),
new NamePredicate("Junún Efreet"),
new NamePredicate("Juzám Djinn"),
new NamePredicate("Khabál Ghoul"),
new NamePredicate("King Suleiman"),
new NamePredicate("Kird Ape"),
new NamePredicate("Library of Alexandria"),
new NamePredicate("Magnetic Mountain"),
new NamePredicate("Merchant Ship"),
new NamePredicate("Metamorphosis"),
new NamePredicate("Mijae Djinn"),
new NamePredicate("Moorish Cavalry"),
new NamePredicate("Nafs Asp"),
new NamePredicate("Oasis"),
new NamePredicate("Old Man of the Sea"),
new NamePredicate("Oubliette"),
new NamePredicate("Piety"),
new NamePredicate("Pyramids"),
new NamePredicate("Repentant Blacksmith"),
new NamePredicate("Ring of Ma'rûf"),
new NamePredicate("Rukh Egg"),
new NamePredicate("Sandals of Abdallah"),
new NamePredicate("Sandstorm"),
new NamePredicate("Serendib Djinn"),
new NamePredicate("Serendib Efreet"),
new NamePredicate("Shahrazad"),
new NamePredicate("Sindbad"),
new NamePredicate("Singing Tree"),
new NamePredicate("Sorceress Queen"),
new NamePredicate("Stone-Throwing Devils"),
new NamePredicate("Unstable Mutation"),
new NamePredicate("War Elephant"),
new NamePredicate("Wyluli Wolf"),
new NamePredicate("Ydwen Efreet")));
filter.add(Predicates.or(getArabianNightsNamePredicates()));
}
CityInABottleSacrificeEffect() {
super(Outcome.Sacrifice);
this.staticText = "its controller sacrifices it";
}
CityInABottleSacrificeEffect(final CityInABottleSacrificeEffect effect) {
super(effect);
}
@Override
public CityInABottleSacrificeEffect copy() {
return new CityInABottleSacrificeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
@ -295,87 +228,11 @@ class CityInABottleSacrificeEffect extends OneShotEffect {
}
class CityInABottleCantPlayEffect extends ContinuousRuleModifyingEffectImpl {
private static final FilterCard filter = new FilterCard("cards originally printed in the Arabian Nights expansion");
static {
filter.add(Predicates.or(
new NamePredicate("Abu Ja'far"),
new NamePredicate("Aladdin"),
new NamePredicate("Aladdin's Lamp"),
new NamePredicate("Aladdin's Ring"),
new NamePredicate("Ali Baba"),
new NamePredicate("Ali from Cairo"),
new NamePredicate("Army of Allah"),
new NamePredicate("Bazaar of Baghdad"),
new NamePredicate("Bird Maiden"),
new NamePredicate("Bottle of Suleiman"),
new NamePredicate("Brass Man"),
new NamePredicate("Camel"),
new NamePredicate("City in a Bottle"),
new NamePredicate("City of Brass"),
new NamePredicate("Cuombajj Witches"),
new NamePredicate("Cyclone"),
new NamePredicate("Dancing Scimitar"),
new NamePredicate("Dandân"),
new NamePredicate("Desert"),
new NamePredicate("Desert Nomads"),
new NamePredicate("Desert Twister"),
new NamePredicate("Diamond Valley"),
new NamePredicate("Drop of Honey"),
new NamePredicate("Ebony Horse"),
new NamePredicate("El-Hajjâj"),
new NamePredicate("Elephant Graveyard"),
new NamePredicate("Erg Raiders"),
new NamePredicate("Erhnam Djinn"),
new NamePredicate("Eye for an Eye"),
new NamePredicate("Fishliver Oil"),
new NamePredicate("Flying Carpet"),
new NamePredicate("Flying Men"),
new NamePredicate("Ghazbán Ogre"),
new NamePredicate("Giant Tortoise"),
new NamePredicate("Guardian Beast"),
new NamePredicate("Hasran Ogress"),
new NamePredicate("Hurr Jackal"),
new NamePredicate("Ifh-Bíff Efreet"),
new NamePredicate("Island Fish Jasconius"),
new NamePredicate("Island of Wak-Wak"),
new NamePredicate("Jandor's Ring"),
new NamePredicate("Jandor's Saddlebags"),
new NamePredicate("Jeweled Bird"),
new NamePredicate("Jihad"),
new NamePredicate("Junún Efreet"),
new NamePredicate("Juzám Djinn"),
new NamePredicate("Khabál Ghoul"),
new NamePredicate("King Suleiman"),
new NamePredicate("Kird Ape"),
new NamePredicate("Library of Alexandria"),
new NamePredicate("Magnetic Mountain"),
new NamePredicate("Merchant Ship"),
new NamePredicate("Metamorphosis"),
new NamePredicate("Mijae Djinn"),
new NamePredicate("Moorish Cavalry"),
new NamePredicate("Nafs Asp"),
new NamePredicate("Oasis"),
new NamePredicate("Old Man of the Sea"),
new NamePredicate("Oubliette"),
new NamePredicate("Piety"),
new NamePredicate("Pyramids"),
new NamePredicate("Repentant Blacksmith"),
new NamePredicate("Ring of Ma'rûf"),
new NamePredicate("Rukh Egg"),
new NamePredicate("Sandals of Abdallah"),
new NamePredicate("Sandstorm"),
new NamePredicate("Serendib Djinn"),
new NamePredicate("Serendib Efreet"),
new NamePredicate("Shahrazad"),
new NamePredicate("Sindbad"),
new NamePredicate("Singing Tree"),
new NamePredicate("Sorceress Queen"),
new NamePredicate("Stone-Throwing Devils"),
new NamePredicate("Unstable Mutation"),
new NamePredicate("War Elephant"),
new NamePredicate("Wyluli Wolf"),
new NamePredicate("Ydwen Efreet")));
filter.add(Predicates.or(getArabianNightsNamePredicates()));
}
CityInABottleCantPlayEffect() {
@ -401,12 +258,12 @@ class CityInABottleCantPlayEffect extends ContinuousRuleModifyingEffectImpl {
public String getInfoMessage(Ability source, GameEvent event, Game game) {
return "You can't play cards originally printed in the Arabian Nights expansion";
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PLAY_LAND || event.getType() == EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Card card = game.getCard(event.getSourceId());

View file

@ -29,23 +29,23 @@ package mage.sets.weatherlight;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.StateTriggeredAbility;
import mage.ObjectColor;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleEvasionAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
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.constants.Zone;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
/**
*
@ -53,6 +53,12 @@ import mage.game.permanent.Permanent;
*/
public class MantaRay extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("except by blue creatures");
static {
filter.add(Predicates.not(new ColorPredicate(ObjectColor.BLUE)));
}
public MantaRay(UUID ownerId) {
super(ownerId, 42, "Manta Ray", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
this.expansionSetCode = "WTH";
@ -61,13 +67,16 @@ public class MantaRay extends CardImpl {
this.toughness = new MageInt(3);
// Manta Ray can't attack unless defending player controls an Island.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island", "an Island"))));
// Manta Ray can't be blocked except by blue creatures.
this.addAbility(MantaRayAbility.getInstance());
this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield)));
// When you control no Islands, sacrifice Manta Ray.
this.addAbility(new MantaRayTriggeredAbility());
this.addAbility(new ControlsPermanentsControllerTriggeredAbility(
new FilterLandPermanent("Island", "no Islands"), Filter.ComparisonType.Equal, 0,
new SacrificeSourceEffect()));
}
public MantaRay(final MantaRay card) {
@ -79,87 +88,3 @@ public class MantaRay extends CardImpl {
return new MantaRay(this);
}
}
class MantaRayTriggeredAbility extends StateTriggeredAbility {
public MantaRayTriggeredAbility() {
super(Zone.BATTLEFIELD, new SacrificeSourceEffect());
}
public MantaRayTriggeredAbility(final MantaRayTriggeredAbility ability) {
super(ability);
}
@Override
public MantaRayTriggeredAbility copy() {
return new MantaRayTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return (game.getBattlefield().countAll(ControllerControlsIslandPredicate.filter, controllerId, game) == 0);
}
@Override
public String getRule() {
return "When you control no islands, sacrifice {this}.";
}
}
class MantaRayAbility extends EvasionAbility {
private static MantaRayAbility instance;
public static MantaRayAbility getInstance() {
if (instance == null) {
instance = new MantaRayAbility();
}
return instance;
}
private MantaRayAbility() {
this.addEffect(new MantaRayEffect());
}
@Override
public String getRule() {
return "{this} can't be blocked except by blue creatures.";
}
@Override
public MantaRayAbility copy() {
return getInstance();
}
}
class MantaRayEffect extends RestrictionEffect {
public MantaRayEffect() {
super(Duration.WhileOnBattlefield);
}
public MantaRayEffect(final MantaRayEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getAbilities().containsKey(MantaRayAbility.getInstance().getId())) {
return true;
}
return false;
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
if (blocker.getColor(game).isBlue()) {
return true;
}
return false;
}
@Override
public MantaRayEffect copy() {
return new MantaRayEffect(this);
}
}

View file

@ -0,0 +1,96 @@
/*
* 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.StateTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.filter.Filter.ComparisonType;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* State triggered ability that triggers if the ability controller controlls the
* defined number of permanents.
*
* @author LevelX2
*/
public class ControlsPermanentsControllerTriggeredAbility extends StateTriggeredAbility {
protected final FilterPermanent filter;
protected final ComparisonType type;
protected final int value;
public ControlsPermanentsControllerTriggeredAbility(FilterPermanent filter, ComparisonType type, int value, Effect effect) {
super(Zone.BATTLEFIELD, effect);
this.filter = filter;
this.value = value;
this.type = type;
}
public ControlsPermanentsControllerTriggeredAbility(final ControlsPermanentsControllerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.type = ability.type;
this.value = ability.value;
}
@Override
public ControlsPermanentsControllerTriggeredAbility copy() {
return new ControlsPermanentsControllerTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int inputValue = game.getBattlefield().countAll(filter, getControllerId(), game);
switch (type) {
case Equal:
if (inputValue != value) {
return false;
}
break;
case GreaterThan:
if (inputValue <= value) {
return false;
}
break;
case LessThan:
if (inputValue >= value) {
return false;
}
break;
}
return true;
}
@Override
public String getRule() {
return "When you control " + filter.getMessage() + ", " + super.getRule();
}
}