Ally home changes to new system
This commit is contained in:
@@ -359,8 +359,7 @@
|
||||
"culture": "shire",
|
||||
"cost": 1,
|
||||
"type": "ally",
|
||||
"block": "fellowship",
|
||||
"site": 1,
|
||||
"allyHome": "fellowship,1",
|
||||
"race": "hobbit",
|
||||
"strength": 2,
|
||||
"vitality": 2,
|
||||
@@ -384,7 +383,7 @@
|
||||
},
|
||||
"effect": {
|
||||
"type": "heal",
|
||||
"filter": "choose(not(self),hobbit,ally,allySite(fellowship,1))"
|
||||
"filter": "choose(not(self),hobbit,ally,allyHome(fellowship,1))"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -36,6 +36,8 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
||||
private int siteNumber;
|
||||
private Set<PossessionClass> possessionClasses;
|
||||
private Direction direction;
|
||||
private SitesBlock allyHomeBlock;
|
||||
private int[] allyHomeSites = new int[0];
|
||||
|
||||
private List<Requirement> requirements;
|
||||
private List<FilterableSource> targetFilters;
|
||||
@@ -62,6 +64,11 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
||||
|
||||
// Building methods
|
||||
|
||||
public void setAllyHomeSites(SitesBlock block, int[] numbers) {
|
||||
this.allyHomeBlock = block;
|
||||
this.allyHomeSites = numbers;
|
||||
}
|
||||
|
||||
public void appendBeforeActivatedTrigger(ActionSource actionSource) {
|
||||
if (beforeActivatedTriggers == null)
|
||||
beforeActivatedTriggers = new LinkedList<>();
|
||||
@@ -296,6 +303,16 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
||||
return siteNumber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAllyHomeSiteNumbers() {
|
||||
return allyHomeSites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SitesBlock getAllyHomeSiteBlock() {
|
||||
return allyHomeBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PossessionClass> getPossessionClasses() {
|
||||
return possessionClasses;
|
||||
@@ -559,16 +576,6 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAllyHomeSiteNumbers() {
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public SitesBlock getAllyHomeSiteBlock() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequiredTriggerAction getDiscardedFromPlayRequiredTrigger(LotroGame game, PhysicalCard self) {
|
||||
return null;
|
||||
|
||||
@@ -41,6 +41,7 @@ public class LotroCardBlueprintBuilder implements CardGenerationEnvironment {
|
||||
fieldProcessors.put("effects", new EffectFieldProcessor());
|
||||
fieldProcessors.put("target", new TargetFieldProcessor());
|
||||
fieldProcessors.put("requirement", new RequirementFieldProcessor());
|
||||
fieldProcessors.put("allyhome", new AllyHomeFieldProcessor());
|
||||
}
|
||||
|
||||
public LotroCardBlueprint buildFromJson(JSONObject json) throws InvalidCardDefinitionException {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.gempukku.lotro.cards.build.field;
|
||||
|
||||
import com.gempukku.lotro.cards.build.BuiltLotroCardBlueprint;
|
||||
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
|
||||
import com.gempukku.lotro.cards.build.FieldProcessor;
|
||||
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
|
||||
import com.gempukku.lotro.common.SitesBlock;
|
||||
|
||||
public class AllyHomeFieldProcessor implements FieldProcessor {
|
||||
@Override
|
||||
public void processField(String key, Object value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
||||
final String allyHome = FieldUtils.getString(value, "allyHome");
|
||||
final String[] allyHomeSplit = allyHome.split(",", 2);
|
||||
SitesBlock sitesBlock = Enum.valueOf(SitesBlock.class, allyHomeSplit[0].toUpperCase().replace(' ', '_'));
|
||||
final int number = Integer.parseInt(allyHomeSplit[1]);
|
||||
|
||||
blueprint.setAllyHomeSites(sitesBlock, new int[]{number});
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class FilterFactory {
|
||||
final FilterableSource filterableSource = filterFactory.generateFilter(parameter);
|
||||
return (playerId, game, source, effectResult, effect) -> Filters.not(filterableSource.getFilterable(playerId, game, source, effectResult, effect));
|
||||
});
|
||||
parameterFilters.put("allySite",
|
||||
parameterFilters.put("allyHome",
|
||||
(parameter, filterFactory) -> {
|
||||
final String[] parameterSplit = parameter.split(",");
|
||||
final SitesBlock sitesBlock = Enum.valueOf(SitesBlock.class, parameterSplit[0].toUpperCase().replace('_', ' '));
|
||||
|
||||
Reference in New Issue
Block a user