Changed tournament structure

This commit is contained in:
marcin.sciesinski
2019-09-23 18:20:44 -07:00
parent 02c52d5d06
commit b34facb8d8
3 changed files with 24 additions and 7 deletions

View File

@@ -160,13 +160,13 @@ public class HallServer extends AbstractServer {
}
});
_tournamentQueues.put("fotr_queue", new ImmediateRecurringQueue(1000, "fotr_block",
_tournamentQueues.put("fotr_queue", new ImmediateRecurringQueue(1500, "fotr_block",
CollectionType.ALL_CARDS, "fotrQueue-", "Fellowship SitesBlock", 4,
true, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "onDemand"), _pairingMechanismRegistry.getPairingMechanism("singleElimination")));
_tournamentQueues.put("movie_queue", new ImmediateRecurringQueue(1000, "movie",
_tournamentQueues.put("movie_queue", new ImmediateRecurringQueue(1500, "movie",
CollectionType.ALL_CARDS, "movieQueue-", "Movie SitesBlock", 4,
true, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "onDemand"), _pairingMechanismRegistry.getPairingMechanism("singleElimination")));
_tournamentQueues.put("expanded_queue", new ImmediateRecurringQueue(1000, "expanded",
_tournamentQueues.put("expanded_queue", new ImmediateRecurringQueue(1500, "expanded",
CollectionType.ALL_CARDS, "expandedQueue-", "Expanded", 4,
true, tournamentService, _tournamentPrizeSchemeRegistry.getTournamentPrizes(cardSets, "onDemand"), _pairingMechanismRegistry.getPairingMechanism("singleElimination")));

View File

@@ -2,19 +2,32 @@ package com.gempukku.lotro.tournament;
import com.gempukku.lotro.competitive.PlayerStanding;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.CardSets;
import com.gempukku.lotro.game.DefaultCardCollection;
import com.gempukku.lotro.game.packs.SetDefinition;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
public class DailyTournamentPrizes implements TournamentPrizes {
private List<String> _promos = new ArrayList<String>();
private String _registryRepresentation;
public DailyTournamentPrizes(String registryRepresentation) {
public DailyTournamentPrizes(CardSets cardSets, String registryRepresentation) {
_registryRepresentation = registryRepresentation;
for (SetDefinition setDefinition : cardSets.getSetDefinitions().values()) {
if (setDefinition.hasFlag("originalSet"))
_promos.addAll(setDefinition.getCardsOfRarity("P"));
}
}
@Override
public CardCollection getPrizeForTournament(PlayerStanding playerStanding, int playersCount) {
DefaultCardCollection tournamentPrize = new DefaultCardCollection();
tournamentPrize.addItem("(S)Booster Choice", playerStanding.getPoints());
if (playerStanding.getPlayerWins() + playerStanding.getPlayerByes() >= 2)
tournamentPrize.addItem(getRandom(_promos), 1);
if (!tournamentPrize.getAll().iterator().hasNext()) {
return null;
@@ -27,6 +40,10 @@ public class DailyTournamentPrizes implements TournamentPrizes {
return null;
}
private String getRandom(List<String> list) {
return list.get(ThreadLocalRandom.current().nextInt(list.size()));
}
@Override
public String getRegistryRepresentation() {
return _registryRepresentation;
@@ -34,6 +51,6 @@ public class DailyTournamentPrizes implements TournamentPrizes {
@Override
public String getPrizeDescription() {
return "2 boosters per win (or bye), 1 per loss, max 3 rounds";
return "2 boosters per win (or bye), 1 per loss, max 3 rounds, players with at least 2 wins get a promo";
}
}

View File

@@ -6,12 +6,12 @@ public class TournamentPrizeSchemeRegistry {
public TournamentPrizes getTournamentPrizes(CardSets cardSets, String prizesScheme) {
if (prizesScheme == null || prizesScheme.equals("none"))
return new NoPrizes();
if (prizesScheme.equals("onDemand"))
return new SingleEliminationOnDemandPrizes(cardSets, "onDemand");
if (prizesScheme.equals("daily"))
return new DailyTournamentPrizes("daily");
return new DailyTournamentPrizes(cardSets, "daily");
return null;
}