added new class for "this or another" triggered abilities

This commit is contained in:
Evan Kranzler 2020-06-25 20:14:48 -04:00
parent 6c69939c0d
commit a379a06485
32 changed files with 389 additions and 672 deletions

View file

@ -4,7 +4,7 @@ package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.costs.common.PayEnergyCost;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.TapTargetEffect;
@ -16,11 +16,11 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import mage.filter.predicate.permanent.DefendingPlayerControlsPredicate;
import mage.target.TargetPermanent;
import java.util.UUID;
@ -29,6 +29,13 @@ import java.util.UUID;
*/
public final class AetherstormRoc extends CardImpl {
private static final FilterPermanent filter
= new FilterCreaturePermanent("creature defending player controls");
static {
filter.add(DefendingPlayerControlsPredicate.instance);
}
public AetherstormRoc(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{W}");
this.subtype.add(SubType.BIRD);
@ -37,21 +44,24 @@ public final class AetherstormRoc extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Aetherstorm Roc or another creature enters the battlefield under your control, you get {E}.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new GetEnergyCountersControllerEffect(1), new FilterCreaturePermanent("{this} or another creature")));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new GetEnergyCountersControllerEffect(1),
StaticFilters.FILTER_PERMANENT_CREATURE, false, true
));
// Whenever Aetherstorm Roc attacks, you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.
DoIfCostPaid doIfCostPaidEffect = new DoIfCostPaid(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new PayEnergyCost(2));
doIfCostPaidEffect.addEffect(new TapTargetEffect());
Ability ability = new AttacksTriggeredAbility(doIfCostPaidEffect, false,
"Whenever {this} attacks you may pay {E}{E}. If you do, put a +1/+1 counter on it and tap up to one target creature defending player controls.");
ability.addTarget(new TargetCreaturePermanent(0, 1, new FilterCreaturePermanent("creature defending player controls"), false));
ability.setTargetAdjuster(AetherstormRocAdjuster.instance);
Ability ability = new AttacksTriggeredAbility(new DoIfCostPaid(
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
.setText("put a +1/+1 counter on it"),
new PayEnergyCost(2)
).addEffect(new TapTargetEffect().concatBy("and")), false);
ability.addTarget(new TargetPermanent(0, 1, filter, false));
this.addAbility(ability);
}
public AetherstormRoc(final AetherstormRoc card) {
private AetherstormRoc(final AetherstormRoc card) {
super(card);
}
@ -61,17 +71,3 @@ public final class AetherstormRoc extends CardImpl {
return new AetherstormRoc(this);
}
}
enum AetherstormRocAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
filter.add(new ControllerIdPredicate(defenderId));
TargetCreaturePermanent target = new TargetCreaturePermanent(0, 1, filter, false);
ability.addTarget(target);
}
}

View file

