add methods to MagicSourceActivation to simplify usage in MagicPriorityEvent
parent
9cfdfbcd2d
commit
c7f0af266a
|
@ -53,10 +53,13 @@ public abstract class MagicActivation<T extends MagicSource> implements MagicEve
|
|||
return id >= actpri.getActivationId();
|
||||
}
|
||||
|
||||
void changeActivationPriority(final MagicGame game,final MagicPlayer player) {
|
||||
void changeActivationPriority(final MagicPlayer player) {
|
||||
final MagicActivationPriority actpri = player.getActivationPriority();
|
||||
actpri.setPriority(priority);
|
||||
actpri.setActivationId(id);
|
||||
|
||||
// reset activation/priority of opponent
|
||||
player.getOpponent().getActivationPriority().clear();
|
||||
}
|
||||
|
||||
public final boolean canPlay(
|
||||
|
|
|
@ -40,19 +40,13 @@ public class MagicPriorityEvent extends MagicEvent {
|
|||
}
|
||||
} else {
|
||||
// Clear priority passed only when stack is used.
|
||||
final MagicSourceActivation sourceActivation=playChoiceResult.sourceActivation;
|
||||
if (sourceActivation.activation.usesStack()) {
|
||||
final MagicSourceActivation<? extends MagicSource> sourceActivation = playChoiceResult.sourceActivation;
|
||||
if (sourceActivation.usesStack()) {
|
||||
game.setPriorityPassed(false);
|
||||
}
|
||||
|
||||
final MagicSource source = sourceActivation.source;
|
||||
final MagicPlayer player = source.getController();
|
||||
|
||||
// set activation/priority of controller
|
||||
sourceActivation.activation.changeActivationPriority(game,player);
|
||||
|
||||
// reset activation/priority of opponent
|
||||
player.getOpponent().getActivationPriority().clear();
|
||||
sourceActivation.changeActivationPriority();
|
||||
|
||||
// reset payed costs
|
||||
game.resetPayedCost();
|
||||
|
|
|
@ -34,6 +34,14 @@ public class MagicSourceActivation<T extends MagicSource> implements Comparable<
|
|||
return activation.getEvent(source);
|
||||
}
|
||||
|
||||
public boolean usesStack() {
|
||||
return activation.usesStack();
|
||||
}
|
||||
|
||||
public void changeActivationPriority() {
|
||||
activation.changeActivationPriority(source.getController());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(final MagicSourceActivation other) {
|
||||
return activation.compareTo(other.activation);
|
||||
|
|
Loading…
Reference in New Issue