mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
spjspj - Update all TargetOpponentsChoicePermanent cards with whether they have to target an opponent. (There was a NPE when an opponent had hexproof)
This commit is contained in:
parent
7017749265
commit
712f19f4e6
7 changed files with 13 additions and 10 deletions
|
@ -58,7 +58,7 @@ public class Arena extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ArenaEffect(), new GenericManaCost(3));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(new FilterControlledCreaturePermanent()));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class DiaochanArtfulBeauty extends CardImpl {
|
|||
// {tap}: Destroy target creature of your choice, then destroy target creature of an opponent's choice. Activate this ability only during your turn, before attackers are declared.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiaochanArtfulBeautyDestroyEffect(), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(new FilterCreaturePermanent()));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterCreaturePermanent(), false, true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class Evangelize extends CardImpl {
|
|||
GainControlTargetEffect effect = new GainControlTargetEffect(Duration.EndOfGame);
|
||||
effect.setText("Gain control of target creature of an opponent's choice that he or she controls");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetOpponentsChoicePermanent(1, 1, filter, false));
|
||||
this.getSpellAbility().addTarget(new TargetOpponentsChoicePermanent(1, 1, filter, false, true));
|
||||
}
|
||||
|
||||
public Evangelize(final Evangelize card) {
|
||||
|
|
|
@ -64,7 +64,7 @@ public class MagusOfTheArena extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MagusOfTheArenaEffect(), new GenericManaCost(3));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetControlledCreaturePermanent());
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(new FilterControlledCreaturePermanent()));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public class Preacher extends CardImpl {
|
|||
|
||||
// {tap}: Gain control of target creature of an opponent's choice that he or she controls for as long as Preacher remains tapped.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreacherEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(new FilterControlledCreaturePermanent()));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, new FilterControlledCreaturePermanent(), false, true));
|
||||
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -127,4 +127,4 @@ class PreacherEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,12 +86,12 @@ public class VolcanicOffering extends CardImpl {
|
|||
FilterLandPermanent filterLandForOpponent = new FilterLandPermanent("nonbasic land not controlled by " + controller.getLogName());
|
||||
filterLandForOpponent.add(Predicates.not(new SupertypePredicate("Basic")));
|
||||
filterLandForOpponent.add(Predicates.not(new ControllerIdPredicate(controller.getId())));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(filterLandForOpponent));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, filterLandForOpponent, false, true));
|
||||
|
||||
ability.addTarget(new TargetPermanent(filterCreature));
|
||||
FilterCreaturePermanent filterCreatureForOpponent = new FilterCreaturePermanent("creature not controlled by " + controller.getLogName());
|
||||
filterCreatureForOpponent.add(Predicates.not(new ControllerIdPredicate(controller.getId())));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(filterCreatureForOpponent));
|
||||
ability.addTarget(new TargetOpponentsChoicePermanent(1, 1, filterCreatureForOpponent, false, true));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,20 +21,23 @@ import mage.target.TargetPermanent;
|
|||
public class TargetOpponentsChoicePermanent extends TargetPermanent {
|
||||
|
||||
protected UUID opponentId = null;
|
||||
private boolean dontTargetPlayer = false;
|
||||
|
||||
public TargetOpponentsChoicePermanent(FilterPermanent filter) {
|
||||
super(1, 1, filter, false);
|
||||
this.targetName = filter.getMessage();
|
||||
}
|
||||
|
||||
public TargetOpponentsChoicePermanent(int minNumTargets, int maxNumTargets, FilterPermanent filter, boolean notTarget) {
|
||||
public TargetOpponentsChoicePermanent(int minNumTargets, int maxNumTargets, FilterPermanent filter, boolean notTarget, boolean dontTargetPlayer) {
|
||||
super(minNumTargets, maxNumTargets, filter, notTarget);
|
||||
this.targetName = filter.getMessage();
|
||||
this.dontTargetPlayer = dontTargetPlayer;
|
||||
}
|
||||
|
||||
public TargetOpponentsChoicePermanent(final TargetOpponentsChoicePermanent target) {
|
||||
super(target);
|
||||
this.opponentId = target.opponentId;
|
||||
this.dontTargetPlayer = target.dontTargetPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +82,7 @@ public class TargetOpponentsChoicePermanent extends TargetPermanent {
|
|||
|
||||
private UUID getOpponentId(UUID playerId, Ability source, Game game) {
|
||||
if (opponentId == null) {
|
||||
TargetOpponent target = new TargetOpponent();
|
||||
TargetOpponent target = new TargetOpponent(dontTargetPlayer);
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.chooseTarget(Outcome.Detriment, target, source, game)) {
|
||||
|
|
Loading…
Reference in a new issue