@ -1,25 +1,20 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.DashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class AmbuscadeShaman extends CardImpl {
@ -32,16 +27,18 @@ public final class AmbuscadeShaman extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Ambuscade Shaman or another creature enters the battlefield under your control, that creature gets +2/+2 until end of turn.
Effect effect = new BoostTargetEffect(2, 2, Duration.EndOfTurn);
effect.setText("that creature gets +2/+2 until end of turn");
this.addAbility(new AmbuscadeShamanTriggeredAbility(effect));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new BoostTargetEffect(2, 2, Duration.EndOfTurn)
.setText("that creature gets +2/+2 until end of turn"),
StaticFilters.FILTER_PERMANENT_CREATURE, false,
SetTargetPointer.PERMANENT, true
));
// Dash {3}{B} <i>(You may cast this spell for its dash cost. If you do, it gains haste, and it's returned from the battlefield to its owner's hand at the beginning of the next end step.)</i>);
this.addAbility(new DashAbility(this, "{3}{B}"));
}
public AmbuscadeShaman(final AmbuscadeShaman card) {
private AmbuscadeShaman(final AmbuscadeShaman card) {
super(card);
}
@ -50,41 +47,3 @@ public final class AmbuscadeShaman extends CardImpl {
return new AmbuscadeShaman(this);
}
}
class AmbuscadeShamanTriggeredAbility extends TriggeredAbilityImpl {
AmbuscadeShamanTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
AmbuscadeShamanTriggeredAbility(final AmbuscadeShamanTriggeredAbility ability) {
super(ability);
}
@Override
public AmbuscadeShamanTriggeredAbility copy() {
return new AmbuscadeShamanTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (permanent.isControlledBy(this.controllerId)
&& permanent.isCreature()) {
this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another creature enters the battlefield under your control, that creature gets +2/+2 until end of turn.";
}
}

View file

@ -1,18 +1,22 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
@ -21,6 +25,12 @@ import java.util.UUID;
*/
public final class ArchonOfRedemption extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("creature with flying");
static {
filter.add(new AbilityPredicate(FlyingAbility.class));
}
public ArchonOfRedemption(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.subtype.add(SubType.ARCHON);
@ -29,11 +39,14 @@ public final class ArchonOfRedemption extends CardImpl {
this.toughness = new MageInt(4);
this.addAbility(FlyingAbility.getInstance());
// Whenever Archon of Redemption or another creature with flying enters the battlefield under your control, you may gain life equal to that creature's power.
this.addAbility(new ArchonOfRedemptionTriggeredAbility());
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new ArchonOfRedemptionEffect(), filter, true, SetTargetPointer.PERMANENT, true
));
}
public ArchonOfRedemption(final ArchonOfRedemption card) {
private ArchonOfRedemption(final ArchonOfRedemption card) {
super(card);
}
@ -43,43 +56,29 @@ public final class ArchonOfRedemption extends CardImpl {
}
}
class ArchonOfRedemptionTriggeredAbility extends TriggeredAbilityImpl {
class ArchonOfRedemptionEffect extends OneShotEffect {
ArchonOfRedemptionTriggeredAbility() {
super(Zone.BATTLEFIELD, null, true);
ArchonOfRedemptionEffect() {
super(Outcome.Benefit);
staticText = "gain life equal to that creature's power";
}
ArchonOfRedemptionTriggeredAbility(final ArchonOfRedemptionTriggeredAbility ability) {
super(ability);
private ArchonOfRedemptionEffect(final ArchonOfRedemptionEffect effect) {
super(effect);
}
@Override
public ArchonOfRedemptionTriggeredAbility copy() {
return new ArchonOfRedemptionTriggeredAbility(this);
public ArchonOfRedemptionEffect copy() {
return new ArchonOfRedemptionEffect(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null
&& permanent.isControlledBy(getControllerId())
&& permanent.isCreature()
&& (permanent.getId().equals(getSourceId())
|| (permanent.getAbilities().contains(FlyingAbility.getInstance())))) {
this.getEffects().clear();
this.addEffect(new GainLifeEffect(permanent.getPower().getValue()));
return true;
}
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (player == null || permanent == null) {
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another creature with flying enters the battlefield under your control, you may gain life equal to that creature's power.";
return player.gainLife(permanent.getPower().getValue(), game, source) > 0;
}
}

View file

@ -3,7 +3,7 @@ package mage.cards.a;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
@ -20,10 +20,10 @@ import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
* @author TheElk801
@ -31,7 +31,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
public final class AyaraFirstOfLocthwain extends CardImpl {
private static final FilterPermanent filter
= new FilterCreaturePermanent("{this} or another black creature");
= new FilterCreaturePermanent("black creature");
private static final FilterControlledPermanent filter2
= new FilterControlledCreaturePermanent("another black creature");
@ -51,7 +51,9 @@ public final class AyaraFirstOfLocthwain extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Ayara, First of Locthwain or another black creature enters the battlefield under your control, each opponent loses 1 life and you gain 1 life.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(new LoseLifeOpponentsEffect(1), filter);
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new LoseLifeOpponentsEffect(1), filter, false, true
);
ability.addEffect(new GainLifeEffect(1).concatBy("and"));
this.addAbility(ability);

View file

@ -1,8 +1,8 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
@ -33,8 +33,8 @@ public final class FieldOfTheDead extends CardImpl {
// Whenever Field of the Dead or another land enters the battlefield under your control, if you control seven or more lands with different names, create a 2/2 black Zombie creature token.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldControlledTriggeredAbility(
new CreateTokenEffect(new ZombieToken()), StaticFilters.FILTER_LAND
new EntersBattlefieldThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new ZombieToken()), StaticFilters.FILTER_LAND, false, true
), FieldOfTheDeadCondition.instance, "Whenever {this} or another land " +
"enters the battlefield under your control, if you control seven or more lands with different names, " +
"create a 2/2 black Zombie creature token."

View file

@ -73,7 +73,7 @@ class FlayerTriggeredAbility extends TriggeredAbilityImpl {
if (permanent != null
&& ((EntersTheBattlefieldEvent) event).getFromZone() == Zone.GRAVEYARD
&& permanent.isOwnedBy(controllerId)
&& permanent.isCreature()) {
&& (permanent.isCreature() || permanent.getId().equals(getSourceId()))) {
Effect effect = this.getEffects().get(0);
effect.setValue("damageSource", event.getTargetId());
return true;

View file

@ -2,7 +2,7 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
@ -32,7 +32,7 @@ public final class GeneralKudroOfDrannith extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent(SubType.HUMAN, "Humans");
private static final FilterPermanent filter2
= new FilterPermanent(SubType.HUMAN, "{this} or another Human");
= new FilterPermanent(SubType.HUMAN, "Human");
private static final FilterCard filter3
= new FilterCard("card from an opponent's graveyard");
private static final FilterControlledPermanent filter4
@ -59,7 +59,7 @@ public final class GeneralKudroOfDrannith extends CardImpl {
)));
// Whenever General Kudro of Drannith or another Human enters the battlefield under your control, exile target card from an opponent's graveyard.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(new ExileTargetEffect(), filter2);
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(new ExileTargetEffect(), filter2, false, true);
ability.addTarget(new TargetCardInOpponentsGraveyard(filter3));
this.addAbility(ability);

View file

@ -1,31 +1,31 @@
package mage.cards.g;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author BursegSardaukar
*/
public final class GoblinAssassin extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.GOBLIN, "Goblin");
public GoblinAssassin(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.subtype.add(SubType.GOBLIN);
@ -35,10 +35,10 @@ public final class GoblinAssassin extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Goblin Assassin or another Goblin enters the battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.
this.addAbility(new GoblinAssassinTriggeredAbiliy());
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new GoblinAssassinTriggeredEffect(), filter));
}
public GoblinAssassin(final GoblinAssassin card) {
private GoblinAssassin(final GoblinAssassin card) {
super(card);
}
@ -48,47 +48,13 @@ public final class GoblinAssassin extends CardImpl {
}
}
class GoblinAssassinTriggeredAbiliy extends TriggeredAbilityImpl {
GoblinAssassinTriggeredAbiliy() {
super(Zone.BATTLEFIELD, new GoblinAssassinTriggeredEffect(), false);
}
GoblinAssassinTriggeredAbiliy(final GoblinAssassinTriggeredAbiliy ability) {
super(ability);
}
@Override
public GoblinAssassinTriggeredAbiliy copy() {
return new GoblinAssassinTriggeredAbiliy(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if ((targetId.equals(this.getSourceId())) || (permanent.hasSubtype(SubType.GOBLIN, game) && !targetId.equals(this.getSourceId()))) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another Goblin enters battlefield, each player flips a coin. Each player whose coin comes up tails sacrifices a creature.";
}
}
class GoblinAssassinTriggeredEffect extends OneShotEffect {
GoblinAssassinTriggeredEffect() {
super(Outcome.Sacrifice);
}
GoblinAssassinTriggeredEffect(final GoblinAssassinTriggeredEffect effect) {
private GoblinAssassinTriggeredEffect(final GoblinAssassinTriggeredEffect effect) {
super(effect);
}

View file

@ -1,9 +1,8 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileSourceCost;
import mage.abilities.costs.common.PayEnergyCost;
@ -13,37 +12,33 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class GontisAetherHeart extends CardImpl {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent("{this} or another artifact");
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public GontisAetherHeart(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
addSuperType(SuperType.LEGENDARY);
// Whenever Gonti's Aether Heart or another artifact enters the battlefield under your control, you get {E}{E} <i>(two energy counters).
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new GetEnergyCountersControllerEffect(2), filter, false));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new GetEnergyCountersControllerEffect(2),
StaticFilters.FILTER_PERMANENT_ARTIFACT, false, true
));
// Pay {E}{E}{E}{E}{E}{E}{E}{E}, Exile Gonti's Aether Heart: Take an extra turn after this one.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddExtraTurnControllerEffect(), new PayEnergyCost(8));
Ability ability = new SimpleActivatedAbility(new AddExtraTurnControllerEffect(), new PayEnergyCost(8));
ability.addCost(new ExileSourceCost());
this.addAbility(ability);
}
public GontisAetherHeart(final GontisAetherHeart card) {
private GontisAetherHeart(final GontisAetherHeart card) {
super(card);
}

View file

@ -20,6 +20,7 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponentsCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
/**
@ -28,12 +29,6 @@ import mage.target.targetpointer.FixedTarget;
*/
public final class GruulRagebeast extends CardImpl {
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature an opponent controls");
static {
filter2.add(TargetController.OPPONENT.getControllerPredicate());
}
public GruulRagebeast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{R}{G}");
this.subtype.add(SubType.BEAST);
@ -42,10 +37,7 @@ public final class GruulRagebeast extends CardImpl {
this.toughness = new MageInt(6);
// Whenever Gruul Ragebeast or another creature enters the battlefield under your control, that creature fights target creature an opponent controls.
Ability ability = new GruulRagebeastTriggeredAbility();
ability.addTarget(new TargetCreaturePermanent(filter2));
this.addAbility(ability);
this.addAbility(new GruulRagebeastTriggeredAbility());
}
public GruulRagebeast(final GruulRagebeast card) {
@ -61,10 +53,10 @@ public final class GruulRagebeast extends CardImpl {
class GruulRagebeastTriggeredAbility extends TriggeredAbilityImpl {
GruulRagebeastTriggeredAbility() {
super(Zone.BATTLEFIELD, new GruulRagebeastEffect(), false);
super(Zone.BATTLEFIELD, new GruulRagebeastEffect(), false);this.addTarget(new TargetOpponentsCreaturePermanent());
}
GruulRagebeastTriggeredAbility(final GruulRagebeastTriggeredAbility ability) {
private GruulRagebeastTriggeredAbility(final GruulRagebeastTriggeredAbility ability) {
super(ability);
}
@ -106,7 +98,7 @@ class GruulRagebeastEffect extends OneShotEffect {
super(Outcome.Damage);
}
GruulRagebeastEffect(final GruulRagebeastEffect effect) {
private GruulRagebeastEffect(final GruulRagebeastEffect effect) {
super(effect);
}

View file

@ -1,9 +1,8 @@
package mage.cards.h;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.Effect;
@ -14,34 +13,29 @@ import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.common.FilterEquipmentPermanent;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author Saga
*/
public final class HammerOfNazahn extends CardImpl {
private static final FilterEquipmentPermanent filter = new FilterEquipmentPermanent("{this} or another Equipment");
public HammerOfNazahn(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.EQUIPMENT);
// Whenever Hammer of Nazahn or another Equipment enters the battlefiend under your control, you may attach that Equipment to target creature you control.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new HammerOfNazahnEffect(), filter, true, SetTargetPointer.PERMANENT, "");
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new HammerOfNazahnEffect(), StaticFilters.FILTER_PERMANENT_EQUIPMENT, true, SetTargetPointer.PERMANENT, true
);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);

View file

@ -1,35 +1,24 @@
package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class KapshoKitefins extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another creature");
private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filterTarget.add(TargetController.OPPONENT.getControllerPredicate());
}
public KapshoKitefins(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
this.subtype.add(SubType.FISH);
@ -40,14 +29,16 @@ public final class KapshoKitefins extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Kapsho Kitefins or another creature enters the battlefield under your control, tap target creature an opponent controls.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new TapTargetEffect(), filter, false);
ability.addTarget(new TargetCreaturePermanent(filterTarget));
this.addAbility(ability);
// Whenever Kapsho Kitefins or another creature enters the battlefield under your control, tap target creature an opponent controls.
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new TapTargetEffect(), StaticFilters.FILTER_PERMANENT_CREATURE, false, true
);
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
}
public KapshoKitefins(final KapshoKitefins card) {
private KapshoKitefins(final KapshoKitefins card) {
super(card);
}

View file

@ -1,31 +1,28 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class MarduWoeReaper extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.WARRIOR, "Warrior");
public MarduWoeReaper(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
this.subtype.add(SubType.HUMAN);
@ -34,12 +31,16 @@ public final class MarduWoeReaper extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Mardu Woe-Reaper or another Warrior enters the battlefield under your control, you may exile target creature card from a graveyard. If you do, you gain 1 life.
Ability ability = new MarduWoeReaperTriggeredAbility();
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card from a graveyard")));
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new ExileTargetEffect("exile target creature card from a graveyard.")
, filter, true, true
);
ability.addEffect(new GainLifeEffect(1).concatBy("If you do,"));
ability.addTarget(new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE));
this.addAbility(ability);
}
public MarduWoeReaper(final MarduWoeReaper card) {
private MarduWoeReaper(final MarduWoeReaper card) {
super(card);
}
@ -48,70 +49,3 @@ public final class MarduWoeReaper extends CardImpl {
return new MarduWoeReaper(this);
}
}
class MarduWoeReaperTriggeredAbility extends TriggeredAbilityImpl {
MarduWoeReaperTriggeredAbility() {
super(Zone.BATTLEFIELD, new MarduWoeReaperEffect(), true);
}
MarduWoeReaperTriggeredAbility(final MarduWoeReaperTriggeredAbility ability) {
super(ability);
}
@Override
public MarduWoeReaperTriggeredAbility copy() {
return new MarduWoeReaperTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && (permanent.getId().equals(this.getSourceId()) || permanent.hasSubtype(SubType.WARRIOR, game))) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another Warrior enters the battlefield under your control, " + super.getRule();
}
}
class MarduWoeReaperEffect extends OneShotEffect {
MarduWoeReaperEffect() {
super(Outcome.GainLife);
this.staticText = "you may exile target creature card from a graveyard. If you do, you gain 1 life";
}
MarduWoeReaperEffect(final MarduWoeReaperEffect effect) {
super(effect);
}
@Override
public MarduWoeReaperEffect copy() {
return new MarduWoeReaperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
if (player != null && card != null) {
if (player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true)) {
player.gainLife(1, game, source);
}
return true;
}
return false;
}
}

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.costs.common.SacrificeSourceCost;
@ -27,7 +27,7 @@ import java.util.UUID;
public final class MaritLagesSlumber extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledPermanent("{this} or another snow permanent");
= new FilterControlledPermanent("snow permanent");
static {
filter.add(SuperType.SNOW.getPredicate());
@ -43,7 +43,9 @@ public final class MaritLagesSlumber extends CardImpl {
this.addSuperType(SuperType.SNOW);
// Whenever Marit Lage's Slumber or another snow permanent enters the battlefield under your control, scry 1.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new ScryEffect(1), filter));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new ScryEffect(1), filter, false, true
));
// At the beginning of your upkeep, if you control ten or more snow permanents, sacrifice Marit Lage's Slumber. If you do, create Marit Lage, a legendary 20/20 black Avatar creature token with flying and indestructible.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(

