Fixed problem with Glorfindel
This commit is contained in:
@@ -22,6 +22,7 @@ import com.gempukku.lotro.logic.timing.PlayConditions;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -240,23 +241,44 @@ public class CardResolver {
|
||||
return new DelayedAppender() {
|
||||
@Override
|
||||
public boolean isPlayableInFull(ActionContext actionContext) {
|
||||
final PhysicalCard attachedTo = actionContext.getSource().getAttachedTo();
|
||||
if (attachedTo == null)
|
||||
return false;
|
||||
if (playabilityFilter != null)
|
||||
return PlayConditions.isActive(actionContext.getGame(), attachedTo, playabilityFilter.getFilterable(actionContext));
|
||||
return true;
|
||||
int min = countSource.getMinimum(actionContext);
|
||||
return filterCards(actionContext, playabilityFilter).size() >= min;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
|
||||
return new UnrespondableEffect() {
|
||||
Collection<PhysicalCard> result = filterCards(actionContext, additionalFilter);
|
||||
return new AbstractEffect() {
|
||||
@Override
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
actionContext.setCardMemory(memory, actionContext.getSource().getAttachedTo());
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
int min = countSource.getMinimum(actionContext);
|
||||
return result.size() >= min;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
actionContext.setCardMemory(memory, result);
|
||||
int min = countSource.getMinimum(actionContext);
|
||||
if (result.size() >= min) {
|
||||
return new FullEffectResult(true);
|
||||
} else {
|
||||
return new FullEffectResult(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Collection<PhysicalCard> filterCards(ActionContext actionContext, FilterableSource filter) {
|
||||
PhysicalCard source = actionContext.getSource();
|
||||
PhysicalCard attachedTo = source.getAttachedTo();
|
||||
if (attachedTo == null)
|
||||
return Collections.emptySet();
|
||||
|
||||
Filterable additionalFilterable = Filters.any;
|
||||
if (filter != null)
|
||||
additionalFilterable = filter.getFilterable(actionContext);
|
||||
return Filters.filter(cardSource.apply(actionContext), actionContext.getGame(), attachedTo, additionalFilterable);
|
||||
}
|
||||
};
|
||||
} else if (type.startsWith("memory(") && type.endsWith(")")) {
|
||||
return resolveMemoryCards(type, additionalFilter, playabilityFilter, countSource, memory, cardSource);
|
||||
|
||||
Reference in New Issue
Block a user