Added tests for A New Light and its errata. Converted that card to json. Fixed a reference in the Sting tests.

This commit is contained in:
Christian 'ketura' McCarty
2022-12-13 20:05:45 -06:00
parent 762827b3c1
commit 80f1cdbf63
6 changed files with 317 additions and 77 deletions

View File

@@ -1,70 +0,0 @@
package com.gempukku.lotro.cards.set17.gandalf;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.PlayEventAction;
import com.gempukku.lotro.logic.cardtype.AbstractEvent;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromHandEffect;
import com.gempukku.lotro.logic.effects.PutCardFromDiscardIntoHandEffect;
import com.gempukku.lotro.logic.effects.RevealAndChooseCardsFromOpponentHandEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseOpponentEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Set: Rise of Saruman
* Side: Free
* Culture: Gandalf
* Twilight Cost: 1
* Type: Event • Fellowship
* Game Text: Spell. Spot a [GANDALF] Wizard to search a Shadow player's discard pile and choose a minion, then return
* that minion to its owner's hand. If you do, you may reveal that Shadow players hand and discard a minion found there.
*/
public class Card17_015 extends AbstractEvent {
public Card17_015() {
super(Side.FREE_PEOPLE, 1, Culture.GANDALF, "A New Light", Phase.FELLOWSHIP);
addKeyword(Keyword.SPELL);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, Culture.GANDALF, Race.WIZARD);
}
@Override
public PlayEventAction getPlayEventCardAction(final String playerId, final LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseOpponentEffect(playerId) {
@Override
protected void opponentChosen(final String opponentId) {
action.appendEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose a minion to return to hand", game.getGameState().getDiscard(opponentId), CardType.MINION, 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {
action.appendEffect(
new PutCardFromDiscardIntoHandEffect(selectedCard));
action.appendEffect(
new RevealAndChooseCardsFromOpponentHandEffect(action, playerId, opponentId, self, "Choose a minion to discard", CardType.MINION, 1, 1) {
@Override
protected void cardsSelected(List<PhysicalCard> selectedCards) {
for (PhysicalCard card : selectedCards) {
action.appendEffect(
new DiscardCardsFromHandEffect(self, opponentId, Collections.singleton(card), true));
}
}
});
}
}
});
}
});
return action;
}
}

View File

@@ -0,0 +1,80 @@
{
17_15: {
cardInfo: {
//Either a full URL, or a subpath for the PC image server
imagePath: errata/LOTR-EN17E015.1.jpg
//If this is true, then all gameplay-related info outside this cardInfo definition
// will be ignored and the java class loaded instead.
javaClass: false
//This instructs the blueprint generator to insert this card as an alt of the listed
// parent blueprint. Can of course be ommitted if not an errata or promo.
parent: 17_15
//This is the tree path to use within the alts structure on the parent.
// Can of course be ommitted if parent is null.
parentPath: errata/pc
//Versioning differentiates releases within a particular alt path, such as PC errata
// version 1 vs version 2. PC version 2 will not conflict with, say, Decipher version 2.
//Top-level cards should always be version 0.
version: 0
collInfo: 17U15
rarity: U
setNum: "17"
cardNum: 15
// Standard, Masterwork, Tengwar, FullArt, etc. Top-level cards are always Standard.
style: Standard
}
title: A New Light
unique: false
culture: gandalf
twilight: 1
type: event
keyword: [
fellowship
spell
]
requires: {
type: canSpot
filter: culture(gandalf),wizard
}
effects: [
{
type: event
effect: [
{
type: PutCardsFromDiscardIntoHand
player: freeps
discard: shadow
filter: choose(minion)
count: 1
}
{
type: revealHand
hand: shadowPlayer
memorize: revealedCards
}
{
type: discardFromHand
hand: shadowPlayer
forced: true
player: you
filter: choose(memory(revealedCards),minion)
}
]
}
]
gametext: <b>Spell.</b>\Spot a [gandalf] Wizard to return 2 minions to a Shadow player's hand from their discard pile. Reveal their hand and discard a minion revealed.
lore: "'I once knew every spell in all the tongues of Men or Elves or Orcs...'"
promotext: ""
alts: {
//These are just CardInfo objects
promos: {
}
//These are full card definitions, with redundant info that is the same as the original card ommitted
errata: {
}
}
}
}

View File

