Added constructed league format.

This commit is contained in:
marcins78@gmail.com
2012-03-08 12:16:34 +00:00
parent ac19b361d7
commit fa152b7e3d
8 changed files with 326 additions and 216 deletions

View File

@@ -0,0 +1,81 @@
package com.gempukku.lotro.league;
import com.gempukku.lotro.collection.CollectionsManager;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.Player;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ConstructedLeagueData implements LeagueData {
private List<LeagueSerieData> _series = new ArrayList<LeagueSerieData>();
private String _leaguePrizePool;
private CollectionType _prizeCollectionType = new CollectionType("permanent", "My cards");
private float _prizeMultiplier;
private LeaguePrizes _leaguePrizes = new LeaguePrizes();
// Example params - 20120312,fotr_block,0.7,default,All cards,7,10,3,fotr1_block,fotr_block,fotr2_block,fotr_block,fotr_block,fotr_block
// Which means - start date,league prize pool,prizes multiplier,collection type,collection name,serie length,serie match count,series count,
// serie1 format, serie1 prize pool,
// serie2 format, serie2 prize pool,
// serie3 format, serie3 prize pool,
public ConstructedLeagueData(String parameters) {
String[] params = parameters.split(",");
final int start = Integer.parseInt(params[0]);
_leaguePrizePool = params[1];
_prizeMultiplier = Float.parseFloat(params[2]);
CollectionType collectionType = new CollectionType(params[3], params[4]);
int days = Integer.parseInt(params[5]);
int matchCount = Integer.parseInt(params[6]);
int series = Integer.parseInt(params[7]);
for (int i = 0; i < series; i++) {
String format = params[8 + i * 2];
String seriePrizePool = params[9 + i * 2];
DefaultLeagueSerieData data = new DefaultLeagueSerieData(_leaguePrizes, false, "Week " + (i + 1), getDate(start, i * days), getDate(start, ((i + 1) * days) - 1), matchCount, format, seriePrizePool, collectionType);
_series.add(data);
}
}
private int getDate(int start, int dayOffset) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Date date = format.parse(String.valueOf(start));
date.setDate(date.getDate() + dayOffset);
return Integer.parseInt(format.format(date));
} catch (ParseException exp) {
throw new RuntimeException("Can't parse date", exp);
}
}
@Override
public List<LeagueSerieData> getSeries() {
return _series;
}
@Override
public CardCollection joinLeague(CollectionsManager collecionsManager, Player player, int currentTime) {
return null;
}
@Override
public int process(CollectionsManager collectionsManager, List<LeagueStanding> leagueStandings, int oldStatus, int currentTime) {
int status = oldStatus;
if (status == 0) {
LeagueSerieData lastSerie = _series.get(_series.size() - 1);
if (currentTime > getDate(lastSerie.getEnd(), 1)) {
for (LeagueStanding leagueStanding : leagueStandings) {
CardCollection leaguePrize = _leaguePrizes.getPrizeForLeague(leagueStanding.getStanding(), leagueStandings.size(), _prizeMultiplier, _leaguePrizePool);
collectionsManager.addItemsToPlayerCollection(leagueStanding.getPlayerName(), _prizeCollectionType, leaguePrize.getAll());
}
status++;
}
}
return status;
}
}

View File