View file

@ -1,10 +1,9 @@
package mage.cards.n;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.TapTargetEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.FlyingAbility;
@ -12,25 +11,17 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.filter.FilterPermanent;
import mage.target.common.TargetOpponentsCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class NebelgastHerald extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another Spirit");
private static final FilterCreaturePermanent filterTarget = new FilterCreaturePermanent("creature an opponent controls");
static {
filter.add(TargetController.YOU.getControllerPredicate());
filter.add(SubType.SPIRIT.getPredicate());
filterTarget.add(TargetController.OPPONENT.getControllerPredicate());
}
private static final FilterPermanent filter = new FilterPermanent(SubType.SPIRIT, "Spirit");
public NebelgastHerald(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
@ -40,11 +31,15 @@ public final class NebelgastHerald extends CardImpl {
// Flash
this.addAbility(FlashAbility.getInstance());
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Nebelgast Herald or another Spirit enters the battlefield under your control, tap target creature an opponent controls.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new TapTargetEffect(), filter, false);
ability.addTarget(new TargetCreaturePermanent(filterTarget));
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new TapTargetEffect(), filter, false, true
);
ability.addTarget(new TargetOpponentsCreaturePermanent());
this.addAbility(ability);
}

View file

@ -1,8 +1,7 @@
package mage.cards.n;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -11,11 +10,7 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
@ -24,13 +19,11 @@ import java.util.UUID;
*/
public final class NoxiousGhoul extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
private static final FilterPermanent filter2 = new FilterPermanent();
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("all non-Zombie creatures");
private static final FilterPermanent filter2 = new FilterPermanent(SubType.ZOMBIE, "Zombie");
static {
filter.add(CardType.CREATURE.getPredicate());
filter.add(Predicates.not(SubType.ZOMBIE.getPredicate()));
filter2.add(NoxiousGhoulPredicate.instance);
}
public NoxiousGhoul(UUID ownerId, CardSetInfo setInfo) {
@ -41,14 +34,12 @@ public final class NoxiousGhoul extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Noxious Ghoul or another Zombie enters the battlefield, all non-Zombie creatures get -1/-1 until end of turn.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
new BoostAllEffect(-1, -1, Duration.EndOfTurn, filter, false),
filter2, "Whenever {this} or another Zombie enters the battlefield, " +
"all non-Zombie creatures get -1/-1 until end of turn."
));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new BoostAllEffect(
-1, -1, Duration.EndOfTurn, filter, false
), filter2, false, true));
}
public NoxiousGhoul(final NoxiousGhoul card) {
private NoxiousGhoul(final NoxiousGhoul card) {
super(card);
}
@ -57,13 +48,3 @@ public final class NoxiousGhoul extends CardImpl {
return new NoxiousGhoul(this);
}
}
enum NoxiousGhoulPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Permanent>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return input.getObject().hasSubtype(SubType.ZOMBIE, game)
|| input.getObject().getId().equals(input.getSourceId());
}
}

