From 5353719bb3ae0635b60c90496d7d428fe33b6c4e Mon Sep 17 00:00:00 2001 From: MarcinSc Date: Sun, 19 May 2024 19:27:34 +0700 Subject: [PATCH] Migrated Sauron cards in set 12 to hjson --- .../lotro/cards/set12/sauron/Card12_118.java | 58 ------------------- .../official/set12}/set12-Sauron.hjson | 9 +++ .../field/effect/filter/FilterFactory.java | 22 +++++++ 3 files changed, 31 insertions(+), 58 deletions(-) delete mode 100644 gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set12/sauron/Card12_118.java rename gemp-lotr/gemp-lotr-cards/src/main/resources/{card-stubs => cards/official/set12}/set12-Sauron.hjson (77%) diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set12/sauron/Card12_118.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set12/sauron/Card12_118.java deleted file mode 100644 index dca43b07e..000000000 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set12/sauron/Card12_118.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gempukku.lotro.cards.set12.sauron; - -import com.gempukku.lotro.common.CardType; -import com.gempukku.lotro.common.Culture; -import com.gempukku.lotro.common.Phase; -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.ActivateCardAction; -import com.gempukku.lotro.logic.cardtype.AbstractMinion; -import com.gempukku.lotro.logic.effects.choose.ChooseAndAssignCharacterToMinionEffect; -import com.gempukku.lotro.logic.timing.PlayConditions; - -import java.util.Collections; -import java.util.List; - -/** - * Set: Black Rider - * Side: Shadow - * Culture: Sauron - * Twilight Cost: 3 - * Type: Minion • Man - * Strength: 9 - * Vitality: 3 - * Site: 5 - * Game Text: Assignment: Assign The Mouth of Sauron to the companion who has the highest strength. (If two or more are - * tied for highest, choose one.) - */ -public class Card12_118 extends AbstractMinion { - public Card12_118() { - super(3, 9, 3, 5, Race.MAN, Culture.SAURON, "The Mouth of Sauron", "Lieutenant of Barad-dûr", true); - } - - @Override - public List getPhaseActionsInPlay(String playerId, LotroGame game, PhysicalCard self) { - if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.ASSIGNMENT, self, 0)) { - ActivateCardAction action = new ActivateCardAction(self); - int strength = 0; - for (PhysicalCard companion : Filters.filterActive(game, CardType.COMPANION)) - strength = Math.max(strength, game.getModifiersQuerying().getStrength(game, companion)); - - final int highestStrength = strength; - - action.appendEffect( - new ChooseAndAssignCharacterToMinionEffect(action, playerId, self, CardType.COMPANION, - new Filter() { - @Override - public boolean accepts(LotroGame game, PhysicalCard physicalCard) { - return game.getModifiersQuerying().getStrength(game, physicalCard) == highestStrength; - } - })); - return Collections.singletonList(action); - } - return null; - } -} diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/card-stubs/set12-Sauron.hjson b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/official/set12/set12-Sauron.hjson similarity index 77% rename from gemp-lotr/gemp-lotr-cards/src/main/resources/card-stubs/set12-Sauron.hjson rename to gemp-lotr/gemp-lotr-cards/src/main/resources/cards/official/set12/set12-Sauron.hjson index 394cb9f7c..ecdd999f5 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/resources/card-stubs/set12-Sauron.hjson +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/cards/official/set12/set12-Sauron.hjson @@ -27,6 +27,15 @@ vitality: 3 site: 5 effects: [ + { + type: activated + phase: assignment + effect: { + type: assignFpCharacterToSkirmish + fpCharacter: choose(companion,highestStrength(companion)) + against: self + } + } ] gametext: Assignment: Assign The Mouth of Sauron to the companion who has the highest strength. (If two or more are tied for highest, choose one.) lore: Is there anyone in this rout with authority to treat with me?' he asked. 'Or indeed with wit to understand me?' diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/filter/FilterFactory.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/filter/FilterFactory.java index ea78dcae5..f97751a24 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/filter/FilterFactory.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/cards/build/field/effect/filter/FilterFactory.java @@ -293,6 +293,28 @@ public class FilterFactory { return Filters.filter(game.getGameState().getSkirmish().getShadowCharacters(), game, filterable).size() >= count; }); }); + parameterFilters.put("higheststrength", + (parameter, environment) -> { + final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(parameter, environment); + return actionContext -> { + final Filterable sourceFilterable = filterableSource.getFilterable(actionContext); + return Filters.and( + sourceFilterable, Filters.strengthEqual( + new SingleMemoryEvaluator( + new Evaluator() { + @Override + public int evaluateExpression(LotroGame game, PhysicalCard cardAffected) { + int maxStrength = Integer.MAX_VALUE; + for (PhysicalCard card : Filters.filterActive(game, sourceFilterable)) + maxStrength = Math.max(maxStrength, game.getModifiersQuerying().getStrength(game, card)); + return maxStrength; + } + } + ) + ) + ); + }; + }); parameterFilters.put("loweststrength", (parameter, environment) -> { final FilterableSource filterableSource = environment.getFilterFactory().generateFilter(parameter, environment);