Adding unit tests for The Ruling Ring and Isildur's Bane

This commit is contained in:
Christian 'ketura' McCarty
2024-09-26 00:20:41 -05:00
parent 40ae63887f
commit fc067ce281
2 changed files with 343 additions and 26 deletions

View File

@@ -2,12 +2,19 @@ package com.gempukku.lotro.cards.official.set01;
import com.gempukku.lotro.cards.GenericCardTestHelper;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.AbstractActionProxy;
import com.gempukku.lotro.game.CardNotFoundException;
import com.gempukku.lotro.game.PhysicalCardImpl;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.effects.PutOnTheOneRingEffect;
import com.gempukku.lotro.logic.timing.Action;
import org.junit.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.*;
@@ -18,17 +25,26 @@ public class Card_01_001_Tests
return new GenericCardTestHelper(
new HashMap<>()
{{
put("card", "1_1");
// put other cards in here as needed for the test case
put("sword", "1_299");
//Shadow wounding
put("snuffler", "13_52");
//Maneuver wounding
put("picket", "6_101");
//Archery wounding
put("marksman", "1_176");
//Skirmish wounding
put("soldier", "1_271");
//Regroup wounding
put("gollum", "9_28");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
GenericCardTestHelper.RulingRing
"1_1"
);
}
@Test
public void TheOneRingStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
public void IsildursBaneStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
/**
* Set: 1
@@ -47,8 +63,7 @@ public class Card_01_001_Tests
var scn = GetScenario();
//Use this once you have set the deck up properly
//var card = scn.GetFreepsRing();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsRing();
assertEquals("The One Ring", card.getBlueprint().getTitle());
assertEquals("Isildur's Bane", card.getBlueprint().getSubtitle());
@@ -58,18 +73,133 @@ public class Card_01_001_Tests
assertEquals(1, card.getBlueprint().getVitality());
}
// Uncomment any @Test markers below once this is ready to be used
//@Test
public void TheOneRingTest1() throws DecisionResultInvalidException, CardNotFoundException {
@Test
public void IsildursBaneConvertsWoundsTo2BurdensDuringAnyPhaseWhenRingIsWorn() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
scn.FreepsMoveCardToHand(card);
var frodo = scn.GetRingBearer();
var ring = scn.GetFreepsRing();
scn.FreepsAttachCardsTo(frodo, "sword");
var marksman = scn.GetShadowCard("marksman");
var soldier = scn.GetShadowCard("soldier");
var picket = scn.GetShadowCard("picket");
var snuffler = scn.GetShadowCard("snuffler");
var gollum = scn.GetShadowCard("gollum");
scn.ShadowMoveCharToTable(marksman, soldier, picket, gollum);
scn.ShadowMoveCardToHand(snuffler);
//Cheat and add an ability to Frodo which puts on the One Ring
scn.ApplyAdHocAction(new AbstractActionProxy() {
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game) {
ActivateCardAction action = new ActivateCardAction(frodo);
action.appendEffect(new PutOnTheOneRingEffect());
return Collections.singletonList(action);
}
});
scn.StartGame();
scn.FreepsPlayCard(card);
assertEquals(0, scn.GetTwilight());
scn.FreepsUseCardAction(frodo);
assertEquals(1, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
scn.FreepsPassCurrentPhaseAction();
//Shadow wounds can convert to burdens
assertTrue(scn.RBWearingOneRing());
assertTrue(scn.ShadowPlayAvailable(snuffler));
scn.ShadowPlayCard(snuffler);
assertEquals(3, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
scn.ShadowPassCurrentPhaseAction();
//Maneuver wounds can convert to burdens
assertTrue(scn.RBWearingOneRing());
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(picket);
scn.FreepsDeclineOptionalTrigger();
assertEquals(5, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
scn.PassCurrentPhaseActions();
//Archery wounds can convert to burdens
assertTrue(scn.RBWearingOneRing());
scn.PassCurrentPhaseActions();
assertEquals(7, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
//Assignment phase
scn.PassCurrentPhaseActions();
scn.FreepsDeclineAssignments();
scn.ShadowAssignToMinions(frodo, soldier);
scn.FreepsResolveSkirmish(frodo);
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(soldier);
//We are now in a skirmish phase, so the burden should have gotten converted
assertTrue(scn.RBWearingOneRing());
assertEquals(9, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
//Have to cheat because we're out of resistance haha
scn.RemoveBurdens(9);
scn.PassCurrentPhaseActions();
//Regular skirmish wound converted to burden
assertEquals(2, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
assertEquals(Phase.REGROUP, scn.GetCurrentPhase());
//Got taken off at the start of the regroup phase
assertFalse(scn.RBWearingOneRing());
scn.FreepsUseCardAction(frodo);
assertTrue(scn.RBWearingOneRing());
//Regroup wounds cannot convert to burdens
scn.ShadowChooseAction("wound"); //We want DaD's wounding action, not his 3 twilight action
assertEquals(4, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
}
@Test
public void IsildursBaneRespondsToAnyWoundToWearRingUntilRegroup() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var frodo = scn.GetRingBearer();
var ring = scn.GetFreepsRing();
var picket = scn.GetShadowCard("picket");
scn.ShadowMoveCharToTable(picket);
scn.StartGame();
scn.SkipToPhase(Phase.MANEUVER);
assertEquals(1, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
assertFalse(scn.RBWearingOneRing());
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(picket);
scn.FreepsDeclineOptionalTrigger(); //Declining the Picket's culture selection.
//One Ring response
assertTrue(scn.FreepsHasOptionalTriggerAvailable());
scn.FreepsAcceptOptionalTrigger();
assertEquals(3, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
assertTrue(scn.RBWearingOneRing());
}
}

View File

@@ -2,12 +2,19 @@ package com.gempukku.lotro.cards.official.set01;
import com.gempukku.lotro.cards.GenericCardTestHelper;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.AbstractActionProxy;
import com.gempukku.lotro.game.CardNotFoundException;
import com.gempukku.lotro.game.PhysicalCardImpl;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.effects.PutOnTheOneRingEffect;
import com.gempukku.lotro.logic.timing.Action;
import org.junit.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import static org.junit.Assert.*;
@@ -18,8 +25,17 @@ public class Card_01_002_Tests
return new GenericCardTestHelper(
new HashMap<>()
{{
put("card", "1_2");
// put other cards in here as needed for the test case
put("sword", "1_299");
//Shadow wounding
put("snuffler", "13_52");
//Maneuver wounding
put("picket", "6_101");
//Archery wounding
put("marksman", "1_176");
//Skirmish wounding
put("soldier", "1_271");
//Regroup wounding
put("gollum", "9_28");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
@@ -28,7 +44,7 @@ public class Card_01_002_Tests
}
@Test
public void TheOneRingStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
public void RulingRingStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
/**
* Set: 1
@@ -37,7 +53,7 @@ public class Card_01_002_Tests
* Side:
* Culture:
* Twilight Cost:
* Type: Onering
* Type: One Ring
* Subtype:
* Strength: 1
* Game Text: <b>Response:</b> If bearer is about to take a wound in a skirmish, he wears The One Ring until the regroup phase.<br>While wearing The One Ring, each time the Ring-bearer is about to take a wound during a skirmish, add a burden instead.
@@ -46,8 +62,7 @@ public class Card_01_002_Tests
var scn = GetScenario();
//Use this once you have set the deck up properly
//var card = scn.GetFreepsRing();
var card = scn.GetFreepsCard("card");
var card = scn.GetFreepsRing();
assertEquals("The One Ring", card.getBlueprint().getTitle());
assertEquals("The Ruling Ring", card.getBlueprint().getSubtitle());
@@ -56,18 +71,190 @@ public class Card_01_002_Tests
assertEquals(1, card.getBlueprint().getStrength());
}
// Uncomment any @Test markers below once this is ready to be used
//@Test
public void TheOneRingTest1() throws DecisionResultInvalidException, CardNotFoundException {
@Test
public void RulingRingConvertsWoundsOnlyDuringSkirmishPhaseWhenRingIsWorn() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var card = scn.GetFreepsCard("card");
scn.FreepsMoveCardToHand(card);
var frodo = scn.GetRingBearer();
var ring = scn.GetFreepsRing();
var marksman = scn.GetShadowCard("marksman");
var soldier = scn.GetShadowCard("soldier");
var picket = scn.GetShadowCard("picket");
var snuffler = scn.GetShadowCard("snuffler");
var gollum = scn.GetShadowCard("gollum");
scn.ShadowMoveCharToTable(marksman, soldier, picket, gollum);
scn.ShadowMoveCardToHand(snuffler);
//Cheat and add an ability to Frodo which puts on the One Ring
scn.ApplyAdHocAction(new AbstractActionProxy() {
@Override
public List<? extends Action> getPhaseActions(String playerId, LotroGame game) {
ActivateCardAction action = new ActivateCardAction(frodo);
action.appendEffect(new PutOnTheOneRingEffect());
return Collections.singletonList(action);
}
});
scn.StartGame();
scn.FreepsPlayCard(card);
assertEquals(0, scn.GetTwilight());
scn.FreepsUseCardAction(frodo);
assertEquals(1, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
scn.FreepsPassCurrentPhaseAction();
//Shadow wounds cannot convert to burdens
assertTrue(scn.RBWearingOneRing());
assertTrue(scn.ShadowPlayAvailable(snuffler));
scn.ShadowPlayCard(snuffler);
assertEquals(1, scn.GetBurdens());
assertEquals(1, scn.GetWoundsOn(frodo));
scn.ShadowPassCurrentPhaseAction();
//Maneuver wounds cannot convert to burdens
assertTrue(scn.RBWearingOneRing());
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(picket);
scn.FreepsDeclineOptionalTrigger();
assertEquals(1, scn.GetBurdens());
assertEquals(2, scn.GetWoundsOn(frodo));
scn.PassCurrentPhaseActions();
//Archery wounds cannot convert to burdens
assertTrue(scn.RBWearingOneRing());
scn.PassCurrentPhaseActions();
assertEquals(1, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
//Assignment phase
scn.PassCurrentPhaseActions();
scn.FreepsDeclineAssignments();
scn.ShadowAssignToMinions(frodo, soldier);
scn.FreepsResolveSkirmish(frodo);
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(soldier);
//We are now in a skirmish phase, so the burden should have gotten converted
assertTrue(scn.RBWearingOneRing());
assertEquals(2, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
scn.PassCurrentPhaseActions();
//Regular skirmish wound converted to burden
assertEquals(3, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
assertEquals(Phase.REGROUP, scn.GetCurrentPhase());
//Got taken off at the start of the regroup phase
assertFalse(scn.RBWearingOneRing());
scn.FreepsUseCardAction(frodo);
assertTrue(scn.RBWearingOneRing());
//We cheat because there's too many wounds
scn.RemoveWoundsFromChar(frodo, 4);
//Regroup wounds cannot convert to burdens
scn.ShadowChooseAction("wound"); //We want DaD's wounding action, not his 3 twilight action
assertEquals(3, scn.GetBurdens());
assertEquals(1, scn.GetWoundsOn(frodo));
}
@Test
public void RulingRingRespondsOnlyDuringSkirmishPhase() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var frodo = scn.GetRingBearer();
var ring = scn.GetFreepsRing();
var marksman = scn.GetShadowCard("marksman");
var soldier = scn.GetShadowCard("soldier");
var picket = scn.GetShadowCard("picket");
var snuffler = scn.GetShadowCard("snuffler");
var gollum = scn.GetShadowCard("gollum");
scn.ShadowMoveCharToTable(marksman, soldier, picket, gollum);
scn.ShadowMoveCardToHand(snuffler);
scn.StartGame();
assertEquals(1, scn.GetBurdens());
assertEquals(0, scn.GetWoundsOn(frodo));
scn.FreepsPassCurrentPhaseAction();
//Shadow wounds cannot convert to burdens
assertFalse(scn.RBWearingOneRing());
assertTrue(scn.ShadowPlayAvailable(snuffler));
scn.ShadowPlayCard(snuffler);
assertFalse(scn.FreepsHasOptionalTriggerAvailable());
assertEquals(1, scn.GetBurdens());
assertEquals(1, scn.GetWoundsOn(frodo));
scn.ShadowPassCurrentPhaseAction();
//Maneuver wounds cannot convert to burdens
assertFalse(scn.RBWearingOneRing());
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(picket);
scn.FreepsDeclineOptionalTrigger(); //Picket's text
assertFalse(scn.FreepsHasOptionalTriggerAvailable());
assertEquals(1, scn.GetBurdens());
assertEquals(2, scn.GetWoundsOn(frodo));
scn.PassCurrentPhaseActions();
//Archery wounds cannot convert to burdens
assertFalse(scn.RBWearingOneRing());
scn.PassCurrentPhaseActions();
assertFalse(scn.FreepsHasOptionalTriggerAvailable());
assertEquals(1, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
//Assignment phase
scn.PassCurrentPhaseActions();
scn.FreepsDeclineAssignments();
scn.ShadowAssignToMinions(frodo, soldier);
scn.FreepsResolveSkirmish(frodo);
scn.FreepsPassCurrentPhaseAction();
scn.ShadowUseCardAction(soldier);
//We are now in a skirmish phase, so the response should now be active
assertTrue(scn.FreepsHasOptionalTriggerAvailable());
scn.FreepsAcceptOptionalTrigger();
assertTrue(scn.RBWearingOneRing());
assertEquals(2, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
scn.PassCurrentPhaseActions();
//Regular skirmish wound converted to burden
assertEquals(3, scn.GetBurdens());
assertEquals(3, scn.GetWoundsOn(frodo));
assertEquals(Phase.REGROUP, scn.GetCurrentPhase());
//Got taken off at the start of the regroup phase
assertFalse(scn.RBWearingOneRing());
scn.FreepsPassCurrentPhaseAction();
//We cheat because there's too many wounds
scn.RemoveWoundsFromChar(frodo, 4);
//Regroup wounds cannot convert to burdens
scn.ShadowChooseAction("wound"); //We want DaD's wounding action, not his 3 twilight action
assertFalse(scn.FreepsHasOptionalTriggerAvailable());
assertEquals(3, scn.GetBurdens());
assertEquals(1, scn.GetWoundsOn(frodo));
}
}