Remove some of the clunky limits implementations.
This commit is contained in:
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set1.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.CheckTurnLimitEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDeckEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
@@ -30,11 +31,11 @@ public class Card1_348 extends AbstractSite {
|
||||
@Override
|
||||
public List<? extends Action> getPhaseActions(final String playerId, final LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseSiteDuringPhase(game, Phase.SHADOW, self)
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, CardType.MINION)
|
||||
&& self.getData() == null) {
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, CardType.MINION)) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndPlayCardFromDeckEffect(playerId, Keyword.WEATHER));
|
||||
new CheckTurnLimitEffect(action, self, 1,
|
||||
new ChooseAndPlayCardFromDeckEffect(playerId, Keyword.WEATHER)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
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;
|
||||
@@ -33,36 +34,42 @@ public class Card11_243 extends AbstractNewSite {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
Set<Integer> minionsMarked = (Set<Integer>) self.getData();
|
||||
if (minionsMarked == null) {
|
||||
minionsMarked = new HashSet<Integer>();
|
||||
self.storeData(minionsMarked);
|
||||
}
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
if (game.getModifiersQuerying().getUntilEndOfTurnLimitCounter(self).getUsedLimit() < 1) {
|
||||
game.getActionsEnvironment().addUntilEndOfTurnActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
private Set<Integer> _minionsMarked = new HashSet<Integer>();
|
||||
|
||||
Set<PhysicalCard> toLose = new HashSet<PhysicalCard>();
|
||||
final Set<Integer> toLoseInts = new HashSet<Integer>();
|
||||
for (PhysicalCard minion : Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmishAgainst(Culture.ROHAN, CardType.COMPANION))) {
|
||||
if (!minionsMarked.contains(minion.getCardId())) {
|
||||
toLose.add(minion);
|
||||
toLoseInts.add(minion.getCardId());
|
||||
}
|
||||
}
|
||||
|
||||
if (toLose.size() > 0) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
final Set<Integer> minionsMarked1 = minionsMarked;
|
||||
action.appendEffect(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
minionsMarked1.addAll(toLoseInts);
|
||||
public List<? extends RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult) {
|
||||
Set<PhysicalCard> toLose = new HashSet<PhysicalCard>();
|
||||
final Set<Integer> toLoseInts = new HashSet<Integer>();
|
||||
for (PhysicalCard minion : Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.inSkirmishAgainst(Culture.ROHAN, CardType.COMPANION))) {
|
||||
if (!_minionsMarked.contains(minion.getCardId())) {
|
||||
toLose.add(minion);
|
||||
toLoseInts.add(minion.getCardId());
|
||||
}
|
||||
}
|
||||
|
||||
if (toLose.size() > 0) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
_minionsMarked.addAll(toLoseInts);
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new RemoveKeywordModifier(self, Filters.in(toLose), Keyword.FIERCE), Phase.REGROUP));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new RemoveKeywordModifier(self, Filters.in(toLose), Keyword.FIERCE), Phase.REGROUP));
|
||||
return Collections.singletonList(action);
|
||||
|
||||
game.getModifiersQuerying().getUntilEndOfTurnLimitCounter(self).incrementToLimit(1, 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Card19_039 extends AbstractMinion {
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Filters.any, self)) {
|
||||
Set<Integer> data = (Set<Integer>) self.getData();
|
||||
Set<Integer> data = (Set<Integer>) self.getWhileInZoneData();
|
||||
if (data == null) {
|
||||
data = new HashSet<Integer>();
|
||||
self.setWhileInZoneData(data);
|
||||
|
||||
@@ -20,12 +20,6 @@ public interface PhysicalCard extends Filterable {
|
||||
|
||||
public PhysicalCard getStackedOn();
|
||||
|
||||
public void storeData(Object object);
|
||||
|
||||
public Object getData();
|
||||
|
||||
public void removeData();
|
||||
|
||||
public void setWhileInZoneData(Object object);
|
||||
|
||||
public Object getWhileInZoneData();
|
||||
|
||||
@@ -24,8 +24,6 @@ public class PhysicalCardImpl implements PhysicalCard {
|
||||
private List<ModifierHook> _modifierHooksInDiscard;
|
||||
private List<ModifierHook> _modifierHooksControlledSite;
|
||||
|
||||
private Object _data;
|
||||
|
||||
private Object _whileInZoneData;
|
||||
|
||||
private Integer _siteNumber;
|
||||
@@ -165,21 +163,6 @@ public class PhysicalCardImpl implements PhysicalCard {
|
||||
return _stackedOn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void storeData(Object object) {
|
||||
_data = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getData() {
|
||||
return _data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeData() {
|
||||
_data = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getWhileInZoneData() {
|
||||
return _whileInZoneData;
|
||||
|
||||
@@ -874,7 +874,6 @@ public class GameState {
|
||||
}
|
||||
|
||||
private void stopAffecting(PhysicalCard card) {
|
||||
card.removeData();
|
||||
((PhysicalCardImpl) card).stopAffectingGame();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user