* Added static Goblins filter.

This commit is contained in:
LevelX2 2016-12-28 11:32:29 +01:00
parent 09ad644a72
commit d3c2c33b44
10 changed files with 77 additions and 101 deletions

View file

@ -28,7 +28,6 @@
package mage.cards.d;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -36,10 +35,15 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import static mage.constants.Layer.ColorChangingEffects_5;
import static mage.constants.Layer.TypeChangingEffects_4;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -49,17 +53,11 @@ import mage.game.permanent.Permanent;
*/
public class DralnusCrusade extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public DralnusCrusade(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{R}");
// Goblin creatures get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, false)));
// All Goblins are black and are Zombies in addition to their other creature types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DralnusCrusadeEffect()));
@ -77,12 +75,6 @@ public class DralnusCrusade extends CardImpl {
class DralnusCrusadeEffect extends ContinuousEffectImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public DralnusCrusadeEffect() {
super(Duration.WhileOnBattlefield, Outcome.Neutral);
staticText = "All Goblins are black and are Zombies in addition to their other creature types";
@ -90,10 +82,10 @@ class DralnusCrusadeEffect extends ContinuousEffectImpl {
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for(Permanent permanent : game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, source.getControllerId(), source.getSourceId(), game)) {
switch (layer) {
case TypeChangingEffects_4:
if(!permanent.hasSubtype("Zombie", game)) {
if (!permanent.getSubtype(game).contains("Zombie")) {
permanent.getSubtype(game).add("Zombie");
}
break;

View file

@ -38,8 +38,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.StaticFilters;
import mage.game.permanent.token.GoblinTokenWithHaste;
import mage.watchers.common.AttackedThisTurnWatcher;
@ -49,20 +48,14 @@ import mage.watchers.common.AttackedThisTurnWatcher;
*/
public class GoblinAssault extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GoblinAssault(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
// At the beginning of your upkeep, create a 1/1 red Goblin creature token with haste.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new GoblinTokenWithHaste()), TargetController.YOU, false));
// Goblin creatures attack each turn if able.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(filter, Duration.WhileOnBattlefield)), new AttackedThisTurnWatcher());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AttacksIfAbleAllEffect(StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, Duration.WhileOnBattlefield)), new AttackedThisTurnWatcher());
}
public GoblinAssault(final GoblinAssault card) {

View file

@ -42,7 +42,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
@ -54,10 +54,8 @@ import mage.target.common.TargetLandPermanent;
*/
public class GoblinCaves extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin", "Goblin creatures");
public GoblinCaves(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}");
this.subtype.add("Aura");
// Enchant land
@ -67,7 +65,7 @@ public class GoblinCaves extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
// As long as enchanted land is a basic Mountain, Goblin creatures get +0/+2.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinuousEffect(
new BoostAllEffect(0, 2, Duration.WhileOnBattlefield, filter, false),
new BoostAllEffect(0, 2, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, false),
new AttachedToBasicMountainCondition(),
"As long as enchanted land is a basic Mountain, Goblin creatures get +0/+2"
)));
@ -98,4 +96,4 @@ class AttachedToBasicMountainCondition implements Condition {
}
return false;
}
}
}

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,27 +20,27 @@
* 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.cards.g;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
/**
*
@ -48,22 +48,23 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class GoblinChieftain extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GoblinChieftain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}");
this.subtype.add("Goblin");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Haste (This creature can attack and as soon as it comes under your control.)
this.addAbility(HasteAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, filter, true)));
// Other Goblin creatures you control get +1/+1 and have haste.
Effect effect = new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, true);
effect.setText("Other Goblin creatures you control get +1/+1");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
effect = new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, true);
effect.setText("and have haste");
this.addAbility(ability);
}
public GoblinChieftain(final GoblinChieftain card) {

View file

@ -35,8 +35,7 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.StaticFilters;
/**
*
@ -44,14 +43,8 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
*/
public class GoblinGeneral extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GoblinGeneral(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}");
this.subtype.add("Goblin");
this.subtype.add("Warrior");
@ -59,7 +52,7 @@ public class GoblinGeneral extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Goblin General attacks, Goblin creatures you control get +1/+1 until end of turn.
this.addAbility(new AttacksTriggeredAbility(new BoostControlledEffect(1, 1, Duration.EndOfTurn, filter, false), false));
this.addAbility(new AttacksTriggeredAbility(new BoostControlledEffect(1, 1, Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, false), false));
}
public GoblinGeneral(final GoblinGeneral card) {

View file

@ -28,39 +28,39 @@
package mage.cards.g;
import java.util.UUID;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.MountainwalkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.StaticFilters;
/**
* @author Loki
*/
public class GoblinKing extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Goblin creatures");
static {
filter.add(new SubtypePredicate("Goblin"));
}
public GoblinKing(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}");
this.subtype.add("Goblin");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new MountainwalkAbility(), Duration.WhileOnBattlefield, filter, true)));
// Other Goblin creatures get +1/+1 and have mountainwalk.
Effect effect = new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, true);
effect.setText("Other Goblin creatures you control get +1/+1");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
effect = new GainAbilityAllEffect(new MountainwalkAbility(), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, true);
effect.setText("and have mountainwalk");
this.addAbility(ability);
}
public GoblinKing(final GoblinKing card) {

View file

@ -39,8 +39,8 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetControlledPermanent;
@ -49,22 +49,21 @@ import mage.target.common.TargetControlledPermanent;
* @author fireshoes
*/
public class GoblinLookout extends CardImpl {
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("Goblin creatures");
private static final FilterControlledPermanent filterPermanent = new FilterControlledPermanent("a Goblin");
static {
filterCreature.add(new SubtypePredicate("Goblin"));
filterPermanent.add(new SubtypePredicate("Goblin"));
}
public GoblinLookout(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add("Goblin");
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {tap}, Sacrifice a Goblin: Goblin creatures get +2/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(2, 0, Duration.EndOfTurn, filterCreature, false), new TapSourceCost());
// {T}, Sacrifice a Goblin: Goblin creatures get +2/+0 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(2, 0, Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, false), new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filterPermanent)));
this.addAbility(ability);
}

View file

@ -39,7 +39,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
@ -47,16 +47,15 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
* @author emerald000
*/
public class GoblinPyromancer extends CardImpl {
private static final FilterCreaturePermanent filterCreature = new FilterCreaturePermanent("Goblin creatures");
private static final FilterPermanent filterPermanent = new FilterPermanent("Goblins");
static {
filterCreature.add(new SubtypePredicate("Goblin"));
filterPermanent.add(new SubtypePredicate("Goblin"));
}
public GoblinPyromancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add("Goblin");
this.subtype.add("Wizard");
@ -64,8 +63,8 @@ public class GoblinPyromancer extends CardImpl {
this.toughness = new MageInt(2);
// When Goblin Pyromancer enters the battlefield, Goblin creatures get +3/+0 until end of turn.
this.addAbility(new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(3, 0, Duration.EndOfTurn, filterCreature)));
this.addAbility(new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(3, 0, Duration.EndOfTurn, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS)));
// At the beginning of the end step, destroy all Goblins.
this.addAbility(new BeginningOfEndStepTriggeredAbility(new DestroyAllEffect(filterPermanent, false), TargetController.ANY, false));
}

