External Activation and Triggers

Ok, so I was looking at this last night and here's the deal:
Here's the (relatively new) block of code that is called form PhaseHandler to wait for activating an ability to be activated and returned or not.
Here's the (relatively new) block of code that is called form PhaseHandler to wait for activating an ability to be activated and returned or not.
- Code: Select all
@Override
public SpellAbility chooseSpellAbilityToPlay() {
PhaseType phase = game.getPhaseHandler().getPhase();
boolean maySkipPriority = mayAutoPass(phase) || isUiSetToSkipPhase(game.getPhaseHandler().getPlayerTurn(), phase);
if (game.getStack().isEmpty() && maySkipPriority) {
return null;
}
else {
autoPassCancel(); // probably cancel, since something has happened
}
InputPassPriority defaultInput = new InputPassPriority(player);
defaultInput.showAndWait();
return defaultInput.getChosenSa();
}
- Code: Select all
@Override
protected void onCardSelected(final Card card, final MouseEvent triggerEvent) {
List<SpellAbility> abilities = card.getAllPossibleAbilities(player, false);
if (abilities.isEmpty()) {
flashIncorrectAction();
return;
}
selectAbility(player.getController().getAbilityToPlay(abilities, triggerEvent));
}
- Code: Select all
ZoneAction flashBackAction = new ZoneAction(player.getZone(ZoneType.Graveyard), MatchConstants.HUMANFLASHBACK) {
@Override
protected List<Card> getCardsAsIterable() {
return player.getCardsActivableInExternalZones();
}
@Override
protected void doAction(final Card c) {
// activate cards only via your own flashback button
if (player.getLobbyPlayer() != CField.this.viewer) {
return;
}
final Game game = player.getGame();
// TODO: "can play" check needed!
// should I check for who owns these cards? Are there any abilities to be played from opponent's graveyard?
final SpellAbility ab = player.getController().getAbilityToPlay(c.getAllPossibleAbilities(player, true));
if ( null != ab) {
game.getAction().invoke(new Runnable(){
@Override public void run() {
HumanPlay.playSpellAbility(player, ab);
game.getStack().addAllTirggeredAbilitiesToStack(); // This line Sloth just added
}});
}
}
};