Removed some object overhead

This commit is contained in:
marcin.sciesinski
2019-10-19 12:18:04 -07:00
parent cb6f1d6ffe
commit 5d482647fe
8 changed files with 11 additions and 54 deletions

View File

@@ -5,14 +5,12 @@ import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.PlayerResolver;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.LinkedList;
@@ -54,12 +52,7 @@ public class Choice implements EffectAppenderProducer {
}
if (playableEffectAppenders.size() == 0)
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// Do nothin
}
};
return null;
if (playableEffectAppenders.size() == 1) {
SubAction subAction = new SubAction(action);

View File

@@ -7,12 +7,10 @@ import com.gempukku.lotro.cards.build.Requirement;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
public class ConditionEffect implements EffectAppenderProducer {
@@ -36,12 +34,7 @@ public class ConditionEffect implements EffectAppenderProducer {
return new StackActionEffect(subAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// ignore
}
};
return null;
}
}

View File

@@ -56,7 +56,10 @@ public abstract class DelayedAppender implements EffectAppender {
}
protected List<? extends Effect> createEffects(boolean cost, CostToEffectAction action, ActionContext actionContext) {
return Collections.singletonList(createEffect(cost, action, actionContext));
final Effect effect = createEffect(cost, action, actionContext);
if (effect == null)
return null;
return Collections.singletonList(effect);
}
@Override

View File

@@ -8,12 +8,10 @@ import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.ValueResolver;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
public class Duplicate implements EffectAppenderProducer {
@@ -36,12 +34,7 @@ public class Duplicate implements EffectAppenderProducer {
effectAppender.appendEffect(cost, subAction, actionContext);
return new StackActionEffect(subAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// Ignore
}
};
return null;
}
}

View File

@@ -17,7 +17,6 @@ import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.ExtraFilters;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.Collection;
@@ -74,12 +73,7 @@ public class PlayCardFromDiscard implements EffectAppenderProducer {
final CostToEffectAction playCardAction = PlayUtils.getPlayCardAction(game, cardsToPlay.iterator().next(), costModifier, onFilterable, false);
return new StackActionEffect(playCardAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// do nothing
}
};
return null;
}
}

View File

@@ -17,7 +17,6 @@ import com.gempukku.lotro.logic.modifiers.ModifierFlag;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.ExtraFilters;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.Collection;
@@ -62,12 +61,7 @@ public class PlayCardFromDrawDeck implements EffectAppenderProducer {
final CostToEffectAction playCardAction = PlayUtils.getPlayCardAction(actionContext.getGame(), cardsToPlay.iterator().next(), costModifier, onFilterable, false);
return new StackActionEffect(playCardAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// do nothing
}
};
return null;
}
}

View File

@@ -16,7 +16,6 @@ import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.ExtraFilters;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.Collection;
@@ -63,12 +62,7 @@ public class PlayCardFromHand implements EffectAppenderProducer {
final CostToEffectAction playCardAction = PlayUtils.getPlayCardAction(game, cardsToPlay.iterator().next(), costModifier, onFilterable, false);
return new StackActionEffect(playCardAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// do nothing
}
};
return null;
}
}
});

View File

@@ -10,13 +10,11 @@ import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.CardResolver;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.PlayUtils;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.StackActionEffect;
import com.gempukku.lotro.logic.modifiers.evaluator.ConstantEvaluator;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import org.json.simple.JSONObject;
import java.util.Collection;
@@ -49,12 +47,7 @@ public class PlayCardFromStacked implements EffectAppenderProducer {
final CostToEffectAction playCardAction = PlayUtils.getPlayCardAction(actionContext.getGame(), cardsToPlay.iterator().next(), 0, Filters.any, false);
return new StackActionEffect(playCardAction);
} else {
return new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
// do nothing
}
};
return null;
}
}
});