use of mage.game.draft.DraftPlayer in project mage by magefree.
the class TableController method endDraft.
public void endDraft(Draft draft) {
if (!draft.isAbort()) {
for (DraftPlayer player : draft.getPlayers()) {
player.prepareDeck();
tournament.getPlayer(player.getPlayer().getId()).setDeck(player.getDeck());
}
}
// free the draft resources after draft step has ended
tournament.clearDraft();
tournament.nextStep();
}
use of mage.game.draft.DraftPlayer in project mage by magefree.
the class DraftController method init.
private void init() {
draft.addTableEventListener((Listener<TableEvent>) event -> {
try {
switch(event.getEventType()) {
case UPDATE:
updateDraft();
break;
case END:
endDraft();
break;
}
} catch (MageException ex) {
logger.fatal("Table event listener error", ex);
}
});
draft.addPlayerQueryEventListener((Listener<PlayerQueryEvent>) event -> {
try {
switch(event.getQueryType()) {
case PICK_CARD:
pickCard(event.getPlayerId(), event.getMax());
break;
}
} catch (MageException ex) {
logger.fatal("Table event listener error", ex);
}
});
for (DraftPlayer player : draft.getPlayers()) {
if (!player.getPlayer().isHuman()) {
player.setJoined();
logger.debug("player " + player.getPlayer().getId() + " has joined draft " + draft.getId());
}
}
checkStart();
}
Aggregations