"Rule of 4" is optional for per format.
This commit is contained in:
@@ -34,7 +34,7 @@ public class PutCardFromDeckIntoHandEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (game.getModifiersQuerying().canDrawCardAndIncrement(game.getGameState(), _card.getOwner())
|
||||
if ((!game.getFormat().hasRuleOfFour() || game.getModifiersQuerying().canDrawCardAndIncrementForRuleOfFour(game.getGameState(), _card.getOwner()))
|
||||
&& _card.getZone() == Zone.DECK) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.sendMessage(_card.getOwner() + " puts " + GameUtils.getCardLink(_card) + " from deck into his or her hand");
|
||||
|
||||
@@ -39,7 +39,7 @@ public class PutCardFromDeckIntoHandOrDiscardEffect extends AbstractEffect {
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (_physicalCard.getZone() == Zone.DECK) {
|
||||
if (game.getModifiersQuerying().canDrawCardAndIncrement(game.getGameState(), _physicalCard.getOwner())) {
|
||||
if ((!game.getFormat().hasRuleOfFour() || game.getModifiersQuerying().canDrawCardAndIncrementForRuleOfFour(game.getGameState(), _physicalCard.getOwner()))) {
|
||||
game.getGameState().sendMessage(_physicalCard.getOwner() + " puts " + GameUtils.getCardLink(_physicalCard) + " from deck into his or her hand");
|
||||
game.getGameState().removeCardsFromZone(_physicalCard.getOwner(), Collections.singleton(_physicalCard));
|
||||
game.getGameState().addCardToZone(game, _physicalCard, Zone.HAND);
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PutCardFromDiscardIntoHandEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (game.getModifiersQuerying().canDrawCardAndIncrement(game.getGameState(), _card.getOwner())
|
||||
if ((!game.getFormat().hasRuleOfFour() || game.getModifiersQuerying().canDrawCardAndIncrementForRuleOfFour(game.getGameState(), _card.getOwner()))
|
||||
&& _card.getZone() == Zone.DISCARD) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.sendMessage(_card.getOwner() + " puts " + GameUtils.getCardLink(_card) + " from discard into his or her hand");
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PutCardFromStackedIntoHandEffect extends AbstractEffect {
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (_card.getZone() == Zone.STACKED
|
||||
&& game.getModifiersQuerying().canDrawCardAndIncrement(game.getGameState(), _card.getOwner())) {
|
||||
&& (!game.getFormat().hasRuleOfFour() || game.getModifiersQuerying().canDrawCardAndIncrementForRuleOfFour(game.getGameState(), _card.getOwner()))) {
|
||||
GameState gameState = game.getGameState();
|
||||
gameState.sendMessage(_card.getOwner() + " puts " + GameUtils.getCardLink(_card) + " from " + GameUtils.getCardLink(_card.getStackedOn()) + " into his or her hand");
|
||||
gameState.removeCardsFromZone(_card.getOwner(), Collections.singleton(_card));
|
||||
|
||||
@@ -10,6 +10,8 @@ public interface LotroFormat {
|
||||
|
||||
public boolean canCancelRingBearerSkirmish();
|
||||
|
||||
public boolean hasRuleOfFour();
|
||||
|
||||
public boolean hasMulliganRule();
|
||||
|
||||
public String getName();
|
||||
|
||||
@@ -40,7 +40,8 @@ public class DrawOneCardEffect extends AbstractEffect implements Preventable {
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
int drawn = 0;
|
||||
if (!_prevented && game.getGameState().getDeck(_playerId).size() > 0 && game.getModifiersQuerying().canDrawCardAndIncrement(game.getGameState(), _playerId)) {
|
||||
if (!_prevented && game.getGameState().getDeck(_playerId).size() > 0 &&
|
||||
(!game.getFormat().hasRuleOfFour() || game.getModifiersQuerying().canDrawCardAndIncrementForRuleOfFour(game.getGameState(), _playerId))) {
|
||||
game.getGameState().playerDrawsCard(_playerId);
|
||||
drawn++;
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean canDrawCardAndIncrement(GameState gameState, String playerId) {
|
||||
public boolean canDrawCardAndIncrementForRuleOfFour(GameState gameState, String playerId) {
|
||||
if (gameState.getCurrentPlayerId().equals(playerId)) {
|
||||
if (gameState.getCurrentPhase() != Phase.FELLOWSHIP)
|
||||
return true;
|
||||
|
||||
@@ -125,7 +125,7 @@ public interface ModifiersQuerying {
|
||||
|
||||
public boolean canDrawCardNoIncrement(GameState gameState, String playerId);
|
||||
|
||||
public boolean canDrawCardAndIncrement(GameState gameState, String playerId);
|
||||
public boolean canDrawCardAndIncrementForRuleOfFour(GameState gameState, String playerId);
|
||||
|
||||
public boolean canLookOrRevealCardsInHand(GameState gameState, String revealingPlayerId, String performingPlayerId);
|
||||
|
||||
|
||||
@@ -21,13 +21,16 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
private int _maximumSameName = 4;
|
||||
private boolean _mulliganRule;
|
||||
private boolean _canCancelRingBearerSkirmish;
|
||||
private boolean _hasRuleOfFour;
|
||||
private int _minimumDeckSize = 60;
|
||||
private List<String> _bannedCards = new ArrayList<String>();
|
||||
private List<String> _restrictedCards = new ArrayList<String>();
|
||||
private List<String> _validCards = new ArrayList<String>();
|
||||
private List<Integer> _validSets = new ArrayList<Integer>();
|
||||
|
||||
public DefaultLotroFormat(LotroCardBlueprintLibrary library, String name, Block siteBlock, boolean validateShadowFPCount, int minimumDeckSize, int maximumSameName, boolean mulliganRule, boolean canCancelRingBearerSkirmish) {
|
||||
public DefaultLotroFormat(LotroCardBlueprintLibrary library, String name, Block siteBlock,
|
||||
boolean validateShadowFPCount, int minimumDeckSize, int maximumSameName, boolean mulliganRule,
|
||||
boolean canCancelRingBearerSkirmish, boolean hasRuleOfFour) {
|
||||
_library = library;
|
||||
_name = name;
|
||||
_siteBlock = siteBlock;
|
||||
@@ -36,6 +39,7 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
_maximumSameName = maximumSameName;
|
||||
_mulliganRule = mulliganRule;
|
||||
_canCancelRingBearerSkirmish = canCancelRingBearerSkirmish;
|
||||
_hasRuleOfFour = hasRuleOfFour;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,6 +62,11 @@ public class DefaultLotroFormat implements LotroFormat {
|
||||
return _canCancelRingBearerSkirmish;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasRuleOfFour() {
|
||||
return _hasRuleOfFour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getValidSets() {
|
||||
return Collections.unmodifiableList(_validSets);
|
||||
|
||||
@@ -33,8 +33,11 @@ public class LotroFormatLibrary {
|
||||
Boolean cancelRingBearerSkirmish = (Boolean) formatDef.get("cancelRingBearerSkirmish");
|
||||
if (cancelRingBearerSkirmish == null)
|
||||
cancelRingBearerSkirmish = false;
|
||||
Boolean hasRuleOfFour = (Boolean) formatDef.get("hasRuleOfFour");
|
||||
if (hasRuleOfFour == null)
|
||||
hasRuleOfFour = true;
|
||||
|
||||
final DefaultLotroFormat format = new DefaultLotroFormat(library, name, block, true, 60, 4, true, cancelRingBearerSkirmish);
|
||||
final DefaultLotroFormat format = new DefaultLotroFormat(library, name, block, true, 60, 4, true, cancelRingBearerSkirmish, hasRuleOfFour);
|
||||
|
||||
JSONArray sets = (JSONArray) formatDef.get("set");
|
||||
for (Object set : sets)
|
||||
|
||||
@@ -255,6 +255,7 @@
|
||||
"valid":[],
|
||||
"set":[20],
|
||||
"cancelRingBearerSkirmish":true,
|
||||
"ruleOfFour":false,
|
||||
"hall":false
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user