diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java index c7bef3a9a..a2e106e89 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/PlayConditions.java @@ -99,13 +99,13 @@ public class PlayConditions { public static boolean canPlayCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) { return (phase == null || game.getGameState().getCurrentPhase() == phase) && self.getZone() == Zone.HAND - && (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))==0); + && (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())) == 0); } public static boolean canPlayCardFromHandDuringPhase(LotroGame game, Phase[] phases, PhysicalCard self) { return (phases == null || containsPhase(phases, game.getGameState().getCurrentPhase())) && self.getZone() == Zone.HAND - && (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName()))==0); + && (!self.getBlueprint().isUnique() || Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.name(self.getBlueprint().getName())) == 0); } public static boolean canUseFPCardDuringPhase(LotroGame game, Phase phase, PhysicalCard self) { @@ -146,7 +146,7 @@ public class PlayConditions { LotroCardBlueprint blueprint = self.getBlueprint(); return (!blueprint.isUnique() || ( - Filters.countActive(gameState, modifiersQuerying, Filters.name(blueprint.getName()))==0 + Filters.countActive(gameState, modifiersQuerying, Filters.name(blueprint.getName())) == 0 && (ignoreCheckingDeadPile || (Filters.filter(gameState.getDeadPile(self.getOwner()), gameState, modifiersQuerying, Filters.name(blueprint.getName())).size() == 0)))); } @@ -223,12 +223,17 @@ public class PlayConditions { }); } + public static boolean canStackDeckTopCards(LotroGame game, String playerId, int cardCount, Filterable... onto) { + return game.getGameState().getDeck(playerId).size() >= cardCount + && canSpot(game, onto); + } + public static boolean canSpot(LotroGame game, Filterable... filters) { return canSpot(game, 1, filters); } public static boolean isActive(LotroGame game, Filterable... filters) { - return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), filters)>0; + return Filters.countActive(game.getGameState(), game.getModifiersQuerying(), filters) > 0; } public static boolean canSpot(LotroGame game, int count, Filterable... filters) { @@ -244,7 +249,7 @@ public class PlayConditions { } public static boolean canSpotFPCultures(LotroGame game, int count, String playerId) { - return GameUtils.getSpottableFPCulturesCount(game.getGameState(), game.getModifiersQuerying(), playerId)>=count; + return GameUtils.getSpottableFPCulturesCount(game.getGameState(), game.getModifiersQuerying(), playerId) >= count; } public static boolean hasInitiative(LotroGame game, Side side) { @@ -279,7 +284,7 @@ public class PlayConditions { public boolean visitPhysicalCard(PhysicalCard physicalCard) { if (filter.accepts(gameState, modifiersQuerying, physicalCard) && modifiersQuerying.getVitality(gameState, physicalCard) >= times - && modifiersQuerying.canTakeWounds(gameState, (source != null)?Collections.singleton(source):Collections.emptySet(), physicalCard, times)) + && modifiersQuerying.canTakeWounds(gameState, (source != null) ? Collections.singleton(source) : Collections.emptySet(), physicalCard, times)) _woundableCount++; return _woundableCount >= count; } @@ -406,7 +411,7 @@ public class PlayConditions { public static boolean canRemoveAnyCultureTokens(LotroGame game, int count, Filterable... fromFilters) { return !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.CANT_TOUCH_CULTURE_TOKENS) - && Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(fromFilters, Filters.hasAnyCultureTokens(count)))>0; + && Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.and(fromFilters, Filters.hasAnyCultureTokens(count))) > 0; } public static boolean canRemoveTokens(LotroGame game, PhysicalCard from, Token token) { diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/Card40_001.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/Card40_001.java new file mode 100644 index 000000000..182559b91 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/Card40_001.java @@ -0,0 +1,127 @@ +package com.gempukku.lotro.cards.set40; + +import com.gempukku.lotro.cards.AbstractAttachable; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.effects.*; +import com.gempukku.lotro.cards.modifiers.ResistanceModifier; +import com.gempukku.lotro.cards.modifiers.VitalityModifier; +import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Keyword; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.filters.Filter; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.ActivateCardAction; +import com.gempukku.lotro.logic.actions.RequiredTriggerAction; +import com.gempukku.lotro.logic.effects.WoundCharactersEffect; +import com.gempukku.lotro.logic.modifiers.KeywordModifier; +import com.gempukku.lotro.logic.modifiers.Modifier; +import com.gempukku.lotro.logic.modifiers.ModifierFlag; +import com.gempukku.lotro.logic.modifiers.StrengthModifier; +import com.gempukku.lotro.logic.timing.Action; +import com.gempukku.lotro.logic.timing.Effect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + +/** + * Title: The One Ring, Doom of Free Peoples + * Set: Second Edition + * Side: Free + * Culture: Ring + * Twilight Cost: 0 + * Type: The One Ring + * Strength: +1 + * Vitality: +1 + * Resistance: +1 + * Card Number: 1R1 + * Game Text: While wearing The One Ring, each time the Ring-bearer is about to take a wound, add a burden instead. + * Maneuver: Exert bearer or discard a card at random from hand to wear The One Ring until the regroup phase. + */ +public class Card40_001 extends AbstractAttachable { + public Card40_001() { + super(null, CardType.THE_ONE_RING, 0, null, null, "The One Ring", "Doom of Free Peoples", true); + } + + @Override + protected Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) { + return Filters.none; + } + + @Override + public List getAlwaysOnModifiers(LotroGame game, PhysicalCard self) { + List modifiers = new LinkedList(); + modifiers.add(new StrengthModifier(self, Filters.hasAttached(self), 1)); + modifiers.add(new VitalityModifier(self, Filters.hasAttached(self), 1)); + modifiers.add(new ResistanceModifier(self, Filters.hasAttached(self), 1)); + modifiers.add(new KeywordModifier(self, Filters.hasAttached(self), Keyword.RING_BOUND)); + return modifiers; + } + + @Override + protected List getExtraPhaseActions(String playerId, LotroGame game, PhysicalCard self) { + if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self) + && (PlayConditions.canExert(self, game, Filters.hasAttached(self)) + || PlayConditions.canDiscardFromHand(game, self.getOwner(), 1, Filters.any))) { + ActivateCardAction action = new ActivateCardAction(self); + List possibleCosts = new LinkedList(); + possibleCosts.add( + new ExertCharactersEffect(action, self, Filters.hasAttached(self))); + possibleCosts.add( + new DiscardCardAtRandomFromHandEffect(self, self.getOwner(), false)); + + ChoiceEffect choiceEffect = new ChoiceEffect(action, self.getOwner(), possibleCosts); + action.appendCost(choiceEffect); + action.appendEffect( + new PutOnTheOneRingEffect()); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getOptionalInPlayBeforeActions(final String playerId, LotroGame game, Effect effect, final PhysicalCard self) { + if (TriggerConditions.isGettingWounded(effect, game, Filters.hasAttached(self)) + && !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.RING_TEXT_INACTIVE)) { + WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect; + List actions = new LinkedList(); + + ActivateCardAction action = new ActivateCardAction(self); + action.appendEffect(new NegateWoundEffect(woundEffect, self.getAttachedTo())); + action.appendEffect(new AddBurdenEffect(self.getOwner(), self, 2)); + action.appendEffect(new PutOnTheOneRingEffect()); + + actions.add(action); + return actions; + } + return null; + } + + @Override + public List getRequiredBeforeTriggers(LotroGame game, Effect effect, PhysicalCard self) { + if (TriggerConditions.isGettingWounded(effect, game, Filters.hasAttached(self)) + && game.getGameState().isWearingRing() + && !game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.RING_TEXT_INACTIVE)) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect(new NegateWoundEffect((WoundCharactersEffect) effect, self.getAttachedTo())); + action.appendEffect(new AddBurdenEffect(self.getOwner(), self, 1)); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if ((TriggerConditions.startOfPhase(game, effectResult, Phase.REGROUP) || TriggerConditions.endOfPhase(game, effectResult, Phase.REGROUP)) + && game.getGameState().isWearingRing()) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect(new TakeOffTheOneRingEffect()); + return Collections.singletonList(action); + } + return null; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_003.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_003.java new file mode 100644 index 000000000..caa87e9a7 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_003.java @@ -0,0 +1,63 @@ +package com.gempukku.lotro.cards.set40.dwarven; + +import com.gempukku.lotro.cards.AbstractPermanent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.TriggerConditions; +import com.gempukku.lotro.cards.effects.PreventCardEffect; +import com.gempukku.lotro.cards.effects.SelfDiscardEffect; +import com.gempukku.lotro.cards.effects.StackTopCardsFromDeckEffect; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.actions.ActivateCardAction; +import com.gempukku.lotro.logic.actions.RequiredTriggerAction; +import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect; +import com.gempukku.lotro.logic.effects.PreventEffect; +import com.gempukku.lotro.logic.timing.Effect; +import com.gempukku.lotro.logic.timing.EffectResult; + +import java.util.Collections; +import java.util.List; + +/** + * Title: *Balin's Lament + * Set: Second Edition + * Side: Free + * Culture: Dwarven + * Twilight Cost: 2 + * Type: Condition - Support Area + * Card Number: 1U3 + * Game Text: Tale. When you play this condition, stack the top card of your draw deck here. + * Response: If a Shadow card is about to discard any number of your [DWARVEN] conditions, discard this condition to prevent that. + */ +public class Card40_003 extends AbstractPermanent { + public Card40_003(Side side, int twilightCost, CardType cardType, Culture culture, Zone playedToZone, String name) { + super(Side.FREE_PEOPLE, 2, CardType.CONDITION, Culture.DWARVEN, Zone.SUPPORT, "Balin's Lament", null, true); + addKeyword(Keyword.TALE); + } + + @Override + public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { + if (TriggerConditions.played(game, effectResult, self)) { + RequiredTriggerAction action = new RequiredTriggerAction(self); + action.appendEffect( + new StackTopCardsFromDeckEffect(self, self.getOwner(), 1, self)); + return Collections.singletonList(action); + } + return null; + } + + @Override + public List getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) { + if (TriggerConditions.isGettingDiscardedBy(effect, game, Side.SHADOW, Filters.and(Culture.DWARVEN, CardType.CONDITION)) + && PlayConditions.canSelfDiscard(self, game)) { + ActivateCardAction action = new ActivateCardAction(self); + action.appendCost(new SelfDiscardEffect(self)); + action.appendEffect( + new PreventCardEffect((DiscardCardsFromPlayEffect) effect, self)); + return Collections.singletonList(action); + } + return null; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_004.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_004.java new file mode 100644 index 000000000..5e01f362e --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_004.java @@ -0,0 +1,45 @@ +package com.gempukku.lotro.cards.set40.dwarven; + +import com.gempukku.lotro.cards.AbstractEvent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect; +import com.gempukku.lotro.common.Culture; +import com.gempukku.lotro.common.Phase; +import com.gempukku.lotro.common.Race; +import com.gempukku.lotro.common.Side; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect; + +/** + * Title: Balin's Revenge + * Set: Second Edition + * Side: Free + * Culture: Dwarven + * Twilight Cost: 0 + * Type: Event - Skirmish + * Card Number: 1C4 + * Game Text: Exert a Dwarf to wound up to two Goblins. + */ +public class Card40_004 extends AbstractEvent{ + public Card40_004(Side side, int twilightCost, Culture culture, String name, Phase playableInPhase, Phase... additionalPlayableInPhases) { + super(Side.FREE_PEOPLE, 0, Culture.DWARVEN, "Balin's Revenge", Phase.SKIRMISH); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) { + return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile) + && PlayConditions.canExert(self, game, Race.DWARF); + } + + @Override + public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) { + PlayEventAction action = new PlayEventAction(self); + action.appendCost( + new ChooseAndExertCharactersEffect(action, self.getOwner(), 1, 1, Race.DWARF)); + action.appendEffect( + new ChooseAndWoundCharactersEffect(action, self.getOwner(), 0, 2, Race.GOBLIN)); + return action; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_005.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_005.java new file mode 100644 index 000000000..236c564ee --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_005.java @@ -0,0 +1,56 @@ +package com.gempukku.lotro.cards.set40.dwarven; + +import com.gempukku.lotro.cards.AbstractEvent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect; +import com.gempukku.lotro.cards.effects.ReplaceInSkirmishEffect; +import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.filters.Filters; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.modifiers.KeywordModifier; +import com.gempukku.lotro.logic.modifiers.StrengthModifier; + +/** + * Title: Battle Fever + * Set: Second Edition + * Side: Free + * Culture: Dwarven + * Twilight Cost: 2 + * Type: Event - Skirmish + * Card Number: 1C5 + * Game Text: Exert Gimli to have him replace an unbound companion in a skirmish. He is strength +2 and damage +1 while in that skirmish. + */ +public class Card40_005 extends AbstractEvent { + public Card40_005(Side side, int twilightCost, Culture culture, String name, Phase playableInPhase, Phase... additionalPlayableInPhases) { + super(Side.FREE_PEOPLE, 2, Culture.DWARVEN, "Battle Fever", Phase.SKIRMISH); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) { + return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile) + && PlayConditions.canExert(self, game, Filters.name("Gimli"), Filters.notAssignedToSkirmish); + } + + @Override + public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) { + final PlayEventAction action = new PlayEventAction(self); + action.appendCost( + new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name("Gimli")) { + @Override + protected void forEachCardExertedCallback(PhysicalCard character) { + action.appendEffect( + new ReplaceInSkirmishEffect(character, Filters.unboundCompanion)); + action.appendEffect( + new AddUntilEndOfPhaseModifierEffect( + new StrengthModifier(self, character, 2))); + action.appendEffect( + new AddUntilEndOfPhaseModifierEffect( + new KeywordModifier(self, character, Keyword.DAMAGE, 1))); + } + }); + return action; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_006.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_006.java new file mode 100644 index 000000000..2aeb08ee3 --- /dev/null +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set40/dwarven/Card40_006.java @@ -0,0 +1,57 @@ +package com.gempukku.lotro.cards.set40.dwarven; + +import com.gempukku.lotro.cards.AbstractEvent; +import com.gempukku.lotro.cards.PlayConditions; +import com.gempukku.lotro.cards.actions.PlayEventAction; +import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect; +import com.gempukku.lotro.cards.effects.StackTopCardsFromDeckEffect; +import com.gempukku.lotro.cards.modifiers.CantTakeMoreThanXWoundsModifier; +import com.gempukku.lotro.common.*; +import com.gempukku.lotro.game.PhysicalCard; +import com.gempukku.lotro.game.state.LotroGame; +import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect; + +/** + * Title: Battle Tested + * Set: Second Edition + * Side: Free + * Culture: Dwarven + * Twilight Cost: 0 + * Type: Event - Skirmish + * Card Number: 1U6 + * Game Text: Stack the top 3 cards of your draw deck onto a [DWARVEN] support area condition to make a Dwarf take no more than one wound in a skirmish. + */ +public class Card40_006 extends AbstractEvent{ + public Card40_006(Side side, int twilightCost, Culture culture, String name, Phase playableInPhase, Phase... additionalPlayableInPhases) { + super(Side.FREE_PEOPLE, 0, Culture.DWARVEN, "Battle Tested", Phase.SKIRMISH); + } + + @Override + public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) { + return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile) + && PlayConditions.canStackDeckTopCards(game, self.getOwner(), 3, Culture.DWARVEN, Zone.SUPPORT, CardType.CONDITION); + } + + @Override + public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) { + final PlayEventAction action = new PlayEventAction(self); + action.appendCost( + new ChooseActiveCardEffect(self, self.getOwner(), "Choose condition to stack cards on", Culture.DWARVEN, Zone.SUPPORT, CardType.CONDITION) { + @Override + protected void cardSelected(LotroGame game, PhysicalCard card) { + action.appendCost(new StackTopCardsFromDeckEffect(self, self.getOwner(), 3, card)); + } + }); + action.appendEffect( + new ChooseActiveCardEffect(self, self.getOwner(), "Choose a Dwarf", Race.DWARF) { + @Override + protected void cardSelected(LotroGame game, PhysicalCard card) { + action.appendEffect( + new AddUntilEndOfPhaseModifierEffect( + new CantTakeMoreThanXWoundsModifier(self, Phase.SKIRMISH, 1, card))); + } + } + ); + return action; + } +} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt index 56084e8f2..428098eb0 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt @@ -228,3 +228,5 @@ 18_149,18_133 # Gemp-LotR promos gl_theOneRing,1_2 +# Second edition +40_2,1_2