Sauron and Shire cards from set 31 in new system

This commit is contained in:
marcin.sciesinski
2019-10-03 09:30:47 -07:00
parent e78a9c37b1
commit a51def0582
12 changed files with 297 additions and 415 deletions

View File

@@ -655,5 +655,199 @@
"filter": "choose(culture(gandalf),spell)"
}
}
},
"31_38": {
"title": "An Acorn from Beorn's House",
"culture": "shire",
"cost": 1,
"type": "possession",
"target": "name(Bilbo)",
"effects": {
"type": "activated",
"phase": "regroup",
"cost": {
"type": "discard",
"filter": "self"
},
"effect": [
{
"type": "removeBurdens",
"amount": 1
},
{
"type": "discard",
"filter": "choose(side(shadow),condition)"
}
]
}
},
"31_39": {
"title": "An Invisible Ring",
"culture": "shire",
"cost": 1,
"type": "event",
"keyword": "skirmish",
"effects": {
"type": "event",
"effect": [
{
"type": "modifyStrength",
"filter": "choose(name(Bilbo))",
"memorize": "bilbo",
"amount": 2
},
{
"type": "conditional",
"condition": {
"type": "ringIsOn"
},
"effect": {
"type": "removeText",
"filter": "choose(minion,not(name(Sauron)),inSkirmishAgainst(memory(bilbo)))",
"until": "start(regroup)"
}
}
]
}
},
"31_40": {
"title": "Barrels",
"culture": "shire",
"type": "event",
"keyword": "regroup",
"cost": 1,
"effects": {
"type": "event",
"cost": {
"type": "exert",
"count": 2,
"filter": "choose(culture(dwarven),companion)"
},
"effect": [
{
"type": "discard",
"count": "0-2",
"filter": "choose(minion,not(name(Smaug)))"
},
{
"type": "drawCards",
"count": 3
},
{
"type": "conditional",
"condition": {
"type": "location",
"filter": "river"
},
"effect": {
"type": "addModifier",
"modifier": {
"type": "modifyMoveLimit",
"amount": 1
},
"until": "endOfTurn"
}
}
]
}
},
"31_41": {
"title": "*Burglar's Contract",
"culture": "shire",
"type": "possession",
"cost": 1,
"resistance": 1,
"target": "name(Bilbo)",
"effects": {
"type": "activated",
"phase": "skirmish",
"cost": [
{
"type": "addBurdens",
"amount": 1
},
{
"type": "exert",
"filter": "bearer"
}
],
"effect": {
"type": "modifyStrength",
"filter": "choose(not(bearer),companion)",
"amount": {
"type": "cardAffectedLimitPerPhase",
"limit": 4,
"source": 2
}
}
}
},
"31_42": {
"title": "*Old Thrush",
"culture": "shire",
"type": "follower",
"race": "bird",
"cost": 1,
"strength": 1,
"effects": [
{
"type": "aidCost",
"cost": {
"type": "exert",
"filter": "choose(name(Bilbo))"
}
},
{
"type": "activated",
"phase": "maneuver",
"cost": {
"type": "discard",
"filter": "self"
},
"effect": {
"type": "choice",
"texts": [
"Take a card from your draw deck into hand",
"Take a card from your discard into hand"
],
"effects": [
{
"type": "putCardsFromDeckIntoHand",
"filter": "choose(side(free people),not(or(culture(gandalf),culture(elven))))"
}
{
"type": "putCardsFromDiscardIntoHand",
"filter": "choose(side(free people),not(or(culture(gandalf),culture(elven))))"
}
]
}
}
]
},
"31_43": {
"title": "Skillful Negociator",
"culture": "shire",
"type": "event",
"keyword": "maneuver",
"cost": 1,
"effects": {
"type": "event",
"cost": [
{
"type": "spot",
"filter": "choose(ally)",
"memorize": "chosenAlly"
},
{
"type": "exert",
"filter": "choose(name(Bilbo))"
}
],
"effect": {
"type": "canParticipateInArcheryFireAndSkirmishes",
"filter": "memory(chosenAlly)",
"until": "start(regroup)"
}
}
}
}

View File

@@ -704,5 +704,56 @@
}
]
}
},
"31_37": {
"title": "*Bolg",
"subtitle": "Servant of Sauron",
"culture": "sauron",
"type": "minion",
"race": "orc",
"cost": 4,
"strength": 9,
"vitality": 3,
"site": 5,
"keyword": "damage+1",
"effects": [
{
"type": "trigger",
"trigger": {
"type": "played",
"filter": "self"
},
"effect": {
"type": "duplicate",
"amount": {
"type": "forEachYouCanSpot",
"filter": "culture(dwarven),companion",
"over": 3
},
"effect": {
"type": "optional",
"text": "Do you want to play an Orc from your discard pile?",
"effect": {
"type": "playCardFromDiscard",
"filter": "choose(orc)"
}
}
}
},
{
"type": "activated",
"phase": "maneuver",
"condition": {
"type": "canSpot",
"filter": "culture(elven),archer"
},
"effect": {
"type": "addKeyword",
"filter": "self",
"keyword": "fierce",
"until": "start(regroup)"
}
}
]
}
}

View File

@@ -1,72 +0,0 @@
package com.gempukku.lotro.cards.set31.sauron;
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.cardtype.AbstractMinion;
import com.gempukku.lotro.logic.effects.AddUntilStartOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.OptionalEffect;
import com.gempukku.lotro.logic.effects.SpotEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import java.util.Collections;
import java.util.List;
/**
* •Bolg, Servant of Sauron [Sauron]
* Minion • Orc
* Twilight Cost 4
* Strength 9
* Vitality 3
* Site 5
* 'Damage +1.
* When you play Bolg, you may play an Orc from your discard pile for each [Dwarven] companion over 3.
* Maneuver: Spot an [Elven] archer to make Bolg fierce until the regroup phase.'
*/
public class Card31_037 extends AbstractMinion {
public Card31_037() {
super(4, 9, 3, 5, Race.ORC, Culture.SAURON, "Bolg", "Servant of Sauron", true);
addKeyword(Keyword.DAMAGE, 1);
}
@Override
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, self)
&& PlayConditions.canSpot(game, 4, Culture.DWARVEN, CardType.COMPANION)) {
int playCount = Filters.countSpottable(game, Culture.DWARVEN, CardType.COMPANION) - 3;
RequiredTriggerAction action = new RequiredTriggerAction(self);
for (int i = 0; i < playCount; i++) {
action.appendEffect(
new OptionalEffect(action, self.getOwner(),
new ChooseAndPlayCardFromDiscardEffect(self.getOwner(), game, Race.ORC)));
}
return Collections.singletonList(action);
}
return null;
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.MANEUVER, self, 0)
&& PlayConditions.canSpot(game, Culture.ELVEN, Keyword.ARCHER)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new SpotEffect(1, Culture.ELVEN, Keyword.ARCHER));
action.appendEffect(
new AddUntilStartOfPhaseModifierEffect(
new KeywordModifier(self, self, Keyword.FIERCE), Phase.REGROUP));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,53 +0,0 @@
package com.gempukku.lotro.cards.set31.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.effects.RemoveBurdenEffect;
import com.gempukku.lotro.logic.effects.SelfDiscardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.List;
/**
* Set: The Short Rest
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Possession
* Game Text: Bearer must be Bilbo. Regroup: Discard this possession to remove a doubt and discard a Shadow condition.
*/
public class Card31_038 extends AbstractAttachableFPPossession {
public Card31_038() {
super(1, 0, 0, Culture.SHIRE, null, "An Acorn from Beorn's House");
}
@Override
public Filter getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.name("Bilbo");
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.REGROUP, self)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new SelfDiscardEffect(self));
action.appendEffect(
new RemoveBurdenEffect(playerId, self));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.SHADOW, CardType.CONDITION));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,50 +0,0 @@
package com.gempukku.lotro.cards.set31.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.AddUntilStartOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndAddUntilEOPStrengthBonusEffect;
import com.gempukku.lotro.logic.modifiers.RemoveGameTextModifier;
/**
* Set: The Short Rest
* Side: Free
* Culture: Shire
* Twilight Cost: 1
* Type: Event
* Game Text: Skirmish: Make Bilbo strength +2. If he wears the One Ring, until the regroup phase,
* remove the game text from a minion (except Sauron) skirmishing him and make it unable to
* gain game text.
*/
public class Card31_039 extends AbstractEvent {
public Card31_039() {
super(Side.FREE_PEOPLE, 1, Culture.SHIRE, "An Invisible Ring", Phase.SKIRMISH);
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, final LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new ChooseAndAddUntilEOPStrengthBonusEffect(action, self, playerId, 2, Filters.name("Bilbo")));
if (game.getGameState().isWearingRing()) {
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION, Filters.inSkirmishAgainst(Filters.name("Bilbo"))) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new AddUntilStartOfPhaseModifierEffect(
new RemoveGameTextModifier(self, card), Phase.REGROUP));
}
});
}
return action;
}
}