@@ -24,12 +24,13 @@
style: Standard
}
title: A New Light
unique: true
unique: false
culture: gandalf
twilight: 1
type: event
keyword: [
fellowship
spell
]
requires: {
type: canSpot

View File

@@ -0,0 +1,114 @@
package com.gempukku.lotro.cards.official.set17;
import com.gempukku.lotro.cards.GenericCardTestHelper;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.CardNotFoundException;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import org.junit.Test;
import java.util.HashMap;
import static org.junit.Assert.*;
public class Card_17_015_Tests
{
protected GenericCardTestHelper GetScenario() throws CardNotFoundException, DecisionResultInvalidException {
return new GenericCardTestHelper(
new HashMap<String, String>()
{{
put("light", "17_15");
put("gandalf", "1_72");
put("runner1", "1_191");
put("runner2", "1_191");
put("runner3", "1_191");
put("scout", "1_178");
put("balrog", "19_18");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
GenericCardTestHelper.FOTRRing
);
}
// Uncomment both @Test markers below once this is ready to be used
@Test
public void ANewLightStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
/**
* Set: 17
* Title: A New Light
* Unique: False
* Side: FREE_PEOPLE
* Culture: Gandalf
* Twilight Cost: 1
* Type: event
* Subtype: Fellowship
* Game Text: <b>Spell.</b>
* Spot a [gandalf] Wizard to return a minion to its owner's hand from its owner's discard pile.
* Reveal that Shadow player's hand and discard a minion from his or her hand.
*/
//Pre-game setup
var scn = GetScenario();
var light = scn.GetFreepsCard("light");
assertFalse(light.getBlueprint().isUnique());
assertEquals(Side.FREE_PEOPLE, light.getBlueprint().getSide());
assertEquals(Culture.GANDALF, light.getBlueprint().getCulture());
assertEquals(CardType.EVENT, light.getBlueprint().getCardType());
assertTrue(scn.HasKeyword(light, Keyword.FELLOWSHIP));
assertTrue(scn.HasKeyword(light, Keyword.SPELL));
assertEquals(1, light.getBlueprint().getTwilightCost());
}
@Test
public void ANewLightFunctions() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var light = scn.GetFreepsCard("light");
var gandalf = scn.GetFreepsCard("gandalf");
scn.FreepsMoveCardToHand(light, gandalf);
var runner1 = scn.GetShadowCard("runner1");
var runner2 = scn.GetShadowCard("runner2");
var runner3 = scn.GetShadowCard("runner3");
var scout = scn.GetShadowCard("scout");
var balrog = scn.GetShadowCard("balrog");
scn.ShadowMoveCardToDiscard(runner1, runner2, scout);
scn.ShadowMoveCardToHand(runner3, balrog);
scn.StartGame();
assertFalse(scn.FreepsPlayAvailable(light));
scn.FreepsPlayCard(gandalf);
assertTrue(scn.FreepsPlayAvailable(light));
scn.FreepsPlayCard(light);
assertTrue(scn.FreepsDecisionAvailable("choose card from discard"));
assertEquals(2, scn.GetShadowHandCount());
assertEquals(Zone.DISCARD, scout.getZone());
scn.FreepsChooseCardBPFromSelection(scout);
assertEquals(3, scn.GetShadowHandCount());
assertEquals(Zone.HAND, scout.getZone());
assertTrue(scn.FreepsDecisionAvailable("hand"));
scn.FreepsDismissRevealedCards();
scn.ShadowDismissRevealedCards();
assertTrue(scn.FreepsDecisionAvailable("choose cards from hand"));
assertEquals(3, scn.GetShadowHandCount());
assertEquals(2, scn.GetShadowDiscardCount());
assertEquals(Zone.HAND, balrog.getZone());
scn.FreepsChooseCardBPFromSelection(balrog);
assertEquals(2, scn.GetShadowHandCount());
assertEquals(3, scn.GetShadowDiscardCount());
assertEquals(Zone.DISCARD, balrog.getZone());
}
}

View File

@@ -147,21 +147,21 @@ public class Card_01_313_ErrataTests
scn.FreepsUseCardAction(sting);
//Both players need to dismiss the card reveal dialog.
scn.FreepsPassCurrentPhaseAction();
scn.ShadowPassCurrentPhaseAction();
scn.FreepsDismissRevealedCards();
scn.ShadowDismissRevealedCards();
// 10 twilight - 1 orc in the hand = 9 twilight
assertEquals(9, scn.GetTwilight());
scn.FreepsUseCardAction(sting);
scn.FreepsPassCurrentPhaseAction();
scn.ShadowPassCurrentPhaseAction();
scn.FreepsDismissRevealedCards();
scn.ShadowDismissRevealedCards();
// 9 twilight - 1 orc in the hand = 8 twilight
assertEquals(8, scn.GetTwilight());
scn.FreepsUseCardAction(sting);
scn.FreepsPassCurrentPhaseAction();
scn.ShadowPassCurrentPhaseAction();
scn.FreepsDismissRevealedCards();
scn.ShadowDismissRevealedCards();
// limit of 2 should have been hit, so no twilight should be removed
assertEquals(8, scn.GetTwilight());

View File

@@ -0,0 +1,115 @@
package com.gempukku.lotro.cards.unofficial.pc.errata.set17;
import com.gempukku.lotro.cards.GenericCardTestHelper;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.game.CardNotFoundException;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import org.junit.Test;
import java.util.HashMap;
import static org.junit.Assert.*;
public class Card_17_015_ErrataTests
{
protected GenericCardTestHelper GetScenario() throws CardNotFoundException, DecisionResultInvalidException {
return new GenericCardTestHelper(
new HashMap<String, String>()
{{
put("light", "87_15");
put("gandalf", "1_72");
put("runner1", "1_178");
put("runner2", "1_178");
put("runner3", "1_178");
put("runner4", "1_178");
put("balrog", "19_18");
}},
GenericCardTestHelper.FellowshipSites,
GenericCardTestHelper.FOTRFrodo,
GenericCardTestHelper.FOTRRing
);
}
// Uncomment both @Test markers below once this is ready to be used
@Test
public void ANewLightStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
/**
* Set: 17
* Title: A New Light
* Unique: False
* Side: FREE_PEOPLE
* Culture: Gandalf
* Twilight Cost: 1
* Type: event
* Subtype: Fellowship
* Game Text: <b>Spell.</b>
* Spot a [gandalf] Wizard to return 2 minions to a Shadow player's hand from their discard pile. Reveal their hand and discard a minion revealed.
*/
//Pre-game setup
var scn = GetScenario();
var light = scn.GetFreepsCard("light");
assertFalse(light.getBlueprint().isUnique());
assertEquals(Side.FREE_PEOPLE, light.getBlueprint().getSide());
assertEquals(Culture.GANDALF, light.getBlueprint().getCulture());
assertEquals(CardType.EVENT, light.getBlueprint().getCardType());
assertTrue(scn.HasKeyword(light, Keyword.FELLOWSHIP));
assertTrue(scn.HasKeyword(light, Keyword.SPELL));
assertEquals(1, light.getBlueprint().getTwilightCost());
}
@Test
public void ANewLightFunctions() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
var light = scn.GetFreepsCard("light");
var gandalf = scn.GetFreepsCard("gandalf");
scn.FreepsMoveCardToHand(light, gandalf);
var runner1 = scn.GetShadowCard("runner1");
var runner2 = scn.GetShadowCard("runner2");
var runner3 = scn.GetShadowCard("runner3");
var runner4 = scn.GetShadowCard("runner4");
var balrog = scn.GetShadowCard("balrog");
scn.ShadowMoveCardToDiscard(runner1, runner2, runner3);
scn.ShadowMoveCardToHand(runner4, balrog);
scn.StartGame();
assertFalse(scn.FreepsPlayAvailable(light));
scn.FreepsPlayCard(gandalf);
assertTrue(scn.FreepsPlayAvailable(light));
scn.FreepsPlayCard(light);
assertTrue(scn.FreepsDecisionAvailable("choose card from discard"));
assertEquals(2, scn.GetShadowHandCount());
assertEquals(Zone.DISCARD, runner1.getZone());
assertEquals(Zone.DISCARD, runner2.getZone());
scn.FreepsChooseCardBPFromSelection(runner1, runner2);
assertEquals(4, scn.GetShadowHandCount());
assertEquals(Zone.HAND, runner1.getZone());
assertEquals(Zone.HAND, runner2.getZone());
assertTrue(scn.FreepsDecisionAvailable("hand"));
scn.FreepsDismissRevealedCards();
scn.ShadowDismissRevealedCards();
assertTrue(scn.FreepsDecisionAvailable("choose cards from hand"));
assertEquals(4, scn.GetShadowHandCount());
assertEquals(1, scn.GetShadowDiscardCount());
assertEquals(Zone.HAND, balrog.getZone());
scn.FreepsChooseCardBPFromSelection(balrog);
assertEquals(3, scn.GetShadowHandCount());
assertEquals(2, scn.GetShadowDiscardCount());
assertEquals(Zone.DISCARD, balrog.getZone());
}
}