Auto-apply errata when joining PC format table
This commit is contained in:
@@ -93,10 +93,15 @@ public class DeckRequestHandler extends LotroServerRequestHandler implements Uri
|
||||
} catch (DeckInvalidException exp) {
|
||||
if (!format.getErrataCardMap().isEmpty()) {
|
||||
LotroDeck deckWithErrata = format.applyErrata(deck);
|
||||
format.validateDeck(deckWithErrata);
|
||||
valid.append("<b>" + format.getName() + "</b>: <font color='yellow'>valid (with PC errata)</font><br/>");
|
||||
try {
|
||||
format.validateDeck(deckWithErrata);
|
||||
valid.append("<b>" + format.getName() + "</b>: <font color='yellow'>valid (with errata automatically applied)</font><br/>");
|
||||
} catch (DeckInvalidException exp2) {
|
||||
invalid.append("<b>" + format.getName() + "</b>: <font color='red'>" + exp.getMessage() + "</font><br/>");
|
||||
}
|
||||
} else {
|
||||
invalid.append("<b>" + format.getName() + "</b>: <font color='red'>" + exp.getMessage() + "</font><br/>");
|
||||
}
|
||||
invalid.append("<b>" + format.getName() + "</b>: <font color='red'>" + exp.getMessage() + "</font><br/>");
|
||||
}
|
||||
}
|
||||
sb.append(valid);
|
||||
|
||||
@@ -1,431 +0,0 @@
|
||||
{
|
||||
"101_1": {
|
||||
"side": "free_people",
|
||||
"culture": "Gondor",
|
||||
"title": "*The Lords of Gondor Have Returned",
|
||||
"type": "condition",
|
||||
"cost": 2,
|
||||
"keyword": "support area",
|
||||
"effects": [
|
||||
{
|
||||
"type": "activated",
|
||||
"phase": "skirmish",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "bearer,inSkirmishAgainst(Nazgul)",
|
||||
},
|
||||
"cost": [
|
||||
{
|
||||
"type": "memorize",
|
||||
"filter": "bearer",
|
||||
"memory": "bearer"
|
||||
},
|
||||
{
|
||||
"type": "discard",
|
||||
"filter": "self"
|
||||
}
|
||||
],
|
||||
"effect":[
|
||||
{
|
||||
"type": "modifyStrength",
|
||||
"filter": "memory(bearer)",
|
||||
"amount": 3
|
||||
},
|
||||
{
|
||||
"type": "addKeyword",
|
||||
"filter": "memory(bearer)",
|
||||
"keyword": "damage+1"
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
"101_2": {
|
||||
"side": "free_people",
|
||||
"culture": "Gondor",
|
||||
"title": "*I Will Not Let the White City Fall",
|
||||
"type": "condition",
|
||||
"cost": 2,
|
||||
"keyword": "support area",
|
||||
"effects": [
|
||||
{
|
||||
"type": "trigger",
|
||||
"trigger": {
|
||||
"type": "losesSkirmish",
|
||||
"filter": "name(Boromir)"
|
||||
},
|
||||
"effect": {
|
||||
"type": "modifyStrength",
|
||||
"filter": "choose(name(Aragorn))",
|
||||
"amount": 2,
|
||||
"until": "start(regroup)"
|
||||
},
|
||||
},
|
||||
{
|
||||
"type": "trigger",
|
||||
"trigger": {
|
||||
"type": "losesSkirmish",
|
||||
"filter": "name(Aragorn)"
|
||||
},
|
||||
"effect": {
|
||||
"type": "modifyStrength",
|
||||
"filter": "choose(name(Boromir))",
|
||||
"amount": 2,
|
||||
"until": "start(regroup)"
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"101_3": {
|
||||
"side": "free_people",
|
||||
"culture": "Gondor",
|
||||
"title": "*Boromir",
|
||||
"subtitle": "The Redeemed",
|
||||
"type": "companion",
|
||||
"cost": 3,
|
||||
"race": "man",
|
||||
"strength": 7,
|
||||
"vitality": 3,
|
||||
"resistance": 6,
|
||||
"signet": "aragorn",
|
||||
"effects": [
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "addKeyword",
|
||||
"filter": "self",
|
||||
"keyword": "defender+1",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "companion,culture(shire)",
|
||||
"count": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "modifyStrength",
|
||||
"filter": "self",
|
||||
"amount": 2,
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "companion,culture(shire)",
|
||||
"count": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "addKeyword",
|
||||
"filter": "self",
|
||||
"keyword": "damage+1",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "companion,culture(shire)",
|
||||
"count": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
"101_4": {
|
||||
"side": "free_people",
|
||||
"culture": "Gondor",
|
||||
"title": "*Loud and Clear It Sounds",
|
||||
"type": "condition",
|
||||
"cost": 1,
|
||||
"keyword": "support area",
|
||||
"effects": [
|
||||
{
|
||||
"type": "trigger",
|
||||
"optional": true,
|
||||
"trigger": {
|
||||
"type": "assignedToSkirmish",
|
||||
"filter": "companion,culture(shire)",
|
||||
"side": "shadow",
|
||||
"memorizeAssigned": "assignedHobbit",
|
||||
"memorizeAgainst": "assignedMinion"
|
||||
},
|
||||
"cost": [
|
||||
{
|
||||
"type": "exert",
|
||||
"count": 1,
|
||||
"filter": "choose(companion,culture(gondor))",
|
||||
"memorize": "newAssignee"
|
||||
},
|
||||
{
|
||||
"type": "discard",
|
||||
"filter": "self"
|
||||
}
|
||||
],
|
||||
"effect": {
|
||||
"type": "replaceInAssignment",
|
||||
"filter": "memory(assignedHobbit)",
|
||||
"with": "memory(newAssignee)"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"101_5": {
|
||||
"side": "free_people",
|
||||
"culture": "Gondor",
|
||||
"title": "Remnant of Numenor",
|
||||
"type": "condition",
|
||||
"cost": 1,
|
||||
"keyword": "support area",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "companion,culture(gondor)"
|
||||
},
|
||||
"effects": {
|
||||
"type": "trigger",
|
||||
"optional": true,
|
||||
"trigger": {
|
||||
"type": "discardFromHand",
|
||||
"filter": "any",
|
||||
"player": "shadowPlayer"
|
||||
},
|
||||
"cost": {
|
||||
"type": "addTwilight",
|
||||
"amount": 1
|
||||
},
|
||||
"effect": {
|
||||
"type": "shuffleCardsFromDiscardIntoDrawDeck",
|
||||
"filter": "choose(culture(gondor))",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"101_6": {
|
||||
"side": "shadow",
|
||||
"culture": "Sauron",
|
||||
"title": "*Great Wolf Chief",
|
||||
"type": "minion",
|
||||
"cost": 5,
|
||||
"race": "warg",
|
||||
"strength": 10,
|
||||
"vitality": 3,
|
||||
"site": 6,
|
||||
"keyword": [
|
||||
"tracker",
|
||||
"fierce"
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "ModifySiteNumber",
|
||||
"filter": "self",
|
||||
"amount": {
|
||||
"type": "forEachYouCanSpot",
|
||||
"filter": "stealth",
|
||||
"multiplier": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "trigger",
|
||||
"optional": true,
|
||||
"trigger": {
|
||||
"type": "played",
|
||||
"filter": "another,culture(sauron),warg"
|
||||
},
|
||||
"effect": {
|
||||
"type": "exert",
|
||||
"player": "fp",
|
||||
"filter": "choose(companion)",
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"101_7": {
|
||||
"side": "shadow",
|
||||
"culture": "Sauron",
|
||||
"title": "Hollin Snarler",
|
||||
"type": "minion",
|
||||
"cost": 3,
|
||||
"race": "warg",
|
||||
"strength": 4,
|
||||
"vitality": 3,
|
||||
"site": 6,
|
||||
"keyword": [
|
||||
"tracker",
|
||||
"fierce"
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "ModifySiteNumber",
|
||||
"filter": "self",
|
||||
"amount": {
|
||||
"type": "forEachYouCanSpot",
|
||||
"filter": "stealth",
|
||||
"multiplier": -1
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"type": "modifier",
|
||||
"modifier": {
|
||||
"type": "ModifyStrength",
|
||||
"filter": "self",
|
||||
"amount": {
|
||||
"type": "forEachYouCanSpot",
|
||||
"filter": "or(stealth,and(companion,wounded))",
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
"101_8": {
|
||||
"side": "shadow",
|
||||
"culture": "Sauron",
|
||||
"title": "Hound of Sauron",
|
||||
"type": "minion",
|
||||
"cost": 2,
|
||||
"race": "warg",
|
||||
"strength": 6,
|
||||
"vitality": 2,
|
||||
"site": 6,
|
||||
"keyword": [
|
||||
"tracker",
|
||||
"fierce"
|
||||
],
|
||||
"effects": [
|
||||
{
|
||||
"type": "activated",
|
||||
"phase": "skirmish",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "bearer,inSkirmishAgainst(Nazgul)",
|
||||
},
|
||||
"cost": [
|
||||
{
|
||||
"type": "memorize",
|
||||
"filter": "bearer",
|
||||
"memory": "bearer"
|
||||
},
|
||||
{
|
||||
"type": "discard",
|
||||
"filter": "self"
|
||||
}
|
||||
],
|
||||
"effect":[
|
||||
{
|
||||
"type": "modifyStrength",
|
||||
"filter": "memory(bearer)",
|
||||
"amount": 3
|
||||
},
|
||||
{
|
||||
"type": "addKeyword",
|
||||
"filter": "memory(bearer)",
|
||||
"keyword": "damage+1"
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
"101_9": {
|
||||
"side": "shadow",
|
||||
"culture": "Sauron",
|
||||
"title": "*The Hunt is Up!",
|
||||
"type": "condition",
|
||||
"cost": 1,
|
||||
"keyword": "support area",
|
||||
"effects": [
|
||||
{
|
||||
"type": "activated",
|
||||
"phase": "skirmish",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "bearer,inSkirmishAgainst(Nazgul)",
|
||||
},
|
||||
"cost": [
|
||||
{
|
||||
"type": "memorize",
|
||||
"filter": "bearer",
|
||||
"memory": "bearer"
|
||||
},
|
||||
{
|
||||
"type": "discard",
|
||||
"filter": "self"
|
||||
}
|
||||
],
|
||||
"effect":[
|
||||
{
|
||||
"type": "modifyStrength",
|
||||
"filter": "memory(bearer)",
|
||||
"amount": 3
|
||||
},
|
||||
{
|
||||
"type": "addKeyword",
|
||||
"filter": "memory(bearer)",
|
||||
"keyword": "damage+1"
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
"101_10": {
|
||||
"side": "shadow",
|
||||
"culture": "Sauron",
|
||||
"title": "I See You",
|
||||
"type": "event",
|
||||
"cost": 1,
|
||||
"keyword": "assignment",
|
||||
"effects": [
|
||||
{
|
||||
"type": "activated",
|
||||
"phase": "skirmish",
|
||||
"condition": {
|
||||
"type": "canSpot",
|
||||
"filter": "bearer,inSkirmishAgainst(Nazgul)",
|
||||
},
|
||||
"cost": [
|
||||
{
|
||||
"type": "memorize",
|
||||
"filter": "bearer",
|
||||
"memory": "bearer"
|
||||
},
|
||||
{
|
||||
"type": "discard",
|
||||
"filter": "self"
|
||||
}
|
||||
],
|
||||
"effect":[
|
||||
{
|
||||
"type": "modifyStrength",
|
||||
"filter": "memory(bearer)",
|
||||
"amount": 3
|
||||
},
|
||||
{
|
||||
"type": "addKeyword",
|
||||
"filter": "memory(bearer)",
|
||||
"keyword": "damage+1"
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -115,6 +115,7 @@ var CardFilter = Class.extend({
|
||||
+ "<option value='50-69,101-150'>All Player's Council Cards</option>"
|
||||
+ "<option disabled>----------</option>"
|
||||
+ "<option value='fotr_block'>Fellowship Block</option>"
|
||||
+ "<option value='pc_fotr_block'>Fellowship Block (PC)</option>"
|
||||
+ "<option value='ttt_block'>Towers Block</option>"
|
||||
+ "<option value='king_block'>King Block</option>"
|
||||
+ "<option value='war_block'>War of the Ring Block</option>"
|
||||
@@ -123,16 +124,14 @@ var CardFilter = Class.extend({
|
||||
+ "<option value='ts_reflections'>Enhanced Towers Standard</option>"
|
||||
+ "<option value='rotk_sta'>King Standard</option>"
|
||||
+ "<option value='movie'>Movie Block</option>"
|
||||
+ "<option value='pc_movie'>Movie Block (PC)</option>"
|
||||
+ "<option value='war_standard'>War of the Ring standard</option>"
|
||||
+ "<option value='standard'>Standard</option>"
|
||||
+ "<option value='expanded'>Expanded</option>"
|
||||
+ "<option value='pc_expanded'>Expanded (PC)</option>"
|
||||
+ "<option value='hobbit_tsr'> The Hobbit: The Short Rest</option>"
|
||||
+ "<option value='hobbit_tcb'> The Hobbit: The Clouds Burst</option>"
|
||||
+ "<option disabled>----------</option>"
|
||||
+ "<option value='pc_fotr_block'>Fellowship block (PC)</option>"
|
||||
+ "<option value='pc_movie'>Movie block (PC)</option>"
|
||||
+ "<option value='pc_expanded'>Expanded (PC)</option>"
|
||||
+ "<option disabled>----------</option>"
|
||||
+ "<option value='0'>00 - Promo</option>"
|
||||
+ "<option value='1'>01 - The Fellowship of the Ring</option>"
|
||||
+ "<option value='51'>01E - The Fellowship of the Ring PC Errata</option>"
|
||||
@@ -161,7 +160,7 @@ var CardFilter = Class.extend({
|
||||
+ "<option value='31'>31 - The Hobbit: Expansion 1</option>"
|
||||
+ "<option value='32'>32 - The Hobbit: Expansion 2</option>"
|
||||
+ "<option disabled>----------</option>"
|
||||
+ "<option value='71-73'>PLAYTEST - Fellowship block (PC)</option>"
|
||||
+ "<option value='71-73'>PLAYTEST - Fellowship Block (PC)</option>"
|
||||
+ "<option value='71-80'>PLAYTEST - Movie Block (PC)</option>"
|
||||
+ "<option value='70-89'>PLAYTEST - Expanded (PC)</option>"
|
||||
+ "</select>");
|
||||
|
||||
@@ -238,6 +238,12 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
throw new DeckInvalidException("Deck contains a copy of an X-listed card: " + GameUtils.getFullName(_library.getLotroCardBlueprint(bannedBlueprintId)));
|
||||
}
|
||||
|
||||
// Errata
|
||||
for (String originalBlueprintId : _errataCardMap.keySet()) {
|
||||
if (originalBlueprintId.equals(blueprintId) || (allAlternates != null && allAlternates.contains(originalBlueprintId)))
|
||||
throw new DeckInvalidException("Deck contains non-errata of an errata'd card: " + GameUtils.getFullName(_library.getLotroCardBlueprint(originalBlueprintId)));
|
||||
}
|
||||
|
||||
} catch (CardNotFoundException e) {
|
||||
// Ignore this card
|
||||
}
|
||||
@@ -328,8 +334,12 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
@Override
|
||||
public LotroDeck applyErrata(LotroDeck deck) {
|
||||
LotroDeck deckWithErrata = new LotroDeck(deck.getDeckName());
|
||||
deckWithErrata.setRingBearer(_errataCardMap.getOrDefault(deck.getRingBearer(), deck.getRingBearer()));
|
||||
deckWithErrata.setRing(_errataCardMap.getOrDefault(deck.getRing(), deck.getRing()));
|
||||
if (deck.getRingBearer() != null) {
|
||||
deckWithErrata.setRingBearer(_errataCardMap.getOrDefault(deck.getRingBearer(), deck.getRingBearer()));
|
||||
}
|
||||
if (deck.getRing() != null) {
|
||||
deckWithErrata.setRing(_errataCardMap.getOrDefault(deck.getRing(), deck.getRing()));
|
||||
}
|
||||
for (String card : deck.getAdventureCards()) {
|
||||
deckWithErrata.addCard(_errataCardMap.getOrDefault(card, card));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user