Added limit option to ForEachInMemory. Fixed Would Have Gone crashing the game :)
This commit is contained in:
@@ -185,31 +185,30 @@
|
||||
{
|
||||
"type": "canSpot",
|
||||
"filter": "name(Aragorn)"
|
||||
}
|
||||
],
|
||||
"cost": [
|
||||
{
|
||||
"type": "chooseANumber",
|
||||
"from": 0,
|
||||
"to": 3,
|
||||
"memorize": "chosenNumber"
|
||||
},
|
||||
{
|
||||
"type": "discardStackedCards",
|
||||
"count": {
|
||||
"type": "fromMemory",
|
||||
"memory": "chosenNumber"
|
||||
},
|
||||
"on": "self",
|
||||
"memorize": "discardedFromStack"
|
||||
"type": "canSpot",
|
||||
"filter": "self,hasStacked(any)"
|
||||
}
|
||||
],
|
||||
"cost": {
|
||||
"type": "discardStackedCards",
|
||||
"count": {
|
||||
"type": "range",
|
||||
"from": 1,
|
||||
"to": {
|
||||
"type": "countStacked",
|
||||
"on": "self"
|
||||
}
|
||||
},
|
||||
"memorize": "discardedCards"
|
||||
},
|
||||
"effect": {
|
||||
"type": "modifyStrength",
|
||||
"filter": "choose(companion,signet(aragorn))",
|
||||
"amount": {
|
||||
"type": "fromMemory",
|
||||
"memory": "chosenNumber",
|
||||
"type": "forEachInMemory",
|
||||
"memory": "discardedCards",
|
||||
"limit": 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,11 +106,12 @@ public class ValueResolver {
|
||||
FieldUtils.validateAllowedFields(object);
|
||||
return (actionContext) -> (game, cardAffected) -> GameUtils.getRegion(actionContext.getGame());
|
||||
} else if (type.equalsIgnoreCase("forEachInMemory")) {
|
||||
FieldUtils.validateAllowedFields(object, "memory");
|
||||
FieldUtils.validateAllowedFields(object, "memory", "limit");
|
||||
final String memory = FieldUtils.getString(object.get("memory"), "memory");
|
||||
final int limit = FieldUtils.getInteger(object.get("limit"), "limit", Integer.MAX_VALUE);
|
||||
return (actionContext) -> {
|
||||
final int count = actionContext.getCardsFromMemory(memory).size();
|
||||
return new ConstantEvaluator(count);
|
||||
return new ConstantEvaluator(Math.min(limit, count));
|
||||
};
|
||||
} else if (type.equalsIgnoreCase("forEachMatchingInMemory")) {
|
||||
FieldUtils.validateAllowedFields(object, "memory", "filter", "limit");
|
||||
|
||||
Reference in New Issue
Block a user