Fixed Azog (or any card playing another card) interaction with Rivendell
This commit is contained in:
@@ -104,6 +104,9 @@ public class PlayUtils {
|
||||
if (!game.getModifiersQuerying().canPayExtraCostsToPlay(game, card))
|
||||
return false;
|
||||
|
||||
if (!game.getModifiersQuerying().canPlayCard(game, card.getOwner(), card))
|
||||
return false;
|
||||
|
||||
// Check uniqueness
|
||||
if (!blueprint.skipUniquenessCheck() && !PlayConditions.checkUniqueness(game, card, ignoreCheckingDeadPile))
|
||||
return false;
|
||||
|
||||
@@ -208,6 +208,11 @@ public abstract class AbstractModifier implements Modifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayCard(LotroGame game, String performingPlayer, PhysicalCard card) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getExtraPhaseAction(LotroGame game, PhysicalCard card) {
|
||||
return null;
|
||||
|
||||
@@ -19,6 +19,11 @@ public class CantPlayCardsModifier extends AbstractModifier {
|
||||
_filters = Filters.and(filters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayCard(LotroGame game, String performingPlayer, PhysicalCard card) {
|
||||
return !_filters.accepts(game, card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayAction(LotroGame game, String performingPlayer, Action action) {
|
||||
final PhysicalCard actionSource = action.getActionSource();
|
||||
|
||||
@@ -85,6 +85,8 @@ public interface Modifier {
|
||||
|
||||
boolean canPlayAction(LotroGame game, String performingPlayer, Action action);
|
||||
|
||||
boolean canPlayCard(LotroGame game, String performingPlayer, PhysicalCard card);
|
||||
|
||||
List<? extends Action> getExtraPhaseAction(LotroGame game, PhysicalCard card);
|
||||
|
||||
List<? extends Action> getExtraPhaseActionFromStacked(LotroGame game, PhysicalCard card);
|
||||
|
||||
@@ -682,6 +682,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlayCard(LotroGame game, String performingPlayer, PhysicalCard card) {
|
||||
for (Modifier modifier : getModifiers(game, ModifierEffect.ACTION_MODIFIER))
|
||||
if (!modifier.canPlayCard(game, performingPlayer, card))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHavePlayedOn(LotroGame game, PhysicalCard playedCard, PhysicalCard target) {
|
||||
for (Modifier modifier : getModifiersAffectingCard(game, ModifierEffect.TARGET_MODIFIER, target))
|
||||
|
||||
@@ -103,6 +103,8 @@ public interface ModifiersQuerying {
|
||||
// Playing actions
|
||||
public boolean canPlayAction(LotroGame game, String performingPlayer, Action action);
|
||||
|
||||
public boolean canPlayCard(LotroGame game, String performingPlayer, PhysicalCard card);
|
||||
|
||||
public boolean canHavePlayedOn(LotroGame game, PhysicalCard playedCard, PhysicalCard target);
|
||||
|
||||
public boolean canHaveTransferredOn(LotroGame game, PhysicalCard playedCard, PhysicalCard target);
|
||||
|
||||
@@ -149,4 +149,38 @@ public class PlayCardFromDiscardAtTest extends AbstractAtTest {
|
||||
|
||||
assertFalse(_userFeedback.getAwaitingDecision(P2).getDecisionType() == AwaitingDecisionType.MULTIPLE_CHOICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void azogCantPlayTrollFromDiscardInRivendell() throws Exception {
|
||||
initializeSimplestGame();
|
||||
|
||||
skipMulligans();
|
||||
|
||||
final PhysicalCardImpl rivendell = createCard(P2, "30_51");
|
||||
rivendell.setSiteNumber(2);
|
||||
_game.getGameState().addCardToZone(_game, rivendell, Zone.ADVENTURE_PATH);
|
||||
|
||||
PhysicalCardImpl azog = createCard(P2, "32_28");
|
||||
_game.getGameState().addCardToZone(_game, azog, Zone.SHADOW_CHARACTERS);
|
||||
|
||||
PhysicalCardImpl watchfulOrc = createCard(P2, "30_40");
|
||||
_game.getGameState().addCardToZone(_game, watchfulOrc, Zone.SHADOW_CHARACTERS);
|
||||
|
||||
PhysicalCardImpl demolitionTroll = createCard(P2, "32_31");
|
||||
_game.getGameState().addCardToZone(_game, demolitionTroll, Zone.DISCARD);
|
||||
|
||||
_game.getGameState().setTwilight(20);
|
||||
|
||||
// Fellowship phase
|
||||
playerDecided(P1, "");
|
||||
// Shadow phase
|
||||
playerDecided(P2, getCardActionId(P2, "Use Watchful Orc"));
|
||||
// Choose Battleground
|
||||
playerDecided(P2, "0");
|
||||
playerDecided(P2, "");
|
||||
// Maneuver phase
|
||||
playerDecided(P1, "");
|
||||
|
||||
assertNull(getCardActionId(P2, "Use Azog"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user