Renamed "requirement" to "condition" to be consistent

This commit is contained in:
marcin.sciesinski
2019-08-29 22:02:28 -07:00
parent e96330bce8
commit 5d2ea67049
10 changed files with 61 additions and 20 deletions

View File

@@ -9,7 +9,7 @@
"strength": 4, "strength": 4,
"vitality": 2, "vitality": 2,
"resistance": 6, "resistance": 6,
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "dwarf" "filter": "dwarf"
} }
@@ -48,7 +48,7 @@
"strength": 5, "strength": 5,
"vitality": 3, "vitality": 3,
"resistance": 6, "resistance": 6,
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "dwarf" "filter": "dwarf"
}, },
@@ -74,7 +74,7 @@
"effects": { "effects": {
"type": "activated", "type": "activated",
"phase": "fellowship", "phase": "fellowship",
"requirement": { "condition": {
"type": "twilightPoolLessThan", "type": "twilightPoolLessThan",
"amount": 2 "amount": 2
}, },
@@ -143,7 +143,7 @@
"cost": 0, "cost": 0,
"type": "event", "type": "event",
"keyword": "archery", "keyword": "archery",
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "elf,archer,companion" "filter": "elf,archer,companion"
}, },
@@ -167,7 +167,7 @@
"strength": 5, "strength": 5,
"vitality": 3, "vitality": 3,
"resistance": 6, "resistance": 6,
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "elf" "filter": "elf"
}, },
@@ -241,7 +241,7 @@
"strength": 4, "strength": 4,
"vitality": 2, "vitality": 2,
"resistance": 6, "resistance": 6,
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "elf" "filter": "elf"
} }
@@ -333,7 +333,7 @@
{ {
"type": "activated", "type": "activated",
"phase": "assignment", "phase": "assignment",
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "hobbit,companion", "filter": "hobbit,companion",
"count": 2 "count": 2

View File

@@ -795,7 +795,7 @@
"type": "played", "type": "played",
"filter": "side(shadow),event" "filter": "side(shadow),event"
}, },
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "self,hasStackedCount(3,any)" "filter": "self,hasStackedCount(3,any)"
}, },

View File

@@ -6,7 +6,7 @@
"cost": 2, "cost": 2,
"type": "event", "type": "event",
"keyword": "archery", "keyword": "archery",
"requirement": { "condition": {
"type": "canSpot", "type": "canSpot",
"filter": "elf,archer,companion" "filter": "elf,archer,companion"
}, },
@@ -47,5 +47,46 @@
}, },
"amount": 3 "amount": 3
} }
},
"40_35": {
"title": "*Arwen",
"subtitle": "Lady of Imladris",
"side": "free people",
"culture": "elven",
"cost": 2,
"type": "companion",
"race": "elf",
"strength": 6,
"vitality": 3,
"resistance": 8,
"effects": [
{
"type": "trigger",
"trigger": {
"type": "startOfTurn"
},
"optional": true,
"condition": {
"type": "canSpot",
"filter": "name(Elrond)"
},
"effect": {
"type": "heal",
"filter": "self"
}
},
{
"type": "activated",
"phase": "fellowship",
"cost": {
"type": "exert",
"filter": "self"
},
"effect": {
"type": "heal",
"filter": "choose(rivendell,ally)"
}
}
]
} }
} }

View File

