Migrated Shire cards in set 3 to hjson

This commit is contained in:
MarcinSc
2024-04-11 15:30:41 +07:00
parent cfbffe33b7
commit 53a06d7cd4
20 changed files with 440 additions and 496 deletions

View File

@@ -1,57 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Race;
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.RequiredTriggerAction;
import com.gempukku.lotro.logic.cardtype.AbstractAttachableFPPossession;
import com.gempukku.lotro.logic.effects.SelfDiscardEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.TwilightCostModifier;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 0
* Type: Possession
* Game Text: Bearer must be a Hobbit companion. The Shadow number of each site is -1. Discard Bill the Pony when at
* an underground site.
*/
public class Card3_106 extends AbstractAttachableFPPossession {
public Card3_106() {
super(0, 0, 0, Culture.SHIRE, null, "Bill the Pony", null, true);
}
@Override
public Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Race.HOBBIT, CardType.COMPANION);
}
@Override
public List<? extends Modifier> getInPlayModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(
new TwilightCostModifier(self, CardType.SITE, -1));
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (!game.getGameState().isMoving()
&& game.getModifiersQuerying().hasKeyword(game, game.getGameState().getCurrentSite(), Keyword.UNDERGROUND)) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new SelfDiscardEffect(self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,60 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.common.*;
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.cardtype.AbstractAttachableFPPossession;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.decisions.ForEachYouSpotDecision;
import com.gempukku.lotro.logic.effects.ChooseAndHealCharactersEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Possession • Pipe
* Game Text: Bearer must be Frodo. Fellowship: Discard a pipeweed possession and spot X pipes to heal a companion
* with the Frodo signet X times.
*/
public class Card3_107 extends AbstractAttachableFPPossession {
public Card3_107() {
super(1, 0, 0, Culture.SHIRE, PossessionClass.PIPE, "Frodo's Pipe", null, true);
}
@Override
public Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.frodo;
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& Filters.canSpot(game, Keyword.PIPEWEED, CardType.POSSESSION)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Keyword.PIPEWEED, CardType.POSSESSION));
action.appendEffect(
new PlayoutDecisionEffect(playerId,
new ForEachYouSpotDecision(1, "Choose number of pipes you wish to spot", game, PossessionClass.PIPE) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
final int spotCount = getValidatedResult(result);
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, 1, 1, spotCount, CardType.COMPANION, Signet.FRODO));
}
}));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,48 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
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.cardtype.AbstractAttachableFPPossession;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 0
* Type: Possession • Hand Weapon
* Strength: +1
* Game Text: Bearer must be a Hobbit. Skirmish: Exert bearer to wound an Orc he or she is skirmishing.
*/
public class Card3_108 extends AbstractAttachableFPPossession {
public Card3_108() {
super(0, 1, 0, Culture.SHIRE, PossessionClass.HAND_WEAPON, "Frying Pan");
}
@Override
public Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Race.HOBBIT;
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
&& PlayConditions.canExert(self, game, Filters.hasAttached(self))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.hasAttached(self)));
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, Race.ORC, Filters.inSkirmishAgainst(Filters.hasAttached(self))));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,57 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
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.PlayEventAction;
import com.gempukku.lotro.logic.cardtype.AbstractEvent;
import com.gempukku.lotro.logic.effects.RemoveTwilightEffect;
import com.gempukku.lotro.logic.effects.RevealRandomCardsFromHandEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseOpponentEffect;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Event
* Game Text: Fellowship: Spot a Hobbit companion (except the Ring-bearer) to reveal a card at random from
* an opponent's hand. Remove (X), where X is the twilight cost of the card revealed.
*/
public class Card3_109 extends AbstractEvent {
public Card3_109() {
super(Side.FREE_PEOPLE, 1, Culture.SHIRE, "Meant to Be Alone", Phase.FELLOWSHIP);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return Filters.canSpot(game, Race.HOBBIT, CardType.COMPANION, Filters.not(Filters.ringBearer));
}
@Override
public PlayEventAction getPlayEventCardAction(final String playerId, LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseOpponentEffect(playerId) {
@Override
protected void opponentChosen(String opponentId) {
action.insertEffect(
new RevealRandomCardsFromHandEffect(playerId, opponentId, self, 1) {
@Override
protected void cardsRevealed(List<PhysicalCard> revealedCards) {
if (revealedCards.size() > 0) {
PhysicalCard revealedCard = revealedCards.get(0);
int twilightCost = revealedCard.getBlueprint().getTwilightCost();
action.appendEffect(
new RemoveTwilightEffect(twilightCost));
}
}
});
}
});
return action;
}
}

