Simplified code
This commit is contained in:
@@ -26,24 +26,19 @@ public class AddBurden implements EffectAppenderProducer {
|
||||
|
||||
final PlayerSource playerSource = PlayerResolver.resolvePlayer(player, environment);
|
||||
|
||||
MultiEffectAppender result = new MultiEffectAppender();
|
||||
return new DelayedAppender() {
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String playerAddingBurden = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
return new AddBurdenEffect(playerAddingBurden, self, amount);
|
||||
}
|
||||
|
||||
result.addEffectAppender(
|
||||
new DelayedAppender() {
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String playerAddingBurden = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
return new AddBurdenEffect(playerAddingBurden, self, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String playerAddingBurden = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
return PlayConditions.canAddBurdens(game, playerAddingBurden, self);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
@Override
|
||||
public boolean isPlayableInFull(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String playerAddingBurden = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
return PlayConditions.canAddBurdens(game, playerAddingBurden, self);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class ConditionEffect implements EffectAppenderProducer {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO, maybe check the requirements, and if met, check if the effect is playable?
|
||||
@Override
|
||||
public boolean isPlayableInFull(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
return true;
|
||||
|
||||
@@ -26,28 +26,23 @@ public class DiscardTopCardFromDeck implements EffectAppenderProducer {
|
||||
|
||||
final PlayerSource playerSource = PlayerResolver.resolvePlayer(deck, environment);
|
||||
|
||||
MultiEffectAppender result = new MultiEffectAppender();
|
||||
return new DelayedAppender() {
|
||||
@Override
|
||||
public boolean isPlayableInFull(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String deckId = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
|
||||
result.addEffectAppender(
|
||||
new DelayedAppender() {
|
||||
@Override
|
||||
public boolean isPlayableInFull(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String deckId = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
// Don't check if can discard top cards, since it's a cost
|
||||
return game.getGameState().getDeck(deckId).size() >= count
|
||||
&& (!forced || game.getModifiersQuerying().canDiscardCardsFromTopOfDeck(game, playerId, self));
|
||||
}
|
||||
|
||||
// Don't check if can discard top cards, since it's a cost
|
||||
return game.getGameState().getDeck(deckId).size() >= count
|
||||
&& (!forced || game.getModifiersQuerying().canDiscardCardsFromTopOfDeck(game, playerId, self));
|
||||
}
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String deckId = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
final String deckId = playerSource.getPlayer(playerId, game, self, effectResult, effect);
|
||||
|
||||
return new DiscardTopCardFromDeckEffect(self, deckId, count, forced);
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
return new DiscardTopCardFromDeckEffect(self, deckId, count, forced);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,18 +23,13 @@ public class ModifyArcheryTotal implements EffectAppenderProducer {
|
||||
final int amount = FieldUtils.getInteger(effectObject.get("amount"), "amount");
|
||||
final Side side = FieldUtils.getEnum(Side.class, effectObject.get("side"), "side");
|
||||
|
||||
MultiEffectAppender result = new MultiEffectAppender();
|
||||
|
||||
result.addEffectAppender(
|
||||
new DelayedAppender() {
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
return new AddUntilEndOfPhaseModifierEffect(
|
||||
new ArcheryTotalModifier(self, side, amount));
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
return new DelayedAppender() {
|
||||
@Override
|
||||
protected Effect createEffect(CostToEffectAction action, String playerId, LotroGame game, PhysicalCard self, EffectResult effectResult, Effect effect) {
|
||||
return new AddUntilEndOfPhaseModifierEffect(
|
||||
new ArcheryTotalModifier(self, side, amount));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user