Preventing burdens.
This commit is contained in:
@@ -5,9 +5,10 @@ import com.gempukku.lotro.game.state.LotroGame;
|
|||||||
import com.gempukku.lotro.logic.GameUtils;
|
import com.gempukku.lotro.logic.GameUtils;
|
||||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
|
import com.gempukku.lotro.logic.timing.Preventable;
|
||||||
import com.gempukku.lotro.logic.timing.results.AddBurdenResult;
|
import com.gempukku.lotro.logic.timing.results.AddBurdenResult;
|
||||||
|
|
||||||
public class AddBurdenEffect extends AbstractEffect {
|
public class AddBurdenEffect extends AbstractEffect implements Preventable {
|
||||||
private PhysicalCard _source;
|
private PhysicalCard _source;
|
||||||
private int _count;
|
private int _count;
|
||||||
private int _prevented;
|
private int _prevented;
|
||||||
@@ -21,10 +22,12 @@ public class AddBurdenEffect extends AbstractEffect {
|
|||||||
return _source;
|
return _source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFullyPrevented() {
|
@Override
|
||||||
|
public boolean isPrevented() {
|
||||||
return _prevented == _count;
|
return _prevented == _count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void prevent() {
|
public void prevent() {
|
||||||
_prevented++;
|
_prevented++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import com.gempukku.lotro.common.Side;
|
|||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
import com.gempukku.lotro.game.state.LotroGame;
|
||||||
import com.gempukku.lotro.logic.actions.ActivateCardAction;
|
import com.gempukku.lotro.logic.actions.ActivateCardAction;
|
||||||
|
import com.gempukku.lotro.logic.effects.PreventEffect;
|
||||||
import com.gempukku.lotro.logic.timing.Action;
|
import com.gempukku.lotro.logic.timing.Action;
|
||||||
import com.gempukku.lotro.logic.timing.Effect;
|
import com.gempukku.lotro.logic.timing.Effect;
|
||||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -41,17 +41,13 @@ public class Card3_110 extends AbstractAlly {
|
|||||||
if (effect.getType() == EffectResult.Type.ADD_BURDEN
|
if (effect.getType() == EffectResult.Type.ADD_BURDEN
|
||||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)) {
|
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)) {
|
||||||
final AddBurdenEffect addBurdenEffect = (AddBurdenEffect) effect;
|
final AddBurdenEffect addBurdenEffect = (AddBurdenEffect) effect;
|
||||||
if (addBurdenEffect.getSource().getBlueprint().getSide() == Side.SHADOW) {
|
if (!addBurdenEffect.isPrevented()
|
||||||
|
&& addBurdenEffect.getSource().getBlueprint().getSide() == Side.SHADOW) {
|
||||||
ActivateCardAction action = new ActivateCardAction(self);
|
ActivateCardAction action = new ActivateCardAction(self);
|
||||||
action.appendCost(
|
action.appendCost(
|
||||||
new ExertCharactersEffect(self, self));
|
new ExertCharactersEffect(self, self));
|
||||||
action.appendEffect(
|
action.appendEffect(
|
||||||
new UnrespondableEffect() {
|
new PreventEffect(addBurdenEffect));
|
||||||
@Override
|
|
||||||
protected void doPlayEffect(LotroGame game) {
|
|
||||||
addBurdenEffect.prevent();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return Collections.singletonList(action);
|
return Collections.singletonList(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user