Added optional text field to trigger definitions. Fixed PutCardsFromDeckIntoHand not shuffling afterwards by default. Fixed copy-paste error in MinTwilight
This commit is contained in:
@@ -12,8 +12,9 @@ import org.json.simple.JSONObject;
|
||||
public class TriggerEffectProcessor implements EffectProcessor {
|
||||
@Override
|
||||
public void processEffect(JSONObject value, BuiltLotroCardBlueprint blueprint, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
|
||||
FieldUtils.validateAllowedFields(value, "trigger", "optional", "condition", "cost", "effect");
|
||||
FieldUtils.validateAllowedFields(value, "trigger", "optional", "condition", "cost", "effect", "text");
|
||||
|
||||
final String text = FieldUtils.getString(value.get("text"), "text", "");
|
||||
final JSONObject[] triggerArray = FieldUtils.getObjectArray(value.get("trigger"), "trigger");
|
||||
if (triggerArray.length == 0)
|
||||
throw new InvalidCardDefinitionException("Trigger effect without trigger definition");
|
||||
@@ -24,6 +25,9 @@ public class TriggerEffectProcessor implements EffectProcessor {
|
||||
final boolean before = triggerChecker.isBefore();
|
||||
|
||||
DefaultActionSource triggerActionSource = new DefaultActionSource();
|
||||
if(text != "") {
|
||||
triggerActionSource.setText(text);
|
||||
}
|
||||
triggerActionSource.addPlayRequirement(triggerChecker);
|
||||
EffectUtils.processRequirementsCostsAndEffects(value, environment, triggerActionSource);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class PutCardsFromDeckIntoHand implements EffectAppenderProducer {
|
||||
|
||||
final ValueSource valueSource = ValueResolver.resolveEvaluator(effectObject.get("count"), 1, environment);
|
||||
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter", "choose(any)");
|
||||
final boolean shuffle = FieldUtils.getBoolean(effectObject.get("shuffle"), "shuffle", false);
|
||||
final boolean shuffle = FieldUtils.getBoolean(effectObject.get("shuffle"), "shuffle", true);
|
||||
|
||||
MultiEffectAppender result = new MultiEffectAppender();
|
||||
|
||||
|
||||
@@ -320,7 +320,7 @@ public class FilterFactory {
|
||||
return Filters.minPrintedTwilightCost(value);
|
||||
}
|
||||
catch(IllegalArgumentException ex) {
|
||||
return Filters.maxPrintedTwilightCost(0);
|
||||
return Filters.minPrintedTwilightCost(0);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user