@@ -3,22 +3,26 @@ package com.gempukku.lotro.league;
import com.gempukku.lotro.db.vo.CollectionType;
import com.gempukku.lotro.game.CardCollection;
public class SealedLeagueSerieData implements LeagueSerieData {
private SealedLeaguePrizes _leaguePrizes;
public class DefaultLeagueSerieData implements LeagueSerieData {
private LeaguePrizes _leaguePrizes;
private boolean _limited;
private String _name;
private int _start;
private int _end;
private int _maxMatches;
private String _format;
private String _prizePool;
private CollectionType _collectionType;
public SealedLeagueSerieData(SealedLeaguePrizes leaguePrizes, String name, int start, int end, int maxMatches, String format, CollectionType collectionType) {
public DefaultLeagueSerieData(LeaguePrizes leaguePrizes, boolean limited, String name, int start, int end, int maxMatches, String format, String prizePool, CollectionType collectionType) {
_leaguePrizes = leaguePrizes;
_limited = limited;
_name = name;
_start = start;
_end = end;
_maxMatches = maxMatches;
_format = format;
_prizePool = prizePool;
_collectionType = collectionType;
}
@@ -44,7 +48,7 @@ public class SealedLeagueSerieData implements LeagueSerieData {
@Override
public boolean isLimited() {
return true;
return _limited;
}
@Override
@@ -59,11 +63,11 @@ public class SealedLeagueSerieData implements LeagueSerieData {
@Override
public CardCollection getPrizeForLeagueMatchWinner(int winCountThisSerie, int totalGamesPlayedThisSerie) {
return _leaguePrizes.getPrizeForLeagueMatchWinner(winCountThisSerie, totalGamesPlayedThisSerie, _format);
return _leaguePrizes.getPrizeForLeagueMatchWinner(winCountThisSerie, totalGamesPlayedThisSerie, _prizePool);
}
@Override
public CardCollection getPrizeForLeagueMatchLoser(int winCountThisSerie, int totalGamesPlayedThisSerie) {
return _leaguePrizes.getPrizeForLeagueMatchLoser(winCountThisSerie, totalGamesPlayedThisSerie, _format);
return _leaguePrizes.getPrizeForLeagueMatchLoser(winCountThisSerie, totalGamesPlayedThisSerie, _prizePool);
}
}

View File

@@ -1,22 +1,189 @@
package com.gempukku.lotro.league;
import com.gempukku.lotro.cards.packs.RarityReader;
import com.gempukku.lotro.cards.packs.SetRarity;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.DefaultCardCollection;
import java.util.*;
public class LeaguePrizes {
public static void main(String[] args) {
int players = 32;
int lastDisplayed = 0;
int lastCount = Integer.MAX_VALUE;
for (int i = 1; i <= players; i++) {
int count = (int) Math.floor((2 * players + 24) / (i + 9) - 2.4);
if (lastCount != count) {
if (lastDisplayed > 0 && lastCount > 0) {
if (lastDisplayed == (i - 1))
System.out.println(lastDisplayed + ": " + lastCount);
else
System.out.println(lastDisplayed + "-" + (i - 1) + ": " + lastCount);
}
lastCount = count;
lastDisplayed = i;
private Map<String, List<String>> _blockPromos = new HashMap<String, List<String>>();
private Map<String, List<String>> _blockCommons = new HashMap<String, List<String>>();
private Map<String, List<String>> _blockUncommons = new HashMap<String, List<String>>();
private static final String FOTR_BLOCK = "fotr_block";
private static final String TTT_BLOCK = "ttt_block";
public LeaguePrizes() {
List<String> fotrPromos = new ArrayList<String>();
fotrPromos.add("0_1");
fotrPromos.add("0_2");
fotrPromos.add("0_3");
fotrPromos.add("0_4");
fotrPromos.add("0_5");
fotrPromos.add("0_6");
fotrPromos.add("0_7");
fotrPromos.add("0_8");
fotrPromos.add("0_9");
fotrPromos.add("0_10");
fotrPromos.add("0_11");
fotrPromos.add("0_12");
fotrPromos.add("0_13");
fotrPromos.add("0_14");
fotrPromos.add("0_15");
fotrPromos.add("0_34");
fotrPromos.add("0_36");
fotrPromos.add("0_37");
fotrPromos.add("0_41");
fotrPromos.add("0_42");
fotrPromos.add("0_43");
_blockPromos.put(FOTR_BLOCK, fotrPromos);
List<String> tttPromos = new ArrayList<String>();
tttPromos.add("0_16");
tttPromos.add("0_17");
tttPromos.add("0_18");
tttPromos.add("0_19");
tttPromos.add("0_21");
tttPromos.add("0_22");
tttPromos.add("0_30");
tttPromos.add("0_32");
tttPromos.add("0_33");
tttPromos.add("0_35");
tttPromos.add("0_38");
tttPromos.add("0_39");
tttPromos.add("0_40");
tttPromos.add("0_44");
tttPromos.add("0_45");
tttPromos.add("0_46");
tttPromos.add("0_47");
_blockPromos.put(TTT_BLOCK, tttPromos);
RarityReader rarityReader = new RarityReader();
SetRarity fotrRarity = rarityReader.getSetRarity("1");
SetRarity momRarity = rarityReader.getSetRarity("2");
SetRarity rotelRarity = rarityReader.getSetRarity("3");
SetRarity tttRarity = rarityReader.getSetRarity("4");
SetRarity bohdRarity = rarityReader.getSetRarity("5");
SetRarity eofRarity = rarityReader.getSetRarity("6");
List<String> fotrCommons = new ArrayList<String>();
fotrCommons.addAll(fotrRarity.getCardsOfRarity("C"));
fotrCommons.addAll(momRarity.getCardsOfRarity("C"));
fotrCommons.addAll(rotelRarity.getCardsOfRarity("C"));
_blockCommons.put(FOTR_BLOCK, fotrCommons);
List<String> fotrUncommons = new ArrayList<String>();
fotrUncommons.addAll(fotrRarity.getCardsOfRarity("U"));
fotrUncommons.addAll(momRarity.getCardsOfRarity("U"));
fotrUncommons.addAll(rotelRarity.getCardsOfRarity("U"));
_blockUncommons.put(FOTR_BLOCK, fotrUncommons);
List<String> tttCommons = new ArrayList<String>();
tttCommons.addAll(tttRarity.getCardsOfRarity("C"));
tttCommons.addAll(bohdRarity.getCardsOfRarity("C"));
tttCommons.addAll(eofRarity.getCardsOfRarity("C"));
_blockCommons.put(TTT_BLOCK, tttCommons);
List<String> tttUncommons = new ArrayList<String>();
tttUncommons.addAll(tttRarity.getCardsOfRarity("U"));
tttUncommons.addAll(bohdRarity.getCardsOfRarity("U"));
tttUncommons.addAll(eofRarity.getCardsOfRarity("U"));
_blockUncommons.put(TTT_BLOCK, tttUncommons);
}
public CardCollection getPrizeForLeagueMatchWinner(int winCountThisSerie, int totalGamesPlayedThisSerie, String format) {
DefaultCardCollection winnerPrize = new DefaultCardCollection();
if (winCountThisSerie == 1 || winCountThisSerie == 3 || winCountThisSerie == 5 || winCountThisSerie == 8 || winCountThisSerie == 10)
winnerPrize.addItem("(S)Booster Choice", 1);
else {
List<String> blockCommons = _blockCommons.get(format);
List<String> blockUncommons = _blockUncommons.get(format);
List<String> blockPromos = _blockPromos.get(format);
if (winCountThisSerie == 2)
winnerPrize.addItem(getRandom(blockCommons) + "*", 1);
else if (winCountThisSerie == 4)
winnerPrize.addItem(getRandom(blockPromos), 1);
else if (winCountThisSerie == 6)
winnerPrize.addItem(getRandom(blockPromos) + "*", 1);
else if (winCountThisSerie == 7)
winnerPrize.addItem(getRandom(blockUncommons) + "*", 1);
else if (winCountThisSerie == 9) {
winnerPrize.addItem(getRandom(blockPromos), 1);
winnerPrize.addItem(getRandom(blockCommons) + "*", 1);
}
}
return winnerPrize;
}
public CardCollection getPrizeForLeagueMatchLoser(int winCountThisSerie, int totalGamesPlayedThisSerie, String format) {
return null;
}
public CardCollection getPrizeForLeague(int position, int playersCount, float multiplier, String format) {
DefaultCardCollection leaguePrize = new DefaultCardCollection();
int count = (int) Math.floor((2 * playersCount + 24) / (position + 9) - 2.4);
if (count > 0) {
count = 1 + (int) Math.floor((count - 1) * multiplier);
leaguePrize.addItem("(S)Booster Choice", count);
}
int tengwar = getTengwarCount(position);
if (tengwar > 0) {
if (format.equals(FOTR_BLOCK))
leaguePrize.addItem("(S)FotR - Tengwar", tengwar);
else if (format.equals(TTT_BLOCK))
leaguePrize.addItem("(S)TTT - Tengwar", tengwar);
}
if (position == 1) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 3));
} else if (position == 2) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 2));
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 1));
} else if (position == 3) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 1));
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 2));
} else if (position >= 4 && position <= 6) {
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 7 - position));
} else if (position >= 9 && position <= 12) {
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 1));
}
return leaguePrize;
}
private void addPrizes(DefaultCardCollection leaguePrize, List<String> cards) {
for (String card : cards)
leaguePrize.addItem(card, 1);
}
private int getTengwarCount(int position) {
if (position == 1)
return 4;
else if (position == 2)
return 3;
else if (position == 3)
return 2;
else if (position <= 8)
return 1;
return 0;
}
private String getRandom(List<String> list) {
return list.get(new Random().nextInt(list.size()));
}
private List<String> getRandom(List<String> list, int count) {
List<String> result = new LinkedList<String>(list);
Collections.shuffle(result);
return result.subList(0, count);
}
private List<String> getRandomFoil(List<String> list, int count) {
List<String> result = new LinkedList<String>();
for (String element : list)
result.add(element + "*");
Collections.shuffle(result);
return result.subList(0, count);
}
}

