Fixing Open and Expanded formats.
This commit is contained in:
@@ -36,6 +36,11 @@ public abstract class DefaultLotroFormat implements LotroFormat {
|
||||
_canCancelRingBearerSkirmish = canCancelRingBearerSkirmish;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isOrderedSites() {
|
||||
return _siteBlock != Block.OTHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
|
||||
@@ -63,9 +63,4 @@ public class ExpandedFormat extends DefaultLotroFormat {
|
||||
addRestrictedCard("4_276");
|
||||
addRestrictedCard("4_304");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,4 @@ public class FotRBlockFormat extends DefaultLotroFormat {
|
||||
addValidSet(2);
|
||||
addValidSet(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,4 @@ public class KingBlockFormat extends DefaultLotroFormat {
|
||||
addValidSet(8);
|
||||
addValidSet(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,4 @@ public class MovieFormat extends DefaultLotroFormat {
|
||||
addValidSet(9);
|
||||
addValidSet(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,9 +34,4 @@ public class OpenFormat extends DefaultLotroFormat {
|
||||
addRestrictedCard("11_100");
|
||||
addRestrictedCard("11_132");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,4 @@ public class TTTBlockFormat extends DefaultLotroFormat {
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,4 @@ public class TowersStandardFormat extends DefaultLotroFormat {
|
||||
addValidSet(5);
|
||||
addValidSet(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,4 @@ public class WarOfTheRingBlockFormat extends DefaultLotroFormat {
|
||||
addValidSet(12);
|
||||
addValidSet(13);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.gempukku.lotro.league;
|
||||
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.db.vo.League;
|
||||
import com.gempukku.lotro.game.*;
|
||||
import com.gempukku.lotro.game.formats.DefaultLotroFormat;
|
||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class LeagueFormat extends DefaultLotroFormat {
|
||||
private LotroCardBlueprintLibrary _library;
|
||||
private LeagueService _leagueService;
|
||||
private League _league;
|
||||
private boolean _orderedSites;
|
||||
|
||||
public LeagueFormat(LotroCardBlueprintLibrary library, LeagueService leagueService, League league, boolean orderedSites) {
|
||||
super(library, Block.FELLOWSHIP, true, 60, Integer.MAX_VALUE, true, true);
|
||||
_library = library;
|
||||
_leagueService = leagueService;
|
||||
_league = league;
|
||||
_orderedSites = orderedSites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateDeck(Player player, LotroDeck deck) throws DeckInvalidException {
|
||||
// First validate the deck is valid at all
|
||||
super.validateDeck(player, deck);
|
||||
|
||||
CardCollection playerCardCollection = _leagueService.getLeagueCollection(player, _league);
|
||||
|
||||
// Now check if player owns all the cards
|
||||
Map<String, Integer> deckCardCounts = CollectionUtils.getTotalCardCountForDeck(deck);
|
||||
final Map<String, Integer> collectionCardCounts = playerCardCollection.getAll();
|
||||
|
||||
for (Map.Entry<String, Integer> cardCount : deckCardCounts.entrySet()) {
|
||||
final Integer collectionCount = collectionCardCounts.get(cardCount.getKey());
|
||||
if (collectionCount == null || collectionCount < cardCount.getValue()) {
|
||||
String cardName = _library.getLotroCardBlueprint(cardCount.getKey()).getName();
|
||||
int owned = (collectionCount == null) ? 0 : collectionCount;
|
||||
throw new DeckInvalidException("You don't have the required cards in collection: " + cardName + " required " + cardCount.getValue() + ", owned " + owned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOrderedSites() {
|
||||
return _orderedSites;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user