Splitting the revealed from deck EffectResult into one for each revealed card
This commit is contained in:
@@ -13,6 +13,7 @@ import com.gempukku.lotro.logic.timing.EffectResult;
|
|||||||
import com.gempukku.lotro.logic.timing.results.RevealCardFromTopOfDeckResult;
|
import com.gempukku.lotro.logic.timing.results.RevealCardFromTopOfDeckResult;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -33,25 +34,21 @@ public class Card20_100 extends AbstractPermanent {
|
|||||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||||
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, self.getOwner())) {
|
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, self.getOwner())) {
|
||||||
RevealCardFromTopOfDeckResult revealedCardsResult = (RevealCardFromTopOfDeckResult) effectResult;
|
RevealCardFromTopOfDeckResult revealedCardsResult = (RevealCardFromTopOfDeckResult) effectResult;
|
||||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
final PhysicalCard revealedCard = revealedCardsResult.getRevealedCard();
|
||||||
final Collection<PhysicalCard> revealedCards = revealedCardsResult.getRevealedCards();
|
final int penalty = revealedCard.getBlueprint().getCulture() == Culture.ELVEN ? -2 : -1;
|
||||||
for (PhysicalCard revealedCard : revealedCards) {
|
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||||
final int penalty = revealedCard.getBlueprint().getCulture() == Culture.ELVEN ? -2 : -1;
|
action.setText("Give minion " + penalty + " strength");
|
||||||
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
action.setTriggerIdentifier(self.getCardId() + "-" + revealedCard.getCardId());
|
||||||
action.setText("Give minion "+penalty+" strength");
|
action.appendEffect(
|
||||||
action.setTriggerIdentifier(self.getCardId() + "-" + revealedCard.getCardId());
|
new ChooseActiveCardEffect(self, self.getOwner(), "Choose a minion for strength " + penalty + " penalty", CardType.MINION) {
|
||||||
action.appendEffect(
|
@Override
|
||||||
new ChooseActiveCardEffect(self, self.getOwner(), "Choose a minion for strength " + penalty + " penalty", CardType.MINION) {
|
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||||
@Override
|
action.appendEffect(
|
||||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
new AddUntilStartOfPhaseModifierEffect(
|
||||||
action.appendEffect(
|
new StrengthModifier(self, card, penalty), Phase.REGROUP));
|
||||||
new AddUntilStartOfPhaseModifierEffect(
|
}
|
||||||
new StrengthModifier(self, card, penalty), Phase.REGROUP));
|
});
|
||||||
}
|
return Collections.singletonList(action);
|
||||||
});
|
|
||||||
actions.add(action);
|
|
||||||
}
|
|
||||||
return actions;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ import com.gempukku.lotro.logic.timing.PlayConditions;
|
|||||||
import com.gempukku.lotro.logic.timing.TriggerConditions;
|
import com.gempukku.lotro.logic.timing.TriggerConditions;
|
||||||
import com.gempukku.lotro.logic.timing.results.RevealCardFromTopOfDeckResult;
|
import com.gempukku.lotro.logic.timing.results.RevealCardFromTopOfDeckResult;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Title: *Golradir, Homely House Advisor
|
* Title: *Golradir, Homely House Advisor
|
||||||
@@ -49,27 +46,22 @@ public class Card40_048 extends AbstractAlly {
|
|||||||
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, playerId)
|
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, playerId)
|
||||||
&& PlayConditions.canSelfExert(self, game)) {
|
&& PlayConditions.canSelfExert(self, game)) {
|
||||||
RevealCardFromTopOfDeckResult revealedResult = (RevealCardFromTopOfDeckResult) effectResult;
|
RevealCardFromTopOfDeckResult revealedResult = (RevealCardFromTopOfDeckResult) effectResult;
|
||||||
Collection<PhysicalCard> revealedCards = revealedResult.getRevealedCards();
|
final PhysicalCard revealedCard = revealedResult.getRevealedCard();
|
||||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
if (Filters.and(Culture.ELVEN).accepts(game, revealedCard)) {
|
||||||
for (PhysicalCard revealedCard : revealedCards) {
|
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||||
if (Filters.and(Culture.ELVEN).accepts(game, revealedCard)) {
|
action.appendCost(
|
||||||
OptionalTriggerAction action = new OptionalTriggerAction("golradir-" + revealedCard.getCardId(), self);
|
new SelfExertEffect(action, self));
|
||||||
action.appendCost(
|
action.appendEffect(
|
||||||
new SelfExertEffect(action, self));
|
new ChooseActiveCardEffect(self, playerId, "Choose an Orc", Race.ORC) {
|
||||||
action.appendEffect(
|
@Override
|
||||||
new ChooseActiveCardEffect(self, playerId, "Choose an Orc", Race.ORC) {
|
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||||
@Override
|
action.appendEffect(
|
||||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
new AddUntilStartOfPhaseModifierEffect(
|
||||||
action.appendEffect(
|
new StrengthModifier(self, card, -2), Phase.REGROUP));
|
||||||
new AddUntilStartOfPhaseModifierEffect(
|
}
|
||||||
new StrengthModifier(self, card, -2), Phase.REGROUP));
|
});
|
||||||
}
|
return Collections.singletonList(action);
|
||||||
});
|
|
||||||
actions.add(action);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (actions.size() > 0)
|
|
||||||
return actions;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.gempukku.lotro.logic.timing.results.RevealCardFromTopOfDeckResult;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,27 +39,19 @@ public class Card40_057 extends AbstractPermanent {
|
|||||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||||
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, playerId)
|
if (TriggerConditions.revealedCardsFromTopOfDeck(effectResult, playerId)
|
||||||
&& PlayConditions.canExert(self, game, Race.ELF)) {
|
&& PlayConditions.canExert(self, game, Race.ELF)) {
|
||||||
RevealCardFromTopOfDeckResult revealedResult = (RevealCardFromTopOfDeckResult) effectResult;
|
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||||
|
action.appendCost(
|
||||||
final Collection<PhysicalCard> revealedCards = revealedResult.getRevealedCards();
|
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.ELF));
|
||||||
List<OptionalTriggerAction> actions = new ArrayList<OptionalTriggerAction>(revealedCards.size());
|
action.appendEffect(
|
||||||
for (PhysicalCard revealedCard : revealedCards) {
|
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION) {
|
||||||
final OptionalTriggerAction action = new OptionalTriggerAction("peeringForward-" + revealedCard.getCardId(), self);
|
@Override
|
||||||
action.appendCost(
|
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.ELF));
|
action.appendEffect(
|
||||||
action.appendEffect(
|
new AddUntilStartOfPhaseModifierEffect(
|
||||||
new ChooseActiveCardEffect(self, playerId, "Choose a minion", CardType.MINION) {
|
new StrengthModifier(self, card, -1), Phase.REGROUP));
|
||||||
@Override
|
}
|
||||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
});
|
||||||
action.appendEffect(
|
return Collections.singletonList(action);
|
||||||
new AddUntilStartOfPhaseModifierEffect(
|
|
||||||
new StrengthModifier(self, card, -1), Phase.REGROUP));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
actions.add(action);
|
|
||||||
}
|
|
||||||
if (actions.size() > 0)
|
|
||||||
return actions;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class Card5_096 extends AbstractEvent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlayEventAction> getOptionalInHandAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
public List<PlayEventAction> getOptionalInHandAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||||
if (effectResult.getType() == EffectResult.Type.REVEAL_CARDS_FROM_HAND) {
|
if (effectResult.getType() == EffectResult.Type.FOR_EACH_REVEALED_FROM_HAND) {
|
||||||
RevealCardFromHandResult revealResult = (RevealCardFromHandResult) effectResult;
|
RevealCardFromHandResult revealResult = (RevealCardFromHandResult) effectResult;
|
||||||
if (revealResult.getSource().getOwner().equals(game.getGameState().getCurrentPlayerId())
|
if (revealResult.getSource().getOwner().equals(game.getGameState().getCurrentPlayerId())
|
||||||
&& revealResult.getRevealedCard() == self
|
&& revealResult.getRevealedCard() == self
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public abstract class RevealTopCardsOfDrawDeckEffect extends AbstractEffect {
|
|||||||
String nextPlayer;
|
String nextPlayer;
|
||||||
while ((nextPlayer = playerOrder.getNextPlayer()) != null) {
|
while ((nextPlayer = playerOrder.getNextPlayer()) != null) {
|
||||||
game.getUserFeedback().sendAwaitingDecision(nextPlayer,
|
game.getUserFeedback().sendAwaitingDecision(nextPlayer,
|
||||||
new ArbitraryCardsSelectionDecision(1, _playerId+" revealed card(s) from hand top of deck", topCards, Collections.<PhysicalCard>emptySet(), 0, 0) {
|
new ArbitraryCardsSelectionDecision(1, _playerId + " revealed card(s) from hand top of deck", topCards, Collections.<PhysicalCard>emptySet(), 0, 0) {
|
||||||
@Override
|
@Override
|
||||||
public void decisionMade(String result) throws DecisionResultInvalidException {
|
public void decisionMade(String result) throws DecisionResultInvalidException {
|
||||||
}
|
}
|
||||||
@@ -59,8 +59,10 @@ public abstract class RevealTopCardsOfDrawDeckEffect extends AbstractEffect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " revealed cards from top of " + _playerId + " deck - " + getAppendedNames(topCards));
|
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " revealed cards from top of " + _playerId + " deck - " + getAppendedNames(topCards));
|
||||||
game.getActionsEnvironment().emitEffectResult(
|
for (PhysicalCard topCard : topCards) {
|
||||||
new RevealCardFromTopOfDeckResult(_playerId, topCards));
|
game.getActionsEnvironment().emitEffectResult(
|
||||||
|
new RevealCardFromTopOfDeckResult(_playerId, topCard));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cardsRevealed(topCards);
|
cardsRevealed(topCards);
|
||||||
return new FullEffectResult(topCards.size() == _count);
|
return new FullEffectResult(topCards.size() == _count);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public abstract class EffectResult {
|
|||||||
|
|
||||||
REMOVE_BURDEN, ADD_BURDEN, ADD_THREAT,
|
REMOVE_BURDEN, ADD_BURDEN, ADD_THREAT,
|
||||||
|
|
||||||
REVEAL_CARDS_FROM_HAND, REVEAL_CARDS_FROM_TOP_OF_DECK,
|
FOR_EACH_REVEALED_FROM_HAND, FOR_EACH_REVEALED_FROM_TOP_OF_DECK,
|
||||||
|
|
||||||
SKIRMISH_FINISHED_WITH_OVERWHELM, SKIRMISH_FINISHED_NORMALLY,
|
SKIRMISH_FINISHED_WITH_OVERWHELM, SKIRMISH_FINISHED_NORMALLY,
|
||||||
|
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ public class TriggerConditions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean revealedCardsFromTopOfDeck(EffectResult effectResult, String playerId) {
|
public static boolean revealedCardsFromTopOfDeck(EffectResult effectResult, String playerId) {
|
||||||
if (effectResult.getType() == EffectResult.Type.REVEAL_CARDS_FROM_TOP_OF_DECK) {
|
if (effectResult.getType() == EffectResult.Type.FOR_EACH_REVEALED_FROM_TOP_OF_DECK) {
|
||||||
RevealCardFromTopOfDeckResult revealCardFromTopOfDeckResult = (RevealCardFromTopOfDeckResult) effectResult;
|
RevealCardFromTopOfDeckResult revealCardFromTopOfDeckResult = (RevealCardFromTopOfDeckResult) effectResult;
|
||||||
return revealCardFromTopOfDeckResult.getPlayerId().equals(playerId);
|
return revealCardFromTopOfDeckResult.getPlayerId().equals(playerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class RevealCardFromHandResult extends EffectResult {
|
|||||||
private PhysicalCard _card;
|
private PhysicalCard _card;
|
||||||
|
|
||||||
public RevealCardFromHandResult(PhysicalCard source, String playerId, PhysicalCard card) {
|
public RevealCardFromHandResult(PhysicalCard source, String playerId, PhysicalCard card) {
|
||||||
super(Type.REVEAL_CARDS_FROM_HAND);
|
super(Type.FOR_EACH_REVEALED_FROM_HAND);
|
||||||
_source = source;
|
_source = source;
|
||||||
_playerId = playerId;
|
_playerId = playerId;
|
||||||
_card = card;
|
_card = card;
|
||||||
|
|||||||
@@ -7,19 +7,19 @@ import java.util.Collection;
|
|||||||
|
|
||||||
public class RevealCardFromTopOfDeckResult extends EffectResult {
|
public class RevealCardFromTopOfDeckResult extends EffectResult {
|
||||||
private String _playerId;
|
private String _playerId;
|
||||||
private Collection<PhysicalCard> _revealedCards;
|
private PhysicalCard _revealedCard;
|
||||||
|
|
||||||
public RevealCardFromTopOfDeckResult(String playerId, Collection<PhysicalCard> revealedCards) {
|
public RevealCardFromTopOfDeckResult(String playerId, PhysicalCard revealedCard) {
|
||||||
super(Type.REVEAL_CARDS_FROM_TOP_OF_DECK);
|
super(Type.FOR_EACH_REVEALED_FROM_TOP_OF_DECK);
|
||||||
_playerId = playerId;
|
_playerId = playerId;
|
||||||
_revealedCards = revealedCards;
|
_revealedCard = revealedCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlayerId() {
|
public String getPlayerId() {
|
||||||
return _playerId;
|
return _playerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<PhysicalCard> getRevealedCards() {
|
public PhysicalCard getRevealedCard() {
|
||||||
return _revealedCards;
|
return _revealedCard;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user