Preventing burdens.

This commit is contained in:
marcins78@gmail.com
2011-10-14 12:48:04 +00:00
parent 1b34589d58
commit 49771c10be
2 changed files with 9 additions and 10 deletions

View File

@@ -5,9 +5,10 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.Preventable;
import com.gempukku.lotro.logic.timing.results.AddBurdenResult;
public class AddBurdenEffect extends AbstractEffect {
public class AddBurdenEffect extends AbstractEffect implements Preventable {
private PhysicalCard _source;
private int _count;
private int _prevented;
@@ -21,10 +22,12 @@ public class AddBurdenEffect extends AbstractEffect {
return _source;
}
public boolean isFullyPrevented() {
@Override
public boolean isPrevented() {
return _prevented == _count;
}
@Override
public void prevent() {
_prevented++;
}

View File

@@ -11,10 +11,10 @@ import com.gempukku.lotro.common.Side;
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.PreventEffect;
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 java.util.Collections;
import java.util.List;
@@ -41,17 +41,13 @@ public class Card3_110 extends AbstractAlly {
if (effect.getType() == EffectResult.Type.ADD_BURDEN
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)) {
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);
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
addBurdenEffect.prevent();
}
});
new PreventEffect(addBurdenEffect));
return Collections.singletonList(action);
}
}