Migrated Elven cards in set 8 to hjson

This commit is contained in:
MarcinSc
2024-05-13 18:28:35 +07:00
parent 035a859594
commit 0e5dcadee8
8 changed files with 156 additions and 317 deletions

View File

@@ -1,60 +0,0 @@
package com.gempukku.lotro.cards.set8.elven;
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.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.decisions.IntegerAwaitingDecision;
import com.gempukku.lotro.logic.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.ChooseAndHealCharactersEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.modifiers.ArcheryTotalModifier;
import com.gempukku.lotro.logic.modifiers.PlayerCantUsePhaseSpecialAbilitiesModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.RuleUtils;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Event • Archery
* Game Text: Spot an Elf companion and make the fellowship archery total -X (to a minimum of 0) to heal X unbound
* companions. You cannot use archery special abilities.
*/
public class Card8_009 extends AbstractEvent {
public Card8_009() {
super(Side.FREE_PEOPLE, 2, Culture.ELVEN, "A Grey Ship", Phase.ARCHERY);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, Race.ELF, CardType.COMPANION);
}
@Override
public PlayEventAction getPlayEventCardAction(final String playerId, LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
int archeryTotal = RuleUtils.calculateFellowshipArcheryTotal(game);
action.appendCost(
new PlayoutDecisionEffect(playerId,
new IntegerAwaitingDecision(1, "Choose X (reduce fellowship archery total)", 0, archeryTotal) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
int reduce = getValidatedResult(result);
action.appendCost(
new AddUntilEndOfPhaseModifierEffect(
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, -reduce)));
action.appendEffect(
new ChooseAndHealCharactersEffect(action, playerId, reduce, reduce, Filters.unboundCompanion));
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new PlayerCantUsePhaseSpecialAbilitiesModifier(self, playerId, Phase.ARCHERY)));
}
}));
return action;
}
}

View File

@@ -1,38 +0,0 @@
package com.gempukku.lotro.cards.set8.elven;
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.cardtype.AbstractCompanion;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.SpotCondition;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import java.util.Collections;
import java.util.List;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Companion • Elf
* Strength: 6
* Vitality: 3
* Resistance: 6
* Signet: Aragorn
* Game Text: Archer. While you can spot 3 wounded minions, each minion skirmishing Legolas is strength -3.
*/
public class Card8_010 extends AbstractCompanion {
public Card8_010() {
super(2, 6, 3, 6, Culture.ELVEN, Race.ELF, Signet.ARAGORN, "Legolas", "Elven Stalwart", true);
addKeyword(Keyword.ARCHER);
}
@Override
public List<? extends Modifier> getInPlayModifiers(LotroGame game, PhysicalCard self) {
return Collections.singletonList(
new StrengthModifier(self, Filters.and(CardType.MINION, Filters.inSkirmishAgainst(self)), new SpotCondition(3, CardType.MINION, Filters.wounded), -3));
}
}

View File

@@ -1,43 +0,0 @@
package com.gempukku.lotro.cards.set8.elven;
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.actions.PlayEventAction;
import com.gempukku.lotro.logic.cardtype.AbstractEvent;
import com.gempukku.lotro.logic.effects.DrawCardsEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.PlayConditions;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Elven
* Twilight Cost: 0
* Type: Event • Regroup
* Game Text: To play, spot 2 Elves. Discard an Elf to draw 3 cards.
*/
public class Card8_011 extends AbstractEvent {
public Card8_011() {
super(Side.FREE_PEOPLE, 0, Culture.ELVEN, "Life of the Eldar", Phase.REGROUP);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, 2, Race.ELF)
&& PlayConditions.canDiscardFromPlay(self, game, Race.ELF);
}
@Override
public PlayEventAction getPlayEventCardAction(String playerId, LotroGame game, PhysicalCard self) {
PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Race.ELF));
action.appendEffect(
new DrawCardsEffect(action, playerId, 3));
return action;
}
}

View File

