Fixed assignment abilities causing issues with defender +1. Fixed Shadow assignment abilities making the Shadow player re-assign those minions later (which causes an error).
This commit is contained in:
@@ -256,7 +256,8 @@ public class Filters {
|
|||||||
(Filter) (game, physicalCard) -> {
|
(Filter) (game, physicalCard) -> {
|
||||||
if (!ignoreExistingAssignments) {
|
if (!ignoreExistingAssignments) {
|
||||||
boolean assignedToSkirmish = Filters.assignedToSkirmish.accepts(game, physicalCard);
|
boolean assignedToSkirmish = Filters.assignedToSkirmish.accepts(game, physicalCard);
|
||||||
if (assignedToSkirmish)
|
int defender = game.getModifiersQuerying().getKeywordCount(game, physicalCard, Keyword.DEFENDER);
|
||||||
|
if (assignedToSkirmish && defender == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return game.getModifiersQuerying().canBeAssignedToSkirmish(game, assignedBySide, physicalCard);
|
return game.getModifiersQuerying().canBeAssignedToSkirmish(game, assignedBySide, physicalCard);
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public class ShadowPlayerAssignsHisMinionsGameProcess implements GameProcess {
|
|||||||
GameState gameState = game.getGameState();
|
GameState gameState = game.getGameState();
|
||||||
Filter minionFilter = Filters.and(CardType.MINION, Filters.owner(_playerId), Filters.in(_leftoverMinions));
|
Filter minionFilter = Filters.and(CardType.MINION, Filters.owner(_playerId), Filters.in(_leftoverMinions));
|
||||||
|
|
||||||
final Collection<PhysicalCard> minions = Filters.filterActive(game, minionFilter, Filters.assignableToSkirmish(Side.SHADOW, true, false));
|
final Collection<PhysicalCard> minions = Filters.filterActive(game, minionFilter, Filters.assignableToSkirmish(Side.SHADOW, false, false));
|
||||||
if (minions.size() > 0) {
|
if (!minions.isEmpty()) {
|
||||||
final Collection<PhysicalCard> freePeopleTargets =
|
final Collection<PhysicalCard> freePeopleTargets =
|
||||||
Filters.filterActive(game,
|
Filters.filterActive(game,
|
||||||
Filters.and(
|
Filters.and(
|
||||||
|
|||||||
@@ -265,13 +265,8 @@ public abstract class AbstractAtTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void validateContents(String[] array1, String[] array2) {
|
public void validateContents(String[] array1, String[] array2) {
|
||||||
if (array1.length != array2.length)
|
assertEquals("Array sizes differ", array1.length, array2.length);
|
||||||
fail("Array sizes differ");
|
assertArrayEquals("Array contents differ", Arrays.stream(array1).sorted().toArray(), Arrays.stream(array2).sorted().toArray());
|
||||||
List<String> values = new ArrayList<>(Arrays.asList(array1));
|
|
||||||
for (String s : array2) {
|
|
||||||
if (!values.remove(s))
|
|
||||||
fail("Arrays contents differ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] toCardIdArray(PhysicalCard... cards) {
|
public String[] toCardIdArray(PhysicalCard... cards) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Card_01_262_Tests
|
|||||||
{{
|
{{
|
||||||
put("assassin", "1_262");
|
put("assassin", "1_262");
|
||||||
put("runner", "1_178");
|
put("runner", "1_178");
|
||||||
put("sam", "1_310");
|
put("sam", "2_114");
|
||||||
}},
|
}},
|
||||||
GenericCardTestHelper.FellowshipSites,
|
GenericCardTestHelper.FellowshipSites,
|
||||||
GenericCardTestHelper.FOTRFrodo,
|
GenericCardTestHelper.FOTRFrodo,
|
||||||
@@ -96,4 +96,47 @@ public class Card_01_262_Tests
|
|||||||
// is unassigned, which isn't right.
|
// is unassigned, which isn't right.
|
||||||
scn.FreepsResolveSkirmish(sam);
|
scn.FreepsResolveSkirmish(sam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void OrcAssassinDoesNotPreventDefenderBonusFromBeingUsed() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
|
//Pre-game setup
|
||||||
|
var scn = GetScenario();
|
||||||
|
|
||||||
|
var assassin = scn.GetShadowCard("assassin");
|
||||||
|
var runner = scn.GetShadowCard("runner");
|
||||||
|
scn.ShadowMoveCharToTable(assassin, runner);
|
||||||
|
|
||||||
|
var frodo = scn.GetRingBearer();
|
||||||
|
var sam = scn.GetFreepsCard("sam");
|
||||||
|
scn.FreepsMoveCharToTable(sam);
|
||||||
|
|
||||||
|
scn.StartGame();
|
||||||
|
|
||||||
|
scn.SkipToPhase(Phase.MANEUVER);
|
||||||
|
scn.FreepsUseCardAction(sam);
|
||||||
|
|
||||||
|
scn.SkipToPhase(Phase.ASSIGNMENT);
|
||||||
|
scn.FreepsPassCurrentPhaseAction();
|
||||||
|
|
||||||
|
assertTrue(scn.ShadowActionAvailable(assassin));
|
||||||
|
scn.ShadowUseCardAction(assassin);
|
||||||
|
assertEquals(2, scn.GetFreepsCardChoiceCount());
|
||||||
|
|
||||||
|
assertTrue(scn.CanBeAssigned(sam));
|
||||||
|
scn.FreepsChooseCard(sam);
|
||||||
|
assertTrue(scn.IsCharAssigned(sam));
|
||||||
|
assertTrue(scn.IsCharAssigned(assassin));
|
||||||
|
|
||||||
|
scn.PassCurrentPhaseActions();
|
||||||
|
|
||||||
|
assertTrue(scn.hasKeyword(sam, Keyword.DEFENDER));
|
||||||
|
assertEquals(1, scn.GetKeywordCount(sam, Keyword.DEFENDER));
|
||||||
|
scn.CanBeAssigned(sam);
|
||||||
|
scn.FreepsAssignToMinions(sam, runner);
|
||||||
|
assertTrue(scn.IsCharAssigned(sam));
|
||||||
|
assertTrue(scn.IsCharAssigned(assassin));
|
||||||
|
assertTrue(scn.IsCharAssigned(runner));
|
||||||
|
// If beginning skirmishes now fails, then there is some issue with defender, which isn't right
|
||||||
|
scn.FreepsResolveSkirmish(sam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.gempukku.lotro.cards.official.set03;
|
|||||||
import com.gempukku.lotro.cards.GenericCardTestHelper;
|
import com.gempukku.lotro.cards.GenericCardTestHelper;
|
||||||
import com.gempukku.lotro.common.*;
|
import com.gempukku.lotro.common.*;
|
||||||
import com.gempukku.lotro.game.CardNotFoundException;
|
import com.gempukku.lotro.game.CardNotFoundException;
|
||||||
import com.gempukku.lotro.game.PhysicalCardImpl;
|
|
||||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@@ -18,8 +17,11 @@ public class Card_03_069_Tests
|
|||||||
return new GenericCardTestHelper(
|
return new GenericCardTestHelper(
|
||||||
new HashMap<>()
|
new HashMap<>()
|
||||||
{{
|
{{
|
||||||
put("card", "3_69");
|
put("saruman", "3_69");
|
||||||
// put other cards in here as needed for the test case
|
put("savage", "1_151");
|
||||||
|
|
||||||
|
put("sam", "2_114");
|
||||||
|
|
||||||
}},
|
}},
|
||||||
GenericCardTestHelper.FellowshipSites,
|
GenericCardTestHelper.FellowshipSites,
|
||||||
GenericCardTestHelper.FOTRFrodo,
|
GenericCardTestHelper.FOTRFrodo,
|
||||||
@@ -47,7 +49,7 @@ public class Card_03_069_Tests
|
|||||||
|
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var card = scn.GetFreepsCard("saruman");
|
||||||
|
|
||||||
assertEquals("Saruman", card.getBlueprint().getTitle());
|
assertEquals("Saruman", card.getBlueprint().getTitle());
|
||||||
assertEquals("Servant of the Eye", card.getBlueprint().getSubtitle());
|
assertEquals("Servant of the Eye", card.getBlueprint().getSubtitle());
|
||||||
@@ -62,18 +64,31 @@ public class Card_03_069_Tests
|
|||||||
assertEquals(4, card.getBlueprint().getSiteNumber());
|
assertEquals(4, card.getBlueprint().getSiteNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uncomment any @Test markers below once this is ready to be used
|
@Test
|
||||||
//@Test
|
public void SarumanCanAssignWithoutErrors() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
public void SarumanTest1() throws DecisionResultInvalidException, CardNotFoundException {
|
|
||||||
//Pre-game setup
|
//Pre-game setup
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var saruman = scn.GetShadowCard("saruman");
|
||||||
scn.FreepsMoveCardToHand(card);
|
var savage = scn.GetShadowCard("savage");
|
||||||
|
scn.ShadowMoveCharToTable(saruman, savage);
|
||||||
|
|
||||||
|
var sam = scn.GetFreepsCard("sam");
|
||||||
|
scn.FreepsMoveCharToTable(sam);
|
||||||
|
|
||||||
scn.StartGame();
|
scn.StartGame();
|
||||||
scn.FreepsPlayCard(card);
|
|
||||||
|
|
||||||
assertEquals(4, scn.GetTwilight());
|
scn.SkipToPhase(Phase.ASSIGNMENT);
|
||||||
|
scn.FreepsPassCurrentPhaseAction();
|
||||||
|
|
||||||
|
assertTrue(scn.ShadowActionAvailable(saruman));
|
||||||
|
assertTrue(scn.CanBeAssigned(sam));
|
||||||
|
assertTrue(scn.CanBeAssigned(savage));
|
||||||
|
|
||||||
|
scn.ShadowUseCardAction(saruman);
|
||||||
|
scn.FreepsChooseNo();
|
||||||
|
scn.PassCurrentPhaseActions();
|
||||||
|
|
||||||
|
scn.FreepsResolveSkirmish(sam);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user