Fixed event requirements check
This commit is contained in:
@@ -390,18 +390,16 @@ public class BuiltLotroCardBlueprint implements LotroCardBlueprint {
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(LotroGame game, PhysicalCard self) {
|
||||
if (requirements == null)
|
||||
return true;
|
||||
|
||||
DefaultActionContext dummy = new DefaultActionContext(self.getOwner(), game, self, null, null);
|
||||
|
||||
for (Requirement requirement : requirements) {
|
||||
if (!requirement.accepts(dummy))
|
||||
return false;
|
||||
}
|
||||
if (requirements != null)
|
||||
for (Requirement requirement : requirements) {
|
||||
if (!requirement.accepts(dummy))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playEventAction != null)
|
||||
playEventAction.isValid(dummy);
|
||||
if (playEventAction != null && !playEventAction.isValid(dummy))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -266,4 +266,43 @@ public class NewCardsAtTest extends AbstractAtTest {
|
||||
assertEquals(Zone.DECK, celebornInDeck.getZone());
|
||||
assertEquals(0, _game.getGameState().getWounds(nazgul));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void battleFeverCantBePlayedOnSkirmishingGimli() throws DecisionResultInvalidException, CardNotFoundException {
|
||||
initializeSimplestGame();
|
||||
|
||||
final PhysicalCardImpl battleFever = createCard(P1, "40_5");
|
||||
final PhysicalCardImpl gimli = createCard(P1, "40_18");
|
||||
PhysicalCardImpl nazgul = createCard(P2, "40_211");
|
||||
|
||||
|
||||
_game.getGameState().addCardToZone(_game, gimli, Zone.FREE_CHARACTERS);
|
||||
_game.getGameState().addCardToZone(_game, battleFever, Zone.HAND);
|
||||
_game.getGameState().addCardToZone(_game, nazgul, Zone.SHADOW_CHARACTERS);
|
||||
|
||||
skipMulligans();
|
||||
|
||||
// Pass in fellowship
|
||||
playerDecided(P1, "");
|
||||
|
||||
// Pass in shadow
|
||||
playerDecided(P2, "");
|
||||
|
||||
//Pass in maneuver
|
||||
playerDecided(P1, "");
|
||||
playerDecided(P2, "");
|
||||
|
||||
//Pass in archery
|
||||
playerDecided(P1, "");
|
||||
playerDecided(P2, "");
|
||||
|
||||
//Pass in assignment
|
||||
playerDecided(P1, "");
|
||||
playerDecided(P2, "");
|
||||
|
||||
playerDecided(P1, gimli.getCardId() + " " + nazgul.getCardId());
|
||||
playerDecided(P1, "" + gimli.getCardId());
|
||||
|
||||
assertNull(getCardActionId(P1, "Play Battle Fever"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user