forked from External/mage
* Tournament play - Player state set to "Eliminated" as soon as he lost a match in an elimination tournament. Points for a Bye for player are shown immediately. Players finishing the last round are set to Finishedinstead of wating for next round.
This commit is contained in:
parent
1155cf2049
commit
b829ad499e
7 changed files with 46 additions and 28 deletions
|
|
@ -351,21 +351,23 @@ public class User {
|
|||
for (Map.Entry<UUID, Table> tableEntry : tables.entrySet()) {
|
||||
Table table = tableEntry.getValue();
|
||||
if (table.isTournament()) {
|
||||
switch (table.getState()) {
|
||||
case CONSTRUCTING:
|
||||
construct++;
|
||||
break;
|
||||
case DRAFTING:
|
||||
draft++;
|
||||
break;
|
||||
case DUELING:
|
||||
tournament++;
|
||||
break;
|
||||
}
|
||||
if (!isConnected()) {
|
||||
table.getTournament().getPlayer(tableEntry.getKey()).setDisconnectInfo(disconnectInfo);
|
||||
} else {
|
||||
table.getTournament().getPlayer(tableEntry.getKey()).setDisconnectInfo("");
|
||||
if (!table.getTournament().getPlayer(tableEntry.getKey()).getEliminated()) {
|
||||
switch (table.getState()) {
|
||||
case CONSTRUCTING:
|
||||
construct++;
|
||||
break;
|
||||
case DRAFTING:
|
||||
draft++;
|
||||
break;
|
||||
case DUELING:
|
||||
tournament++;
|
||||
break;
|
||||
}
|
||||
if (!isConnected()) {
|
||||
table.getTournament().getPlayer(tableEntry.getKey()).setDisconnectInfo(disconnectInfo);
|
||||
} else {
|
||||
table.getTournament().getPlayer(tableEntry.getKey()).setDisconnectInfo("");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (table.getState()) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ public class Round {
|
|||
if (!pair.isAlreadyPublished()) {
|
||||
tournament.updateResults();
|
||||
pair.setAlreadyPublished(true);
|
||||
if (tournament instanceof TournamentSingleElimination) {
|
||||
pair.eliminatePlayers();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ public abstract class TournamentImpl implements Tournament {
|
|||
round.getPlayerByes().add(player1);
|
||||
player1.setState(TournamentPlayerState.WAITING);
|
||||
player1.setStateInfo("Round Bye");
|
||||
updateResults();
|
||||
}
|
||||
return round;
|
||||
}
|
||||
|
|
@ -244,13 +245,21 @@ public abstract class TournamentImpl implements Tournament {
|
|||
TournamentPlayer tp2 = pair.getPlayer2();
|
||||
MatchPlayer mp1 = match.getPlayer(pair.getPlayer1().getPlayer().getId());
|
||||
MatchPlayer mp2 = match.getPlayer(pair.getPlayer2().getPlayer().getId());
|
||||
// set player satte
|
||||
if (round.getRoundNumber() == rounds.size()) {
|
||||
// set player state if he finished the round
|
||||
if (round.getRoundNumber() == rounds.size()) { // for elimination getRoundNumber = 0 so never true here
|
||||
if (tp1.getState().equals(TournamentPlayerState.DUELING)) {
|
||||
tp1.setState(TournamentPlayerState.WAITING);
|
||||
if (round.getRoundNumber() == getNumberRounds()) {
|
||||
tp1.setState(TournamentPlayerState.FINISHED);
|
||||
} else {
|
||||
tp1.setState(TournamentPlayerState.WAITING);
|
||||
}
|
||||
}
|
||||
if (tp2.getState().equals(TournamentPlayerState.DUELING)) {
|
||||
tp2.setState(TournamentPlayerState.WAITING);
|
||||
if (round.getRoundNumber() == getNumberRounds()) {
|
||||
tp2.setState(TournamentPlayerState.FINISHED);
|
||||
} else {
|
||||
tp2.setState(TournamentPlayerState.WAITING);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add round result
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class TournamentOptions implements Serializable {
|
|||
|
||||
protected String name;
|
||||
protected String tournamentType;;
|
||||
protected List<String> playerTypes = new ArrayList<String>();
|
||||
protected List<String> playerTypes = new ArrayList<>();
|
||||
protected MatchOptions matchOptions = new MatchOptions("", "Two Player Duel");
|
||||
protected LimitedOptions limitedOptions;
|
||||
protected boolean watchingAllowed = true;
|
||||
|
|
|
|||
|
|
@ -72,13 +72,15 @@ public class TournamentPairing {
|
|||
}
|
||||
|
||||
public void eliminatePlayers() {
|
||||
MatchPlayer mPlayer1 = match.getPlayer(player1.getPlayer().getId());
|
||||
MatchPlayer mPlayer2 = match.getPlayer(player2.getPlayer().getId());
|
||||
if (mPlayer1.hasQuit() || (!mPlayer2.hasQuit() && mPlayer1.getWins() < match.getWinsNeeded())) {
|
||||
player1.setEliminated();
|
||||
}
|
||||
if (mPlayer2.hasQuit() || (!mPlayer1.hasQuit() && mPlayer2.getWins() < match.getWinsNeeded())) {
|
||||
player2.setEliminated();
|
||||
if (match.isMatchOver()) {
|
||||
MatchPlayer mPlayer1 = match.getPlayer(player1.getPlayer().getId());
|
||||
MatchPlayer mPlayer2 = match.getPlayer(player2.getPlayer().getId());
|
||||
if (mPlayer1.hasQuit() || (!mPlayer2.hasQuit() && mPlayer1.getWins() < match.getWinsNeeded())) {
|
||||
player1.setEliminated();
|
||||
}
|
||||
if (mPlayer2.hasQuit() || (!mPlayer1.hasQuit() && mPlayer2.getWins() < match.getWinsNeeded())) {
|
||||
player2.setEliminated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public abstract class TournamentSwiss extends TournamentImpl {
|
|||
round.getPlayerByes().add(player1);
|
||||
player1.setState(TournamentPlayerState.WAITING);
|
||||
player1.setStateInfo("Round Bye");
|
||||
updateResults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23196,4 +23196,5 @@ Mana Confluence|Journey into Nyx|163|R||Land|||{T}, Pay 1 life: Add one mana of
|
|||
Hypnotic Siren|Journey into Nyx|42|R|{U}|Enchantment Creature - Siren|1|1|Bestow 5UU (If you cast this card for its bestow cost, it's an Aura spell with enchant creature. It becomes a creature again if it's not attached to a creature.)$Flying$You control enchanted creature.$Enchanted creature gets +1/+1 and has flying.|
|
||||
Kiora's Dismissal|Journey into Nyx|44|R|{U}|Instant|||Strive — Kiora's Dismissal costs U more to cast for each target beyond the first.$Return any number of target enchantments to their owners' hands.|
|
||||
Worst Fears|Journey into Nyx|97|M|{7}{B}|Sorcery|||You control target player during that player's next turn. Exile Worst Fears. (You see all cards that player could see and make all decisions for that player.)|
|
||||
Ritual of the Returned|Journey into Nyx|80|U|{3}{B}|Instant|||Exile target creature card from your graveyard. Put a black Zombie creature token onto the battlefield with power equal to the exiled card's power and toughness equal to the exiled card's toughness.|
|
||||
Ritual of the Returned|Journey into Nyx|80|U|{3}{B}|Instant|||Exile target creature card from your graveyard. Put a black Zombie creature token onto the battlefield with power equal to the exiled card's power and toughness equal to the exiled card's toughness.|
|
||||
Pheres Band Warchief|Journey into Nyx|135|R|{3}{G}|Creature - Centaur Warrior|3|3|Vigilance, trample$Other Centaur creatures you control get +1/+1 and have vigilance and trample.|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue