Implementing Legacy Ruling #2: The last removed character from a skirmish counts as a loser
This commit is contained in:
@@ -3,7 +3,7 @@ package com.gempukku.lotro.game.state;
|
|||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
|
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class Skirmish {
|
public class Skirmish {
|
||||||
@@ -14,7 +14,7 @@ public class Skirmish {
|
|||||||
private Evaluator _fpStrengthOverrideEvaluator;
|
private Evaluator _fpStrengthOverrideEvaluator;
|
||||||
private Evaluator _shadowStrengthOverrideEvaluator;
|
private Evaluator _shadowStrengthOverrideEvaluator;
|
||||||
|
|
||||||
private final Set<PhysicalCard> _removedFromSkirmish = new HashSet<>();
|
private final Set<PhysicalCard> _removedFromSkirmish = new LinkedHashSet<>();
|
||||||
|
|
||||||
public Skirmish(PhysicalCard fellowshipCharacter, Set<PhysicalCard> shadowCharacters) {
|
public Skirmish(PhysicalCard fellowshipCharacter, Set<PhysicalCard> shadowCharacters) {
|
||||||
_fellowshipCharacter = fellowshipCharacter;
|
_fellowshipCharacter = fellowshipCharacter;
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public class ResolveSkirmishEffect extends AbstractEffect {
|
|||||||
|
|
||||||
var shadow = skirmish.getShadowCharacters();
|
var shadow = skirmish.getShadowCharacters();
|
||||||
var freeps = fpList(skirmish.getFellowshipCharacter());
|
var freeps = fpList(skirmish.getFellowshipCharacter());
|
||||||
|
var removed = skirmish.getRemovedFromSkirmish();
|
||||||
|
|
||||||
Set<PhysicalCard> involving = new HashSet<>();
|
Set<PhysicalCard> involving = new HashSet<>();
|
||||||
involving.addAll(freeps);
|
involving.addAll(freeps);
|
||||||
@@ -125,10 +126,22 @@ public class ResolveSkirmishEffect extends AbstractEffect {
|
|||||||
for (PhysicalCard loser : losers) {
|
for (PhysicalCard loser : losers) {
|
||||||
game.getActionsEnvironment().emitEffectResult(new CharacterLostSkirmishResult(skirmishType, loser, involving));
|
game.getActionsEnvironment().emitEffectResult(new CharacterLostSkirmishResult(skirmishType, loser, involving));
|
||||||
}
|
}
|
||||||
|
// Legacy Ruling #2: The final removed character from a skirmish counts as a loser
|
||||||
|
// https://wiki.lotrtcgpc.net/wiki/Legacy_Ruling_2
|
||||||
|
if(losers.isEmpty()) {
|
||||||
|
PhysicalCard finalRemoved = null;
|
||||||
|
for(var card : removed) {
|
||||||
|
finalRemoved = card;
|
||||||
|
}
|
||||||
|
if(finalRemoved != null) {
|
||||||
|
game.getActionsEnvironment().emitEffectResult(new CharacterLostSkirmishResult(skirmishType, finalRemoved, involving));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (PhysicalCard winner : winners) {
|
for (PhysicalCard winner : winners) {
|
||||||
game.getActionsEnvironment().emitEffectResult(new CharacterWonSkirmishResult(skirmishType, winner, involving));
|
game.getActionsEnvironment().emitEffectResult(new CharacterWonSkirmishResult(skirmishType, winner, involving));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new FullEffectResult(true);
|
return new FullEffectResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ public class Card_12_132_Tests
|
|||||||
return new GenericCardTestHelper(
|
return new GenericCardTestHelper(
|
||||||
new HashMap<>()
|
new HashMap<>()
|
||||||
{{
|
{{
|
||||||
put("card", "12_132");
|
put("fury", "12_132");
|
||||||
// put other cards in here as needed for the test case
|
put("merry", "4_310");
|
||||||
|
|
||||||
|
put("savage", "1_151");
|
||||||
}},
|
}},
|
||||||
GenericCardTestHelper.FellowshipSites,
|
GenericCardTestHelper.FellowshipSites,
|
||||||
GenericCardTestHelper.FOTRFrodo,
|
GenericCardTestHelper.FOTRFrodo,
|
||||||
@@ -38,12 +40,13 @@ public class Card_12_132_Tests
|
|||||||
* Twilight Cost: 2
|
* Twilight Cost: 2
|
||||||
* Type: Condition
|
* Type: Condition
|
||||||
* Subtype: Support area
|
* Subtype: Support area
|
||||||
* Game Text: Each time a [shire] companion loses a skirmish, add a [shire] token here.<br><b>Skirmish:</b> Remove a [shire] token from here to make a [shire] companion strength +1.
|
* Game Text: Each time a [shire] companion loses a skirmish, add a [shire] token here.
|
||||||
|
* <b>Skirmish:</b> Remove a [shire] token from here to make a [shire] companion strength +1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var card = scn.GetFreepsCard("fury");
|
||||||
|
|
||||||
assertEquals("Sudden Fury", card.getBlueprint().getTitle());
|
assertEquals("Sudden Fury", card.getBlueprint().getTitle());
|
||||||
assertNull(card.getBlueprint().getSubtitle());
|
assertNull(card.getBlueprint().getSubtitle());
|
||||||
@@ -55,17 +58,65 @@ public class Card_12_132_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 SuddenFuryAddsATokenWhenAHobbitLosesAStandardSkirmish() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
public void SuddenFuryTest1() throws DecisionResultInvalidException, CardNotFoundException {
|
|
||||||
//Pre-game setup
|
//Pre-game setup
|
||||||
var scn = GetScenario();
|
var scn = GetScenario();
|
||||||
|
|
||||||
var card = scn.GetFreepsCard("card");
|
var fury = scn.GetFreepsCard("fury");
|
||||||
scn.FreepsMoveCardToHand(card);
|
var merry = scn.GetFreepsCard("merry");
|
||||||
|
scn.FreepsMoveCardToSupportArea(fury);
|
||||||
|
scn.FreepsMoveCharToTable(merry);
|
||||||
|
|
||||||
|
var savage = scn.GetShadowCard("savage");
|
||||||
|
scn.ShadowMoveCharToTable(savage);
|
||||||
|
|
||||||
scn.StartGame();
|
scn.StartGame();
|
||||||
scn.FreepsPlayCard(card);
|
|
||||||
|
scn.SkipToAssignments();
|
||||||
|
scn.FreepsAssignAndResolve(merry, savage);
|
||||||
|
|
||||||
|
assertEquals(0, scn.GetCultureTokensOn(fury));
|
||||||
|
scn.PassSkirmishActions();
|
||||||
|
scn.FreepsResolveRuleFirst();
|
||||||
|
assertEquals(1, scn.GetCultureTokensOn(fury));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void SuddenFuryAddsATokenWhenAHobbitIsTheLastFreepsSkirmisherAndIsRemoved() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
|
//Pre-game setup
|
||||||
|
var scn = GetScenario();
|
||||||
|
|
||||||
|
var fury = scn.GetFreepsCard("fury");
|
||||||
|
var merry = scn.GetFreepsCard("merry");
|
||||||
|
scn.FreepsMoveCardToSupportArea(fury);
|
||||||
|
scn.FreepsMoveCharToTable(merry);
|
||||||
|
|
||||||
|
var savage = scn.GetShadowCard("savage");
|
||||||
|
scn.ShadowMoveCharToTable(savage);
|
||||||
|
|
||||||
|
scn.StartGame();
|
||||||
|
|
||||||
|
scn.SkipToAssignments();
|
||||||
|
scn.FreepsAssignAndResolve(merry, savage);
|
||||||
|
|
||||||
|
assertEquals(0, scn.GetCultureTokensOn(fury));
|
||||||
|
scn.FreepsUseCardAction(merry);
|
||||||
|
scn.ShadowChooseNo();
|
||||||
|
scn.FreepsResolveRuleFirst();
|
||||||
|
assertEquals(1, scn.GetCultureTokensOn(fury));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void SuddenFuryDoesNotAddTokenWhenHobbitRemovedBeforeSkirmishBegins() throws DecisionResultInvalidException, CardNotFoundException {
|
||||||
|
//Pre-game setup
|
||||||
|
var scn = GetScenario();
|
||||||
|
|
||||||
|
var fury = scn.GetFreepsCard("fury");
|
||||||
|
scn.FreepsMoveCardToHand(fury);
|
||||||
|
|
||||||
|
scn.StartGame();
|
||||||
|
scn.FreepsPlayCard(fury);
|
||||||
|
|
||||||
assertEquals(2, scn.GetTwilight());
|
assertEquals(2, scn.GetTwilight());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user