View File

@@ -1,52 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.common.SitesBlock;
import com.gempukku.lotro.logic.cardtype.AbstractAlly;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import com.gempukku.lotro.logic.effects.AddBurdenEffect;
import com.gempukku.lotro.logic.effects.SelfExertEffect;
import com.gempukku.lotro.common.Culture;
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.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Ally • Home 1 • Hobbit
* Strength: 2
* Vitality: 2
* Site: 1
* Game Text: Response: If a burden is about to be added by a Shadow card, exert Melilot Brandybuck to prevent
* that burden.
*/
public class Card3_110 extends AbstractAlly {
public Card3_110() {
super(1, SitesBlock.FELLOWSHIP, 1, 2, 2, Race.HOBBIT, Culture.SHIRE, "Melilot Brandybuck", "Merry Dancer", true);
}
@Override
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isAddingBurden(effect, game, Side.SHADOW)
&& PlayConditions.canExert(self, game, self)) {
final AddBurdenEffect addBurdenEffect = (AddBurdenEffect) effect;
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new SelfExertEffect(action, self));
action.appendEffect(
new PreventEffect(addBurdenEffect));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,47 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.logic.cardtype.AbstractAlly;
import com.gempukku.lotro.logic.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
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.OptionalTriggerAction;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.results.DiscardCardFromHandResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Ally • Home 1 • Hobbit
* Strength: 1
* Vitality: 2
* Site: 1
* Game Text: Each time a Shadow card makes you discard a card from hand, you may also discard a minion or Shadow
* condition.
*/
public class Card3_111 extends AbstractAlly {
public Card3_111() {
super(1, SitesBlock.FELLOWSHIP, 1, 1, 2, Race.HOBBIT, Culture.SHIRE, "Old Noakes", "Purveyor of Wisdoms", true);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_DISCARDED_FROM_HAND) {
DiscardCardFromHandResult discardCardsResult = (DiscardCardFromHandResult) effectResult;
if (discardCardsResult.isForced() && discardCardsResult.getHandPlayerId().equals(playerId)
&& Filters.and(Side.SHADOW).accepts(game, discardCardsResult.getSource())) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(CardType.MINION, Filters.and(Side.SHADOW, CardType.CONDITION))));
return Collections.singletonList(action);
}
}
return null;
}
}

View File

@@ -1,47 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
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.PlayEventAction;
import com.gempukku.lotro.logic.cardtype.AbstractEvent;
import com.gempukku.lotro.logic.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.modifiers.RemoveKeywordModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Event
* Game Text: Stealth. Skirmish: Spot 2 [SHIRE] companions to make a minion lose all damage bonuses.
*/
public class Card3_112 extends AbstractEvent {
public Card3_112() {
super(Side.FREE_PEOPLE, 1, Culture.SHIRE, "Seek and Hide", Phase.SKIRMISH);
addKeyword(Keyword.STEALTH);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, 2, Culture.SHIRE, CardType.COMPANION);
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new RemoveKeywordModifier(self, Filters.sameCard(card), Keyword.DAMAGE)));
}
});
return action;
}
}

View File

@@ -1,52 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
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.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.cardtype.AbstractPermanent;
import com.gempukku.lotro.logic.effects.ChooseAndHealCharactersEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.results.RemoveBurdenResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Condition
* Game Text: To play, spot 2 [SHIRE] companions. Plays to your support area. Each time you remove a burden (except by
* a Hobbit's game text), you may heal a companion.
*/
public class Card3_113 extends AbstractPermanent {
public Card3_113() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.SHIRE, "The Shire Countryside");
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, 2, Culture.SHIRE, CardType.COMPANION);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (effectResult.getType() == EffectResult.Type.REMOVE_BURDEN) {
RemoveBurdenResult removeBurdenResult = (RemoveBurdenResult) effectResult;
PhysicalCard source = removeBurdenResult.getSource();
if (source != null && removeBurdenResult.getPerformingPlayerId().equals(playerId) && source.getBlueprint().getRace() != Race.HOBBIT) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, CardType.COMPANION));
return Collections.singletonList(action);
}
}
return null;
}
}

