Fixing couple of bugs

This commit is contained in:
marcin.sciesinski
2019-10-26 14:25:29 -07:00
parent 2a98b81d87
commit e8375d33a2
3 changed files with 14 additions and 2 deletions

View File

@@ -453,7 +453,7 @@
"type": "extraCost",
"cost": {
"type": "exert",
"filter": "choose(ally)"
"filter": "choose(elf,ally)"
}
},
{

View File

@@ -755,6 +755,10 @@
"type": "location",
"filter": "not(marsh)"
}
},
"effect": {
"type": "discard",
"filter": "self"
}
},
{
@@ -797,6 +801,10 @@
"type": "location",
"filter": "not(marsh)"
}
},
"effect": {
"type": "discard",
"filter": "self"
}
},
{

View File

@@ -19,6 +19,11 @@ public class EffectUtils {
public static void processCostsAndEffects(JSONObject value, CardGenerationEnvironment environment, DefaultActionSource actionSource) throws InvalidCardDefinitionException {
final JSONObject[] costArray = FieldUtils.getObjectArray(value.get("cost"), "cost");
final JSONObject[] effectArray = FieldUtils.getObjectArray(value.get("effect"), "effect");
if (costArray.length == 0 && effectArray.length == 0)
throw new InvalidCardDefinitionException("Action does not contain a cost, nor effect");
final EffectAppenderFactory effectAppenderFactory = environment.getEffectAppenderFactory();
for (JSONObject cost : costArray) {
final EffectAppender effectAppender = effectAppenderFactory.getEffectAppender(cost, environment);
@@ -27,7 +32,6 @@ public class EffectUtils {
actionSource.addCost(effectAppender);
}
final JSONObject[] effectArray = FieldUtils.getObjectArray(value.get("effect"), "effect");
for (JSONObject effect : effectArray) {
final EffectAppender effectAppender = effectAppenderFactory.getEffectAppender(effect, environment);
if (effectAppender == null) {