View file

@ -1,44 +1,35 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.StaticFilters;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class OathOfTheAncientWood extends CardImpl {
private static final FilterEnchantmentPermanent filter = new FilterEnchantmentPermanent("Oath of the Ancient Wood or another enchantment");
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
public OathOfTheAncientWood(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// Whenever Oath of the Ancient Wood or another enchantment enters the battlefield under your control, you may put a +1/+1 counter on target creature.
Effect effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance());
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, effect, filter, true, SetTargetPointer.NONE, null, true);
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new AddCountersTargetEffect(CounterType.P1P1.createInstance()),
StaticFilters.FILTER_ENCHANTMENT_PERMANENT, true, true
);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public OathOfTheAncientWood(final OathOfTheAncientWood card) {
private OathOfTheAncientWood(final OathOfTheAncientWood card) {
super(card);
}

View file

@ -1,28 +1,27 @@
package mage.cards.q;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
*
* @author spjspj
*/
public final class QasaliSlingers extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent(SubType.CAT, "Cat");
public QasaliSlingers(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
@ -35,10 +34,14 @@ public final class QasaliSlingers extends CardImpl {
this.addAbility(ReachAbility.getInstance());
// Whenever Qasali Slingers or another Cat enters the battlefield under your control, you may destroy target artifact or enchantment.
this.addAbility(new QasaliSlingersTriggeredAbility());
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new DestroyTargetEffect(), filter, true, true
);
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
this.addAbility(ability);
}
public QasaliSlingers(final QasaliSlingers card) {
private QasaliSlingers(final QasaliSlingers card) {
super(card);
}
@ -47,44 +50,3 @@ public final class QasaliSlingers extends CardImpl {
return new QasaliSlingers(this);
}
}
class QasaliSlingersTriggeredAbility extends TriggeredAbilityImpl {
public QasaliSlingersTriggeredAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
this.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
}
public QasaliSlingersTriggeredAbility(final QasaliSlingersTriggeredAbility ability) {
super(ability);
}
@Override
public QasaliSlingersTriggeredAbility copy() {
return new QasaliSlingersTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
if (permanent.getId().equals(this.getSourceId())) {
return true;
}
if (permanent.hasSubtype(SubType.CAT, game) && permanent.isControlledBy(this.getControllerId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another Cat enters the battlefield under your control, you may destroy target artifact or enchantment.";
}
}

View file

@ -2,7 +2,7 @@ package mage.cards.r;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -22,8 +22,7 @@ import java.util.UUID;
*/
public final class RisenReef extends CardImpl {
private static final FilterPermanent filter
= new FilterPermanent(SubType.ELEMENTAL, "{this} or another Elemental");
private static final FilterPermanent filter = new FilterPermanent(SubType.ELEMENTAL, "Elemental");
public RisenReef(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
@ -33,7 +32,9 @@ public final class RisenReef extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Risen Reef or another Elemental enters the battlefield under your control, look at the top card of your library. If it's a land card, you may put it onto the battlefield tapped. If you don't put the card onto the battlefield, put it into your hand.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new RisenReefEffect(), filter));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new RisenReefEffect(), filter, false, true
));
}
private RisenReef(final RisenReef card) {

View file

@ -1,7 +1,7 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -18,8 +18,7 @@ import java.util.UUID;
*/
public final class SageOfTheFalls extends CardImpl {
private static final FilterPermanent filter
= new FilterCreaturePermanent("{this} or another non-Human creature");
private static final FilterPermanent filter = new FilterCreaturePermanent("non-Human creature");
static {
filter.add(Predicates.not(SubType.HUMAN.getPredicate()));
@ -34,9 +33,9 @@ public final class SageOfTheFalls extends CardImpl {
this.toughness = new MageInt(5);
// Whenever Sage of the Falls or another non-Human creature enters the battlefield under you control, you may draw a card. If you do, discard a card.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
new DrawDiscardControllerEffect(1, 1, true), filter
));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(new DrawDiscardControllerEffect(
1, 1, true
), filter, false, true));
}
private SageOfTheFalls(final SageOfTheFalls card) {

View file

@ -2,7 +2,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
@ -10,9 +10,12 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -25,13 +28,7 @@ import java.util.UUID;
*/
public final class ScourgeOfValkas extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("{this} or another Dragon");
static {
filter.add(SubType.DRAGON.getPredicate());
}
private static final String rule = "Whenever {this} or another Dragon enters the battlefield under your control, it deals X damage to any target, where X is the number of Dragons you control.";
private static final FilterPermanent filter = new FilterPermanent(SubType.DRAGON, "Dragon");
public ScourgeOfValkas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}{R}");
@ -45,16 +42,17 @@ public final class ScourgeOfValkas extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Whenever Scourge of Valkas or another Dragon enters the battlefield under your control, it deals X damage to any target, where X is the number of Dragons you control.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new ScourgeOfValkasDamageEffect(), filter, false, rule);
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new ScourgeOfValkasDamageEffect(), filter, false, true
);
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// {R}: Scourge of Valkas gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
public ScourgeOfValkas(final ScourgeOfValkas card) {
private ScourgeOfValkas(final ScourgeOfValkas card) {
super(card);
}
@ -66,12 +64,14 @@ public final class ScourgeOfValkas extends CardImpl {
class ScourgeOfValkasDamageEffect extends OneShotEffect {
public ScourgeOfValkasDamageEffect() {
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.DRAGON, "");
ScourgeOfValkasDamageEffect() {
super(Outcome.Damage);
this.staticText = "it deals X damage to any target, where X is the number of Dragons you control";
}
public ScourgeOfValkasDamageEffect(final ScourgeOfValkasDamageEffect effect) {
private ScourgeOfValkasDamageEffect(final ScourgeOfValkasDamageEffect effect) {
super(effect);
}
@ -84,11 +84,13 @@ class ScourgeOfValkasDamageEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent enteringDragon = (Permanent) getValue("permanentEnteringBattlefield");
if (controller != null && enteringDragon != null) {
FilterPermanent filter = new FilterPermanent();
filter.add(SubType.DRAGON.getPredicate());
int dragons = game.getBattlefield().countAll(filter, source.getControllerId(), game);
if (dragons > 0) {
if (controller == null || enteringDragon == null) {
return false;
}
int dragons = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
if (dragons < 1) {
return true;
}
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null) {
permanent.damage(dragons, enteringDragon.getId(), game, false, true);
@ -99,9 +101,6 @@ class ScourgeOfValkasDamageEffect extends OneShotEffect {
player.damage(dragons, enteringDragon.getId(), game);
}
}
}
return true;
}
return false;
}
}

View file

@ -1,28 +1,22 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import mage.filter.StaticFilters;
import java.util.UUID;
/**
*
* @author CountAndromalius
*/
public final class SerumTank extends CardImpl {
@ -31,18 +25,20 @@ public final class SerumTank extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Whenever {this} or another artifact comes into play, put a charge counter on {this}.
Effect effect = new AddCountersSourceEffect(CounterType.CHARGE.createInstance());
effect.setText("put a charge counter on {this}");
this.addAbility(new SerumTankTriggeredAbility(effect));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new AddCountersSourceEffect(CounterType.CHARGE.createInstance()), StaticFilters.FILTER_PERMANENT_ARTIFACT
));
// {3}, {tap}, Remove a charge counter from {this}: Draw a card.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new ManaCostsImpl("{3}"));
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)));
Ability ability = new SimpleActivatedAbility(
new DrawCardSourceControllerEffect(1), new GenericManaCost(3)
);
ability.addCost(new TapSourceCost());
ability.addCost(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
this.addAbility(ability);
}
public SerumTank(final SerumTank card) {
private SerumTank(final SerumTank card) {
super(card);
}
@ -51,42 +47,3 @@ public final class SerumTank extends CardImpl {
return new SerumTank(this);
}
}
class SerumTankTriggeredAbility extends TriggeredAbilityImpl {
SerumTankTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect, false);
}
SerumTankTriggeredAbility(final SerumTankTriggeredAbility ability) {
super(ability);
}
@Override
public SerumTankTriggeredAbility copy() {
return new SerumTankTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
UUID targetId = event.getTargetId();
Permanent permanent = game.getPermanent(targetId);
if (permanent.isArtifact()) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(permanent, game));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another artifact enters the battlefield, put a charge counter on {this}.";
}
}

