mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Imporved setTargetPointer of EntersBattlefieldAllTriggeredAbility.
This commit is contained in:
parent
1ed1bc2e0d
commit
00281f0b10
16 changed files with 84 additions and 64 deletions
|
@ -39,6 +39,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
@ -88,7 +89,7 @@ public class RikuOfTwoReflections extends CardImpl {
|
|||
|
||||
// Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, put a token that's a copy of that creature onto the battlefield.
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new RikuOfTwoReflectionsCopyTokenEffect(),filterPermanent, false, true,
|
||||
Zone.BATTLEFIELD, new RikuOfTwoReflectionsCopyTokenEffect(),filterPermanent, false, SetTargetPointer.PERMANENT,
|
||||
"Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, put a token that's a copy of that creature onto the battlefield.",
|
||||
true);
|
||||
ability.addCost(new ManaCostsImpl("{G}{U}"));
|
||||
|
|
|
@ -36,6 +36,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
@ -78,7 +79,7 @@ class GenesisChamberTriggeredAbility extends EntersBattlefieldAllTriggeredAbilit
|
|||
private static final String rule = "Whenever a nontoken creature enters the battlefield, if {this} is untapped, that creature's controller puts a 1/1 colorless Myr artifact creature token onto the battlefield";
|
||||
public GenesisChamberTriggeredAbility(Effect effect, FilterPermanent filter)
|
||||
{
|
||||
super(Zone.BATTLEFIELD, effect, filter, false, true, rule);
|
||||
super(Zone.BATTLEFIELD, effect, filter, false, SetTargetPointer.PERMANENT, rule);
|
||||
}
|
||||
|
||||
public GenesisChamberTriggeredAbility(final GenesisChamberTriggeredAbility ability) {
|
||||
|
|
|
@ -37,6 +37,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -67,7 +68,9 @@ public class AjanisChosen extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever an enchantment enters the battlefield under your control, put a 2/2 white Cat creature token onto the battlefield. If that enchantment is an Aura, you may attach it to the token.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new AjanisChosenEffect(), filter, false, true, "Whenever an enchantment enters the battlefield under your control, put a 2/2 white Cat creature token onto the battlefield. If that enchantment is an Aura, you may attach it to the token"));
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AjanisChosenEffect(), filter, false, SetTargetPointer.PERMANENT,
|
||||
"Whenever an enchantment enters the battlefield under your control, put a 2/2 white Cat creature token onto the battlefield. If that enchantment is an Aura, you may attach it to the token"));
|
||||
}
|
||||
|
||||
public AjanisChosen(final AjanisChosen card) {
|
||||
|
|
|
@ -35,6 +35,7 @@ import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
@ -61,7 +62,7 @@ public class OathOfTheAncientWood extends CardImpl {
|
|||
|
||||
// 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, false, null, true);
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, effect, filter, true, SetTargetPointer.PERMANENT, null, true);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
@ -70,7 +71,7 @@ public class OgreBattledriver extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever another creature enters the battlefield under your control, that creature gets +2/+0 and gains haste until end of turn.
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Duration.EndOfTurn), filter, false, true, rule, true);
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Duration.EndOfTurn), filter, false, SetTargetPointer.PERMANENT, rule, true);
|
||||
ability.addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
|||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -71,7 +72,7 @@ public class CloakAndDagger extends CardImpl {
|
|||
// Whenever a Rogue creature enters the battlefield, you may attach Cloak and Dagger to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true, null));
|
||||
filter, true, SetTargetPointer.PERMANENT, null));
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
|
|||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -85,7 +86,7 @@ public class DivinersWand extends CardImpl {
|
|||
// Whenever a Wizard creature enters the battlefield, you may attach Diviner's Wand to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true, null));
|
||||
filter, true, SetTargetPointer.PERMANENT, null));
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
|||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -71,7 +72,7 @@ public class ObsidianBattleAxe extends CardImpl {
|
|||
// Whenever a Warrior creature enters the battlefield, you may attach Obsidian Battle-Axe to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true, null));
|
||||
filter, true, SetTargetPointer.PERMANENT, null));
|
||||
// Equip {3}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import mage.abilities.effects.common.UntapSourceEffect;
|
|||
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -83,7 +84,7 @@ public class ThornbiteStaff extends CardImpl {
|
|||
// Whenever a Shaman creature enters the battlefield, you may attach Thornbite Staff to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true, null));
|
||||
filter, true, SetTargetPointer.PERMANENT, null));
|
||||
// Equip {4}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(4)));
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import mage.abilities.effects.common.continious.BoostSourceEffect;
|
|||
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
@ -79,7 +80,8 @@ public class VeteransArmaments extends CardImpl {
|
|||
// Whenever a Soldier creature enters the battlefield, you may attach Veteran's Armaments to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true, null));
|
||||
filter, true, SetTargetPointer.PERMANENT, null));
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2)));
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.effects.common.continious.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
|
@ -65,8 +66,7 @@ public class SaiOfTheShinobi extends CardImpl {
|
|||
// Whenever a creature enters the battlefield under your control, you may attach Sai of the Shinobi to it.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
|
||||
filter, true, true,
|
||||
null, true));
|
||||
filter, true, SetTargetPointer.PERMANENT, null, true));
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
|
||||
}
|
||||
|
|
|
@ -30,15 +30,16 @@ package mage.sets.ravnika;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -66,7 +67,7 @@ public class CloudstoneCurio extends CardImpl {
|
|||
this.expansionSetCode = "RAV";
|
||||
|
||||
// Whenever a nonartifact permanent enters the battlefield under your control, you may return another permanent you control that shares a card type with it to its owner's hand.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new CloudstoneCurioEffect(), filter, true, true, "", true));
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new CloudstoneCurioEffect(), filter, true, SetTargetPointer.PERMANENT, "", true));
|
||||
|
||||
|
||||
}
|
||||
|
@ -99,34 +100,31 @@ class CloudstoneCurioEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent triggeringCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (triggeringCreature == null) {
|
||||
triggeringCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
|
||||
}
|
||||
if (triggeringCreature != null) {
|
||||
FilterPermanent filter = new FilterPermanent("another permanent you control that shares a card type with " + triggeringCreature.getName());
|
||||
filter.add(Predicates.not(new PermanentIdPredicate(triggeringCreature.getId())));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
Set<CardTypePredicate> cardTypes = new HashSet<CardTypePredicate>();
|
||||
for (CardType cardType :triggeringCreature.getCardType()) {
|
||||
cardTypes.add(new CardTypePredicate(cardType));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent triggeringCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (triggeringCreature == null) {
|
||||
triggeringCreature = (Permanent) game.getLastKnownInformation(getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD);
|
||||
}
|
||||
filter.add(Predicates.or(cardTypes));
|
||||
TargetPermanent target = new TargetPermanent(1,1,filter, true);
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (triggeringCreature != null) {
|
||||
FilterPermanent filter = new FilterPermanent("another permanent you control that shares a card type with " + triggeringCreature.getName());
|
||||
filter.add(Predicates.not(new PermanentIdPredicate(triggeringCreature.getId())));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
Set<CardTypePredicate> cardTypes = new HashSet<>();
|
||||
for (CardType cardType : triggeringCreature.getCardType()) {
|
||||
cardTypes.add(new CardTypePredicate(cardType));
|
||||
}
|
||||
filter.add(Predicates.or(cardTypes));
|
||||
TargetPermanent target = new TargetPermanent(1, 1, filter, true);
|
||||
|
||||
if (target.canChoose(controller.getId(), game) && controller.chooseTarget(outcome, target, source, game)) {
|
||||
Permanent returningCreature = game.getPermanent(target.getFirstTarget());
|
||||
if (returningCreature != null) {
|
||||
if (returningCreature.moveToZone(Zone.HAND, source.getSourceId(), game, true)) {
|
||||
game.informPlayers(new StringBuilder("Cloudstone Curio: Returning ").append(returningCreature.getName()).append(" to owner's hand").toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
controller.moveCardToHandWithInfo(returningCreature, source.getSourceId(), game, Zone.BATTLEFIELD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ public class PollutedBonds extends CardImpl {
|
|||
this.color.setBlack(true);
|
||||
|
||||
// Whenever a land enters the battlefield under an opponent's control, that player loses 2 life and you gain 2 life.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new PollutedBondsEffect(), filter, false, true, rule, true));
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new PollutedBondsEffect(), filter, false, SetTargetPointer.PLAYER, rule, true));
|
||||
|
||||
}
|
||||
|
||||
|
@ -96,18 +96,15 @@ class PollutedBondsEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player opponent = null;
|
||||
Permanent land = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (land != null) {
|
||||
opponent = game.getPlayer(land.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (opponent != null) {
|
||||
opponent.loseLife(2, game);
|
||||
}
|
||||
controller.gainLife(2, game);
|
||||
return true;
|
||||
}
|
||||
if (opponent != null) {
|
||||
opponent.loseLife(2, game);
|
||||
}
|
||||
if (you != null) {
|
||||
you.gainLife(2, game);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffec
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
@ -82,7 +83,7 @@ public class PrisonTerm extends CardImpl {
|
|||
|
||||
// Whenever a creature enters the battlefield under an opponent's control, you may attach Prison Term to that creature.
|
||||
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
|
||||
Zone.BATTLEFIELD, new PrisonTermEffect(), filter, true, true, "Whenever a creature enters the battlefield under an opponent's control, you may attach Prison Term to that creature."));
|
||||
Zone.BATTLEFIELD, new PrisonTermEffect(), filter, true, SetTargetPointer.PERMANENT, "Whenever a creature enters the battlefield under an opponent's control, you may attach Prison Term to that creature."));
|
||||
}
|
||||
|
||||
public PrisonTerm(final PrisonTerm card) {
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import static mage.constants.SetTargetPointer.PERMANENT;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -46,7 +48,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
protected FilterPermanent filter;
|
||||
protected String rule;
|
||||
protected boolean controlled;
|
||||
protected boolean setTargetPointer;
|
||||
protected SetTargetPointer setTargetPointer;
|
||||
|
||||
/**
|
||||
* zone = BATTLEFIELD optional = false
|
||||
|
@ -63,7 +65,7 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional) {
|
||||
this(zone, effect, filter, optional, false, null, false);
|
||||
this(zone, effect, filter, optional, SetTargetPointer.NONE, null, false);
|
||||
}
|
||||
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, String rule) {
|
||||
|
@ -71,14 +73,14 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, String rule, boolean controlled) {
|
||||
this(zone, effect, filter, optional, false, rule, controlled);
|
||||
this(zone, effect, filter, optional, SetTargetPointer.NONE, rule, controlled);
|
||||
}
|
||||
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, boolean setTargetPointer, String rule) {
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule) {
|
||||
this(zone, effect, filter, optional, setTargetPointer, rule, false);
|
||||
}
|
||||
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, boolean setTargetPointer, String rule, boolean controlled) {
|
||||
public EntersBattlefieldAllTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule, boolean controlled) {
|
||||
super(zone, effect, optional);
|
||||
this.filter = filter;
|
||||
this.rule = rule;
|
||||
|
@ -100,9 +102,17 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
UUID targetId = event.getTargetId();
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (setTargetPointer) {
|
||||
if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
switch(setTargetPointer) {
|
||||
case PERMANENT:
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
break;
|
||||
case PLAYER:
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
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;
|
||||
|
@ -63,10 +64,10 @@ public class EntersBattlefieldControlledTriggeredAbility extends EntersBattlefie
|
|||
}
|
||||
|
||||
public EntersBattlefieldControlledTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, String rule) {
|
||||
this(zone, effect, filter, optional, false, rule);
|
||||
this(zone, effect, filter, optional, SetTargetPointer.NONE, rule);
|
||||
}
|
||||
|
||||
public EntersBattlefieldControlledTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, boolean setTargetPointer, String rule) {
|
||||
public EntersBattlefieldControlledTriggeredAbility(Zone zone, Effect effect, FilterPermanent filter, boolean optional, SetTargetPointer setTargetPointer, String rule) {
|
||||
super(zone, effect, filter, optional, setTargetPointer, rule, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue