Added more ATs

This commit is contained in:
Marcin Sciesinski
2024-10-18 12:48:50 +07:00
parent 6854cd5bcc
commit f8d20f061b
11 changed files with 209 additions and 8 deletions

View File

@@ -61,7 +61,7 @@ public class ExchangeCardsInHandWithCardsInDeadPile implements EffectAppenderPro
for (PhysicalCard handCard : handCards) {
game.getGameState().addCardToZone(game, handCard, Zone.DEAD);
}
return null;
return new FullEffectResult(true);
}
@Override

View File

@@ -59,7 +59,7 @@ public class ExchangeCardsInHandWithCardsInDiscard implements EffectAppenderProd
for (PhysicalCard handCard : handCards) {
game.getGameState().addCardToZone(game, handCard, Zone.DISCARD);
}
return null;
return new FullEffectResult(true);
}
@Override

View File

@@ -64,7 +64,7 @@ public class ExchangeCardsInHandWithCardsStacked implements EffectAppenderProduc
for (PhysicalCard handCard : handCards) {
game.getGameState().stackCard(game, handCard, stackedCard);
}
return null;
return new FullEffectResult(true);
}
@Override

View File

@@ -254,6 +254,11 @@ public class FilterFactory {
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(parameter, environment);
return (actionContext) -> Filters.attachedTo(filterableSource.getFilterable(actionContext));
});
parameterFilters.put("stackedon",
(parameter, environment) -> {
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(parameter, environment);
return (actionContext) -> Filters.stackedOn(filterableSource.getFilterable(actionContext));
});
parameterFilters.put("culture", (parameter, environment) -> {
final Culture culture = Culture.findCulture(parameter);
if (culture == null)

View File

@@ -156,7 +156,7 @@ public class ModifiersAtTest extends AbstractAtTest {
initializeSimplestGame();
PhysicalCard elfSong = addToZone(createCard(P1, "1_39"), Zone.HAND);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.FREE_CHARACTERS);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.SUPPORT);
JSONObject obj = new JSONObject();
obj.put("phase", "fellowship");
@@ -242,7 +242,7 @@ public class ModifiersAtTest extends AbstractAtTest {
public void cantUseSpecialAbilities() throws Exception {
initializeSimplestGame();
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.FREE_CHARACTERS);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.SUPPORT);
JSONObject obj = new JSONObject();
obj.put("phase", "fellowship");
@@ -260,7 +260,7 @@ public class ModifiersAtTest extends AbstractAtTest {
public void disableGameText() throws Exception {
initializeSimplestGame();
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.FREE_CHARACTERS);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.SUPPORT);
JSONObject obj = new JSONObject();
obj.put("filter", "elf");

View File

@@ -530,7 +530,7 @@ public class TriggersAtTest extends AbstractAtTest {
PhysicalCard theShireCountryside = addToZone(createCard(P1, "3_113"), Zone.SUPPORT);
PhysicalCard elfSong = addToZone(createCard(P1, "1_39"), Zone.HAND);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.FREE_CHARACTERS);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.SUPPORT);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, elfSong);

View File

@@ -0,0 +1,29 @@
package com.gempukku.lotro.at.effects;
import com.gempukku.lotro.at.AbstractAtTest;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class BurdensAtTest extends AbstractAtTest {
@Test
public void preventAddingAllBurdens() throws Exception {
initializeSimplestGame();
PhysicalCard samwiseTheBrave = addToZone(createCard(P1, "4_316"), Zone.FREE_CHARACTERS);
PhysicalCard ringBearer = getRingBearer(P1);
PhysicalCard desperateDefenseOfTheRing = attachTo(createCard(P2, "1_244"), ringBearer);
PhysicalCard goblinRunner = addToZone(createCard(P2, "1_178"), Zone.SHADOW_CHARACTERS);
passUntil(Phase.ASSIGNMENT);
pass(P1);
pass(P2);
assertEquals(1, getBurdens());
playerDecided(P1, ringBearer.getCardId() + " " + goblinRunner.getCardId());
selectCardAction(P1, samwiseTheBrave);
assertEquals(1, getBurdens());
}
}

View File

@@ -0,0 +1,57 @@
package com.gempukku.lotro.at.effects;
import com.gempukku.lotro.at.AbstractAtTest;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ExchangeCardsAtTest extends AbstractAtTest {
@Test
public void exchangeCardsInHandWithCardsInDeadPile() throws Exception {
initializeSimplestGame();
PhysicalCard gandalf = addToZone(createCard(P1, "1_72"), Zone.FREE_CHARACTERS);
PhysicalCard borneFarAway = addToZone(createCard(P1, "10_14"), Zone.HAND);
PhysicalCard aragornInDeadPile = addToZone(createCard(P1, "1_89"), Zone.DEAD);
PhysicalCard gimliInHand = addToZone(createCard(P1, "5_7"), Zone.HAND);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, borneFarAway);
assertEquals(Zone.HAND, aragornInDeadPile.getZone());
assertEquals(Zone.DEAD, gimliInHand.getZone());
}
@Test
public void exchangeCardsInHandWithCardsInDiscard() throws Exception {
initializeSimplestGame();
PhysicalCard gandalf = addToZone(createCard(P1, "1_72"), Zone.FREE_CHARACTERS);
PhysicalCard borneFarAway = addToZone(createCard(P1, "10_14"), Zone.HAND);
PhysicalCard aragornInDiscard = addToZone(createCard(P1, "1_89"), Zone.DISCARD);
PhysicalCard gimliInHand = addToZone(createCard(P1, "5_7"), Zone.HAND);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, borneFarAway);
assertEquals(Zone.HAND, aragornInDiscard.getZone());
assertEquals(Zone.DISCARD, gimliInHand.getZone());
}
@Test
public void exchangeCardsInHandWithCardsStacked() throws Exception {
initializeSimplestGame();
PhysicalCard gimli = addToZone(createCard(P1, "5_7"), Zone.FREE_CHARACTERS);
PhysicalCard hallOfOurFathers = addToZone(createCard(P1, "11_11"), Zone.SUPPORT);
PhysicalCard gandalfStacked = stackOn(createCard(P1, "1_72"), hallOfOurFathers);
PhysicalCard aragornInHand = addToZone(createCard(P1, "1_89"), Zone.HAND);
PhysicalCard goblinRunner = addToZone(createCard(P2, "1_178"), Zone.SHADOW_CHARACTERS);
passUntil(Phase.MANEUVER);
selectCardAction(P1, hallOfOurFathers);
assertEquals(Zone.HAND, gandalfStacked.getZone());
assertEquals(Zone.STACKED, aragornInHand.getZone());
}
}

View File

@@ -0,0 +1,27 @@
package com.gempukku.lotro.at.effects;
import com.gempukku.lotro.at.AbstractAtTest;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class PlayCardFromDeadPileAtTest extends AbstractAtTest {
@Test
public void playCardFromDeadPile() throws Exception {
initializeSimplestGame();
PhysicalCard wellMetIndeed = addToZone(createCard(P1, "4_106"), Zone.HAND);
PhysicalCard aragorn = addToZone(createCard(P1, "1_89"), Zone.FREE_CHARACTERS);
PhysicalCard gimli = addToZone(createCard(P1, "5_7"), Zone.FREE_CHARACTERS);
PhysicalCard elrond = addToZone(createCard(P1, "1_40"), Zone.SUPPORT);
PhysicalCard gandalf = addToZone(createCard(P1, "1_72"), Zone.DEAD);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, wellMetIndeed);
assertEquals(Zone.FREE_CHARACTERS, gandalf.getZone());
}
}

View File

@@ -0,0 +1,37 @@
package com.gempukku.lotro.at.effects;
import com.gempukku.lotro.at.AbstractAtTest;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.game.PhysicalCard;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class PlaySiteAtTest extends AbstractAtTest {
@Test
public void playNextSite() throws Exception {
initializeSimplestGame();
PhysicalCard aragorn = addToZone(createCard(P1, "1_89"), Zone.FREE_CHARACTERS);
PhysicalCard pathfinder = addToZone(createCard(P1, "1_110"), Zone.HAND);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, pathfinder);
assertNotNull(getSite(2));
assertEquals(P1, getSite(2).getOwner());
}
@Test
public void playSite() throws Exception {
initializeSimplestGame();
PhysicalCard getOndAndGetAway = addToZone(createCard(P1, "4_304"), Zone.HAND);
passUntil(Phase.FELLOWSHIP);
selectCardAction(P1, getOndAndGetAway);
assertEquals(P1, getSite(2).getOwner());
assertEquals(P1, getSite(3).getOwner());
}
}

View File

@@ -18,15 +18,18 @@ import com.gempukku.lotro.logic.modifiers.SpecialFlagModifier;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import com.gempukku.lotro.logic.vo.LotroDeck;
import org.junit.Test;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.*;
public class WoundEffectAtTest extends AbstractAtTest {
public class WoundsEffectAtTest extends AbstractAtTest {
@Test
public void woundSuccessful() throws DecisionResultInvalidException, CardNotFoundException {
initializeSimplestGame();
@@ -287,4 +290,47 @@ public class WoundEffectAtTest extends AbstractAtTest {
pass(P2);
assertEquals(2, getWounds(aragorn));
}
@Test
public void preventAllWounds() throws Exception {
Map<String, LotroDeck> decks = new HashMap<>();
decks.put(P1, createDeckWithMrUnderhill());
decks.put(P2, createDeckWithMrUnderhill());
initializeGameWithDecks(decks);
PhysicalCard ringBearer = getRingBearer(P1);
PhysicalCard gandalf = addToZone(createCard(P1, "1_72"), Zone.FREE_CHARACTERS);
PhysicalCard keepYourForkedTongue = addToZone(createCard(P1, "4_96"), Zone.HAND);
PhysicalCard goblinRunner = addToZone(createCard(P2, "1_178"), Zone.SHADOW_CHARACTERS);
passUntil(Phase.FELLOWSHIP);
setTwilightPool(5);
passUntil(Phase.ASSIGNMENT);
pass(P1);
pass(P2);
playerDecided(P1, ringBearer.getCardId() + " " + goblinRunner.getCardId());
selectCard(P1, ringBearer);
selectCardAction(P1, keepYourForkedTongue);
pass(P2);
pass(P1);
assertEquals(0, getWounds(ringBearer));
}
public LotroDeck createDeckWithMrUnderhill() {
LotroDeck lotroDeck = new LotroDeck("Some deck");
// 10_121,1_2
lotroDeck.setRingBearer("0_67");
lotroDeck.setRing("1_2");
// 7_330,7_336,8_117,7_342,7_345,7_350,8_120,10_120,7_360
lotroDeck.addSite("7_330");
lotroDeck.addSite("7_335");
lotroDeck.addSite("8_117");
lotroDeck.addSite("7_342");
lotroDeck.addSite("7_345");
lotroDeck.addSite("7_350");
lotroDeck.addSite("8_120");
lotroDeck.addSite("10_120");
lotroDeck.addSite("7_360");
return lotroDeck;
}
}