View file

@ -2,7 +2,7 @@ package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
@ -17,7 +17,6 @@ import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TokenPredicate;
@ -30,9 +29,8 @@ import java.util.UUID;
*/
public final class SethronHurloonGeneral extends CardImpl {
private static final FilterPermanent filter = new FilterControlledPermanent(
SubType.MINOTAUR, "{this} or another nontoken Minotaur"
);
private static final FilterPermanent filter
= new FilterPermanent(SubType.MINOTAUR, "nontoken Minotaur");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.MINOTAUR, "");
private static final FilterPermanent filter3 = new FilterPermanent(SubType.MINOTAUR, "");
@ -50,7 +48,9 @@ public final class SethronHurloonGeneral extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Sethron, Hurloon General or another nontoken Minotaur enters the battlefield under your control, create a 2/3 red Minotaur creature token.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new CreateTokenEffect(new MinotaurToken()), filter));
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new CreateTokenEffect(new MinotaurToken()), filter, false, true
));
// {2}{B/R}: Minotaurs you control get +1/+0 and gain menace and haste until end of turn.
Ability ability = new SimpleActivatedAbility(new BoostControlledEffect(

View file

@ -1,11 +1,8 @@
package mage.cards.t;
import java.util.Objects;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
@ -25,6 +22,9 @@ import mage.game.Game;
import mage.game.Graveyard;
import mage.players.Player;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
@ -44,10 +44,10 @@ public final class ThievesGuildEnforcer extends CardImpl {
this.addAbility(FlashAbility.getInstance());
// Whenever Thieves' Guild Enforcer or another Rogue enters the battlefield under your control, each opponent mills two cards.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new PutTopCardOfLibraryIntoGraveEachPlayerEffect(
2, TargetController.OPPONENT
), filter
), filter, false, true
));
// As long as an opponent has eight or more cards in their graveyard, Thieves' Guild Enforcer gets +2/+1 and has deathtouch.

