"Black Breath"
This commit is contained in:
@@ -1,15 +1,27 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.RemoveBurdenResult;
|
||||
|
||||
public class RemoveBurdenEffect extends UnrespondableEffect {
|
||||
public class RemoveBurdenEffect extends AbstractEffect {
|
||||
private String _playerId;
|
||||
|
||||
public RemoveBurdenEffect(String playerId) {
|
||||
_playerId = playerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayEffect(LotroGame game) {
|
||||
return game.getGameState().getBurdens(_playerId) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EffectResult getRespondableResult() {
|
||||
return new RemoveBurdenResult(_playerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Remove a burden";
|
||||
|
||||
@@ -199,4 +199,12 @@ public class ProxyingModifier implements Modifier {
|
||||
return modifier.canBeDiscardedFromPlay(gameState, modifiersQuerying, card, source, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
Modifier modifier = getProxiedModifier(gameState, modifiersQuerying);
|
||||
if (modifier != null)
|
||||
return modifier.canBeHealed(gameState, modifiersQuerying, card, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gempukku.lotro.cards.set1.wraith;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.CancelEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.DefaultCostToEffectAction;
|
||||
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
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.UnrespondableEffect;
|
||||
import com.gempukku.lotro.logic.timing.results.RemoveBurdenResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Side: Shadow
|
||||
* Culture: Wraith
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition
|
||||
* Game Text: Plays to your support area. Skirmish: Transfer this condition from your support area to a character
|
||||
* skirmishing a Nazgul. Burdens and wounds may not be removed from bearer.
|
||||
*/
|
||||
public class Card1_207 extends AbstractLotroCardBlueprint {
|
||||
public Card1_207() {
|
||||
super(Side.SHADOW, CardType.CONDITION, Culture.WRAITH, "Black Breath");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return PlayConditions.canPayForShadowCard(game, self, twilightModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Action getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return new PlayPermanentAction(self, Zone.SHADOW_SUPPORT, twilightModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canPlayCardDuringPhase(game, Phase.SHADOW, self)
|
||||
&& checkPlayRequirements(playerId, game, self, 0))
|
||||
return Collections.singletonList(getPlayCardAction(playerId, game, self, 0));
|
||||
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self, 0)
|
||||
&& self.getZone() == Zone.SHADOW_SUPPORT
|
||||
&& Filters.filter(game.getGameState().getSkirmish().getShadowCharacters(), game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.NAZGUL)).size() > 0
|
||||
&& game.getGameState().getSkirmish().getFellowshipCharacter() != null) {
|
||||
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, Keyword.SKIRMISH, "Transfer this condition to character skirmishing a Nazgul");
|
||||
action.addEffect(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
PhysicalCard fpCharacter = game.getGameState().getSkirmish().getFellowshipCharacter();
|
||||
game.getGameState().attachCard(self, fpCharacter);
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modifier getAlwaysOnEffect(PhysicalCard self) {
|
||||
return new AbstractModifier(self, "Burdens and wounds may not be removed from bearer.", Filters.attachedTo(self), new ModifierEffect[]{ModifierEffect.WOUND_MODIFIER}) {
|
||||
@Override
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getRequiredBeforeTriggers(LotroGame game, Effect effect, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.REMOVE_BURDEN) {
|
||||
RemoveBurdenResult removeBurdenResult = (RemoveBurdenResult) effectResult;
|
||||
if (game.getGameState().getRingBearer(removeBurdenResult.getPlayerId()) == self.getStackedOn()) {
|
||||
DefaultCostToEffectAction action = new DefaultCostToEffectAction(self, null, "Cancel burden removal");
|
||||
action.addEffect(
|
||||
new CancelEffect(effect));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,8 @@ public class HealCharacterEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public boolean canPlayEffect(LotroGame game) {
|
||||
return (game.getGameState().getWounds(_physicalCard) > 0);
|
||||
return (game.getGameState().getWounds(_physicalCard) > 0)
|
||||
&& game.getModifiersQuerying().canBeHealed(game.getGameState(), _physicalCard);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -133,4 +133,9 @@ public abstract class AbstractModifier implements Modifier {
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, PhysicalCard source, boolean result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,4 +203,12 @@ public class CompositeModifier implements Modifier {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
for (Modifier modifier : _modifiers)
|
||||
result = modifier.canBeHealed(gameState, modifiersQuerying, card, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,6 @@ public interface Modifier {
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result);
|
||||
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, PhysicalCard source, boolean result);
|
||||
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
|
||||
}
|
||||
|
||||
@@ -382,6 +382,18 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHealed(GameState gameState, PhysicalCard card) {
|
||||
boolean result = true;
|
||||
for (Modifier modifier : getModifiers(ModifierEffect.WOUND_MODIFIER))
|
||||
if (affectsCardWithSkipSet(gameState, card, modifier))
|
||||
result = modifier.canBeHealed(gameState, this, card, result);
|
||||
for (Modifier modifier : getModifiers(ModifierEffect.ALL_MODIFIER))
|
||||
if (affectsCardWithSkipSet(gameState, card, modifier))
|
||||
result = modifier.canBeHealed(gameState, this, card, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private class ModifierHookImpl implements ModifierHook {
|
||||
private Modifier _modifier;
|
||||
|
||||
|
||||
@@ -45,4 +45,6 @@ public interface ModifiersQuerying {
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, Map<PhysicalCard, List<PhysicalCard>> assignments);
|
||||
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, PhysicalCard card, PhysicalCard source);
|
||||
|
||||
public boolean canBeHealed(GameState gameState, PhysicalCard card);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public abstract class EffectResult {
|
||||
|
||||
PLAY,
|
||||
|
||||
PUT_ON_THE_ONE_RING,
|
||||
PUT_ON_THE_ONE_RING, REMOVE_BURDEN,
|
||||
|
||||
WHEN_MOVE_FROM, WHEN_FELLOWSHIP_MOVES, WHEN_MOVE_TO
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.gempukku.lotro.logic.timing.results;
|
||||
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
public class RemoveBurdenResult extends EffectResult {
|
||||
private String _playerId;
|
||||
|
||||
public RemoveBurdenResult(String playerId) {
|
||||
super(EffectResult.Type.REMOVE_BURDEN);
|
||||
_playerId = playerId;
|
||||
}
|
||||
|
||||
public String getPlayerId() {
|
||||
return _playerId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user