Migrated Dwarven cards in set 10 to hjson

This commit is contained in:
MarcinSc
2024-05-16 17:35:52 +07:00
parent b18bf32c5f
commit 9614d993a7
8 changed files with 119 additions and 210 deletions

View File

@@ -1,56 +0,0 @@
package com.gempukku.lotro.cards.set10.dwarven;
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.AbstractResponseEvent;
import com.gempukku.lotro.logic.effects.ExertCharactersEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.PlayConditions;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import com.gempukku.lotro.logic.timing.results.PlayCardResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Mount Doom
* Side: Free
* Culture: Dwarven
* Twilight Cost: 3
* Type: Event • Response
* Game Text: If an opponent plays a minion, exert a Dwarf who is damage +X to exert that minion X times.
*/
public class Card10_001 extends AbstractResponseEvent {
public Card10_001() {
super(Side.FREE_PEOPLE, 3, Culture.DWARVEN, "Great Day, Great Hour");
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canExert(self, game, Race.DWARF, Keyword.DAMAGE);
}
@Override
public List<PlayEventAction> getPlayResponseEventAfterActions(String playerId, final LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.played(game, effectResult, CardType.MINION)) {
PlayCardResult playResult = (PlayCardResult) effectResult;
final PhysicalCard playedMinion = playResult.getPlayedCard();
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.DWARF, Keyword.DAMAGE) {
@Override
protected void forEachCardExertedCallback(PhysicalCard character) {
int damageCount = game.getModifiersQuerying().getKeywordCount(game, character, Keyword.DAMAGE);
for (int i = 0; i < damageCount; i++)
action.appendEffect(
new ExertCharactersEffect(action, self, playedMinion));
}
});
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,58 +0,0 @@
package com.gempukku.lotro.cards.set10.dwarven;
import com.gempukku.lotro.common.*;
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.ChoiceEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPlayCardFromDiscardEffect;
import com.gempukku.lotro.logic.effects.choose.ChooseAndPlayCardFromHandEffect;
import com.gempukku.lotro.logic.timing.Effect;
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.LinkedList;
import java.util.List;
/**
* Set: Mount Doom
* Side: Free
* Culture: Dwarven
* Twilight Cost: 1
* Type: Condition • Support Area
* Game Text: To play, spot a Dwarf. Each time you lose initiative (except during the fellowship phase), you may play
* a [DWARVEN] condition from hand or from your discard pile.
*/
public class Card10_002 extends AbstractPermanent {
public Card10_002() {
super(Side.FREE_PEOPLE, 1, CardType.CONDITION, Culture.DWARVEN, "Memories of Darkness", null, true);
}
@Override
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
return PlayConditions.canSpot(game, Race.DWARF);
}
@Override
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.losesInitiative(effectResult, Side.FREE_PEOPLE)
&& game.getGameState().getCurrentPhase() != Phase.FELLOWSHIP
&& (
PlayConditions.canPlayFromHand(playerId, game, Culture.DWARVEN, CardType.CONDITION)
|| PlayConditions.canPlayFromDiscard(playerId, game, Culture.DWARVEN, CardType.CONDITION))) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
List<Effect> possibleEffects = new LinkedList<>();
possibleEffects.add(
new ChooseAndPlayCardFromHandEffect(playerId, game, Culture.DWARVEN, CardType.CONDITION));
possibleEffects.add(
new ChooseAndPlayCardFromDiscardEffect(playerId, game, Culture.DWARVEN, CardType.CONDITION));
action.appendEffect(
new ChoiceEffect(action, playerId, possibleEffects));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -1,60 +0,0 @@
package com.gempukku.lotro.cards.set10.dwarven;
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.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.PlayUtils;
import com.gempukku.lotro.logic.actions.PlayEventAction;
import com.gempukku.lotro.logic.actions.ResolveSkirmishDamageAction;
import com.gempukku.lotro.logic.cardtype.AbstractResponseEvent;
import com.gempukku.lotro.logic.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.TriggerConditions;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
import java.util.List;
/**
* Set: Mount Doom
* Side: Free
* Culture: Dwarven
* Twilight Cost: 0
* Type: Event • Response
* Game Text: If a Dwarf kills a minion in a skirmish and that minion did not take all wounds caused by that Dwarf's
* damage bonus, assign those remaining wounds to minions not assigned to a skirmish.
*/
public class Card10_003 extends AbstractResponseEvent {
public Card10_003() {
super(Side.FREE_PEOPLE, 0, Culture.DWARVEN, "More Yet to Come");
}
@Override
public List<PlayEventAction> getPlayResponseEventAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.forEachKilledInASkirmish(game, effectResult, Race.DWARF, CardType.MINION)
&& PlayUtils.checkPlayRequirements(game, self, Filters.any, 0, 0, false, false)) {
final ResolveSkirmishDamageAction resolveSkirmishDamageAction = game.getActionsEnvironment().findTopmostActionOfType(ResolveSkirmishDamageAction.class);
if (resolveSkirmishDamageAction != null
&& resolveSkirmishDamageAction.getRemainingDamage() > 0) {
final PlayEventAction action = new PlayEventAction(self);
action.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
int remainingDamage = resolveSkirmishDamageAction.getRemainingDamage();
resolveSkirmishDamageAction.consumeRemainingDamage();
for (int i = 0; i < remainingDamage; i++)
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, CardType.MINION, Filters.notAssignedToSkirmish));
}
});
return Collections.singletonList(action);
}
}
return null;
}
}

View File