@@ -1,63 +0,0 @@
package com.gempukku.lotro.cards.set8.elven;
import com.gempukku.lotro.common.*;
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.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.decisions.IntegerAwaitingDecision;
import com.gempukku.lotro.logic.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.modifiers.ArcheryTotalModifier;
import com.gempukku.lotro.logic.modifiers.PlayerCantUsePhaseSpecialAbilitiesModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.RuleUtils;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Event • Archery
* Game Text: Exert an Elf companion and make the fellowship archery total -X (to a minimum of 0) to wound a minion
* X times. You cannot use archery special abilities.
*/
public class Card8_012 extends AbstractEvent {
public Card8_012() {
super(Side.FREE_PEOPLE, 2, Culture.ELVEN, "Reckless We Rode", Phase.ARCHERY);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canExert(self, game, Race.ELF, CardType.COMPANION);
}
@Override
public PlayEventAction getPlayEventCardAction(final String playerId, LotroGame game, final PhysicalCard self) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.ELF, CardType.COMPANION));
int archeryTotal = RuleUtils.calculateFellowshipArcheryTotal(game);
action.appendCost(
new PlayoutDecisionEffect(playerId,
new IntegerAwaitingDecision(1, "Choose X (reduce fellowship archery total)", 0, archeryTotal) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
int reduce = getValidatedResult(result);
action.appendCost(
new AddUntilEndOfPhaseModifierEffect(
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, -reduce)));
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, reduce, CardType.MINION));
action.appendEffect(
new AddUntilEndOfPhaseModifierEffect(
new PlayerCantUsePhaseSpecialAbilitiesModifier(self, playerId, Phase.ARCHERY)));
}
}));
return action;
}
}

View File

@@ -1,61 +0,0 @@
package com.gempukku.lotro.cards.set8.elven;
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.AbstractPermanent;
import com.gempukku.lotro.logic.effects.AddTokenEffect;
import com.gempukku.lotro.logic.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.logic.effects.CheckPhaseLimitEffect;
import com.gempukku.lotro.logic.effects.RemoveTokenEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.modifiers.ArcheryTotalModifier;
import com.gempukku.lotro.logic.timing.PlayConditions;
import java.util.Collections;
import java.util.List;
/**
* Set: Siege of Gondor
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Condition • Support Area
* Game Text: Fellowship: Exert an Elf companion and either a [GANDALF] companion or a [DWARVEN] companion to add an
* [ELVEN] token here. Archery: Remove an [ELVEN] token here to make the fellowship archery total +1 (limit +2).
*/
public class Card8_013 extends AbstractPermanent {
public Card8_013() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.ELVEN, "Shake Off the Shadow");
}
@Override
public List<? extends ActivateCardAction> getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.FELLOWSHIP, self)
&& PlayConditions.canExert(self, game, Race.ELF, CardType.COMPANION)
&& PlayConditions.canExert(self, game, CardType.COMPANION, Filters.or(Culture.GANDALF, Culture.DWARVEN))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.ELF, CardType.COMPANION));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.COMPANION, Filters.or(Culture.GANDALF, Culture.DWARVEN)));
action.appendEffect(
new AddTokenEffect(self, self, Token.ELVEN));
return Collections.singletonList(action);
}
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.ARCHERY, self)
&& PlayConditions.canRemoveTokens(game, self, Token.ELVEN, 1)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new RemoveTokenEffect(self, self, Token.ELVEN));
action.appendEffect(
new CheckPhaseLimitEffect(action, self, 2, Phase.ARCHERY,
new AddUntilEndOfPhaseModifierEffect(
new ArcheryTotalModifier(self, Side.FREE_PEOPLE, 1))));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -22,20 +22,49 @@
twilight: 2
type: Event
keywords: Archery
/*requires: {
}
*/
effects: {
type: event
cost: {
type: SendMessage
text: Placeholder effect for development.
},
requires: {
type: canSpot
filter: elf,companion
}
cost: [
{
type: chooseANumber
text: Choose X (reduce fellowship archery total)
from: 0
to: {
type: archeryTotal
side: free people
}
memorize: x
}
{
type: modifyArcheryTotal
side: free people
amount: {
type: fromMemory
memory: x
multiplier: -1
}
}
]
effect: [
{
type: SendMessage
text: Placeholder effect for development.
type: heal
filter: choose(unbound,companion)
count: {
type: fromMemory
memory: x
}
}
{
type: addModifier
modifier: {
type: cantPlayPhaseSpecialAbilities
player: you
phase: archery
}
}
]
}
@@ -78,17 +107,21 @@
signet: Aragorn
resistance: 6
keywords: Archer
/*requires: {
}
effects: [
{
}
{
}
]*/
{
type: modifier
modifier: {
type: modifyStrength
requires: {
type: canSpot
filter: wounded,minion
count: 3
}
filter: minion,inSkirmishAgainst(self)
amount: -3
}
}
]
gametext: <b>Archer</b>.<br>While you can spot 3 wounded minions, each minion skirmishing Legolas is strength -3.
lore: ...Legolas of the Elves, for whom the ghosts of Men have no terror.
promotext: ""
@@ -122,20 +155,21 @@
twilight: 0
type: Event
keywords: Regroup
/*requires: {
}
*/
effects: {
type: event
requires: {
type: canSpot
filter: elf
count: 2
}
cost: {
type: SendMessage
text: Placeholder effect for development.
},
type: discard
filter: choose(elf)
}
effect: [
{
type: SendMessage
text: Placeholder effect for development.
type: drawCards
count: 3
}
]
}
@@ -172,20 +206,49 @@
twilight: 2
type: Event
keywords: Archery
/*requires: {
}
*/
effects: {
type: event
cost: {
type: SendMessage
text: Placeholder effect for development.
},
cost: [
{
type: exert
filter: choose(elf,companion)
}
{
type: chooseANumber
text: Choose X (reduce fellowship archery total)
from: 0
to: {
type: archeryTotal
side: free people
}
memorize: x
}
{
type: modifyArcheryTotal
side: free people
amount: {
type: fromMemory
memory: x
multiplier: -1
}
}
],
effect: [
{
type: SendMessage
text: Placeholder effect for development.
type: wound
filter: choose(minion)
times: {
type: fromMemory
memory: x
}
}
{
type: addModifier
modifier: {
type: cantPlayPhaseSpecialAbilities
player: you
phase: archery
}
}
]
}
@@ -222,17 +285,42 @@
twilight: 1
type: Condition
keywords: Support Area
/*requires: {
}
effects: [
{
}
{
}
]*/
{
type: activated
phase: fellowship
cost: [
{
type: exert
filter: choose(elf,companion)
}
{
type: exert
filter: choose(or(culture(gandalf),culture(dwarven)),companion)
}
]
effect: {
type: addTokens
culture: elven
filter: self
}
}
{
type: activated
phase: archery
cost: {
type: removeTokens
culture: elven
filter: self
}
effect: {
type: modifyArcheryTotal
side: free people
amount: 1
}
limitPerPhase: 2
}
]
gametext: <b>Fellowship:</b> Exert an Elf companion and either a [gandalf] companion or a [dwarven] companion to add an [elven] token here.<br><b>Archery:</b> Remove an [elven] token here to make the fellowship archery total +1 (limit +2).
lore: Speak and be comforted....'
promotext: ""

