Fixed removing burdens

This commit is contained in:
marcin.sciesinski
2019-09-17 10:33:00 -07:00
parent a1a5ffef69
commit 0ddc020e2e
3 changed files with 23 additions and 2 deletions

View File

@@ -36,7 +36,10 @@ public class DefaultActionContext implements ActionContext {
@Override
public String getValueFromMemory(String memory) {
return valueMemory.get(memory);
final String result = valueMemory.get(memory);
if (result == null)
throw new IllegalArgumentException("Memory not found - " + memory);
return result;
}
@Override

View File

@@ -26,7 +26,7 @@ public class RemoveBurdens implements EffectAppenderProducer {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
final String removingPlayer = playerSource.getPlayer(actionContext);
final Evaluator evaluator = valueSource.getEvaluator(null);
final Evaluator evaluator = valueSource.getEvaluator(actionContext);
return new RemoveBurdenEffect(removingPlayer, actionContext.getSource(), evaluator.evaluateExpression(actionContext.getGame(), null));
}

View File

@@ -588,4 +588,22 @@ public class NewCardsAtTest extends AbstractAtTest {
playerDecided(P1, getCardActionId(P1, "Use Bilbo's Pipe"));
assertEquals("2", _userFeedback.getAwaitingDecision(P1).getDecisionParameters().get("max"));
}
@Test
public void removeBurdens() throws DecisionResultInvalidException, CardNotFoundException {
initializeSimplestGame();
final PhysicalCardImpl samsPipe = createCard(P1, "40_269");
final PhysicalCardImpl pipeweed = createCard(P1, "40_255");
_game.getGameState().addCardToZone(_game, pipeweed, Zone.SUPPORT);
_game.getGameState().attachCard(_game, samsPipe, _game.getGameState().getRingBearer(P1));
skipMulligans();
playerDecided(P1, getCardActionId(P1, "Use Sam's Pipe"));
playerDecided(P1, "1");
assertEquals(0, _game.getGameState().getBurdens());
}
}