Couple of fixes
This commit is contained in:
@@ -322,7 +322,8 @@
|
|||||||
"filter": "choose(dwarf)",
|
"filter": "choose(dwarf)",
|
||||||
"count": {
|
"count": {
|
||||||
"type": "forEachKeywordOnCardInMemory",
|
"type": "forEachKeywordOnCardInMemory",
|
||||||
"memory": "spottedDwarf"
|
"memory": "spottedDwarf",
|
||||||
|
"keyword": "damage"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, null);
|
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, null);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
activatedActions.addAll(firstActive.getBlueprint().getPhaseActionsInPlay(playerId, game, self));
|
addAllNotNull(activatedActions, firstActive.getBlueprint().getPhaseActionsInPlay(playerId, game, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return activatedActions;
|
return activatedActions;
|
||||||
@@ -445,13 +445,19 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
for (FilterableSource copiedFilter : copiedFilters) {
|
for (FilterableSource copiedFilter : copiedFilters) {
|
||||||
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, null, null);
|
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, null, null);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null) {
|
||||||
modifiers.addAll(firstActive.getBlueprint().getInPlayModifiers(game, self));
|
addAllNotNull(modifiers, firstActive.getBlueprint().getInPlayModifiers(game, self));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return modifiers;
|
return modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private <T> void addAllNotNull(List<T> list, List<? extends T> possiblyNullList) {
|
||||||
|
if (possiblyNullList != null)
|
||||||
|
list.addAll(possiblyNullList);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Modifier> getStackedOnModifiers(LotroGame game, PhysicalCard self) {
|
public List<? extends Modifier> getStackedOnModifiers(LotroGame game, PhysicalCard self) {
|
||||||
return getModifiers(game, self, stackedOnModifiers);
|
return getModifiers(game, self, stackedOnModifiers);
|
||||||
@@ -528,7 +534,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, null, effect);
|
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, null, effect);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getRequiredBeforeTriggers(game, effect, self));
|
addAllNotNull(result, firstActive.getBlueprint().getRequiredBeforeTriggers(game, effect, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,7 +564,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, effectResult, null);
|
DefaultActionContext actionContext = new DefaultActionContext(self.getOwner(), game, self, effectResult, null);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getRequiredAfterTriggers(game, effectResult, self));
|
addAllNotNull(result, firstActive.getBlueprint().getRequiredAfterTriggers(game, effectResult, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,7 +594,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, effect);
|
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, effect);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getOptionalBeforeTriggers(playerId, game, effect, self));
|
addAllNotNull(result, firstActive.getBlueprint().getOptionalBeforeTriggers(playerId, game, effect, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +624,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, effectResult, null);
|
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, effectResult, null);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getOptionalAfterTriggers(playerId, game, effectResult, self));
|
addAllNotNull(result, firstActive.getBlueprint().getOptionalAfterTriggers(playerId, game, effectResult, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -648,7 +654,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, effect);
|
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, null, effect);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getOptionalInPlayBeforeActions(playerId, game, effect, self));
|
addAllNotNull(result, firstActive.getBlueprint().getOptionalInPlayBeforeActions(playerId, game, effect, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,7 +684,7 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
|||||||
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, effectResult, null);
|
DefaultActionContext actionContext = new DefaultActionContext(playerId, game, self, effectResult, null);
|
||||||
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
final PhysicalCard firstActive = Filters.findFirstActive(game, copiedFilter.getFilterable(actionContext));
|
||||||
if (firstActive != null)
|
if (firstActive != null)
|
||||||
result.addAll(firstActive.getBlueprint().getOptionalInPlayAfterActions(playerId, game, effectResult, self));
|
addAllNotNull(result, firstActive.getBlueprint().getOptionalInPlayAfterActions(playerId, game, effectResult, self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ public class ValueResolver {
|
|||||||
FieldUtils.validateAllowedFields(object, "memory", "keyword");
|
FieldUtils.validateAllowedFields(object, "memory", "keyword");
|
||||||
final String memory = FieldUtils.getString(object.get("memory"), "memory");
|
final String memory = FieldUtils.getString(object.get("memory"), "memory");
|
||||||
final Keyword keyword = FieldUtils.getEnum(Keyword.class, object.get("keyword"), "keyword");
|
final Keyword keyword = FieldUtils.getEnum(Keyword.class, object.get("keyword"), "keyword");
|
||||||
|
if (keyword == null)
|
||||||
|
throw new InvalidCardDefinitionException("Keyword cannot be null");
|
||||||
return (actionContext) -> {
|
return (actionContext) -> {
|
||||||
final LotroGame game = actionContext.getGame();
|
final LotroGame game = actionContext.getGame();
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user