Finished cleaning up

This commit is contained in:
marcin.sciesinski
2019-09-01 00:09:12 -07:00
parent 5032fc2cbb
commit 82c05b96d4
3 changed files with 19 additions and 15 deletions

View File

@@ -34,11 +34,6 @@ public class ActivatedEffectProcessor implements EffectProcessor {
(actionContext) -> PlayConditions.checkPhaseLimit(actionContext.getGame(), actionContext.getSource(), phase, limitPerPhase));
actionSource.addCost(
new AbstractEffectAppender() {
@Override
public boolean isPlayableInFull(ActionContext actionContext) {
return true;
}
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
return new IncrementPhaseLimitEffect(actionContext.getSource(), phase, limitPerPhase);

View File

@@ -15,4 +15,9 @@ public abstract class AbstractEffectAppender implements EffectAppender {
}
protected abstract Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext);
@Override
public boolean isPlayableInFull(ActionContext actionContext) {
return true;
}
}

View File

@@ -16,6 +16,8 @@ import java.util.Collection;
public class PlayerResolver {
public static PlayerSource resolvePlayer(String type, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
if (type.equals("you"))
return (actionContext) -> actionContext.getPerformingPlayer();
if (type.equals("owner"))
return (actionContext) -> actionContext.getSource().getOwner();
else if (type.equals("shadowPlayer"))
@@ -30,6 +32,18 @@ public class PlayerResolver {
}
public static EffectAppender resolvePlayer(String type, String memory, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
if (type.equals("you"))
return new AbstractEffectAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
actionContext.setValueToMemory(memory, actionContext.getPerformingPlayer());
}
};
}
};
if (type.equals("owner")) {
return new AbstractEffectAppender() {
@Override
@@ -41,21 +55,11 @@ public class PlayerResolver {
}
};
}
@Override
public boolean isPlayableInFull(ActionContext actionContext) {
return true;
}
};
} else if (type.startsWith("owner(") && type.endsWith(")")) {
String filter = type.substring(type.indexOf("(") + 1, type.lastIndexOf(")"));
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(filter);
return new AbstractEffectAppender() {
@Override
public boolean isPlayableInFull(ActionContext actionContext) {
return true;
}
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
return new UnrespondableEffect() {