Fixed play-from-deck actions not working. Fixed all flood insurance cards not properly removing themselves from the game after playing.

This commit is contained in:
Christian 'ketura' McCarty
2024-11-14 09:53:43 -06:00
parent 618bfe3973
commit e5b869b44a
9 changed files with 134 additions and 26 deletions

View File

@@ -218,8 +218,8 @@
type: TakeControlOfSite type: TakeControlOfSite
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -31,8 +31,8 @@
count: 8 count: 8
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -262,8 +262,8 @@
select: all(character,MinTwilight(4)) select: all(character,MinTwilight(4))
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -410,8 +410,8 @@
} }
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -33,8 +33,8 @@
until: regroup until: regroup
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -31,8 +31,8 @@
amount: 0-9 amount: 0-9
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -41,8 +41,8 @@
} }
} }
{ {
type: RemoveFromTheGame type: removePlayedEventFromTheGame
select: self filter: self
} }
] ]
} }

View File

@@ -26,7 +26,7 @@ public class ActivatePhaseActionsFromDrawDeckRule {
public List<? extends Action> getPhaseActions(String playerId, LotroGame game) { public List<? extends Action> getPhaseActions(String playerId, LotroGame game) {
List<Action> result = new LinkedList<>(); List<Action> result = new LinkedList<>();
final Side side = GameUtils.getSide(game, playerId); final Side side = GameUtils.getSide(game, playerId);
for (PhysicalCard activableCard : Filters.filter(game, game.getGameState().getDiscard(playerId), side)) { for (PhysicalCard activableCard : Filters.filter(game, game.getGameState().getDeck(playerId), side)) {
List<? extends Action> list = activableCard.getBlueprint().getPhaseActionsFromDrawDeck(playerId, game, activableCard); List<? extends Action> list = activableCard.getBlueprint().getPhaseActionsFromDrawDeck(playerId, game, activableCard);
if (list != null) { if (list != null) {
for (Action action : list) { for (Action action : list) {

View File

@@ -3,7 +3,6 @@ package com.gempukku.lotro.cards.unofficial.pc.vsets.set_v02;
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_V2_022_Tests
return new GenericCardTestHelper( return new GenericCardTestHelper(
new HashMap<>() new HashMap<>()
{{ {{
put("card", "102_22"); put("folly", "102_22");
// put other cards in here as needed for the test case put("uruk", "1_151");
put("gandalf", "1_72");
put("sam", "1_311");
}}, }},
GenericCardTestHelper.FellowshipSites, GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo, GenericCardTestHelper.FOTRFrodo,
@@ -44,7 +46,7 @@ public class Card_V2_022_Tests
var scn = GetScenario(); var scn = GetScenario();
var card = scn.GetFreepsCard("card"); var card = scn.GetFreepsCard("folly");
assertEquals("Fell from Wisdom into Folly", card.getBlueprint().getTitle()); assertEquals("Fell from Wisdom into Folly", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle()); assertNull(card.getBlueprint().getSubtitle());
@@ -56,18 +58,124 @@ public class Card_V2_022_Tests
assertEquals(0, card.getBlueprint().getTwilightCost()); assertEquals(0, card.getBlueprint().getTwilightCost());
} }
// Uncomment any @Test markers below once this is ready to be used @Test
//@Test public void FellfromWisdomintoFollyExertsOnceOrTwiceWhenPlayedFromHand() throws DecisionResultInvalidException, CardNotFoundException {
public void FellfromWisdomintoFollyTest1() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup //Pre-game setup
var scn = GetScenario(); var scn = GetScenario();
var card = scn.GetFreepsCard("card"); var folly = scn.GetShadowCard("folly");
scn.FreepsMoveCardToHand(card); var uruk = scn.GetShadowCard("uruk");
scn.ShadowMoveCardToHand(folly);
scn.ShadowMoveCharToTable(uruk);
var frodo = scn.GetRingBearer();
var sam = scn.GetFreepsCard("sam");
var gandalf = scn.GetFreepsCard("gandalf");
scn.FreepsMoveCharToTable(sam, gandalf);
scn.StartGame(); scn.StartGame();
scn.FreepsPlayCard(card);
assertEquals(0, scn.GetTwilight()); scn.SetTwilight(20);
scn.FreepsPassCurrentPhaseAction();
assertEquals(25, scn.GetTwilight());
assertTrue(scn.ShadowPlayAvailable(folly));
assertEquals(0, scn.GetWoundsOn(frodo));
assertEquals(0, scn.GetWoundsOn(sam));
assertEquals(0, scn.GetWoundsOn(gandalf));
assertEquals(0, scn.GetWoundsOn(uruk));
scn.ShadowPlayCard(folly);
assertEquals(15, scn.GetTwilight());
assertEquals(1, scn.GetWoundsOn(frodo));
assertEquals(1, scn.GetWoundsOn(sam));
//Gandalf costs 4 or more, so he gets 2
assertEquals(2, scn.GetWoundsOn(gandalf));
assertEquals(1, scn.GetWoundsOn(uruk));
assertEquals(Zone.REMOVED, folly.getZone());
}
@Test
public void FellfromWisdomintoFollyFunctionsWhenPlayedFromDiscard() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var folly = scn.GetShadowCard("folly");
var uruk = scn.GetShadowCard("uruk");
scn.ShadowMoveCardToDiscard(folly);
scn.ShadowMoveCharToTable(uruk);
var frodo = scn.GetRingBearer();
var sam = scn.GetFreepsCard("sam");
var gandalf = scn.GetFreepsCard("gandalf");
scn.FreepsMoveCharToTable(sam, gandalf);
scn.StartGame();
scn.SetTwilight(20);
scn.FreepsPassCurrentPhaseAction();
assertEquals(25, scn.GetTwilight());
//It's an ability being activated and not a "play", which is only true for cards
// currently in hand.
assertTrue(scn.ShadowActionAvailable(folly));
assertEquals(0, scn.GetWoundsOn(frodo));
assertEquals(0, scn.GetWoundsOn(sam));
assertEquals(0, scn.GetWoundsOn(gandalf));
assertEquals(0, scn.GetWoundsOn(uruk));
scn.ShadowUseCardAction(folly);
assertEquals(15, scn.GetTwilight());
assertEquals(1, scn.GetWoundsOn(frodo));
assertEquals(1, scn.GetWoundsOn(sam));
//Gandalf costs 4 or more, so he gets 2
assertEquals(2, scn.GetWoundsOn(gandalf));
assertEquals(1, scn.GetWoundsOn(uruk));
assertEquals(Zone.REMOVED, folly.getZone());
}
@Test
public void FellfromWisdomintoFollyFunctionsWhenPlayedFromDrawDeck() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var folly = scn.GetShadowCard("folly");
var uruk = scn.GetShadowCard("uruk");
scn.ShadowMoveCardsToTopOfDeck(folly);
scn.ShadowMoveCharToTable(uruk);
var frodo = scn.GetRingBearer();
var sam = scn.GetFreepsCard("sam");
var gandalf = scn.GetFreepsCard("gandalf");
scn.FreepsMoveCharToTable(sam, gandalf);
scn.StartGame();
scn.SetTwilight(20);
scn.FreepsPassCurrentPhaseAction();
assertEquals(25, scn.GetTwilight());
//It's an ability being activated and not a "play", which is only true for cards
// currently in hand.
assertTrue(scn.ShadowActionAvailable(folly));
assertEquals(0, scn.GetWoundsOn(frodo));
assertEquals(0, scn.GetWoundsOn(sam));
assertEquals(0, scn.GetWoundsOn(gandalf));
assertEquals(0, scn.GetWoundsOn(uruk));
scn.ShadowUseCardAction(folly);
assertEquals(15, scn.GetTwilight());
assertEquals(1, scn.GetWoundsOn(frodo));
assertEquals(1, scn.GetWoundsOn(sam));
//Gandalf costs 4 or more, so he gets 2
assertEquals(2, scn.GetWoundsOn(gandalf));
assertEquals(1, scn.GetWoundsOn(uruk));
assertEquals(Zone.REMOVED, folly.getZone());
} }
} }