View File

@@ -8,6 +8,7 @@ import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.modifiers.evaluator.*;
import com.gempukku.lotro.logic.timing.RuleUtils;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
@@ -71,6 +72,11 @@ public class ValueResolver {
return toValue.getEvaluator(actionContext).evaluateExpression(actionContext.getGame(), null);
}
};
} else if (type.equalsIgnoreCase("archeryTotal")) {
FieldUtils.validateAllowedFields(object, "side");
final Side side = FieldUtils.getSide(object.get("side"), "side");
return (actionContext) -> (Evaluator) (game, cardAffected) -> RuleUtils.calculateArcheryTotal(game, side);
} else if (type.equalsIgnoreCase("turnNumber")) {
return (actionContext) -> (Evaluator) (game, cardAffected) ->
actionContext.getGame().getGameState().getTurnNumber();

View File

@@ -2,16 +2,19 @@ package com.gempukku.lotro.cards.build.field.effect.modifier;
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.common.Phase;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.PlayerCantUsePhaseSpecialAbilitiesModifier;
import com.gempukku.lotro.logic.modifiers.PlayersCantUsePhaseSpecialAbilitiesModifier;
import org.json.simple.JSONObject;
public class CantPlayPhaseSpecialAbilities implements ModifierSourceProducer {
@Override
public ModifierSource getModifierSource(JSONObject object, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(object, "phase", "requires");
FieldUtils.validateAllowedFields(object, "player", "phase", "requires");
String player = FieldUtils.getString(object.get("player"), "player");
final Phase phase = FieldUtils.getEnum(Phase.class, object.get("phase"), "phase");
if (phase == null)
throw new InvalidCardDefinitionException("Has to have a phase defined");
@@ -19,12 +22,19 @@ public class CantPlayPhaseSpecialAbilities implements ModifierSourceProducer {
final JSONObject[] conditionArray = FieldUtils.getObjectArray(object.get("requires"), "requires");
final Requirement[] requirements = environment.getRequirementFactory().getRequirements(conditionArray, environment);
PlayerSource playerSource = player != null ? PlayerResolver.resolvePlayer(player, environment) : null;
return new ModifierSource() {
@Override
public Modifier getModifier(ActionContext actionContext) {
return new PlayersCantUsePhaseSpecialAbilitiesModifier(actionContext.getSource(),
new RequirementCondition(requirements, actionContext), phase);
if (playerSource != null) {
String bannedPlayer = playerSource.getPlayer(actionContext);
return new PlayerCantUsePhaseSpecialAbilitiesModifier(actionContext.getSource(),
new RequirementCondition(requirements, actionContext), bannedPlayer, phase);
} else {
return new PlayersCantUsePhaseSpecialAbilitiesModifier(actionContext.getSource(),
new RequirementCondition(requirements, actionContext), phase);
}
}
};
}