Splitting WoundResult for each card taking wound.
This commit is contained in:
@@ -136,17 +136,9 @@ public class TriggerConditions {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isWounded(EffectResult effectResult, PhysicalCard character) {
|
||||
if (effectResult.getType() == EffectResult.Type.WOUND) {
|
||||
return ((WoundResult) effectResult).getWoundedCards().contains(character);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isWounded(LotroGame game, EffectResult effectResult, Filterable... filters) {
|
||||
if (effectResult.getType() == EffectResult.Type.WOUND) {
|
||||
return Filters.filter(((WoundResult) effectResult).getWoundedCards(), game.getGameState(), game.getModifiersQuerying(), filters).size() > 0;
|
||||
}
|
||||
if (effectResult.getType() == EffectResult.Type.WOUND)
|
||||
return Filters.and(filters).accepts(game.getGameState(), game.getModifiersQuerying(), ((WoundResult) effectResult).getWoundedCard());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gempukku.lotro.cards.set1.moria;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractResponseOldEvent;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.decisions.ForEachYouSpotDecision;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
@@ -16,7 +17,6 @@ import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.ExertResult;
|
||||
import com.gempukku.lotro.logic.timing.results.WoundResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -45,9 +45,7 @@ public class Card1_189 extends AbstractResponseOldEvent {
|
||||
if (((
|
||||
effectResult.getType() == EffectResult.Type.EXERT
|
||||
&& Filters.filter(((ExertResult) effectResult).getExertedCards(), game.getGameState(), game.getModifiersQuerying(), Keyword.RING_BEARER).size() > 0)
|
||||
|| (
|
||||
effectResult.getType() == EffectResult.Type.WOUND
|
||||
&& Filters.filter(((WoundResult) effectResult).getWoundedCards(), game.getGameState(), game.getModifiersQuerying(), Keyword.RING_BEARER).size() > 0))
|
||||
|| TriggerConditions.isWounded(game, effectResult, Keyword.RING_BEARER))
|
||||
&& checkPlayRequirements(playerId, game, self, 0, false, false)) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.gempukku.lotro.cards.effects.choose.ChooseAndAddUntilEOPStrengthBonus
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromPlayEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
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;
|
||||
@@ -18,7 +17,6 @@ import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.WoundResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@@ -42,15 +40,10 @@ public class Card10_096 extends AbstractPermanent {
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.isWounded(game, effectResult, Culture.SAURON, CardType.MINION, Keyword.ROAMING)) {
|
||||
WoundResult woundResult = (WoundResult) effectResult;
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
for (PhysicalCard minion : Filters.filter(woundResult.getWoundedCards(), game.getGameState(), game.getModifiersQuerying(), Culture.SAURON, CardType.MINION, Keyword.ROAMING)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddTokenEffect(self, self, Token.SAURON));
|
||||
actions.add(action);
|
||||
}
|
||||
return actions;
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddTokenEffect(self, self, Token.SAURON));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Card2_053 extends AbstractAttachable {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.isWounded(effectResult, self.getAttachedTo())
|
||||
if (TriggerConditions.isWounded(game, effectResult, Filters.hasAttached(self))
|
||||
&& game.getGameState().getCurrentPhase() == Phase.ARCHERY) {
|
||||
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set8.gollum;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractPermanent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -12,9 +13,8 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.WoundResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,17 +32,12 @@ public class Card8_024 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.WOUND
|
||||
if (TriggerConditions.isWounded(game, effectResult, CardType.COMPANION)
|
||||
&& PlayConditions.canSpot(game, Culture.GOLLUM, CardType.MINION, Filters.inSkirmish)) {
|
||||
WoundResult woundResult = (WoundResult) effectResult;
|
||||
List<RequiredTriggerAction> actions = new LinkedList<RequiredTriggerAction>();
|
||||
for (PhysicalCard physicalCard : Filters.filter(woundResult.getWoundedCards(), game.getGameState(), game.getModifiersQuerying(), CardType.COMPANION)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndExertCharactersEffect(action, self.getOwner(), 1, 1, CardType.COMPANION));
|
||||
actions.add(action);
|
||||
}
|
||||
return actions;
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndExertCharactersEffect(action, self.getOwner(), 1, 1, CardType.COMPANION));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -78,8 +78,8 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
for (PhysicalCard woundedCard : cards) {
|
||||
game.getGameState().addWound(woundedCard);
|
||||
game.getModifiersEnvironment().addedWound(woundedCard);
|
||||
game.getActionsEnvironment().emitEffectResult(new WoundResult(woundedCard));
|
||||
}
|
||||
game.getActionsEnvironment().emitEffectResult(new WoundResult(cards));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,17 +3,15 @@ package com.gempukku.lotro.logic.timing.results;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class WoundResult extends EffectResult {
|
||||
private Collection<PhysicalCard> _cards;
|
||||
private PhysicalCard _card;
|
||||
|
||||
public WoundResult(Collection<PhysicalCard> cards) {
|
||||
public WoundResult(PhysicalCard card) {
|
||||
super(EffectResult.Type.WOUND);
|
||||
_cards = cards;
|
||||
_card = card;
|
||||
}
|
||||
|
||||
public Collection<PhysicalCard> getWoundedCards() {
|
||||
return _cards;
|
||||
public PhysicalCard getWoundedCard() {
|
||||
return _card;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user