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:
Christian 'ketura' McCarty
2021-11-30 09:23:07 -06:00
parent ee7750fdc4
commit 43e5a5db96
3 changed files with 7 additions and 3 deletions

View File

@@ -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);

View File

@@ -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();

View File

@@ -320,7 +320,7 @@ public class FilterFactory {
return Filters.minPrintedTwilightCost(value);
}
catch(IllegalArgumentException ex) {
return Filters.maxPrintedTwilightCost(0);
return Filters.minPrintedTwilightCost(0);
}
};
} else {