View File

@@ -1,49 +0,0 @@
package com.gempukku.lotro.cards.set31.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.AddUntilEndOfTurnModifierEffect;
import com.gempukku.lotro.logic.effects.DrawCardsEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.modifiers.MoveLimitModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
/**
* Barrels [Shire]
Event • Regroup
Twilight Cost 1
'Exert 2 [Dwarven] companions to discard up to 2 minions (except Smaug) and draw 3 cards. If the fellowship is at
a river, make the move limit +1 for this turn.'
*/
public class Card31_040 extends AbstractEvent {
public Card31_040() {
super(Side.FREE_PEOPLE, 1, Culture.SHIRE, "Barrels", Phase.REGROUP);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canExert(self, game, 1, 2, Culture.DWARVEN, CardType.COMPANION);
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, LotroGame game, PhysicalCard self) {
PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Culture.DWARVEN, CardType.COMPANION));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 0, 2, CardType.MINION, Filters.not(Filters.name("Smaug"))));
action.appendEffect(
new DrawCardsEffect(action, playerId, 3));
if (game.getModifiersQuerying().hasKeyword(game, game.getGameState().getCurrentSite(), Keyword.RIVER)) {
action.appendEffect(
new AddUntilEndOfTurnModifierEffect(
new MoveLimitModifier(self, 1)));
}
return action;
}
}

View File

@@ -1,70 +0,0 @@
package com.gempukku.lotro.cards.set31.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Filterable;
import com.gempukku.lotro.common.Phase;
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.AddBurdenEffect;
import com.gempukku.lotro.logic.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.CheckPhaseLimitEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.List;
/**
* •Burglar's Contract [Shire]
* Possession
* Twilight Cost 1
* Resistance bonus: +1
* 'Bearer must be Bilbo.
* Skirmish: Add a doubt and exert Bilbo to make another companion strength +2 (limit +4).'
*/
public class Card31_041 extends AbstractAttachableFPPossession {
public Card31_041() {
super(1, 0, 0, Culture.SHIRE, null, "Burglar's Contract", null, true);
}
@Override
public int getResistance() {
return 1;
}
@Override
public Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.name("Bilbo");
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(final String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
&& PlayConditions.canAddBurdens(game, playerId, self)
&& PlayConditions.canExert(self, game, Filters.name("Bilbo"))) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new AddBurdenEffect(playerId, self, 1));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name("Bilbo")));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose another companion to add strength bonus", CardType.COMPANION, Filters.not(Filters.name("Bilbo"))) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new CheckPhaseLimitEffect(action, self, card.getCardId()+"-", 2, Phase.SKIRMISH,
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, card, 2))));
}
});
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,69 +0,0 @@
package com.gempukku.lotro.cards.set31.shire;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.CostToEffectAction;
import com.gempukku.lotro.logic.cardtype.AbstractFollower;
import com.gempukku.lotro.logic.effects.ChoiceEffect;
import com.gempukku.lotro.logic.effects.SelfDiscardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPutCardFromDeckIntoHandEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPutCardFromDiscardIntoHandEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* •Old Thrush [Shire]
Follower • Bird
Twilight Cost 1
Strength bonus: +1
'Aid - Exert Bilbo.
Maneuver: Discard this follower to take into hand a Free Peoples card (except [Gandalf] or [Elven]) from your draw deck
or discard pile.'
*/
public class Card31_042 extends AbstractFollower {
public Card31_042() {
super(Side.FREE_PEOPLE, 1, 1, 0, 0, Culture.SHIRE, "Old Thrush", null, true);
}
@Override
public boolean canPayAidCost(LotroGame game, PhysicalCard self) {
return PlayConditions.canExert(self, game, Filters.name("Bilbo"));
}
@Override
public void appendAidCosts(LotroGame game, CostToEffectAction action, PhysicalCard self) {
action.appendCost(new ChooseAndExertCharactersEffect(action, self.getOwner(), 1, 1, Filters.name("Bilbo")));
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)
&& PlayConditions.canSpot(game, Filters.hasAttached(self))
&& PlayConditions.canSelfDiscard(self, game)) {
ActivateCardAction action= new ActivateCardAction(self);
action.appendCost(
new SelfDiscardEffect(self));
List<Effect> possibleEffects = new LinkedList<Effect>();
possibleEffects.add(
new ChooseAndPutCardFromDeckIntoHandEffect(action, playerId, 1, 1, Side.FREE_PEOPLE,
Filters.not(Filters.or(Culture.GANDALF, Culture.ELVEN))));
possibleEffects.add(
new ChooseAndPutCardFromDiscardIntoHandEffect(action, playerId, 1, 1, Side.FREE_PEOPLE,
Filters.not(Filters.or(Culture.GANDALF, Culture.ELVEN))));
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,51 +0,0 @@
package com.gempukku.lotro.cards.set31.shire;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Side;
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.AddUntilStartOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.modifiers.AllyParticipatesInArcheryFireAndSkirmishesModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
/**
* Skillful Negociator [Shire]
Event • Maneuver
Twilight Cost 1
'Spot an ally and exert Bilbo to allow that ally to participate in archery fire and skirmishes until the regroup phase.'
*/
public class Card31_043 extends AbstractEvent {
public Card31_043() {
super(Side.FREE_PEOPLE, 1, Culture.SHIRE, "Skillful Negociator", Phase.MANEUVER);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, CardType.ALLY)
&& PlayConditions.canExert(self, game, Filters.name("Bilbo"));
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name("Bilbo")));
action.appendEffect(
new ChooseActiveCardEffect(self, playerId, "Choose an ally", CardType.ALLY) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new AddUntilStartOfPhaseModifierEffect(
new AllyParticipatesInArcheryFireAndSkirmishesModifier(self, card), Phase.REGROUP));
}
});
return action;
}
}

