Some FotR cards

This commit is contained in:
marcin.sciesinski
2019-09-14 20:22:40 -07:00
parent 3b1b39996c
commit 88416afabc
8 changed files with 194 additions and 259 deletions

View File

@@ -0,0 +1,173 @@
{
"1_69": {
"title": "*Albert Dreary",
"subtitle": "Entertainer From Bree",
"culture": "gandalf",
"cost": 1,
"type": "ally",
"allyHome": "fellowship,1",
"race": "man",
"strength": 3,
"vitality": 3,
"condition": {
"type": "canSpot",
"filter": "name(Gandalf)"
},
"effects": {
"type": "activated",
"phase": "maneuver",
"cost": {
"type": "exert",
"filter": "self"
},
"effect": {
"type": "discard",
"filter": "choose(condition,or(culture(isengard),culture(moria)))"
}
}
},
"1_70": {
"title": "*Barliman Butterbur",
"subtitle": "Prancing Pony Proprietor",
"culture": "gandalf",
"cost": 0,
"type": "ally",
"allyHome": "fellowship,1",
"race": "man",
"strength": 1,
"vitality": 2,
"effects": {
"type": "activated",
"phase": "fellowship",
"cost": {
"type": "exert",
"filter": "self"
},
"effect": {
"type": "putCardsFromDiscardIntoHand",
"filter": "choose(culture(gandalf),event)"
}
}
},
"1_71": {
"title": "Durin's Secret",
"culture": "gandalf",
"cost": 2,
"type": "event",
"keyword": "fellowship",
"condition": [
{
"type": "canSpot",
"filter": "name(Gandalf)"
},
{
"type": "canSpot",
"filter": "dwarf"
},
{
"type": "canSpot",
"filter": "elf"
}
],
"effects": {
"type": "event",
"effect": {
"type": "addModifier",
"modifier": {
"type": "modifyMoveLimit",
"amount": 1
},
"until": "endOfTurn"
}
}
},
"1_72": {
"title": "*Gandalf",
"subtitle": "Friend of the Shirefolk",
"culture": "gandalf",
"cost": 4,
"type": "companion",
"race": "wizard",
"strength": 6,
"vitality": 4,
"resistance": 6,
"signet": "Frodo",
"effects": {
"type": "modifier",
"modifier": {
"type": "modifyStrength",
"filter": "self",
"amount": {
"type": "sum",
"source": [
{
"type": "condition",
"condition": {
"type": "canSpot",
"filter": "hobbit,companion"
},
"true": 1,
"false": 0
},
{
"type": "condition",
"condition": {
"type": "canSpot",
"filter": "dwarf,companion"
},
"true": 1,
"false": 0
},
{
"type": "condition",
"condition": {
"type": "canSpot",
"filter": "elf,companion"
},
"true": 1,
"false": 0
},
{
"type": "condition",
"condition": {
"type": "canSpot",
"filter": "man,companion"
},
"true": 1,
"false": 0
}
]
}
}
}
},
"1_73": {
"title": "*Gandalf's Cart",
"culture": "gandalf",
"cost": 1,
"type": "possession",
"keyword": "support area",
"effects": {
"type": "activated",
"phase": "fellowship",
"effect": {
"type": "choice",
"texts": [
"Stack a Free Peoples artifact (or possession)",
"Play a card stacked here"
],
"effects": [
{
"type": "stackCardsFromHand",
"filter": "choose(side(free people),or(artifact,possession))",
"where": "self"
},
{
"type": "playCardFromStacked",
"on": "self"
}
]
}
}
}
}

View File

@@ -1,49 +0,0 @@
package com.gempukku.lotro.cards.set1.gandalf;
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.AbstractAlly;
import com.gempukku.lotro.logic.effects.SelfExertEffect;
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 Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 1
* Type: Ally • Home 1 • Man
* Strength: 3
* Vitality: 3
* Site: 1
* Game Text: To play, spot Gandalf. Maneuver: Exert Albert Dreary to discard a [ISENGARD] or [MORIA] condition.
*/
public class Card1_069 extends AbstractAlly {
public Card1_069() {
super(1, SitesBlock.FELLOWSHIP, 1, 3, 3, Race.MAN, Culture.GANDALF, "Albert Dreary", "Entertainer From Bree", true);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return Filters.canSpot(game, Filters.gandalf);
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.MANEUVER, self)
&& PlayConditions.canExert(self, game, self)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new SelfExertEffect(action, self));
action.appendEffect(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Filters.or(Culture.ISENGARD, Culture.MORIA), CardType.CONDITION));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,55 +0,0 @@
package com.gempukku.lotro.cards.set1.gandalf;
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.AbstractAlly;
import com.gempukku.lotro.logic.effects.ChooseArbitraryCardsEffect;
import com.gempukku.lotro.logic.effects.PutCardFromDiscardIntoHandEffect;
import com.gempukku.lotro.logic.effects.SelfExertEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 0
* Type: Ally • Home 1 • Man
* Strength: 1
* Vitality: 2
* Site: 1
* Game Text: Fellowship: Exert Barliman Butterbur to take a [GANDALF] event into hand from your discard pile.
*/
public class Card1_070 extends AbstractAlly {
public Card1_070() {
super(0, SitesBlock.FELLOWSHIP, 1, 1, 2, Race.MAN, Culture.GANDALF, "Barliman Butterbur", "Prancing Pony Proprietor", true);
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(self, game, self)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(new SelfExertEffect(action, self));
action.appendEffect(
new ChooseArbitraryCardsEffect(playerId, "Choose GANDALF event", game.getGameState().getDiscard(playerId), Filters.and(Culture.GANDALF, CardType.EVENT), 1, 1) {
@Override
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> selectedCards) {
for (PhysicalCard selectedCard : selectedCards) {
action.appendEffect(
new PutCardFromDiscardIntoHandEffect(selectedCard));
}
}
}
);
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,43 +0,0 @@
package com.gempukku.lotro.cards.set1.gandalf;
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.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.modifiers.MoveLimitModifier;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 2
* Type: Event
* Game Text: Fellowship: Spot Gandalf, a Dwarf, and an Elf to make the move limit for this turn +1.
*/
public class Card1_071 extends AbstractEvent {
public Card1_071() {
super(Side.FREE_PEOPLE, 2, Culture.GANDALF, "Durin's Secret", Phase.FELLOWSHIP);
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, LotroGame game, PhysicalCard self) {
PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new AddUntilEndOfTurnModifierEffect(
new MoveLimitModifier(self, 1)));
return action;
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return Filters.canSpot(game, Filters.gandalf)
&& Filters.canSpot(game, Race.DWARF)
&& Filters.canSpot(game, Race.ELF);
}
}

