Fixing ChooseANumber
- Adding log message output to indicate what numbers are being chosen - Fixed PrintedTwilightCostFromMemory not extracting the stored number from memory - Fixed Gathering Wind not working.
This commit is contained in:
@@ -44,7 +44,11 @@ public class ChooseANumber implements EffectAppenderProducer {
|
|||||||
min, max, defaultAmount) {
|
min, max, defaultAmount) {
|
||||||
@Override
|
@Override
|
||||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||||
actionContext.setValueToMemory(memorize, String.valueOf(getValidatedResult(result)));
|
final String value = String.valueOf(getValidatedResult(result));
|
||||||
|
actionContext.getGame().getGameState().sendMessage(actionContext.getPerformingPlayer()
|
||||||
|
+ " chooses " + value + ".");
|
||||||
|
|
||||||
|
actionContext.setValueToMemory(memorize, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -568,12 +568,17 @@ public class FilterFactory {
|
|||||||
});
|
});
|
||||||
parameterFilters.put("printedtwilightcostfrommemory",
|
parameterFilters.put("printedtwilightcostfrommemory",
|
||||||
(parameter, environment) -> actionContext -> {
|
(parameter, environment) -> actionContext -> {
|
||||||
PhysicalCard card = actionContext.getCardFromMemory(parameter);
|
String valueStr = actionContext.getValueFromMemory(parameter);
|
||||||
if (card == null)
|
if (valueStr == null)
|
||||||
return Filters.none;
|
return Filters.none;
|
||||||
|
|
||||||
int memoryPrintedTwilightCost = card.getBlueprint().getTwilightCost();
|
try {
|
||||||
return Filters.printedTwilightCost(memoryPrintedTwilightCost);
|
int twilight = Integer.parseInt(valueStr);
|
||||||
|
return Filters.printedTwilightCost(twilight);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex) {
|
||||||
|
return Filters.none;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
parameterFilters.put("race",
|
parameterFilters.put("race",
|
||||||
(parameter, environment) -> {
|
(parameter, environment) -> {
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.gempukku.lotro.cards.official.set10;
|
package com.gempukku.lotro.cards.official.set10;
|
||||||
|
|
||||||
import com.gempukku.lotro.cards.GenericCardTestHelper;
|
import com.gempukku.lotro.cards.GenericCardTestHelper;
|
||||||
import com.gempukku.lotro.common.CardType;
|
import com.gempukku.lotro.common.*;
|
||||||
import com.gempukku.lotro.common.Culture;
|
|
||||||
import com.gempukku.lotro.common.Side;
|
|
||||||
import com.gempukku.lotro.common.Timeword;
|
|
||||||
import com.gempukku.lotro.game.CardNotFoundException;
|
import com.gempukku.lotro.game.CardNotFoundException;
|
||||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -20,8 +17,14 @@ public class Card_10_016_Tests
|
|||||||
return new GenericCardTestHelper(
|
return new GenericCardTestHelper(
|
||||||
new HashMap<>()
|
new HashMap<>()
|
||||||
{{
|
{{
|
||||||
put("card", "10_16");
|
put("wind", "10_16");
|
||||||
// put other cards in here as needed for the test case
|
put("gandalf", "1_364");
|
||||||
|
|
||||||
|
put("two1", "1_184");
|
||||||
|
put("two2", "1_185");
|
||||||
|
put("one1", "1_174");
|
||||||
|
put("three1", "1_179");
|
||||||
|
|
||||||
}},
|
}},
|
||||||
GenericCardTestHelper.FellowshipSites,
|
GenericCardTestHelper.FellowshipSites,
|
||||||
GenericCardTestHelper.FOTRFrodo,
|
GenericCardTestHelper.FOTRFrodo,
|
||||||
@@ -46,7 +49,7 @@ public class Card_10_016_Tests
|
|||||||
|
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var card = scn.GetFreepsCard("wind");
|
||||||
|
|
||||||
assertEquals("Gathering Wind", card.getBlueprint().getTitle());
|
assertEquals("Gathering Wind", card.getBlueprint().getTitle());
|
||||||
assertNull(card.getBlueprint().getSubtitle());
|
assertNull(card.getBlueprint().getSubtitle());
|
||||||
@@ -58,18 +61,39 @@ public class Card_10_016_Tests
|
|||||||
assertEquals(2, card.getBlueprint().getTwilightCost());
|
assertEquals(2, card.getBlueprint().getTwilightCost());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment any @Test markers below once this is ready to be used
|
@Test
|
||||||
//@Test
|
public void GatheringWindReducesStrengthOfChosenTwilightMinions() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
public void GatheringWindTest1() throws DecisionResultInvalidException, CardNotFoundException {
|
|
||||||
//Pre-game setup
|
//Pre-game setup
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var wind = scn.GetFreepsCard("wind");
|
||||||
scn.FreepsMoveCardToHand(card);
|
var gandalf = scn.GetFreepsCard("gandalf");
|
||||||
|
scn.FreepsMoveCardToHand(wind);
|
||||||
|
scn.FreepsMoveCharToTable(gandalf);
|
||||||
|
|
||||||
|
var one1 = scn.GetShadowCard("one1");
|
||||||
|
var two1 = scn.GetShadowCard("two1");
|
||||||
|
var two2 = scn.GetShadowCard("two2");
|
||||||
|
var three1 = scn.GetShadowCard("three1");
|
||||||
|
scn.ShadowMoveCharToTable(one1, two1, two2, three1);
|
||||||
|
|
||||||
scn.StartGame();
|
scn.StartGame();
|
||||||
scn.FreepsPlayCard(card);
|
|
||||||
|
|
||||||
assertEquals(2, scn.GetTwilight());
|
scn.SkipToPhase(Phase.MANEUVER);
|
||||||
|
assertEquals(5, scn.GetStrength(one1));
|
||||||
|
assertEquals(6, scn.GetStrength(two1));
|
||||||
|
assertEquals(6, scn.GetStrength(two2));
|
||||||
|
assertEquals(8, scn.GetStrength(three1));
|
||||||
|
assertEquals(0, scn.GetWoundsOn(gandalf));
|
||||||
|
assertTrue(scn.FreepsPlayAvailable(wind));
|
||||||
|
|
||||||
|
scn.FreepsPlayCard(wind);
|
||||||
|
assertEquals(1, scn.GetWoundsOn(gandalf));
|
||||||
|
scn.FreepsChoose("2");
|
||||||
|
|
||||||
|
assertEquals(5, scn.GetStrength(one1));
|
||||||
|
assertEquals(4, scn.GetStrength(two1));
|
||||||
|
assertEquals(4, scn.GetStrength(two2));
|
||||||
|
assertEquals(8, scn.GetStrength(three1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user