View File

@@ -7,7 +7,7 @@ public enum Race implements Filterable {
GOBLIN("Goblin"),
//Additional Hobbit Draft races
DRAGON("Dragon"), EAGLE("Eagle");
DRAGON("Dragon"), EAGLE("Eagle"), BIRD("Bird");
private String _humanReadable;

View File

@@ -122,6 +122,7 @@ public class EffectAppenderFactory {
effectAppenderProducers.put("placenowoundforexert", new PlaceNoWoundForExert());
effectAppenderProducers.put("shufflehandintodrawdeck", new ShuffleHandIntoDrawDeck());
effectAppenderProducers.put("getcardsfromtopofdeck", new GetCardsFromTopOfDeck());
effectAppenderProducers.put("removetext", new RemoveText());
}
public EffectAppender getEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {

View File

@@ -0,0 +1,50 @@
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.ValueSource;
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.cards.build.field.effect.appender.resolver.CardResolver;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.TimeResolver;
import com.gempukku.lotro.cards.build.field.effect.appender.resolver.ValueResolver;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.actions.CostToEffectAction;
import com.gempukku.lotro.logic.effects.AddUntilModifierEffect;
import com.gempukku.lotro.logic.modifiers.RemoveGameTextModifier;
import com.gempukku.lotro.logic.timing.Effect;
import org.json.simple.JSONObject;
import java.util.Collection;
public class RemoveText implements EffectAppenderProducer {
@Override
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "count", "filter", "until", "memorize");
final ValueSource valueSource = ValueResolver.resolveEvaluator(effectObject.get("count"), 1, environment);
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter");
final String memory = FieldUtils.getString(effectObject.get("memorize"), "memorize", "_temp");
final TimeResolver.Time time = TimeResolver.resolveTime(effectObject.get("until"), "end(current)");
MultiEffectAppender result = new MultiEffectAppender();
result.addEffectAppender(
CardResolver.resolveCards(filter, valueSource, memory, "you", "Choose cards to remove text from", environment));
result.addEffectAppender(
new DelayedAppender() {
@Override
protected Effect createEffect(boolean cost, CostToEffectAction action, ActionContext actionContext) {
final Collection<? extends PhysicalCard> cardsFromMemory = actionContext.getCardsFromMemory(memory);
return new AddUntilModifierEffect(
new RemoveGameTextModifier(actionContext.getSource(), Filters.in(cardsFromMemory)), time);
}
});
return result;
}
}