make it mandatory to specify player making the choice in HasOptions. Fixes #17.
parent
2df74e24cf
commit
b576cdd882
|
@ -42,15 +42,15 @@ public class MagicConditionFactory {
|
|||
return MagicManaCost.create(manaCost).getCondition();
|
||||
}
|
||||
|
||||
|
||||
public static MagicCondition HasOptions(final MagicTargetChoice targetChoice) {
|
||||
public static MagicCondition HasOptions(final MagicPlayer player, final MagicTargetChoice targetChoice) {
|
||||
return new MagicCondition() {
|
||||
public boolean accept(final MagicSource source) {
|
||||
return targetChoice.hasOptions(source.getGame(), source.getController(), source, false);
|
||||
final MagicGame game = source.getGame();
|
||||
return targetChoice.hasOptions(game, player.map(game), source, false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static MagicCondition HasSubType(final MagicSubType subtype) {
|
||||
return new MagicCondition() {
|
||||
public boolean accept(final MagicSource source) {
|
||||
|
|
|
@ -35,7 +35,7 @@ public class MagicAddCounterChosenEvent extends MagicEvent {
|
|||
"Put a " + counterType.getName() + " counter on a creature$ you control."
|
||||
);
|
||||
conds = new MagicCondition[]{
|
||||
MagicConditionFactory.HasOptions(getTargetChoice())
|
||||
MagicConditionFactory.HasOptions(source.getController(), getTargetChoice())
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public class MagicBounceChosenPermanentEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Return "+targetChoice.getTargetDescription()+"$ to its owner's hand."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class MagicDiscardChosenEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"PN discards " + targetChoice.getTargetDescription().replace(" from your hand", "") + "$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
|
|
|
@ -31,7 +31,7 @@ public class MagicExileCardEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Choose " + targetChoice.getTargetDescription() + "$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION = new MagicEventAction() {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class MagicExileCardPayManaCostEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Choose " + targetChoice.getTargetDescription() + "$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
|
|
|
@ -40,7 +40,7 @@ public class MagicRemoveCounterChosenEvent extends MagicEvent {
|
|||
"Remove a " + counterType.getName() + " counter from a creature$ you control."
|
||||
);
|
||||
conds = new MagicCondition[]{
|
||||
MagicConditionFactory.HasOptions(getTargetChoice())
|
||||
MagicConditionFactory.HasOptions(source.getController(), getTargetChoice())
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MagicSacrificePermanentEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Choose "+targetChoice.getTargetDescription()+"$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MagicTapPermanentEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Choose "+targetChoice.getTargetDescription()+"$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
|
|
|
@ -33,7 +33,7 @@ public class MagicUntapPermanentEvent extends MagicEvent {
|
|||
EVENT_ACTION,
|
||||
"Choose "+targetChoice.getTargetDescription()+"$."
|
||||
);
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(targetChoice)};
|
||||
conds = new MagicCondition[]{MagicConditionFactory.HasOptions(player, targetChoice)};
|
||||
}
|
||||
|
||||
private static final MagicEventAction EVENT_ACTION=new MagicEventAction() {
|
||||
|
|
Loading…
Reference in New Issue