Plenty of streamlining code.
This commit is contained in:
@@ -9,6 +9,8 @@ import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
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 java.util.*;
|
||||
|
||||
@@ -118,4 +120,26 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
|
||||
public final int getTwilightCost() {
|
||||
return _twilight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<? extends Action> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (self.getZone().isInPlay())
|
||||
return getOptionalInPlayAfterActions(playerId, game, effectResult, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (self.getZone().isInPlay())
|
||||
return getOptionalInPlayBeforeActions(playerId, game, effect, self);
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<? extends Action> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<? extends Action> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ public class PlayConditions {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean canExertSelf(PhysicalCard self, LotroGame game) {
|
||||
public static boolean canSelfExert(PhysicalCard self, LotroGame game) {
|
||||
return canExert(self, game, Filters.sameCard(self));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Card1_001 extends AbstractAttachable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalBeforeActions(final String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
public List<? extends Action> getOptionalInPlayBeforeActions(final String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
if (effect.getType() == EffectResult.Type.WOUND
|
||||
&& !game.getModifiersQuerying().hasFlagActive(ModifierFlag.RING_TEXT_INACTIVE)) {
|
||||
WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Card1_002 extends AbstractAttachable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalBeforeActions(final String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
public List<? extends Action> getOptionalInPlayBeforeActions(final String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
if (game.getGameState().getCurrentPhase() == Phase.SKIRMISH
|
||||
&& effect.getType() == EffectResult.Type.WOUND
|
||||
&& !game.getModifiersQuerying().hasFlagActive(ModifierFlag.RING_TEXT_INACTIVE)) {
|
||||
|
||||
@@ -36,8 +36,7 @@ public class Card1_173 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(Filters.owner(self.getOwner()), Filters.culture(Culture.MORIA), Filters.or(Filters.keyword(Keyword.HAND_WEAPON), Filters.keyword(Keyword.RANGED_WEAPON))))) {
|
||||
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(Filters.owner(self.getOwner()), Filters.culture(Culture.MORIA), Filters.or(Filters.keyword(Keyword.HAND_WEAPON), Filters.keyword(Keyword.RANGED_WEAPON))))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(new AddTwilightEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
@@ -47,8 +46,7 @@ public class Card1_173 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, final Effect effect, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& effect.getType() == EffectResult.Type.WOUND) {
|
||||
if (effect.getType() == EffectResult.Type.WOUND) {
|
||||
final WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
|
||||
final Collection<PhysicalCard> cardsToBeWounded = woundEffect.getAffectedCardsMinusPrevented(game);
|
||||
if (Filters.filter(cardsToBeWounded, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.MORIA), Filters.race(Race.ORC)).size() > 0) {
|
||||
|
||||
@@ -54,8 +54,7 @@ public class Card1_183 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(Filters.culture(Culture.MORIA), Filters.race(Race.ORC)))
|
||||
if (PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.and(Filters.culture(Culture.MORIA), Filters.race(Race.ORC)))
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.MORIA), Filters.race(Race.ORC), Filters.inSkirmish())) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -42,8 +42,7 @@ public class Card1_261 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effect, Filters.and(Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.EVENT), Filters.keyword(Keyword.REGROUP)))
|
||||
if (PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effect, Filters.and(Filters.side(Side.FREE_PEOPLE), Filters.type(CardType.EVENT), Filters.keyword(Keyword.REGROUP)))
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
|
||||
@@ -32,8 +32,7 @@ public class Card1_275 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.SAURON), Filters.keyword(Keyword.TRACKER))
|
||||
if (PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.SAURON), Filters.keyword(Keyword.TRACKER))
|
||||
&& PlayConditions.played(game.getGameState(), game.getModifiersQuerying(), effect, Filters.and(Filters.type(CardType.EVENT), Filters.keyword(Keyword.STEALTH)))) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
|
||||
@@ -54,7 +54,7 @@ public class Card1_221 extends AbstractAttachable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
public List<? extends Action> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
|
||||
if (PlayConditions.winsSkirmish(effectResult, self.getAttachedTo())
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo())) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Card2_003 extends AbstractAttachableFPPossession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
public List<? extends Action> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (effect.getType() == EffectResult.Type.WOUND
|
||||
&& ((WoundCharactersEffect) effect).getAffectedCardsMinusPrevented(game).contains(self.getAttachedTo())) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
|
||||
@@ -35,8 +35,7 @@ public class Card3_059 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 2)
|
||||
&& PlayConditions.isGettingWounded(effect, game, Filters.culture(Culture.ISENGARD), Filters.race(Race.ORC))) {
|
||||
if (PlayConditions.isGettingWounded(effect, game, Filters.culture(Culture.ISENGARD), Filters.race(Race.ORC))) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new RemoveTwilightEffect(2));
|
||||
|
||||
@@ -78,7 +78,6 @@ public class Card3_068 extends AbstractMinion {
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (PlayConditions.isGettingWounded(effect, game, Filters.race(Race.URUK_HAI))
|
||||
&& PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), self)) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Card4_063 extends AbstractAttachableFPPossession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
public List<? extends Action> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
|
||||
if (effect.getType() == EffectResult.Type.DISCARD_FROM_PLAY) {
|
||||
final DiscardCardsFromPlayEffect discardEffect = (DiscardCardsFromPlayEffect) effect;
|
||||
Collection<PhysicalCard> discardedCards = discardEffect.getAffectedCardsMinusPrevented(game);
|
||||
|
||||
@@ -6,7 +6,10 @@ import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.ChoiceEffect;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.effects.LiberateASiteEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
@@ -39,8 +42,7 @@ public class Card4_079 extends AbstractResponseEvent {
|
||||
|
||||
@Override
|
||||
public List<PlayEventAction> getOptionalAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), (Phase) null, self)
|
||||
&& PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.race(Race.ELF))) {
|
||||
if (PlayConditions.winsSkirmish(game.getGameState(), game.getModifiersQuerying(), effectResult, Filters.race(Race.ELF))) {
|
||||
final List<PhysicalCard> winners = ((SkirmishResult) effectResult).getWinners();
|
||||
if (PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.in(winners))) {
|
||||
PlayEventAction action = new PlayEventAction(self);
|
||||
|
||||
@@ -41,8 +41,7 @@ public class Card4_103 extends AbstractAlly {
|
||||
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, final PhysicalCard self) {
|
||||
if (effect.getType() == EffectResult.Type.DISCARD_FROM_PLAY
|
||||
&& PlayConditions.canUseFPCardDuringPhase(game.getGameState(), null, self)) {
|
||||
if (effect.getType() == EffectResult.Type.DISCARD_FROM_PLAY) {
|
||||
DiscardCardsFromPlayEffect discardEffect = (DiscardCardsFromPlayEffect) effect;
|
||||
Collection<PhysicalCard> discardedHobbits = Filters.filter(discardEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Filters.unboundCompanion(), Filters.race(Race.HOBBIT));
|
||||
if (discardedHobbits.size() > 0) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.gempukku.lotro.cards.set4.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.DiscardCardFromDeckEffect;
|
||||
import com.gempukku.lotro.cards.effects.RevealTopCardsOfDrawDeckEffect;
|
||||
@@ -54,9 +53,8 @@ public class Card4_107 extends AbstractAttachable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getOptionalAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.KILL
|
||||
&& PlayConditions.canUseFPCardDuringPhase(game.getGameState(), null, self)) {
|
||||
public List<? extends Action> getOptionalInPlayAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.KILL) {
|
||||
KillResult killResult = (KillResult) effectResult;
|
||||
if (Filters.filter(killResult.getKilledCards(), game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.MINION), Filters.culture(Culture.ISENGARD)).size() > 0) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
|
||||
@@ -47,7 +47,6 @@ public class Card4_186 extends AbstractMinion {
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.KILL
|
||||
&& PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
&& PlayConditions.canExert(self, game, Filters.sameCard(self))) {
|
||||
KillResult killResult = (KillResult) effectResult;
|
||||
if (Filters.filter(killResult.getKilledCards(), game.getGameState(), game.getModifiersQuerying(), Filters.unboundCompanion(), Filters.race(Race.HOBBIT)).size() > 0) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Card4_188 extends AbstractMinion {
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.KILL
|
||||
&& PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
|
||||
&& PlayConditions.canExert(self, game, 2, Filters.sameCard(self))) {
|
||||
KillResult killResult = (KillResult) effectResult;
|
||||
if (Filters.filter(killResult.getKilledCards(), game.getGameState(), game.getModifiersQuerying(), Filters.unboundCompanion(), Filters.race(Race.HOBBIT)).size() > 0) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class Card4_190 extends AbstractMinion {
|
||||
@Override
|
||||
public List<? extends ActivateCardAction> getOptionalInPlayAfterActions(final String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.KILL
|
||||
&& PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), null, self, 0)
|
||||
|
||||
&& PlayConditions.canExert(self, game, Filters.sameCard(self))) {
|
||||
KillResult killResult = (KillResult) effectResult;
|
||||
if (Filters.filter(killResult.getKilledCards(), game.getGameState(), game.getModifiersQuerying(), Filters.unboundCompanion(), Filters.race(Race.HOBBIT)).size() > 0) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Card4_281 extends AbstractAlly {
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self)
|
||||
&& PlayConditions.canExertSelf(self, game)) {
|
||||
&& PlayConditions.canSelfExert(self, game)) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new ExertCharactersEffect(self, self));
|
||||
|
||||
Reference in New Issue
Block a user