View File

@@ -1,46 +0,0 @@
package com.gempukku.lotro.cards.set3.shire;
import com.gempukku.lotro.logic.cardtype.AbstractPermanent;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.common.*;
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.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
/**
* Set: Realms of Elf-lords
* Side: Free
* Culture: Shire
* Twilight Cost: 0
* Type: Condition
* Game Text: Tale. Plays to your support area. Response: If a Shadow card is about to add any number of twilight
* tokens, exert a Hobbit ally to prevent this.
*/
public class Card3_114 extends AbstractPermanent {
public Card3_114() {
super(Side.FREE_PEOPLE, 0, CardType.CONDITION, Culture.SHIRE, "Three Monstrous Trolls");
addKeyword(Keyword.TALE);
}
@Override
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isAddingTwilight(effect, game, Side.SHADOW)
&& PlayConditions.canExert(self, game, Race.HOBBIT, CardType.ALLY)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.HOBBIT, CardType.ALLY));
action.appendEffect(
new PreventEffect((AddTwilightEffect) effect));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -0,0 +1,257 @@
{
3_106: {
title: Bill the Pony
unique: true
side: free_people
culture: Shire
twilight: 0
type: possession
target: hobbit,companion
effects: [
{
type: modifier
modifier: {
type: modifyCost
filter: site
amount: -1
}
}
{
type: trigger
trigger: {
type: ConstantlyCheck
requires: {
type: location
filter: underground
}
}
effect: {
type: discard
filter: self
}
}
]
}
3_107: {
title: Frodo's Pipe
unique: true
side: free_people
culture: Shire
twilight: 1
type: possession
itemclass: Pipe
target: name(Frodo)
effects: {
type: activated
phase: fellowship
cost: [
{
type: discard
filter: choose(pipeweed,possession)
}
{
type: chooseHowManyToSpot
filter: pipe
memorize: pipeCount
}
]
effect: {
type: heal
filter: choose(companion,signet(Frodo))
times: {
type: fromMemory
memory: pipeCount
}
}
}
}
3_108: {
title: Frying Pan
side: free_people
culture: Shire
twilight: 0
type: possession
itemclass: Hand Weapon
strength: 1
target: hobbit
effects: {
type: activated
phase: skirmish
cost: {
type: exert
filter: bearer
}
effect: {
type: wound
filter: choose(orc,inSkirmishAgainst(bearer))
}
}
}
3_109: {
title: Meant to Be Alone
side: free_people
culture: Shire
twilight: 1
type: event
keyword: Fellowship
effects: {
type: event
requires: {
type: canSpot
filter: hobbit,companion,not(ringBearer)
}
effect: [
{
type: revealRandomCardsFromHand
forced: true
hand: shadow
memorize: revealedCard
}
{
type: removeTwilight
amount: {
type: twilightCostInMemory
memory: revealedCard
}
}
]
}
}
3_110: {
title: Melilot Brandybuck
subtitle: Merry Dancer
unique: true
side: free_people
culture: Shire
twilight: 1
type: ally
race: Hobbit
strength: 2
vitality: 2
allyHome: Fellowship,1
keyword: Support Area
effects: {
type: activatedTrigger
trigger: {
type: aboutToAddBurden
filter: side(shadow)
}
cost: {
type: exert
filter: self
}
effect: {
type: preventBurden
}
}
}
3_111: {
title: Old Noakes
subtitle: Purveyor of Wisdoms
unique: true
side: free_people
culture: Shire
twilight: 1
type: ally
race: Hobbit
strength: 1
vitality: 2
allyHome: Fellowship,1
keyword: Support Area
effects: {
type: trigger
optional: true
trigger: {
type: discardFromHandBy
by: side(shadow)
forced: true
}
effect: {
type: discard
filter: choose(or(minion,and(side(shadow),condition)))
}
}
}
3_112: {
title: Seek and Hide
side: free_people
culture: Shire
twilight: 1
type: event
keyword:
[
Skirmish
Stealth
]
effects: {
type: event
requires: {
type: canSpot
filter: culture(shire),companion
count: 2
}
effect: {
type: removeKeyword
filter: choose(minion)
keyword: damage
}
}
}
3_113: {
title: The Shire Countryside
side: free_people
culture: Shire
twilight: 1
type: condition
keyword: Support Area
effects: [
{
type: toPlay
requires: {
type: canSpot
filter: culture(shire),companion
count: 2
}
}
{
type: trigger
optional: true
trigger: {
type: removesBurden
player: you
filter: not(hobbit)
}
effect: {
type: heal
filter: choose(companion)
}
}
]
}
3_114: {
title: Three Monstrous Trolls
side: free_people
culture: Shire
twilight: 0
type: condition
keyword:
[
Support Area
Tale
]
effects: {
type: activatedTrigger
trigger: {
type: aboutToAddTwilight
filter: side(shadow)
}
cost: {
type: exert
filter: choose(hobbit,ally)
}
effect: {
type: preventTwilight
}
}
}
}

View File

@@ -96,9 +96,11 @@ public class EffectAppenderFactory {
effectAppenderProducers.put("playnextsite", new PlayNextSite());
effectAppenderProducers.put("playsite", new PlaySite());
effectAppenderProducers.put("preventable", new PreventableAppenderProducer());
effectAppenderProducers.put("preventburden", new PreventBurden());
effectAppenderProducers.put("preventdiscard", new PreventCardEffectAppender());
effectAppenderProducers.put("preventexert", new PreventExert());
effectAppenderProducers.put("preventheal", new PreventCardEffectAppender());
effectAppenderProducers.put("preventtwilight", new PreventTwilight());
effectAppenderProducers.put("preventwound", new PreventWound());
effectAppenderProducers.put("putcardsfromdeckintohand", new PutCardsFromDeckIntoHand());
effectAppenderProducers.put("putcardsfromdeckontopofdeck", new PutCardsFromDeckOnTopOfDeck());

View File

@@ -0,0 +1,34 @@
package com.gempukku.lotro.cards.build.field.effect.appender;
import com.gempukku.lotro.cards.build.ActionContext;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.AddBurdenEffect;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.timing.Effect;
import org.json.simple.JSONObject;
public class PreventBurden implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject);
MultiEffectAppender result = new MultiEffectAppender();
result.addEffectAppender(
new DelayedAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
AddBurdenEffect addBurdenEffect = (AddBurdenEffect) actionContext.getEffect();
return new PreventEffect(addBurdenEffect);
}
});
return result;
}
}

View File

@@ -0,0 +1,34 @@
package com.gempukku.lotro.cards.build.field.effect.appender;
import com.gempukku.lotro.cards.build.ActionContext;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.EffectAppender;
import com.gempukku.lotro.cards.build.field.effect.EffectAppenderProducer;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.timing.Effect;
import org.json.simple.JSONObject;
public class PreventTwilight implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject);
MultiEffectAppender result = new MultiEffectAppender();
result.addEffectAppender(
new DelayedAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
AddTwilightEffect addTwilightEffect = (AddTwilightEffect) actionContext.getEffect();
return new PreventEffect(addTwilightEffect);
}
});
return result;
}
}

View File

@@ -0,0 +1,34 @@
package com.gempukku.lotro.cards.build.field.effect.trigger;
import com.gempukku.lotro.cards.build.ActionContext;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.FilterableSource;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import org.json.simple.JSONObject;
public class AboutToAddBurden implements TriggerCheckerProducer {
@Override
public TriggerChecker getTriggerChecker(JSONObject value, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "filter");
String filter = FieldUtils.getString(value.get("filter"), "filter");
final FilterableSource sourceFilter = environment.getFilterFactory().generateFilter(filter, environment);
return new TriggerChecker() {
@Override
public boolean accepts(ActionContext actionContext) {
final Filterable source = sourceFilter.getFilterable(actionContext);
return TriggerConditions.isAddingBurden(actionContext.getEffect(), actionContext.getGame(), source);
}
@Override
public boolean isBefore() {
return true;
}
};
}
}

View File