@@ -22,26 +22,30 @@
twilight: 3
type: Event
keywords: Response
/*requires: {
}
*/
effects: {
type: responseEvent
trigger: {
type: played
filter: not(your),minion
memorize: playedMinion
}
cost: {
type: SendMessage
text: Placeholder effect for development.
type: exert
filter: choose(dwarf,damage)
memorize: exertedDwarf
}
effect: [
{
type: SendMessage
text: Placeholder effect for development.
type: exert
filter: memory(playedMinion)
times: {
type: forEachKeyword
filter: memory(exertedDwarf)
keyword: damage
}
}
]
]
}
gametext: If an opponent plays a minion, exert a Dwarf who is damage +X to exert that minion X times.
lore: Oft hope is born, when all is forlorn.'
promotext: ""
@@ -75,17 +79,47 @@
twilight: 1
type: Condition
keywords: Support Area
/*requires: {
}
effects: [
{
}
{
}
]*/
{
type: toPlay
requires: {
type: canSpot
filter: dwarf
}
}
{
type: trigger
optional: true
trigger: {
type: losesInitiative
side: free people
}
requires: {
type: not
requires: {
type: phase
phase: fellowship
}
}
effect: {
type: choice
texts: [
Play a {dwarven} condition from hand
Play a {dwarven} condition from discard
]
effects: [
{
type: play
filter: choose(culture(dwarven),condition)
}
{
type: playCardFromDiscard
filter: choose(culture(dwarven),condition)
}
]
}
}
]
gametext: To play, spot a Dwarf.<br>Each time you lose initiative (except during the fellowship phase), you may play a [dwarven] condition from hand or from your discard pile.
lore: Had I known what was before me, I think that not for any friendship would I have taken the Paths of the Dead.'
promotext: ""
@@ -119,26 +153,33 @@
twilight: 0
type: Event
keywords: Response
/*requires: {
}
*/
effects: {
type: responseEvent
trigger: {
type: killedInSkirmish
filter: minion
by: dwarf
memorize: killedMinion
}
cost: {
type: SendMessage
text: Placeholder effect for development.
text: Play for {killedMinion}
requires: {
type: killedWithSurplusDamage
memorize: surplusDamage
}
effect: [
{
type: SendMessage
text: Placeholder effect for development.
type: repeat
times: {
type: fromMemory
memory: surplusDamage
}
effect: {
type: wound
filter: choose(minion,notAssignedToSkirmish)
}
}
]
]
}
gametext: If a Dwarf kills a minion in a skirmish and that minion did not take all wounds caused by that Dwarf's damage bonus, assign those remaining wounds to minions not assigned to a skirmish.
lore: ...whatever is still to do, I hope to have a part in it, for the honour of the folk of the Lonely Mountain.'
promotext: ""

View File

@@ -0,0 +1,36 @@
package com.gempukku.lotro.cards.build.field.effect.requirement;
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.Requirement;
import com.gempukku.lotro.cards.build.field.FieldUtils;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.ResolveSkirmishDamageAction;
import org.json.simple.JSONObject;
public class KilledWithSurplusDamage implements RequirementProducer {
@Override
public Requirement getPlayRequirement(JSONObject object, CardGenerationEnvironment environment) throws InvalidCardDefinitionException {
FieldUtils.validateAllowedFields(object, "memorize");
final String memory = FieldUtils.getString(object.get("memorize"), "memorize");
return new Requirement() {
@Override
public boolean accepts(ActionContext actionContext) {
LotroGame game = actionContext.getGame();
final ResolveSkirmishDamageAction resolveSkirmishDamageAction = game.getActionsEnvironment().findTopmostActionOfType(ResolveSkirmishDamageAction.class);
if (resolveSkirmishDamageAction != null
&& resolveSkirmishDamageAction.getRemainingDamage() > 0) {
if (memory != null) {
actionContext.setValueToMemory(memory, String.valueOf(resolveSkirmishDamageAction.getRemainingDamage()));
}
return true;
}
return false;
}
};
}
}

View File

@@ -50,6 +50,7 @@ public class RequirementFactory {
requirementProducers.put("isnotequal", new IsNotEqual());
requirementProducers.put("isowner", new IsOwnerRequirementProducer());
requirementProducers.put("isside", new IsSideRequirementProducer());
requirementProducers.put("killedwithsurplusdamage", new KilledWithSurplusDamage());
requirementProducers.put("location", new Location());
requirementProducers.put("lostskirmishthisturn", new LostSkirmishThisTurn());
requirementProducers.put("memoryis", new MemoryIs());

View File

@@ -110,6 +110,14 @@ public abstract class AbstractAtTest {
return null;
}
public String getCardActionId(AwaitingDecision awaitingDecision, PhysicalCard card) {
String[] cardIds = (String[]) awaitingDecision.getDecisionParameters().get("cardId");
for (int i = 0; i < cardIds.length; i++)
if (cardIds[i].equals(String.valueOf(card.getCardId())))
return ((String[]) awaitingDecision.getDecisionParameters().get("actionId"))[i];
return null;
}
public String getCardActionId(String playerId, int cardId) {
AwaitingDecision awaitingDecision = _userFeedback.getAwaitingDecision(playerId);
String[] cardIds = (String[]) awaitingDecision.getDecisionParameters().get("cardId");

View File

@@ -14,10 +14,7 @@ import org.junit.Test;
import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.*;
public class IndividualCardAtTest extends AbstractAtTest {
@@ -656,7 +653,7 @@ public class IndividualCardAtTest extends AbstractAtTest {
assertEquals(Zone.DISCARD, goblinRunner.getZone());
AwaitingDecision playMoreYetToCome = _userFeedback.getAwaitingDecision(P1);
playerDecided(P1, getCardActionId(playMoreYetToCome, "Play More"));
playerDecided(P1, getCardActionId(playMoreYetToCome, moreYetToCome));
assertEquals(Zone.DISCARD, goblinRunner2.getZone());
}