Discarding cards from play effect result now carries information on who performed the discarding.
This commit is contained in:
@@ -81,7 +81,7 @@ public class LiberateASiteEffect extends AbstractEffect {
|
||||
game.getGameState().loseControlOfCard(siteToLiberate, Zone.ADVENTURE_PATH);
|
||||
|
||||
for (PhysicalCard discardedCard : discardedCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
|
||||
game.getGameState().sendMessage(_liberatingPlayer + " liberated a " + GameUtils.getCardLink(siteToLiberate) + " using " + GameUtils.getCardLink(_source));
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PutCardFromPlayOnBottomOfDeckEffect extends AbstractEffect {
|
||||
|
||||
gameState.putCardOnBottomOfDeck(_physicalCard);
|
||||
for (PhysicalCard discardedCard : discardedCards) {
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
}
|
||||
for (PhysicalCard toGoToDiscardCard : toGoToDiscardCards)
|
||||
gameState.addCardToZone(game, toGoToDiscardCard, Zone.DISCARD);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PutCardFromPlayOnTopOfDeckEffect extends AbstractEffect {
|
||||
|
||||
gameState.putCardOnTopOfDeck(_physicalCard);
|
||||
for (PhysicalCard discardedCard : discardedCards) {
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
}
|
||||
for (PhysicalCard toGoToDiscardCard : toGoToDiscardCards)
|
||||
gameState.addCardToZone(game, toGoToDiscardCard, Zone.DISCARD);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ReturnCardsToHandEffect extends AbstractEffect {
|
||||
gameState.sendMessage(GameUtils.getCardLink(_source) + " returns " + getAppendedNames(cardsToReturnToHand) + " to hand");
|
||||
|
||||
for (PhysicalCard discardedCard : discardedFromPlay)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
for (PhysicalCard cardReturned : cardsToReturnToHand)
|
||||
game.getActionsEnvironment().emitEffectResult(new ReturnCardsToHandResult(cardReturned));
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ShuffleCardsFromPlayIntoDeckEffect extends AbstractEffect {
|
||||
game.getGameState().addCardToZone(game, physicalCard, Zone.DISCARD);
|
||||
|
||||
for (PhysicalCard physicalCard : discardedFromPlay)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, physicalCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, physicalCard));
|
||||
|
||||
game.getGameState().sendMessage(getAppendedNames(toShuffleIn) + " " + GameUtils.be(toShuffleIn) + " shuffled into " + _playerDeck + " deck");
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public class StackCardFromPlayEffect extends AbstractEffect {
|
||||
|
||||
// Send the result (attached cards get discarded)
|
||||
for (PhysicalCard discardedCard : discardedFromPlayCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
|
||||
return new FullEffectResult(true);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.TwilightCostModifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.DiscardCardsFromPlayResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -36,36 +37,36 @@ public class Card31_064 extends AbstractMinion {
|
||||
super(5, 11, 4, 2, Race.TROLL, Culture.GUNDABAD, "Bert", "Troll of Ettenmoors", true);
|
||||
addKeyword(Keyword.FIERCE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
|
||||
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
|
||||
&& PlayConditions.canDiscardFromPlay(self, game, Race.ORC);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
final PlayPermanentAction playCardAction = super.getPlayCardAction(playerId, game, self, twilightModifier, ignoreRoamingPenalty);
|
||||
playCardAction.appendCost(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(playCardAction, playerId, 1, 1, Race.ORC));
|
||||
return playCardAction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new TwilightCostModifier(self, Race.TROLL, -2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.forEachDiscardedFromPlay(game, effectResult, CardType.CONDITION)) {
|
||||
if (!discardEffect.getPerformingPlayer().equals(self.getOwner())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.ALLY));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
if (TriggerConditions.forEachDiscardedFromPlay(game, effectResult, CardType.CONDITION)
|
||||
&& ((DiscardCardsFromPlayResult) effectResult).getPerformingPlayer() != null
|
||||
&& !((DiscardCardsFromPlayResult) effectResult).getPerformingPlayer().equals(self.getOwner())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.ALLY));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class DiscardCardsFromPlayEffect extends AbstractPreventableCardEffect {
|
||||
game.getGameState().sendMessage(_source.getOwner() + " discards " + getAppendedNames(discardedCards) + " from play using " + GameUtils.getCardLink(_source));
|
||||
|
||||
for (PhysicalCard discardedCard : discardedCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(_source, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(_source, getPerformingPlayer(), discardedCard));
|
||||
|
||||
forEachDiscardedByEffectCallback(cards);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class KillEffect extends AbstractSuccessfulEffect {
|
||||
for (PhysicalCard killedCard : killedCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new ForEachKilledResult(killedCard, _cause));
|
||||
for (PhysicalCard discardedCard : discardedCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, null, discardedCard));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,20 @@ import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
public class DiscardCardsFromPlayResult extends EffectResult {
|
||||
private PhysicalCard _source;
|
||||
private String _performingPlayer;
|
||||
private PhysicalCard _card;
|
||||
|
||||
public DiscardCardsFromPlayResult(PhysicalCard source, PhysicalCard card) {
|
||||
public DiscardCardsFromPlayResult(PhysicalCard source, String performingPlayer, PhysicalCard card) {
|
||||
super(EffectResult.Type.FOR_EACH_DISCARDED_FROM_PLAY);
|
||||
_source = source;
|
||||
_performingPlayer = performingPlayer;
|
||||
_card = card;
|
||||
}
|
||||
|
||||
public String getPerformingPlayer() {
|
||||
return _performingPlayer;
|
||||
}
|
||||
|
||||
public PhysicalCard getDiscardedCard() {
|
||||
return _card;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user