Prevent all damage now allows the character to be wounded, but immediatelly prevents the damage.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
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.effects.WoundCharactersEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PreventAllWoundsActionProxy extends AbstractActionProxy {
|
||||
private PhysicalCard _source;
|
||||
private Filterable[] _filters;
|
||||
|
||||
public PreventAllWoundsActionProxy(PhysicalCard source, Filterable... filters) {
|
||||
_source = source;
|
||||
this._filters = filters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect) {
|
||||
if (PlayConditions.isGettingWounded(effect, game, _filters)) {
|
||||
WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
|
||||
Collection<PhysicalCard> toPreventOn = Filters.filter(woundEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), _filters);
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(_source);
|
||||
action.appendEffect(
|
||||
new PreventCardEffect(woundEffect, toPreventOn));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,17 +5,25 @@ import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class PreventCardEffect extends UnrespondableEffect {
|
||||
private AbstractPreventableCardEffect _effect;
|
||||
private PhysicalCard _card;
|
||||
private Collection<PhysicalCard> _cards;
|
||||
|
||||
public PreventCardEffect(AbstractPreventableCardEffect effect, PhysicalCard card) {
|
||||
this(effect, Collections.singleton(card));
|
||||
}
|
||||
|
||||
public PreventCardEffect(AbstractPreventableCardEffect effect, Collection<PhysicalCard> cards) {
|
||||
_effect = effect;
|
||||
_card = card;
|
||||
_cards = cards;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
_effect.preventEffect(_card);
|
||||
for (PhysicalCard card : _cards)
|
||||
_effect.preventEffect(card);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.gempukku.lotro.cards.set1.dwarven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.PreventAllWoundsActionProxy;
|
||||
import com.gempukku.lotro.cards.modifiers.CantTakeMoreThanXWoundsModifier;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
@@ -9,7 +12,10 @@ import com.gempukku.lotro.filters.Filter;
|
||||
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;
|
||||
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -38,4 +44,19 @@ public class Card1_015 extends AbstractAttachableFPPossession {
|
||||
return Collections.singletonList(
|
||||
new CantTakeMoreThanXWoundsModifier(self, Phase.SKIRMISH, 1, Filters.hasAttached(self)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
|
||||
&& PlayConditions.canSelfDiscard(self, game)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new DiscardCardsFromPlayEffect(self, self));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new PreventAllWoundsActionProxy(self, self.getAttachedTo()), Phase.SKIRMISH));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.gempukku.lotro.cards.set4.dwarven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractPermanent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.PreventAllWoundsActionProxy;
|
||||
import com.gempukku.lotro.cards.effects.StackCardFromHandEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseCardsFromHandEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantTakeWoundsModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -56,8 +56,8 @@ public class Card4_047 extends AbstractPermanent {
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new CantTakeWoundsModifier(self, Filters.sameCard(character)), Phase.SKIRMISH));
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new PreventAllWoundsActionProxy(self, character), Phase.SKIRMISH));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.gempukku.lotro.cards.set4.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractOldEvent;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantTakeWoundsModifier;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.PreventAllWoundsActionProxy;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -39,8 +39,8 @@ public class Card4_096 extends AbstractOldEvent {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new CantTakeWoundsModifier(self, Filters.sameCard(card)), Phase.SKIRMISH));
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new PreventAllWoundsActionProxy(self, card), Phase.SKIRMISH));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
|
||||
@@ -2,9 +2,9 @@ package com.gempukku.lotro.cards.set4.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractOldEvent;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.PreventAllWoundsActionProxy;
|
||||
import com.gempukku.lotro.cards.effects.PreventableEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantTakeWoundsModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -40,8 +40,8 @@ public class Card4_097 extends AbstractOldEvent {
|
||||
PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new PreventableEffect(action,
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new CantTakeWoundsModifier(self, Filters.name("Gandalf")), Phase.SKIRMISH) {
|
||||
new AddUntilEndOfPhaseActionProxyEffect(
|
||||
new PreventAllWoundsActionProxy(self, Filters.name("Gandalf")), Phase.SKIRMISH) {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Prevent all wounds to Gandalf";
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.gempukku.lotro.cards.set6.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseActionProxyEffect;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.effects.PreventAllWoundsActionProxy;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndRemoveTokensFromCardEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantTakeWoundsModifier;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
@@ -69,8 +69,8 @@ public class Card6_060 extends AbstractMinion {
|
||||
action.appendCost(
|
||||
new ExertCharactersEffect(self, self));
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new CantTakeWoundsModifier(self, Race.URUK_HAI), Phase.ASSIGNMENT));
|
||||
new AddUntilStartOfPhaseActionProxyEffect(
|
||||
new PreventAllWoundsActionProxy(self, Race.URUK_HAI), Phase.ASSIGNMENT));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -9,17 +9,17 @@ import java.util.List;
|
||||
|
||||
public abstract class AbstractActionProxy implements ActionProxy {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame lotroGame, Effect effect) {
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterTriggers(String playerId, LotroGame lotroGame, EffectResult effectResult) {
|
||||
public List<? extends Action> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
TO DO:
|
||||
Critical:
|
||||
- If a card prevents all wounds, the wounds can still be assiged to the card, but take no effect, which is different
|
||||
from "can't take wounds".
|
||||
- Fix "Final Cry"
|
||||
|
||||
Next priority:
|
||||
|
||||
Reference in New Issue
Block a user