Discard trigger fixes
- Fixed Gnawing Biting Hacking Burning catching minions discarded at the end of the turn - Fixed V2 Now For Wrath not catching cards discarded from hand or deck
This commit is contained in:
@@ -404,6 +404,16 @@
|
||||
type: Discarded
|
||||
filter: culture(rohan), or(item, ally)
|
||||
}
|
||||
{
|
||||
type: Discarded
|
||||
fromZone: hand
|
||||
filter: culture(rohan), or(item, ally)
|
||||
}
|
||||
{
|
||||
type: Discarded
|
||||
fromZone: deck
|
||||
filter: culture(rohan), or(item, ally)
|
||||
}
|
||||
{
|
||||
type: Killed
|
||||
filter: culture(rohan), ally
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Discarded implements TriggerCheckerProducer {
|
||||
FieldUtils.validateAllowedFields(value, "filter", "source", "player", "fromZone", "ignoreVoluntary", "memorize");
|
||||
|
||||
final String filter = FieldUtils.getString(value.get("filter"), "filter", "any");
|
||||
final String source = FieldUtils.getString(value.get("source"), "source", "any");
|
||||
final String source = FieldUtils.getString(value.get("source"), "source");
|
||||
final String discardingPlayer = FieldUtils.getString(value.get("player"), "player");
|
||||
Zone zone = FieldUtils.getEnum(Zone.class, value.get("fromZone"), "fromZone");
|
||||
final boolean ignoreVoluntary = FieldUtils.getBoolean(value.get("ignoreVoluntary"), "ignoreVoluntary", false);
|
||||
@@ -88,13 +88,18 @@ public class Discarded implements TriggerCheckerProducer {
|
||||
source = discardResult.getSource();
|
||||
forced = discardResult.isForced();
|
||||
//TODO: split owner and performing player properly
|
||||
performingPlayer = source.getOwner();
|
||||
if(source != null) {
|
||||
performingPlayer = source.getOwner();
|
||||
}
|
||||
discardedCard = discardResult.getDiscardedCard();
|
||||
}
|
||||
}
|
||||
|
||||
if(discardedCard == null)
|
||||
return false;
|
||||
|
||||
if (result && bySource != null) {
|
||||
if (discardedCard == null || !Filters.accepts(actionContext.getGame(), bySource.getFilterable(actionContext), source))
|
||||
if (source == null || !Filters.accepts(actionContext.getGame(), bySource.getFilterable(actionContext), source))
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ public class Card_06_063_Tests
|
||||
return new GenericCardTestHelper(
|
||||
new HashMap<>()
|
||||
{{
|
||||
put("card", "6_63");
|
||||
// put other cards in here as needed for the test case
|
||||
put("gnawing", "6_63");
|
||||
put("artisan", "6_65");
|
||||
}},
|
||||
GenericCardTestHelper.FellowshipSites,
|
||||
GenericCardTestHelper.FOTRFrodo,
|
||||
@@ -27,7 +27,7 @@ public class Card_06_063_Tests
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GnawingBitingbrHackingBurningStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
public void GnawingBitingHackingBurningStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
|
||||
/**
|
||||
* Set: 6
|
||||
@@ -43,7 +43,7 @@ public class Card_06_063_Tests
|
||||
|
||||
var scn = GetScenario();
|
||||
|
||||
var card = scn.GetFreepsCard("card");
|
||||
var card = scn.GetFreepsCard("gnawing");
|
||||
|
||||
assertEquals("Gnawing, Biting, Hacking, Burning", card.getBlueprint().getTitle());
|
||||
assertNull(card.getBlueprint().getSubtitle());
|
||||
@@ -55,18 +55,44 @@ public class Card_06_063_Tests
|
||||
assertEquals(2, card.getBlueprint().getTwilightCost());
|
||||
}
|
||||
|
||||
// Uncomment any @Test markers below once this is ready to be used
|
||||
//@Test
|
||||
public void GnawingBitingbrHackingBurningTest1() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
@Test
|
||||
public void GnawingBitingHackingBurningCatchesRegroupActionDiscards() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
//Pre-game setup
|
||||
var scn = GetScenario();
|
||||
|
||||
var card = scn.GetFreepsCard("card");
|
||||
scn.FreepsMoveCardToHand(card);
|
||||
var gnawing = scn.GetShadowCard("gnawing");
|
||||
var artisan = scn.GetShadowCard("artisan");
|
||||
scn.ShadowMoveCharToTable(artisan);
|
||||
scn.ShadowMoveCardToSupportArea(gnawing);
|
||||
|
||||
scn.StartGame();
|
||||
scn.FreepsPlayCard(card);
|
||||
scn.SkipToPhase(Phase.REGROUP);
|
||||
|
||||
assertEquals(2, scn.GetTwilight());
|
||||
scn.FreepsPassCurrentPhaseAction();
|
||||
assertTrue(scn.ShadowActionAvailable(artisan));
|
||||
scn.ShadowUseCardAction(artisan);
|
||||
assertTrue(scn.ShadowHasOptionalTriggerAvailable());
|
||||
scn.ShadowAcceptOptionalTrigger();
|
||||
assertEquals(Zone.STACKED, artisan.getZone());
|
||||
assertEquals(gnawing, artisan.getStackedOn());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void GnawingBitingHackingBurningDoesNotCatchTurnEndDiscards() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
//Pre-game setup
|
||||
var scn = GetScenario();
|
||||
|
||||
var gnawing = scn.GetShadowCard("gnawing");
|
||||
var artisan = scn.GetShadowCard("artisan");
|
||||
scn.ShadowMoveCharToTable(artisan);
|
||||
scn.ShadowMoveCardToSupportArea(gnawing);
|
||||
|
||||
scn.StartGame();
|
||||
scn.SkipToPhase(Phase.REGROUP);
|
||||
|
||||
scn.PassCurrentPhaseActions();
|
||||
scn.FreepsChooseToStay();
|
||||
assertFalse(scn.ShadowHasOptionalTriggerAvailable());
|
||||
assertEquals(Phase.FELLOWSHIP, scn.getPhase());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.gempukku.lotro.cards.unofficial.pc.vsets.set_v02;
|
||||
import com.gempukku.lotro.cards.GenericCardTestHelper;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.game.CardNotFoundException;
|
||||
import com.gempukku.lotro.game.PhysicalCardImpl;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -18,8 +17,8 @@ public class Card_V2_051_Tests
|
||||
return new GenericCardTestHelper(
|
||||
new HashMap<>()
|
||||
{{
|
||||
put("card", "102_51");
|
||||
// put other cards in here as needed for the test case
|
||||
put("wrath", "102_51");
|
||||
put("javelin", "7_248");
|
||||
}},
|
||||
GenericCardTestHelper.FellowshipSites,
|
||||
GenericCardTestHelper.FOTRFrodo,
|
||||
@@ -45,7 +44,7 @@ public class Card_V2_051_Tests
|
||||
|
||||
var scn = GetScenario();
|
||||
|
||||
var card = scn.GetFreepsCard("card");
|
||||
var card = scn.GetFreepsCard("wrath");
|
||||
|
||||
assertEquals("Now for Wrath", card.getBlueprint().getTitle());
|
||||
assertNull(card.getBlueprint().getSubtitle());
|
||||
@@ -57,18 +56,24 @@ public class Card_V2_051_Tests
|
||||
assertEquals(1, card.getBlueprint().getTwilightCost());
|
||||
}
|
||||
|
||||
// Uncomment any @Test markers below once this is ready to be used
|
||||
//@Test
|
||||
@Test
|
||||
public void NowforWrathTest1() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
//Pre-game setup
|
||||
var scn = GetScenario();
|
||||
|
||||
var card = scn.GetFreepsCard("card");
|
||||
scn.FreepsMoveCardToHand(card);
|
||||
var wrath = scn.GetFreepsCard("wrath");
|
||||
var javelin = scn.GetFreepsCard("javelin");
|
||||
scn.FreepsMoveCardToSupportArea(wrath);
|
||||
scn.FreepsMoveCardToHand(javelin);
|
||||
|
||||
scn.StartGame();
|
||||
scn.FreepsPlayCard(card);
|
||||
scn.SkipToPhase(Phase.REGROUP);
|
||||
scn.PassCurrentPhaseActions();
|
||||
scn.FreepsChooseToStay();
|
||||
|
||||
assertEquals(1, scn.GetTwilight());
|
||||
assertEquals(0, scn.GetCultureTokensOn(wrath));
|
||||
scn.FreepsChooseCard(javelin);
|
||||
assertEquals(Zone.DISCARD, javelin.getZone());
|
||||
assertEquals(1, scn.GetCultureTokensOn(wrath));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user