View File

@@ -1,55 +0,0 @@
package com.gempukku.lotro.cards.set1.gandalf;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Race;
import com.gempukku.lotro.common.Signet;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.cardtype.AbstractCompanion;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.modifiers.evaluator.Evaluator;
import java.util.Collections;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 4
* Type: Companion • Wizard
* Strength: 6
* Vitality: 4
* Resistance: 6
* Signet: Frodo
* Game Text: Gandalf is strength +1 for each of these races you can spot in the fellowship: Hobbit, Dwarf, Elf, and
* Man.
*/
public class Card1_072 extends AbstractCompanion {
public Card1_072() {
super(4, 6, 4, 6, Culture.GANDALF, Race.WIZARD, Signet.FRODO, "Gandalf", "Friend of the Shirefolk", true);
}
@Override
public List<? extends Modifier> getInPlayModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(new StrengthModifier(self, self, null,
new Evaluator() {
@Override
public int evaluateExpression(LotroGame game, PhysicalCard self) {
int result = 0;
if (Filters.canSpot(game, CardType.COMPANION, Race.HOBBIT))
result++;
if (Filters.canSpot(game, CardType.COMPANION, Race.DWARF))
result++;
if (Filters.canSpot(game, CardType.COMPANION, Race.ELF))
result++;
if (Filters.canSpot(game, CardType.COMPANION, Race.MAN))
result++;
return result;
}
}));
}
}

View File

@@ -1,56 +0,0 @@
package com.gempukku.lotro.cards.set1.gandalf;
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.ActivateCardAction;
import com.gempukku.lotro.logic.cardtype.AbstractPermanent;
import com.gempukku.lotro.logic.effects.ChoiceEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPlayCardFromStackedEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndStackCardsFromHandEffect;
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;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Gandalf
* Twilight Cost: 1
* Type: Possession
* Game Text: Plays to your support area. Fellowship: Stack a Free Peoples artifact (or possession) from hand on this
* card, or play a card stacked here as if played from hand.
*/
public class Card1_073 extends AbstractPermanent {
public Card1_073() {
super(Side.FREE_PEOPLE, 1, CardType.POSSESSION, Culture.GANDALF, "Gandalf's Cart", null, true);
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(final String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& (
Filters.filter(game.getGameState().getStackedCards(self), game, Filters.playable(game)).size() > 0
|| Filters.filter(game.getGameState().getHand(playerId), game, Side.FREE_PEOPLE, Filters.or(CardType.ARTIFACT, CardType.POSSESSION)).size() > 0)) {
final ActivateCardAction action = new ActivateCardAction(self);
List<Effect> possibleChoices = new LinkedList<Effect>();
possibleChoices.add(
new ChooseAndStackCardsFromHandEffect(action, playerId, 1, 1, self, Side.FREE_PEOPLE, Filters.or(CardType.ARTIFACT, CardType.POSSESSION)));
possibleChoices.add(
new ChooseAndPlayCardFromStackedEffect(playerId, self, Filters.any));
action.appendEffect(
new ChoiceEffect(action, playerId, possibleChoices));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -26,7 +26,7 @@ public class PlayCardFromStacked implements EffectAppenderProducer {
public EffectAppender createEffectAppender(JSONObject effectObject, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(effectObject, "filter", "on", "removedTwilight");
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter");
final String filter = FieldUtils.getString(effectObject.get("filter"), "filter", "choose(any)");
final String onFilter = FieldUtils.getString(effectObject.get("on"), "on");
final int removedTwilight = FieldUtils.getInteger(effectObject.get("removedTwilight"), "removedTwilight", 0);

View File

@@ -246,6 +246,26 @@ public class ValueResolver {
final int second = secondNumber.getEvaluator(actionContext).evaluateExpression(actionContext.getGame(), null);
return first - second;
};
} else if (type.equalsIgnoreCase("sum")) {
FieldUtils.validateAllowedFields(object, "source");
final JSONObject[] sourceArray = FieldUtils.getObjectArray(object.get("source"), "source");
ValueSource[] sources = new ValueSource[sourceArray.length];
for (int i = 0; i < sources.length; i++)
sources[i] = ValueResolver.resolveEvaluator(sourceArray[i], 0, environment);
return actionContext -> {
Evaluator[] evaluators = new Evaluator[sources.length];
for (int i = 0; i < sources.length; i++)
evaluators[i] = sources[i].getEvaluator(actionContext);
return (game, cardAffected) -> {
int sum = 0;
for (Evaluator evaluator : evaluators)
sum += evaluator.evaluateExpression(game, cardAffected);
return sum;
};
};
} else if (type.equalsIgnoreCase("twilightCostInMemory")) {
FieldUtils.validateAllowedFields(object, "multiplier", "memory");
final int multiplier = FieldUtils.getInteger(object.get("multiplier"), "multiplier", 1);