@@ -9,7 +9,7 @@
"effects": [ "effects": [
{ {
"type": "trigger", "type": "trigger",
"requirement": [ "condition": [
{ {
"type": "ringIsOn" "type": "ringIsOn"
}, },
@@ -33,7 +33,7 @@
}, },
{ {
"type": "activated", "type": "activated",
"requirement": { "condition": {
"type": "ringIsActive" "type": "ringIsActive"
}, },
"phase": "maneuver", "phase": "maneuver",
@@ -68,7 +68,7 @@
"effects": [ "effects": [
{ {
"type": "trigger", "type": "trigger",
"requirement": [ "condition": [
{ {
"type": "ringIsOn" "type": "ringIsOn"
}, },
@@ -100,7 +100,7 @@
"type": "aboutToTakeWound", "type": "aboutToTakeWound",
"filter": "hasAttached(self)" "filter": "hasAttached(self)"
}, },
"requirement": [ "condition": [
{ {
"type": "phase", "type": "phase",
"phase": "skirmish" "phase": "skirmish"

View File

@@ -39,7 +39,7 @@ public class LotroCardBlueprintBuilder implements CardGenerationEnvironment {
fieldProcessors.put("direction", new DirectionFieldProcessor()); fieldProcessors.put("direction", new DirectionFieldProcessor());
fieldProcessors.put("effects", new EffectFieldProcessor()); fieldProcessors.put("effects", new EffectFieldProcessor());
fieldProcessors.put("target", new TargetFieldProcessor()); fieldProcessors.put("target", new TargetFieldProcessor());
fieldProcessors.put("requirement", new RequirementFieldProcessor()); fieldProcessors.put("condition", new RequirementFieldProcessor());
fieldProcessors.put("allyhome", new AllyHomeFieldProcessor()); fieldProcessors.put("allyhome", new AllyHomeFieldProcessor());
} }

View File

@@ -19,7 +19,7 @@ import org.json.simple.JSONObject;
public class ActivatedEffectProcessor implements EffectProcessor { public class ActivatedEffectProcessor implements EffectProcessor {
@Override @Override
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException { public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "phase", "requirement", "cost", "effect", "limitPerPhase"); FieldUtils.validateAllowedFields(value, "phase", "condition", "cost", "effect", "limitPerPhase");
final String[] phaseArray = FieldUtils.getStringArray(value.get("phase"), "phase"); final String[] phaseArray = FieldUtils.getStringArray(value.get("phase"), "phase");
final int limitPerPhase = FieldUtils.getInteger(value.get("limitPerPhase"), "limitPerPhase", 0); final int limitPerPhase = FieldUtils.getInteger(value.get("limitPerPhase"), "limitPerPhase", 0);

View File

@@ -11,7 +11,7 @@ import org.json.simple.JSONObject;
public class ActivatedTriggerEffectProcessor implements EffectProcessor { public class ActivatedTriggerEffectProcessor implements EffectProcessor {
@Override @Override
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException { public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "trigger", "requirement", "cost", "effect"); FieldUtils.validateAllowedFields(value, "trigger", "condition", "cost", "effect");
final JSONObject[] triggerArray = FieldUtils.getObjectArray(value.get("trigger"), "trigger"); final JSONObject[] triggerArray = FieldUtils.getObjectArray(value.get("trigger"), "trigger");

View File

@@ -8,7 +8,7 @@ import org.json.simple.JSONObject;
public class EffectUtils { public class EffectUtils {
public static void processRequirementsCostsAndEffects(JSONObject value, CardGenerationEnvironment environment, DefaultActionSource actionSource) throws InvalidCardDefinitionException { public static void processRequirementsCostsAndEffects(JSONObject value, CardGenerationEnvironment environment, DefaultActionSource actionSource) throws InvalidCardDefinitionException {
final JSONObject[] requirementArray = FieldUtils.getObjectArray(value.get("requirement"), "requirement"); final JSONObject[] requirementArray = FieldUtils.getObjectArray(value.get("condition"), "condition");
for (JSONObject requirement : requirementArray) { for (JSONObject requirement : requirementArray) {
final Requirement conditionRequirement = environment.getRequirementFactory().getRequirement(requirement, environment); final Requirement conditionRequirement = environment.getRequirementFactory().getRequirement(requirement, environment);
actionSource.addPlayRequirement(conditionRequirement); actionSource.addPlayRequirement(conditionRequirement);

View File

@@ -11,7 +11,7 @@ import org.json.simple.JSONObject;
public class TriggerEffectProcessor implements EffectProcessor { public class TriggerEffectProcessor implements EffectProcessor {
@Override @Override
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException { public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "trigger", "optional", "requirement", "cost", "effect"); FieldUtils.validateAllowedFields(value, "trigger", "optional", "condition", "cost", "effect");
final JSONObject[] triggerArray = FieldUtils.getObjectArray(value.get("trigger"), "trigger"); final JSONObject[] triggerArray = FieldUtils.getObjectArray(value.get("trigger"), "trigger");
final boolean optional = FieldUtils.getBoolean(value.get("optional"), "optional", false); final boolean optional = FieldUtils.getBoolean(value.get("optional"), "optional", false);

View File

@@ -27,13 +27,13 @@ import java.util.List;
public class AddTrigger implements EffectAppenderProducer { public class AddTrigger implements EffectAppenderProducer {
@Override @Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException { public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "trigger", "until", "optional", "requirement", "cost", "effect"); FieldUtils.validateAllowedFields(effectObject, "trigger", "until", "optional", "condition", "cost", "effect");
final TimeResolver.Time until = TimeResolver.resolveTime(effectObject.get("until"), "end(current)"); final TimeResolver.Time until = TimeResolver.resolveTime(effectObject.get("until"), "end(current)");
final TriggerChecker trigger = environment.getTriggerCheckerFactory().getTriggerChecker((JSONObject) effectObject.get("trigger"), environment); final TriggerChecker trigger = environment.getTriggerCheckerFactory().getTriggerChecker((JSONObject) effectObject.get("trigger"), environment);
final boolean optional = FieldUtils.getBoolean(effectObject.get("optional"), "optional", false); final boolean optional = FieldUtils.getBoolean(effectObject.get("optional"), "optional", false);
final JSONObject[] requirementArray = FieldUtils.getObjectArray(effectObject.get("requirement"), "requirement"); final JSONObject[] requirementArray = FieldUtils.getObjectArray(effectObject.get("condition"), "condition");
final JSONObject[] costArray = FieldUtils.getObjectArray(effectObject.get("cost"), "cost"); final JSONObject[] costArray = FieldUtils.getObjectArray(effectObject.get("cost"), "cost");
final JSONObject[] effectArray = FieldUtils.getObjectArray(effectObject.get("effect"), "effect"); final JSONObject[] effectArray = FieldUtils.getObjectArray(effectObject.get("effect"), "effect");