View File

@@ -16,7 +16,7 @@ public class SealedLeagueData implements LeagueData {
private List<LeagueSerieData> _series;
private CollectionType _collectionType;
private CollectionType _prizeCollectionType = new CollectionType("permanent", "My cards");
private SealedLeaguePrizes _leaguePrizes;
private LeaguePrizes _leaguePrizes;
private SealedLeagueProduct _leagueProduct;
public SealedLeagueData(String parameters) {
@@ -28,14 +28,15 @@ public class SealedLeagueData implements LeagueData {
int serieDuration = 7;
int maxMatches = 10;
_leaguePrizes = new SealedLeaguePrizes();
_leaguePrizes = new LeaguePrizes();
_leagueProduct = new SealedLeagueProduct();
_series = new LinkedList<LeagueSerieData>();
for (int i = 0; i < 4; i++) {
_series.add(
new SealedLeagueSerieData(_leaguePrizes, "Week " + (i + 1),
getDate(start, i * serieDuration), getDate(start, (i + 1) * serieDuration - 1), maxMatches, _format, _collectionType));
new DefaultLeagueSerieData(_leaguePrizes, true, "Week " + (i + 1),
getDate(start, i * serieDuration), getDate(start, (i + 1) * serieDuration - 1), maxMatches,
_format, _format, _collectionType));
}
}
@@ -89,9 +90,9 @@ public class SealedLeagueData implements LeagueData {
if (status == _series.size()) {
LeagueSerieData lastSerie = _series.get(_series.size() - 1);
if (currentTime >= getDate(lastSerie.getEnd(), 1)) {
if (currentTime > getDate(lastSerie.getEnd(), 1)) {
for (LeagueStanding leagueStanding : leagueStandings) {
CardCollection leaguePrize = _leaguePrizes.getPrizeForLeague(leagueStanding.getStanding(), leagueStandings.size(), _format);
CardCollection leaguePrize = _leaguePrizes.getPrizeForLeague(leagueStanding.getStanding(), leagueStandings.size(), 1f, _format);
collectionsManager.addItemsToPlayerCollection(leagueStanding.getPlayerName(), _prizeCollectionType, leaguePrize.getAll());
}
for (LeagueStanding leagueStanding : leagueStandings) {

View File

@@ -1,187 +0,0 @@
package com.gempukku.lotro.league;
import com.gempukku.lotro.cards.packs.RarityReader;
import com.gempukku.lotro.cards.packs.SetRarity;
import com.gempukku.lotro.game.CardCollection;
import com.gempukku.lotro.game.DefaultCardCollection;
import java.util.*;
public class SealedLeaguePrizes {
private Map<String, List<String>> _blockPromos = new HashMap<String, List<String>>();
private Map<String, List<String>> _blockCommons = new HashMap<String, List<String>>();
private Map<String, List<String>> _blockUncommons = new HashMap<String, List<String>>();
private static final String FOTR_BLOCK = "fotr_block";
private static final String TTT_BLOCK = "ttt_block";
public SealedLeaguePrizes() {
List<String> fotrPromos = new ArrayList<String>();
fotrPromos.add("0_1");
fotrPromos.add("0_2");
fotrPromos.add("0_3");
fotrPromos.add("0_4");
fotrPromos.add("0_5");
fotrPromos.add("0_6");
fotrPromos.add("0_7");
fotrPromos.add("0_8");
fotrPromos.add("0_9");
fotrPromos.add("0_10");
fotrPromos.add("0_11");
fotrPromos.add("0_12");
fotrPromos.add("0_13");
fotrPromos.add("0_14");
fotrPromos.add("0_15");
fotrPromos.add("0_34");
fotrPromos.add("0_36");
fotrPromos.add("0_37");
fotrPromos.add("0_41");
fotrPromos.add("0_42");
fotrPromos.add("0_43");
_blockPromos.put(FOTR_BLOCK, fotrPromos);
List<String> tttPromos = new ArrayList<String>();
tttPromos.add("0_16");
tttPromos.add("0_17");
tttPromos.add("0_18");
tttPromos.add("0_19");
tttPromos.add("0_21");
tttPromos.add("0_22");
tttPromos.add("0_30");
tttPromos.add("0_32");
tttPromos.add("0_33");
tttPromos.add("0_35");
tttPromos.add("0_38");
tttPromos.add("0_39");
tttPromos.add("0_40");
tttPromos.add("0_44");
tttPromos.add("0_45");
tttPromos.add("0_46");
tttPromos.add("0_47");
_blockPromos.put(TTT_BLOCK, tttPromos);
RarityReader rarityReader = new RarityReader();
SetRarity fotrRarity = rarityReader.getSetRarity("1");
SetRarity momRarity = rarityReader.getSetRarity("2");
SetRarity rotelRarity = rarityReader.getSetRarity("3");
SetRarity tttRarity = rarityReader.getSetRarity("4");
SetRarity bohdRarity = rarityReader.getSetRarity("5");
SetRarity eofRarity = rarityReader.getSetRarity("6");
List<String> fotrCommons = new ArrayList<String>();
fotrCommons.addAll(fotrRarity.getCardsOfRarity("C"));
fotrCommons.addAll(momRarity.getCardsOfRarity("C"));
fotrCommons.addAll(rotelRarity.getCardsOfRarity("C"));
_blockCommons.put(FOTR_BLOCK, fotrCommons);
List<String> fotrUncommons = new ArrayList<String>();
fotrUncommons.addAll(fotrRarity.getCardsOfRarity("U"));
fotrUncommons.addAll(momRarity.getCardsOfRarity("U"));
fotrUncommons.addAll(rotelRarity.getCardsOfRarity("U"));
_blockUncommons.put(FOTR_BLOCK, fotrUncommons);
List<String> tttCommons = new ArrayList<String>();
tttCommons.addAll(tttRarity.getCardsOfRarity("C"));
tttCommons.addAll(bohdRarity.getCardsOfRarity("C"));
tttCommons.addAll(eofRarity.getCardsOfRarity("C"));
_blockCommons.put(TTT_BLOCK, tttCommons);
List<String> tttUncommons = new ArrayList<String>();
tttUncommons.addAll(tttRarity.getCardsOfRarity("U"));
tttUncommons.addAll(bohdRarity.getCardsOfRarity("U"));
tttUncommons.addAll(eofRarity.getCardsOfRarity("U"));
_blockUncommons.put(TTT_BLOCK, tttUncommons);
}
public CardCollection getPrizeForLeagueMatchWinner(int winCountThisSerie, int totalGamesPlayedThisSerie, String format) {
DefaultCardCollection winnerPrize = new DefaultCardCollection();
if (winCountThisSerie == 1 || winCountThisSerie == 3 || winCountThisSerie == 5 || winCountThisSerie == 8 || winCountThisSerie == 10)
winnerPrize.addItem("(S)Booster Choice", 1);
else {
List<String> blockCommons = _blockCommons.get(format);
List<String> blockUncommons = _blockUncommons.get(format);
List<String> blockPromos = _blockPromos.get(format);
if (winCountThisSerie == 2)
winnerPrize.addItem(getRandom(blockCommons) + "*", 1);
else if (winCountThisSerie == 4)
winnerPrize.addItem(getRandom(blockPromos), 1);
else if (winCountThisSerie == 6)
winnerPrize.addItem(getRandom(blockPromos) + "*", 1);
else if (winCountThisSerie == 7)
winnerPrize.addItem(getRandom(blockUncommons) + "*", 1);
else if (winCountThisSerie == 9) {
winnerPrize.addItem(getRandom(blockPromos), 1);
winnerPrize.addItem(getRandom(blockCommons) + "*", 1);
}
}
return winnerPrize;
}
public CardCollection getPrizeForLeagueMatchLoser(int winCountThisSerie, int totalGamesPlayedThisSerie, String format) {
return null;
}
public CardCollection getPrizeForLeague(int position, int playersCount, String format) {
DefaultCardCollection leaguePrize = new DefaultCardCollection();
int count = (int) Math.floor((2 * playersCount + 24) / (position + 9) - 2.4);
if (count > 0)
leaguePrize.addItem("(S)Booster Choice", count);
int tengwar = getTengwarCount(position);
if (tengwar > 0) {
if (format.equals(FOTR_BLOCK))
leaguePrize.addItem("(S)FotR - Tengwar", tengwar);
else if (format.equals(TTT_BLOCK))
leaguePrize.addItem("(S)TTT - Tengwar", tengwar);
}
if (position == 1) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 3));
} else if (position == 2) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 2));
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 1));
} else if (position == 3) {
addPrizes(leaguePrize, getRandomFoil(_blockPromos.get(format), 1));
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 2));
} else if (position >= 4 && position <= 6) {
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 7 - position));
} else if (position >= 9 && position <= 12) {
addPrizes(leaguePrize, getRandom(_blockPromos.get(format), 1));
}
return leaguePrize;
}
private void addPrizes(DefaultCardCollection leaguePrize, List<String> cards) {
for (String card : cards)
leaguePrize.addItem(card, 1);
}
private int getTengwarCount(int position) {
if (position == 1)
return 4;
else if (position == 2)
return 3;
else if (position == 3)
return 2;
else if (position <= 8)
return 1;
return 0;
}
private String getRandom(List<String> list) {
return list.get(new Random().nextInt(list.size()));
}
private List<String> getRandom(List<String> list, int count) {
List<String> result = new LinkedList<String>(list);
Collections.shuffle(result);
return result.subList(0, count);
}
private List<String> getRandomFoil(List<String> list, int count) {
List<String> result = new LinkedList<String>();
for (String element : list)
result.add(element + "*");
Collections.shuffle(result);
return result.subList(0, count);
}
}

