"Depart Silently"
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
public class CantBeAssignedToSkirmishModifier extends AbstractModifier {
|
||||
public CantBeAssignedToSkirmishModifier(PhysicalCard source, Filter affectFilter) {
|
||||
super(source, "Can't be assigned to skirmish", affectFilter, new ModifierEffect[]{ModifierEffect.ASSIGNMENT_MODIFIER});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,10 @@ package com.gempukku.lotro.cards.set1.moria;
|
||||
import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.CardAffectsCardEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.game.state.Skirmish;
|
||||
import com.gempukku.lotro.logic.effects.AssignmentEffect;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
|
||||
@@ -41,10 +36,10 @@ public class Card1_169 extends AbstractEvent {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
final PhysicalCard ringBearer = game.getGameState().getRingBearer(game.getGameState().getCurrentPlayerId());
|
||||
|
||||
if (!isFPCharacterAssigned(game.getGameState(), ringBearer)) {
|
||||
if (Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER), Filters.canBeAssignedToSkirmish()).size() > 0) {
|
||||
action.appendEffect(new CardAffectsCardEffect(self, ringBearer));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(game.getGameState().getCurrentPlayerId(), "Choose minion to assign Ring-Bearer to", Filters.type(CardType.MINION), Filters.notAssigned()) {
|
||||
new ChooseActiveCardEffect(game.getGameState().getCurrentPlayerId(), "Choose minion to assign Ring-Bearer to", Filters.type(CardType.MINION), Filters.canBeAssignedToSkirmish()) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard minion) {
|
||||
action.appendEffect(
|
||||
@@ -55,14 +50,6 @@ public class Card1_169 extends AbstractEvent {
|
||||
return action;
|
||||
}
|
||||
|
||||
private boolean isFPCharacterAssigned(GameState gameState, PhysicalCard card) {
|
||||
for (Skirmish skirmish : gameState.getAssignments()) {
|
||||
if (skirmish.getFellowshipCharacter() == card)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost() {
|
||||
return 0;
|
||||
|
||||
@@ -29,12 +29,12 @@ public class Card1_171 extends AbstractEvent {
|
||||
public PlayEventAction getPlayCardAction(final String playerId, final LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose exhausted companion", Filters.type(CardType.COMPANION), Filters.exhausted(), Filters.notAssigned()) {
|
||||
new ChooseActiveCardEffect(playerId, "Choose exhausted companion", Filters.type(CardType.COMPANION), Filters.exhausted(), Filters.canBeAssignedToSkirmish()) {
|
||||
@Override
|
||||
protected void cardSelected(final PhysicalCard companion) {
|
||||
action.appendEffect(new CardAffectsCardEffect(self, companion));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose MORIA Orc", Filters.culture(Culture.MORIA), Filters.race(Race.ORC), Filters.notAssigned()) {
|
||||
new ChooseActiveCardEffect(playerId, "Choose MORIA Orc", Filters.culture(Culture.MORIA), Filters.race(Race.ORC), Filters.canBeAssignedToSkirmish()) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard moriaOrc) {
|
||||
action.appendEffect(
|
||||
|
||||
@@ -44,10 +44,10 @@ public class Card1_262 extends AbstractMinion {
|
||||
protected List<? extends Action> getExtraPhaseActions(final String playerId, LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.ASSIGNMENT, self, 0)
|
||||
&& Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.HOBBIT), Filters.type(CardType.COMPANION)) >= 2
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.sameCard(self), Filters.notAssigned())) {
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.sameCard(self), Filters.canBeAssignedToSkirmish())) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self, Keyword.ASSIGNMENT);
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(game.getGameState().getCurrentPlayerId(), "Choose a Hobbit", Filters.race(Race.HOBBIT), Filters.type(CardType.COMPANION)) {
|
||||
new ChooseActiveCardEffect(game.getGameState().getCurrentPlayerId(), "Choose a Hobbit", Filters.race(Race.HOBBIT), Filters.type(CardType.COMPANION), Filters.canBeAssignedToSkirmish()) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard hobbit) {
|
||||
action.appendEffect(new CardAffectsCardEffect(self, hobbit));
|
||||
|
||||
@@ -4,10 +4,7 @@ import com.gempukku.lotro.cards.AbstractResponseEvent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.CardAffectsCardEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -52,26 +49,28 @@ public class Card1_224 extends AbstractResponseEvent {
|
||||
for (Skirmish assignment : assignments)
|
||||
game.getGameState().removeAssignment(assignment);
|
||||
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose a Nazgul to skirmish the Ring-Bearer", Filters.race(Race.NAZGUL)) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard nazgul) {
|
||||
PhysicalCard ringBearer = game.getGameState().getRingBearer(game.getGameState().getCurrentPlayerId());
|
||||
action.appendEffect(new CardAffectsCardEffect(self, ringBearer));
|
||||
action.appendEffect(new AssignmentEffect(playerId, ringBearer, Collections.singletonList(nazgul), "Return to Its Master effect"));
|
||||
game.getGameState().setCancelRingText(true);
|
||||
game.getActionsEnvironment().addUntilStartOfPhaseActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
|
||||
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
|
||||
&& lotroGame.getGameState().getCurrentPhase() == Phase.SKIRMISH)
|
||||
game.getGameState().setCancelRingText(false);
|
||||
return null;
|
||||
}
|
||||
}, Phase.REGROUP);
|
||||
}
|
||||
});
|
||||
if (Filters.countActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER), Filters.canBeAssignedToSkirmish()) > 0) {
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose a Nazgul to skirmish the Ring-Bearer", Filters.race(Race.NAZGUL)) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard nazgul) {
|
||||
PhysicalCard ringBearer = game.getGameState().getRingBearer(game.getGameState().getCurrentPlayerId());
|
||||
action.appendEffect(new CardAffectsCardEffect(self, ringBearer));
|
||||
action.appendEffect(new AssignmentEffect(playerId, ringBearer, Collections.singletonList(nazgul), "Return to Its Master effect"));
|
||||
game.getGameState().setCancelRingText(true);
|
||||
game.getActionsEnvironment().addUntilStartOfPhaseActionProxy(
|
||||
new AbstractActionProxy() {
|
||||
@Override
|
||||
public List<? extends Action> getRequiredAfterTriggers(LotroGame lotroGame, EffectResult effectResult) {
|
||||
if (effectResult.getType() == EffectResult.Type.END_OF_PHASE
|
||||
&& lotroGame.getGameState().getCurrentPhase() == Phase.SKIRMISH)
|
||||
game.getGameState().setCancelRingText(false);
|
||||
return null;
|
||||
}
|
||||
}, Phase.REGROUP);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Card1_236 extends AbstractMinion {
|
||||
final ActivateCardAction action = new ActivateCardAction(self, Keyword.ASSIGNMENT);
|
||||
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.sameCard(self), Filters.notAssigned())) {
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose a companion (except the Ring-Bearer", Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER))) {
|
||||
new ChooseActiveCardEffect(playerId, "Choose a companion (except the Ring-Bearer", Filters.type(CardType.COMPANION), Filters.not(Filters.keyword(Keyword.RING_BEARER)), Filters.canBeAssignedToSkirmish()) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard companion) {
|
||||
action.appendEffect(new CardAffectsCardEffect(self, companion));
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gempukku.lotro.cards.set3.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilStartOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantBeAssignedToSkirmishModifier;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Side: Free
|
||||
* Culture: Gandalf
|
||||
* Twilight Cost: 1
|
||||
* Type: Event
|
||||
* Game Text: Stealth. Maneuver: At sites 1 to 5, spot Gandalf to prevent Hobbits from being assigned to skirmishes
|
||||
* until the regroup phase. At any other site, spot Gandalf to make a Hobbit strength +3 until the regroup phase.
|
||||
*/
|
||||
public class Card3_031 extends AbstractEvent {
|
||||
public Card3_031() {
|
||||
super(Side.FREE_PEOPLE, Culture.GANDALF, "Depart Silently", Phase.MANEUVER);
|
||||
addKeyword(Keyword.STEALTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) {
|
||||
return super.checkPlayRequirements(playerId, game, self, twilightModifier)
|
||||
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.name("Gandalf"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, final PhysicalCard self, int twilightModifier) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
if (game.getGameState().getCurrentSiteNumber() <= 5) {
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new CantBeAssignedToSkirmishModifier(self, Filters.race(Race.HOBBIT)), Phase.REGROUP));
|
||||
} else {
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(playerId, "Choose a Hobbit", Filters.race(Race.HOBBIT)) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard card) {
|
||||
action.insertEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.sameCard(card), 3), Phase.REGROUP));
|
||||
}
|
||||
});
|
||||
}
|
||||
return action;
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,22 @@ public class Filters {
|
||||
|
||||
// Filters available
|
||||
|
||||
public static Filter canBeAssignedToSkirmish() {
|
||||
return new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
if (physicalCard.getBlueprint().getSide() == Side.SHADOW) {
|
||||
for (Skirmish assignment : gameState.getAssignments()) {
|
||||
if (assignment.getFellowshipCharacter() == physicalCard
|
||||
|| assignment.getShadowCharacters().contains(physicalCard))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return modifiersQuerying.canBeAssignedToSkirmish(gameState, physicalCard);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Filter weapon() {
|
||||
return new Filter() {
|
||||
@Override
|
||||
|
||||
@@ -150,6 +150,11 @@ public abstract class AbstractModifier implements Modifier {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, PhysicalCard source, boolean result) {
|
||||
return result;
|
||||
|
||||
@@ -62,6 +62,8 @@ public interface Modifier {
|
||||
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result);
|
||||
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
|
||||
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, PhysicalCard source, boolean result);
|
||||
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
|
||||
|
||||
@@ -357,6 +357,16 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, PhysicalCard card) {
|
||||
boolean result = true;
|
||||
|
||||
for (Modifier modifier : getModifiers(ModifierEffect.ASSIGNMENT_MODIFIER))
|
||||
if (affectsCardWithSkipSet(gameState, card, modifier))
|
||||
result = modifier.canBeAssignedToSkirmish(gameState, this, card, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, PhysicalCard card, PhysicalCard source) {
|
||||
boolean result = true;
|
||||
|
||||
@@ -51,6 +51,8 @@ public interface ModifiersQuerying {
|
||||
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, Map<PhysicalCard, List<PhysicalCard>> assignments);
|
||||
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, PhysicalCard card);
|
||||
|
||||
public boolean canBeDiscardedFromPlay(GameState gameState, PhysicalCard card, PhysicalCard source);
|
||||
|
||||
public boolean canBeHealed(GameState gameState, PhysicalCard card);
|
||||
|
||||
@@ -48,7 +48,8 @@ public class FreePeoplePlayerAssignsMinionsGameProcess implements GameProcess {
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
return modifiersQuerying.isAllyOnCurrentSite(gameState, physicalCard);
|
||||
}
|
||||
}));
|
||||
}),
|
||||
Filters.canBeAssignedToSkirmish());
|
||||
|
||||
_game.getUserFeedback().sendAwaitingDecision(gameState.getCurrentPlayerId(),
|
||||
new PlayerAssignMinionsDecision(1, "Assign minions to companions or allies at home", freePeopleTargets, minions) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ShadowPlayerAssignsHisMinionsGameProcess implements GameProcess {
|
||||
return modifiersQuerying.isAllyOnCurrentSite(gameState, physicalCard);
|
||||
}
|
||||
}
|
||||
));
|
||||
), Filters.canBeAssignedToSkirmish());
|
||||
|
||||
_game.getUserFeedback().sendAwaitingDecision(_playerId,
|
||||
new PlayerAssignMinionsDecision(1, "Assign minions to companions or allies at home", freePeopleTargets, minions) {
|
||||
|
||||
Reference in New Issue
Block a user