Refactored "Underground Lake"

This commit is contained in:
marcin.sciesinski
2017-11-13 17:33:53 -08:00
parent ecda5ae48d
commit a460e992ad
2 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,56 @@
package com.gempukku.lotro.cards.effects;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.actions.SubAction;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
public class CheckPhaseLimitPerPlayerEffect extends UnrespondableEffect {
private Action _action;
private PhysicalCard _card;
private String _limitPrefix;
private String _playerId;
private int _limit;
private Phase _phase;
private Effect _limitedEffect;
public CheckPhaseLimitPerPlayerEffect(Action action, PhysicalCard card, int limit, Effect limitedEffect) {
this(action, card, limit, null, limitedEffect);
}
public CheckPhaseLimitPerPlayerEffect(Action action, PhysicalCard card, int limit, Phase phase, Effect limitedEffect) {
this(action, card, "", limit, phase, limitedEffect);
}
public CheckPhaseLimitPerPlayerEffect(Action action, PhysicalCard card, String limitPrefix, int limit, Phase phase, Effect limitedEffect) {
this(action, card, limitPrefix, "", limit, phase, limitedEffect);
}
public CheckPhaseLimitPerPlayerEffect(Action action, PhysicalCard card, String limitPrefix, String playerId, int limit, Phase phase, Effect limitedEffect) {
_card = card;
_limitPrefix = limitPrefix;
_playerId = playerId;
_limit = limit;
_phase = phase;
_limitedEffect = limitedEffect;
_action = action;
}
@Override
public void doPlayEffect(LotroGame game) {
Phase phase = _phase;
if (phase == null)
phase = game.getGameState().getCurrentPhase();
int incrementedBy = game.getModifiersQuerying().getUntilEndOfPhaseLimitCounter(_card, _playerId + "-" + _limitPrefix, phase).incrementToLimit(_limit, 1);
if (incrementedBy > 0) {
SubAction subAction = new SubAction(_action);
subAction.appendEffect(
_limitedEffect);
game.getActionsEnvironment().addActionToStack(subAction);
}
}
}

View File

@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set31.site;
import com.gempukku.lotro.cards.AbstractSite;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.CheckPhaseLimitPerPlayerEffect;
import com.gempukku.lotro.cards.effects.CheckTurnLimitEffect;
import com.gempukku.lotro.cards.effects.CheckTurnLimitPerPlayerEffect;
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
@@ -35,7 +36,7 @@ public class Card31_048 extends AbstractSite {
public List<? extends Action> getPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
if (PlayConditions.canUseSiteDuringPhase(game, Phase.MANEUVER, self)) {
final ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new CheckTurnLimitPerPlayerEffect(action, self, playerId, 1,
action.appendEffect(new CheckPhaseLimitPerPlayerEffect(action, self, "", playerId, 1, Phase.MANEUVER,
new ChooseAndPlayCardFromDeckEffect(playerId, Filters.or(Filters.and(Side.SHADOW, CardType.CONDITION), Filters.name("The One Ring")))));
return Collections.singletonList(action);
}