View File

@@ -7,6 +7,24 @@
"restricted": ["1_248"],
"set": [1,2,3]
},
{
"name": "Fellowship block - Part 1",
"code": "fotr1_block",
"sites": "FELLOWSHIP",
"cancelRingBearerSkirmish": true,
"restricted": ["1_248"],
"set": [1],
"hall": false
},
{
"name": "Fellowship block - Part 2",
"code": "fotr2_block",
"sites": "FELLOWSHIP",
"cancelRingBearerSkirmish": true,
"restricted": ["1_248"],
"set": [1,2],
"hall": false
},
{
"name": "Towers block",
"code": "ttt_block",

View File

@@ -0,0 +1,26 @@
package com.gempukku.lotro.league;
import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ConstructedLeagueDataTest {
@Test
public void testParameters() {
ConstructedLeagueData leagueData = new ConstructedLeagueData("20120312,fotr_block,0.7,default,All cards,7,10,3,fotr1_block,fotr_block,fotr2_block,fotr_block,fotr_block,fotr_block");
final List<LeagueSerieData> series = leagueData.getSeries();
assertTrue(series.size() == 3);
assertTrue(series.get(0).getStart() == 20120312);
assertTrue(series.get(0).getEnd() == 20120318);
assertEquals("fotr1_block", series.get(0).getFormat());
assertTrue(series.get(1).getStart() == 20120319);
assertTrue(series.get(1).getEnd() == 20120325);
assertEquals("fotr2_block", series.get(1).getFormat());
assertTrue(series.get(2).getStart() == 20120326);
assertTrue(series.get(2).getEnd() == 20120401);
assertEquals("fotr_block", series.get(2).getFormat());
}
}

View File

@@ -5,10 +5,10 @@ import org.junit.Test;
import java.util.Map;
public class SealedLeaguePrizesTest {
public class LeaguePrizesTest {
@Test
public void test() {
SealedLeaguePrizes leaguePrizes = new SealedLeaguePrizes();
LeaguePrizes leaguePrizes = new LeaguePrizes();
CardCollection prize = leaguePrizes.getPrizeForLeagueMatchWinner(2, 2, "fotr_block");
for (Map.Entry<String, Integer> stringIntegerEntry : prize.getAll().entrySet()) {
System.out.println(stringIntegerEntry.getKey() + ": " + stringIntegerEntry.getValue());