@@ -0,0 +1,34 @@
package com.gempukku.lotro.cards.build.field.effect.trigger;
import com.gempukku.lotro.cards.build.ActionContext;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.FilterableSource;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import org.json.simple.JSONObject;
public class AboutToAddTwilight implements TriggerCheckerProducer {
@Override
public TriggerChecker getTriggerChecker(JSONObject value, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "filter");
String filter = FieldUtils.getString(value.get("filter"), "filter");
final FilterableSource sourceFilter = environment.getFilterFactory().generateFilter(filter, environment);
return new TriggerChecker() {
@Override
public boolean accepts(ActionContext actionContext) {
final Filterable source = sourceFilter.getFilterable(actionContext);
return TriggerConditions.isAddingTwilight(actionContext.getEffect(), actionContext.getGame(), source);
}
@Override
public boolean isBefore() {
return true;
}
};
}
}

View File

@@ -10,11 +10,12 @@ import org.json.simple.JSONObject;
public class DiscardFromHand implements TriggerCheckerProducer {
@Override
public TriggerChecker getTriggerChecker(JSONObject value, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "filter", "memorize", "player");
FieldUtils.validateAllowedFields(value, "filter", "memorize", "player", "forced");
final String filter = FieldUtils.getString(value.get("filter"), "filter", "any");
final String memorize = FieldUtils.getString(value.get("memorize"), "memorize");
final String player = FieldUtils.getString(value.get("player"), "player");
final boolean forced = FieldUtils.getBoolean(value.get("forced"), "forced", false);
PlayerSource playerSource = (player != null) ? PlayerResolver.resolvePlayer(player, environment) : null;
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(filter, environment);
@@ -29,6 +30,11 @@ public class DiscardFromHand implements TriggerCheckerProducer {
public boolean accepts(ActionContext actionContext) {
boolean result = TriggerConditions.forEachDiscardedFromHand(actionContext.getGame(), actionContext.getEffectResult(),
filterableSource.getFilterable(actionContext));
if (result && forced) {
// Need to check if the discard was forced
if (!((DiscardCardFromHandResult) actionContext.getEffectResult()).isForced())
result = false;
}
if (result && playerSource != null) {
// Need to check if it was that player discarding the card
final String performingPlayer = ((DiscardCardFromHandResult) actionContext.getEffectResult()).getSource().getOwner();

View File

@@ -10,12 +10,13 @@ import org.json.simple.JSONObject;
public class DiscardFromHandBy implements TriggerCheckerProducer {
@Override
public TriggerChecker getTriggerChecker(JSONObject value, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "filter", "memorize", "player", "by");
FieldUtils.validateAllowedFields(value, "filter", "memorize", "player", "by", "forced");
final String filter = FieldUtils.getString(value.get("filter"), "filter", "any");
final String memorize = FieldUtils.getString(value.get("memorize"), "memorize");
final String player = FieldUtils.getString(value.get("player"), "player", "you");
final String byFilter = FieldUtils.getString(value.get("by"), "by");
final boolean forced = FieldUtils.getBoolean(value.get("forced"), "forced", false);
PlayerSource playerSource = (player != null) ? PlayerResolver.resolvePlayer(player, environment) : null;
final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(filter, environment);
@@ -31,6 +32,11 @@ public class DiscardFromHandBy implements TriggerCheckerProducer {
public boolean accepts(ActionContext actionContext) {
boolean result = TriggerConditions.forEachDiscardedFromHandBy(actionContext.getGame(), actionContext.getEffectResult(),
byFilterableSource.getFilterable(actionContext), filterableSource.getFilterable(actionContext));
if (result && forced) {
// Need to check if the discard was forced
if (!((DiscardCardFromHandResult) actionContext.getEffectResult()).isForced())
result = false;
}
if (result && playerSource != null) {
// Need to check if it was that player discarding the card
final String performingPlayer = ((DiscardCardFromHandResult) actionContext.getEffectResult()).getSource().getOwner();

View File

@@ -1,27 +1,28 @@
package com.gempukku.lotro.cards.build.field.effect.trigger;
import com.gempukku.lotro.cards.build.ActionContext;
import com.gempukku.lotro.cards.build.CardGenerationEnvironment;
import com.gempukku.lotro.cards.build.FilterableSource;
import com.gempukku.lotro.cards.build.InvalidCardDefinitionException;
import com.gempukku.lotro.cards.build.*;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.PlayerResolver;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import org.json.simple.JSONObject;
public class RemovesBurden implements TriggerCheckerProducer {
@Override
public TriggerChecker getTriggerChecker(JSONObject value, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(value, "filter");
FieldUtils.validateAllowedFields(value, "player", "filter");
String player = FieldUtils.getString(value.get("player"), "player");
String filter = FieldUtils.getString(value.get("filter"), "filter", "any");
PlayerSource playerSource = (player != null) ? PlayerResolver.resolvePlayer(player, environment) : null;
final FilterableSource sourceFilter = environment.getFilterFactory().generateFilter(filter, environment);
return new TriggerChecker() {
@Override
public boolean accepts(ActionContext actionContext) {
String performingPlayer = (playerSource != null) ? playerSource.getPlayer(actionContext) : null;
return TriggerConditions.removedBurden(actionContext.getGame(), actionContext.getEffectResult(),
sourceFilter.getFilterable(actionContext));
performingPlayer, sourceFilter.getFilterable(actionContext));
}
@Override

View File

@@ -12,6 +12,8 @@ public class TriggerCheckerFactory {
private final Map<String, TriggerCheckerProducer> triggerCheckers = new HashMap<>();
public TriggerCheckerFactory() {
triggerCheckers.put("abouttoaddburden", new AboutToAddBurden());
triggerCheckers.put("abouttoaddtwilight", new AboutToAddBurden());
triggerCheckers.put("abouttobekilled", new AboutToBeKilled());
triggerCheckers.put("abouttodiscard", new AboutToDiscardFromPlay());
triggerCheckers.put("abouttoexert", new AboutToExert());

View File

@@ -107,10 +107,11 @@ public class TriggerConditions {
return false;
}
public static boolean removedBurden(LotroGame game, EffectResult effectResult, Filterable... sourceFilters) {
public static boolean removedBurden(LotroGame game, EffectResult effectResult, String player, Filterable... sourceFilters) {
if (effectResult.getType() == EffectResult.Type.REMOVE_BURDEN) {
RemoveBurdenResult burdenResult = (RemoveBurdenResult) effectResult;
return (Filters.and(sourceFilters).accepts(game, burdenResult.getSource()));
return (player == null || burdenResult.getPerformingPlayerId().equals(player))
&& Filters.and(sourceFilters).accepts(game, burdenResult.getSource());
}
return false;
}
@@ -201,11 +202,11 @@ public class TriggerConditions {
return Filters.and(filters).accepts(game, ((DiscardCardFromDeckResult) effectResult).getDiscardedCard());
return false;
}
public static boolean forEachDiscardedFromHandBy(LotroGame game, EffectResult effectResult, Filterable discardedBy, Filterable... discarded) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_DISCARDED_FROM_HAND) {
DiscardCardFromHandResult discardResult = (DiscardCardFromHandResult) effectResult;
if (discardResult.getSource() != null
if (discardResult.getSource() != null
&& Filters.and(discardedBy).accepts(game, discardResult.getSource()))
return Filters.and(discarded).accepts(game, discardResult.getDiscardedCard());
}
@@ -214,7 +215,7 @@ public class TriggerConditions {
public static boolean forEachWoundedBy(LotroGame game, EffectResult effectResult, Filterable woundedBy, Filterable... filters) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_WOUNDED) {
var woundResult = (WoundResult)effectResult;
var woundResult = (WoundResult) effectResult;
return Filters.filter(woundResult.getSources(), game, woundedBy).size() > 0 &&
Filters.and(filters).accepts(game, woundResult.getWoundedCard());
@@ -224,16 +225,16 @@ public class TriggerConditions {
public static boolean forEachMortallyWoundedBy(LotroGame game, EffectResult effectResult, Filterable woundedBy, Filterable... filters) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_WOUNDED) {
var woundResult = (WoundResult)effectResult;
var woundResult = (WoundResult) effectResult;
var wounded = woundResult.getWoundedCard();
return Filters.filter(woundResult.getSources(), game, woundedBy).size() > 0 &&
Filters.and(filters).accepts(game, woundResult.getWoundedCard()) &&
(
( Filters.or(CardType.ALLY, CardType.COMPANION).accepts(game, wounded) &&
wounded.getZone() == Zone.DEAD ) ||
( Filters.and(CardType.MINION).accepts(game, wounded) &&
wounded.getZone() != Zone.SHADOW_CHARACTERS)
(Filters.or(CardType.ALLY, CardType.COMPANION).accepts(game, wounded) &&
wounded.getZone() == Zone.DEAD) ||
(Filters.and(CardType.MINION).accepts(game, wounded) &&
wounded.getZone() != Zone.SHADOW_CHARACTERS)
);
}
return false;
@@ -249,7 +250,7 @@ public class TriggerConditions {
if (effectResult.getType() != EffectResult.Type.FOR_EACH_HEALED)
return false;
HealResult healResult = (HealResult)effectResult;
HealResult healResult = (HealResult) effectResult;
if (player == null || player.equals(healResult.getPerformingPlayer()))
return Filters.and(filters).accepts(game, ((HealResult) effectResult).getHealedCard());
else
@@ -355,17 +356,16 @@ public class TriggerConditions {
}
public static boolean forEachKilledBy(LotroGame game, EffectResult effectResult, Filterable killedBy, Filterable... killed) {
if(effectResult.getType() == EffectResult.Type.FOR_EACH_WOUNDED) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_WOUNDED) {
return forEachMortallyWoundedBy(game, effectResult, killedBy, killed);
}
else if (effectResult.getType() == EffectResult.Type.FOR_EACH_KILLED) {
if(forEachKilledInASkirmish(game, effectResult, killedBy, killed))
} else if (effectResult.getType() == EffectResult.Type.FOR_EACH_KILLED) {
if (forEachKilledInASkirmish(game, effectResult, killedBy, killed))
return true;
ForEachKilledResult killResult = (ForEachKilledResult) effectResult;
var killers = killResult.getKillers();
if(killers == null || killers.isEmpty() || killers.stream().allMatch(Objects::isNull))
if (killers == null || killers.isEmpty() || killers.stream().allMatch(Objects::isNull))
return false;
return Filters.filter(killResult.getKillers(), game, killedBy).size() > 0 &&
@@ -377,7 +377,7 @@ public class TriggerConditions {
public static boolean forEachKilledInASkirmish(LotroGame game, EffectResult effectResult, Filterable killedBy, Filterable... killed) {
if (effectResult.getType() == EffectResult.Type.FOR_EACH_KILLED
&& game.getGameState().getCurrentPhase() == Phase.SKIRMISH
&& Filters.countActive(game, Filters.inSkirmish, killedBy)>0) {
&& Filters.countActive(game, Filters.inSkirmish, killedBy) > 0) {
ForEachKilledResult killResult = (ForEachKilledResult) effectResult;
return Filters.and(killed).accepts(game, killResult.getKilledCard());
@@ -523,7 +523,7 @@ public class TriggerConditions {
return false;
}
public static boolean skirmishCancelled(LotroGame game, EffectResult effectResult, Filterable ... fpCharacterFilter) {
public static boolean skirmishCancelled(LotroGame game, EffectResult effectResult, Filterable... fpCharacterFilter) {
if (effectResult.getType() == EffectResult.Type.SKIRMISH_CANCELLED) {
SkirmishCancelledResult cancelledResult = (SkirmishCancelledResult) effectResult;
return Filters.and(fpCharacterFilter).accepts(game, cancelledResult.getFpCharacter());
@@ -540,8 +540,8 @@ public class TriggerConditions {
}
public static boolean freePlayerDecidedToMove(LotroGame game, EffectResult effectResult) {
if(effectResult.getType() == EffectResult.Type.FREE_PEOPLE_PLAYER_DECIDED_IF_MOVING) {
var result = (FreePlayerMoveDecisionResult)effectResult;
if (effectResult.getType() == EffectResult.Type.FREE_PEOPLE_PLAYER_DECIDED_IF_MOVING) {
var result = (FreePlayerMoveDecisionResult) effectResult;
return result.IsMoving();
}
@@ -549,8 +549,8 @@ public class TriggerConditions {
}
public static boolean freePlayerDecidedToStay(LotroGame game, EffectResult effectResult) {
if(effectResult.getType() == EffectResult.Type.FREE_PEOPLE_PLAYER_DECIDED_IF_MOVING) {
var result = (FreePlayerMoveDecisionResult)effectResult;
if (effectResult.getType() == EffectResult.Type.FREE_PEOPLE_PLAYER_DECIDED_IF_MOVING) {
var result = (FreePlayerMoveDecisionResult) effectResult;
return result.IsStaying();
}