Fixed Borne Far Away (and other "exchange card in hand for X" effects) permitting the exchange with no actual valid target in hand, resulting in a free transfer to hand.

This commit is contained in:
Christian 'ketura' McCarty
2025-04-23 22:14:19 -05:00
parent a8910811ed
commit 0dfe74cde3
3 changed files with 25 additions and 3 deletions

View File

@@ -50,6 +50,13 @@ public class ExchangeCardsInHandWithCardsInDeadPile implements EffectAppenderPro
return new AbstractEffect() { return new AbstractEffect() {
@Override @Override
protected FullEffectResult playEffectReturningResult(LotroGame game) { protected FullEffectResult playEffectReturningResult(LotroGame game) {
int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
if(handCards.size() < hand) {
game.getGameState().sendMessage(performingPlayer + " did not have " + hand + " card in hand to exchange.");
return new FullEffectResult(false);
}
Set<PhysicalCard> cardsToRemove = new HashSet<>(); Set<PhysicalCard> cardsToRemove = new HashSet<>();
cardsToRemove.addAll(handCards); cardsToRemove.addAll(handCards);
cardsToRemove.addAll(deadPileCards); cardsToRemove.addAll(deadPileCards);
@@ -66,7 +73,8 @@ public class ExchangeCardsInHandWithCardsInDeadPile implements EffectAppenderPro
@Override @Override
public boolean isPlayableInFull(LotroGame game) { public boolean isPlayableInFull(LotroGame game) {
return true; int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
return handCards.size() >= hand;
} }
}; };
} }

View File

@@ -48,6 +48,12 @@ public class ExchangeCardsInHandWithCardsInDiscard implements EffectAppenderProd
return new AbstractEffect() { return new AbstractEffect() {
@Override @Override
protected FullEffectResult playEffectReturningResult(LotroGame game) { protected FullEffectResult playEffectReturningResult(LotroGame game) {
int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
if(handCards.size() < hand) {
game.getGameState().sendMessage(performingPlayer + " did not have " + hand + " card in hand to exchange.");
return new FullEffectResult(false);
}
Set<PhysicalCard> cardsToRemove = new HashSet<>(); Set<PhysicalCard> cardsToRemove = new HashSet<>();
cardsToRemove.addAll(handCards); cardsToRemove.addAll(handCards);
cardsToRemove.addAll(discardCards); cardsToRemove.addAll(discardCards);
@@ -64,7 +70,8 @@ public class ExchangeCardsInHandWithCardsInDiscard implements EffectAppenderProd
@Override @Override
public boolean isPlayableInFull(LotroGame game) { public boolean isPlayableInFull(LotroGame game) {
return true; int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
return handCards.size() >= hand;
} }
}; };
} }

View File

@@ -53,6 +53,12 @@ public class ExchangeCardsInHandWithCardsStacked implements EffectAppenderProduc
return new AbstractEffect() { return new AbstractEffect() {
@Override @Override
protected FullEffectResult playEffectReturningResult(LotroGame game) { protected FullEffectResult playEffectReturningResult(LotroGame game) {
int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
if(handCards.size() < hand) {
game.getGameState().sendMessage(performingPlayer + " did not have " + hand + " card in hand to exchange.");
return new FullEffectResult(false);
}
Set<PhysicalCard> cardsToRemove = new HashSet<>(); Set<PhysicalCard> cardsToRemove = new HashSet<>();
cardsToRemove.addAll(handCards); cardsToRemove.addAll(handCards);
cardsToRemove.addAll(stackedCards); cardsToRemove.addAll(stackedCards);
@@ -69,7 +75,8 @@ public class ExchangeCardsInHandWithCardsStacked implements EffectAppenderProduc
@Override @Override
public boolean isPlayableInFull(LotroGame game) { public boolean isPlayableInFull(LotroGame game) {
return true; int hand = countHand.getEvaluator(actionContext).evaluateExpression(game, null);
return handCards.size() >= hand;
} }
}; };
} }