Fix to 17R98 "Throne of the Golden Hall"

Players may no longer exert a character to prevent that same character's wound.
This commit is contained in:
PhallenCassidy
2018-12-15 11:33:38 -05:00
committed by GitHub
parent 89be5cac6c
commit 47f511cb8a

View File

@@ -3,12 +3,14 @@ package com.gempukku.lotro.cards.set17.rohan;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndPreventCardEffect;
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.GameUtils;
import com.gempukku.lotro.logic.actions.ActivateCardAction;
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.effects.WoundCharactersEffect;
@@ -16,7 +18,8 @@ import com.gempukku.lotro.logic.modifiers.CantBeAssignedToSkirmishModifier;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
/**
@@ -49,14 +52,24 @@ public class Card17_098 extends AbstractPermanent {
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isGettingWounded(effect, game, Culture.ROHAN, Race.MAN)
&& PlayConditions.canExert(self, game, Culture.ROHAN, Race.MAN)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new AddTwilightEffect(self, 2));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Culture.ROHAN, Race.MAN));
action.appendEffect(
new ChooseAndPreventCardEffect(self, (WoundCharactersEffect) effect, playerId, "Choose character to prevent wound to", Culture.ROHAN, Race.MAN));
return Collections.singletonList(action);
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
Collection<PhysicalCard> woundedCharacters = Filters.filter(woundEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Culture.ROHAN, Race.MAN);
List<ActivateCardAction> actions = new LinkedList<ActivateCardAction>();
for (PhysicalCard woundedCharacter : woundedCharacters) {
if (PlayConditions.canExert(self, game, Culture.ROHAN, Race.MAN, Filters.not(woundedCharacter))) {
ActivateCardAction action = new ActivateCardAction(self);
action.setText("Prevent for " + GameUtils.getFullName(woundedCharacter));
action.appendCost(
new AddTwilightEffect(self, 2));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Culture.ROHAN, Race.MAN, Filters.not(woundedCharacter)));
action.appendEffect(
new PreventCardEffect(woundEffect, woundedCharacter));
actions.add(action);
}
}
return actions;
}
return null;
}