View file

@ -27,7 +27,7 @@
*/
package mage.cards.m;
import mage.constants.CardType;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -37,13 +37,13 @@ import mage.abilities.effects.common.RegenerateTargetEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import java.util.UUID;
import mage.target.common.TargetCreaturePermanent;
/**
@ -53,16 +53,14 @@ import mage.target.common.TargetCreaturePermanent;
public class MadAuntie extends CardImpl {
private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("another target Goblin");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Goblin creatures");
static {
filter1.add(new SubtypePredicate("Goblin"));
filter1.add(new AnotherPredicate());
filter2.add(new SubtypePredicate("Goblin"));
}
public MadAuntie(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add("Goblin");
this.subtype.add("Shaman");
@ -70,7 +68,7 @@ public class MadAuntie extends CardImpl {
this.toughness = new MageInt(2);
// Other Goblin creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter2, true)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURE_GOBLINS, true)));
// {T}: Regenerate another target Goblin.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateTargetEffect(), new TapSourceCost());

View file

@ -10,6 +10,7 @@ import mage.filter.common.FilterArtifactCard;
import mage.filter.common.FilterArtifactCreaturePermanent;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -28,6 +29,8 @@ public class StaticFilters {
public static final FilterNonlandCard FILTER_CARD_NON_LAND = new FilterNonlandCard();
public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card");
public static final FilterCreaturePermanent FILTER_PERMANENT_CREATURE_GOBLINS = new FilterCreaturePermanent("Goblin", "Goblin creatures");
static {
FILTER_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),