View file

@ -2,7 +2,7 @@ package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.effects.common.FightTargetSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
@ -30,10 +30,9 @@ public final class ThornMammoth extends CardImpl {
this.addAbility(TrampleAbility.getInstance());
// Whenever Thorn Mammoth or another creature enters the battlefield under your control, Thorn Mammoth fights up to one target creature you don't control.
Ability ability = new EntersBattlefieldControlledTriggeredAbility(
new FightTargetSourceEffect(), StaticFilters.FILTER_PERMANENT_CREATURE,
"Whenever {this} or another creature enters the battlefield under your control, " +
"{this} fights up to one target creature you don't control."
Ability ability = new EntersBattlefieldThisOrAnotherTriggeredAbility(
new FightTargetSourceEffect().setText("{this} fights up to one target creature you don't control"),
StaticFilters.FILTER_PERMANENT_CREATURE, false, true
);
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
this.addAbility(ability);

View file

@ -1,24 +1,24 @@
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterTeamPermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class ThrasherBrute extends CardImpl {
@ -35,10 +35,7 @@ public final class ThrasherBrute extends CardImpl {
// Whenever Thrasher Brute or another Warrior enters the battlefield under your team's control, target opponent loses 1 life and you gain 1 life.
Ability ability = new EntersBattlefieldAllTriggeredAbility(
Zone.BATTLEFIELD,
new LoseLifeTargetEffect(1),
filter,
false,
Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), filter, false,
"Whenever {this} or another Warrior enters the battlefield under your team's control, "
+ "target opponent loses 1 life and you gain 1 life."
);
@ -63,8 +60,8 @@ class ThrasherBruteFilter extends FilterTeamPermanent {
super();
}
ThrasherBruteFilter(final ThrasherBruteFilter effect) {
super(effect);
private ThrasherBruteFilter(final ThrasherBruteFilter filter) {
super(filter);
}
@Override
@ -74,16 +71,8 @@ class ThrasherBruteFilter extends FilterTeamPermanent {
@Override
public boolean match(Permanent permanent, UUID sourceId, UUID playerId, Game game) {
if (super.match(permanent, sourceId, playerId, game)) {
if (sourceId.equals(permanent.getId())) {
return true;
} else {
if (permanent.hasSubtype(SubType.WARRIOR, game)) {
return true;
return super.match(permanent, sourceId, playerId, game)
&& (sourceId.equals(permanent.getId())
|| permanent.hasSubtype(SubType.WARRIOR, game));
}
}
}
return false;
}
}

View file

@ -1,44 +1,33 @@
package mage.cards.u;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldThisOrAnotherTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.*;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
/**
*
* @author spjspj
*/
public final class UneshCriosphinxSovereign extends CardImpl {
private static final FilterCard filter = new FilterCard("Sphinx spells");
private static final FilterPermanent filter2 = new FilterPermanent(SubType.SPHINX, "Sphinx");
static {
filter.add(SubType.SPHINX.getPredicate());
@ -56,13 +45,15 @@ public final class UneshCriosphinxSovereign extends CardImpl {
this.addAbility(FlyingAbility.getInstance());
// Sphinx spells you cast cost {2} less to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 2)));
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 2)));
// Whenever Unesh, Criosphinx Sovereign or another Sphinx enters the battlefield under your control, reveal the top four cards of your library. An opponent seperates those cards into two piles. Put one pile into your hand and the other into your graveyard.
this.addAbility(new UneshCriosphinxSovereignTriggeredAbility());
this.addAbility(new EntersBattlefieldThisOrAnotherTriggeredAbility(
new UneshCriosphinxSovereignEffect(), filter2, false, true
));
}
public UneshCriosphinxSovereign(final UneshCriosphinxSovereign card) {
private UneshCriosphinxSovereign(final UneshCriosphinxSovereign card) {
super(card);
}
@ -72,58 +63,14 @@ public final class UneshCriosphinxSovereign extends CardImpl {
}
}
class UneshCriosphinxSovereignTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
static {
filter.add(SubType.SPHINX.getPredicate());
}
public UneshCriosphinxSovereignTriggeredAbility() {
super(Zone.BATTLEFIELD, new UneshCriosphinxSovereignEffect(), false);
}
public UneshCriosphinxSovereignTriggeredAbility(UneshCriosphinxSovereignTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null
&& permanent.isOwnedBy(controllerId)
&& permanent.isCreature()
&& (event.getTargetId().equals(getSourceId()) || filter.match(permanent, game))) {
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another Sphinx enters the battlefield under your control, " + super.getRule();
}
@Override
public UneshCriosphinxSovereignTriggeredAbility copy() {
return new UneshCriosphinxSovereignTriggeredAbility(this);
}
}
class UneshCriosphinxSovereignEffect extends OneShotEffect {
public UneshCriosphinxSovereignEffect() {
UneshCriosphinxSovereignEffect() {
super(Outcome.DrawCard);
this.staticText = "reveal the top four cards of your library. An opponent separates those cards into two piles. Put one pile into your hand and the other into your graveyard";
}
public UneshCriosphinxSovereignEffect(final UneshCriosphinxSovereignEffect effect) {
private UneshCriosphinxSovereignEffect(final UneshCriosphinxSovereignEffect effect) {
super(effect);
}

View file

@ -53,7 +53,7 @@ public class ConstellationAbility extends TriggeredAbilityImpl {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && permanent.isEnchantment();
return permanent != null && ((thisOr && permanent.getId().equals(getSourceId())) || permanent.isEnchantment());
}
@Override

View file

@ -1,7 +1,6 @@
package mage.abilities.common;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
@ -12,8 +11,9 @@ import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
@ -22,6 +22,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
protected String rule;
protected boolean controlledText;
protected SetTargetPointer setTargetPointer;
protected final boolean thisOrAnother;
/**
* zone = BATTLEFIELD optional = false
@ -54,11 +55,16 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
}
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule, boolean controlledText) {
this(zone, effect, filter, optional, setTargetPointer, rule, controlledText, false);
}
protected EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule, boolean controlledText, boolean thisOrAnother) {
super(zone, effect, optional);
this.filter = filter;
this.rule = rule;
this.controlledText = controlledText;
this.setTargetPointer = setTargetPointer;
this.thisOrAnother = thisOrAnother;
}
public EntersBattlefieldAllTriggeredAbility(final EntersBattlefieldAllTriggeredAbility ability) {
@ -67,6 +73,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
this.rule = ability.rule;
this.controlledText = ability.controlledText;
this.setTargetPointer = ability.setTargetPointer;
this.thisOrAnother = ability.thisOrAnother;
}
@Override
@ -105,7 +112,11 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
if (rule != null && !rule.isEmpty()) {
return rule;
}
StringBuilder sb = new StringBuilder("Whenever ").append(filter.getMessage());
StringBuilder sb = new StringBuilder("Whenever ");
if (thisOrAnother) {
sb.append("{this} or another ");
}
sb.append(filter.getMessage());
sb.append(" enters the battlefield");
if (controlledText) {
sb.append(" under your control, ");

View file

@ -0,0 +1,62 @@
package mage.abilities.common;
import mage.abilities.effects.Effect;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
* @author TheElk801
*/
public class EntersBattlefieldThisOrAnotherTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
private final boolean onlyControlled;
public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter) {
this(effect, filter, false, false);
}
public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, boolean onlyControlled) {
this(effect, filter, optional, SetTargetPointer.NONE, onlyControlled);
}
public EntersBattlefieldThisOrAnotherTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyControlled) {
this(Zone.BATTLEFIELD, effect, filter, optional, setTargetPointer, onlyControlled);
}
public EntersBattlefieldThisOrAnotherTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, boolean onlyControlled) {
super(zone, effect, filter, optional, setTargetPointer, null, onlyControlled, true);
this.onlyControlled = onlyControlled;
}
private EntersBattlefieldThisOrAnotherTriggeredAbility(final EntersBattlefieldThisOrAnotherTriggeredAbility ability) {
super(ability);
this.onlyControlled = ability.onlyControlled;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!super.checkTrigger(event, game)) {
return false;
}
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent == null) {
return false;
}
if (permanent.getId().equals(getSourceId())) {
return true;
}
if (onlyControlled && !permanent.isControlledBy(this.getControllerId())) {
return false;
}
return filter.match(permanent, getSourceId(), getControllerId(), game);
}
@Override
public EntersBattlefieldThisOrAnotherTriggeredAbility copy() {
return new EntersBattlefieldThisOrAnotherTriggeredAbility(this);
}
}

View file

@ -615,13 +615,7 @@ public final class StaticFilters {
FILTER_PERMANENT_AURA.setLockedFilter(true);
}
public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterPermanent();
static {
FILTER_PERMANENT_EQUIPMENT.add(CardType.ARTIFACT.getPredicate());
FILTER_PERMANENT_EQUIPMENT.add(SubType.EQUIPMENT.getPredicate());
FILTER_PERMANENT_EQUIPMENT.setLockedFilter(true);
}
public static final FilterPermanent FILTER_PERMANENT_EQUIPMENT = new FilterEquipmentPermanent();
public static final FilterPermanent FILTER_PERMANENT_FORTIFICATION = new FilterPermanent();

View file

@ -12,7 +12,7 @@ import mage.filter.FilterPermanent;
public class FilterEquipmentPermanent extends FilterPermanent {
public FilterEquipmentPermanent() {
this("equipment");
this("Equipment");
}
public FilterEquipmentPermanent(String name) {