Fixed site name referencing in the test rig, and flipped draw deck population to a more intuitive bottom-up style....which broke every test that dealt with topdecking (also fixed). Fixed CardPhaseLimit wrong limit.

This commit is contained in:
Christian 'ketura' McCarty
2022-08-17 00:16:54 -05:00
parent 12fc68b357
commit 7d9307afd7
7 changed files with 51 additions and 15 deletions

View File

@@ -26,7 +26,7 @@ public class CardPhaseLimitEvaluator implements Evaluator {
private int evaluateOnce(LotroGame game, PhysicalCard cardAffected) {
LimitCounter limitCounter = game.getModifiersQuerying().getUntilEndOfPhaseLimitCounter(_source, _phase);
int amountResult = _amount.evaluateExpression(game, cardAffected);
int limitResult = _amount.evaluateExpression(game, cardAffected);
int limitResult = _limit.evaluateExpression(game, cardAffected);
return limitCounter.incrementToLimit(limitResult, amountResult);
}

View File

@@ -104,11 +104,33 @@ public class GenericCardTestHelper extends AbstractAtTest {
String id = cardIDs.get(name);
PhysicalCardImpl card = createCard(P1, id);
Cards.get(P1).put(name, card);
FreepsMoveCardsToTopOfDeck(card);
FreepsMoveCardsToBottomOfDeck(card);
card = createCard(P2, id);
Cards.get(P2).put(name, card);
FreepsMoveCardsToTopOfDeck(card);
ShadowMoveCardsToBottomOfDeck(card);
}
}
if(siteIDs != null) {
for (var card : _game.getGameState().getAdventureDeck(P1)) {
String name = siteIDs.entrySet()
.stream()
.filter(x -> x.getValue().equals(card.getBlueprintId()))
.map(Map.Entry::getKey)
.findFirst().get();
Cards.get(P1).put(name, (PhysicalCardImpl) card);
}
for (var card : _game.getGameState().getAdventureDeck(P2)) {
String name = siteIDs.entrySet()
.stream()
.filter(x -> x.getValue().equals(card.getBlueprintId()))
.map(Map.Entry::getKey)
.findFirst().get();
Cards.get(P2).put(name, (PhysicalCardImpl) card);
}
}
}
@@ -129,6 +151,7 @@ public class GenericCardTestHelper extends AbstractAtTest {
public PhysicalCardImpl GetFreepsCard(String cardName) { return Cards.get(P1).get(cardName); }
public PhysicalCardImpl GetShadowCard(String cardName) { return Cards.get(P2).get(cardName); }
public PhysicalCardImpl GetCard(String player, String cardName) { return Cards.get(player).get(cardName); }
public PhysicalCardImpl GetFreepsCardByID(String id) { return GetCardByID(P1, Integer.parseInt(id)); }
public PhysicalCardImpl GetFreepsCardByID(int id) { return GetCardByID(P1, id); }
public PhysicalCardImpl GetShadowCardByID(String id) { return GetCardByID(P2, Integer.parseInt(id)); }
@@ -152,10 +175,14 @@ public class GenericCardTestHelper extends AbstractAtTest {
}
public PhysicalCardImpl GetFreepsSite(String name) { return GetSiteByName(P1, name); }
public PhysicalCardImpl GetShadowSite(String name) { return GetSiteByName(P2, name); }
public PhysicalCardImpl GetSiteByName(String playerID, String name)
public PhysicalCardImpl GetSiteByName(String player, String name)
{
var attempt = GetCard(player, name);
if(attempt != null)
return attempt;
final String lowername = name.toLowerCase();
List<PhysicalCardImpl> advDeck = (List<PhysicalCardImpl>)_game.getGameState().getAdventureDeck(playerID);
List<PhysicalCardImpl> advDeck = (List<PhysicalCardImpl>)_game.getGameState().getAdventureDeck(player);
return advDeck.stream().filter(x -> x.getBlueprint().getTitle().toLowerCase().contains(lowername)).findFirst().get();
}
@@ -686,7 +713,16 @@ public class GenericCardTestHelper extends AbstractAtTest {
return _game.getModifiersQuerying().getStrength(_game, card);
}
public int GetVitality(PhysicalCardImpl card) { return _game.getModifiersQuerying().getVitality(_game, card); }
public int GetSiteNumber(PhysicalCardImpl card) { return _game.getModifiersQuerying().getMinionSiteNumber(_game, card); }
public int GetMinionSiteNumber(PhysicalCardImpl card) { return _game.getModifiersQuerying().getMinionSiteNumber(_game, card); }
public int GetGeneralSiteNumber(PhysicalCardImpl card)
{
int bpNumber = card.getBlueprint().getSiteNumber();
Integer siteNumber = card.getSiteNumber();
if(siteNumber == null)
return bpNumber;
return siteNumber;
}
public boolean HasKeyword(PhysicalCardImpl card, Keyword keyword)
{

View File

@@ -270,7 +270,7 @@ public class Card_V1_025_Tests
scn.SkipToPhase(Phase.REGROUP);
scn.PassCurrentPhaseActions();
//scn.ShadowDeclineReconciliation();
scn.ShadowChooseCard("aragorn"); // reconciling a card away so we draw the weather from the top
scn.ShadowChooseCard("arwen"); // reconciling a card away so we draw the weather from the top
scn.FreepsChooseToMove();
scn.SkipToPhase(Phase.MANEUVER);

View File

@@ -276,7 +276,7 @@ public class Card_V1_026_Tests
scn.SkipToPhase(Phase.REGROUP);
scn.PassCurrentPhaseActions();
scn.ShadowChooseCard("gimli"); // reconciling a card away so we draw the item from the top
scn.ShadowChooseCard("axe5"); // reconciling a card away so we draw the item from the top
scn.FreepsChooseToMove();
scn.SkipToPhase(Phase.MANEUVER);

View File

@@ -156,7 +156,7 @@ public class Card_V1_028_Tests
scn.SkipToPhase(Phase.REGROUP);
scn.PassCurrentPhaseActions();
//scn.ShadowDeclineReconciliation();
scn.ShadowChooseCard("filler1"); // reconciling a card away so we draw the saruman from the top
scn.ShadowChooseCard("filler5"); // reconciling a card away so we draw the saruman from the top
scn.FreepsChooseToMove();
scn.SkipToPhase(Phase.MANEUVER);

View File

@@ -257,7 +257,7 @@ public class Card_V1_029_Tests
scn.SkipToPhase(Phase.REGROUP);
scn.PassCurrentPhaseActions();
scn.ShadowChooseCard("fcond1"); // reconciling a card away so we draw the item from the top
scn.ShadowChooseCard("fcond5"); // reconciling a card away so we draw the item from the top
scn.FreepsChooseToMove();
scn.SkipToPhase(Phase.MANEUVER);

View File

@@ -81,15 +81,15 @@ public class Card_V1_046_Tests
scn.StartGame();
scn.RemoveBurdens(1);
assertEquals(6, scn.GetSiteNumber(orc));
assertEquals(6, scn.GetMinionSiteNumber(orc));
scn.AddBurdens(1);
assertEquals(5, scn.GetSiteNumber(orc));
assertEquals(5, scn.GetMinionSiteNumber(orc));
scn.AddBurdens(1);
assertEquals(4, scn.GetSiteNumber(orc));
assertEquals(4, scn.GetMinionSiteNumber(orc));
scn.AddBurdens(1);
assertEquals(3, scn.GetSiteNumber(orc));
assertEquals(3, scn.GetMinionSiteNumber(orc));
scn.AddBurdens(1);
assertEquals(2, scn.GetSiteNumber(orc));
assertEquals(2, scn.GetMinionSiteNumber(orc));
scn.FreepsPassCurrentPhaseAction();