- Roaming penalty does not get reduced by cost decreasing effects ("play X, its twilight cost is -Y"), including Toil.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
- Actions that have playing a card as an effect (except playing from hand or discard), no longer check if there is
|
||||
a card player can legally play. Effects that play cards from hand and discard, are still not playable if no legal card
|
||||
can be played.
|
||||
- Roaming penalty does not get reduced by cost decreasing effects ("play X, its twilight cost is -Y"), including Toil.
|
||||
|
||||
<b>5 Mar. 2013</b>
|
||||
- "Bilbo", "Bearer of Things Burgled" and any card that allows a choice of adding twilight now correctly displays
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.Map;
|
||||
|
||||
public class PlayConditions {
|
||||
public static boolean canPayForShadowCard(LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
return game.getModifiersQuerying().getTwilightCost(game.getGameState(), self, ignoreRoamingPenalty) + twilightModifier <= game.getGameState().getTwilightPool() - withTwilightRemoved;
|
||||
return game.getModifiersQuerying().getTwilightCost(game.getGameState(), self, twilightModifier, ignoreRoamingPenalty) <= game.getGameState().getTwilightPool() - withTwilightRemoved;
|
||||
}
|
||||
|
||||
private static boolean containsPhase(Phase[] phases, Phase phase) {
|
||||
|
||||
@@ -133,7 +133,7 @@ public class AttachPermanentAction extends AbstractCostToEffectAction implements
|
||||
if (_discountEffect != null) {
|
||||
int requiredDiscount = 0;
|
||||
if (_cardToAttach.getBlueprint().getSide() == Side.SHADOW) {
|
||||
int twilightCost = game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _cardToAttach, _target) + _twilightModifier;
|
||||
int twilightCost = game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _cardToAttach, _target, _twilightModifier);
|
||||
int underPool = twilightCost - game.getGameState().getTwilightPool();
|
||||
if (underPool > 0)
|
||||
requiredDiscount = underPool;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class PlayEventAction extends AbstractCostToEffectAction implements Disco
|
||||
if (_discountEffect != null) {
|
||||
int requiredDiscount = 0;
|
||||
if (_eventPlayed.getBlueprint().getSide() == Side.SHADOW) {
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _eventPlayed, false);
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _eventPlayed, 0, false);
|
||||
int underPool = twilightCost - game.getGameState().getTwilightPool();
|
||||
if (underPool > 0)
|
||||
requiredDiscount = underPool;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PlayPermanentAction extends AbstractCostToEffectAction implements D
|
||||
if (_discountEffect != null) {
|
||||
int requiredDiscount = 0;
|
||||
if (_permanentPlayed.getBlueprint().getSide() == Side.SHADOW) {
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _permanentPlayed, _ignoreRoamingPenalty) + _twilightModifier;
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _permanentPlayed, _twilightModifier, _ignoreRoamingPenalty);
|
||||
int underPool = twilightCost - game.getGameState().getTwilightPool();
|
||||
if (underPool > 0)
|
||||
requiredDiscount = underPool;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class PayPlayOnTwilightCostEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
int twilightCost = _twilightModifier + game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _physicalCard, _target);
|
||||
int twilightCost = game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _physicalCard, _target, _twilightModifier);
|
||||
|
||||
String currentPlayerId = game.getGameState().getCurrentPlayerId();
|
||||
if (!currentPlayerId.equals(_physicalCard.getOwner())) {
|
||||
@@ -41,7 +41,7 @@ public class PayPlayOnTwilightCostEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
int twilightCost = _twilightModifier + game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _physicalCard, _target);
|
||||
int twilightCost = game.getModifiersQuerying().getPlayOnTwilightCost(game.getGameState(), _physicalCard, _target, _twilightModifier);
|
||||
|
||||
String currentPlayerId = game.getGameState().getCurrentPlayerId();
|
||||
if (currentPlayerId.equals(_physicalCard.getOwner())) {
|
||||
|
||||
@@ -36,7 +36,7 @@ public class PayTwilightCostEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
int twilightCost = _twilightModifier + game.getModifiersQuerying().getTwilightCost(game.getGameState(), _physicalCard, _ignoreRoamingPenalty);
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _physicalCard, _twilightModifier, _ignoreRoamingPenalty);
|
||||
|
||||
String currentPlayerId = game.getGameState().getCurrentPlayerId();
|
||||
if (!currentPlayerId.equals(_physicalCard.getOwner())) {
|
||||
@@ -49,7 +49,7 @@ public class PayTwilightCostEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
int twilightCost = _twilightModifier + game.getModifiersQuerying().getTwilightCost(game.getGameState(), _physicalCard, _ignoreRoamingPenalty);
|
||||
int twilightCost = game.getModifiersQuerying().getTwilightCost(game.getGameState(), _physicalCard, _twilightModifier, _ignoreRoamingPenalty);
|
||||
|
||||
String currentPlayerId = game.getGameState().getCurrentPlayerId();
|
||||
if (currentPlayerId.equals(_physicalCard.getOwner())) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Card17_084 extends AbstractMinion {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new SelfExertEffect(action, self));
|
||||
int number = game.getModifiersQuerying().getTwilightCost(game.getGameState(), game.getGameState().getCurrentSite(), false);
|
||||
int number = game.getModifiersQuerying().getTwilightCost(game.getGameState(), game.getGameState().getCurrentSite(), 0, false);
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(self, number));
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Card17_125 extends AbstractMinion {
|
||||
@Override
|
||||
public void liberatedSiteCallback(PhysicalCard liberatedSite) {
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(self, game.getModifiersQuerying().getTwilightCost(game.getGameState(), liberatedSite, false)));
|
||||
new AddTwilightEffect(self, game.getModifiersQuerying().getTwilightCost(game.getGameState(), liberatedSite, 0, false)));
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -459,10 +459,10 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTwilightCost(GameState gameState, PhysicalCard physicalCard, boolean ignoreRoamingPenalty) {
|
||||
public int getTwilightCost(GameState gameState, PhysicalCard physicalCard, int twilightCostModifier, boolean ignoreRoamingPenalty) {
|
||||
LoggingThreadLocal.logMethodStart(physicalCard, "getTwilightCost");
|
||||
try {
|
||||
int result = physicalCard.getBlueprint().getTwilightCost();
|
||||
int result = physicalCard.getBlueprint().getTwilightCost() + twilightCostModifier;
|
||||
result += physicalCard.getBlueprint().getTwilightCostModifier(gameState, this, physicalCard);
|
||||
for (Modifier modifier : getModifiersAffectingCard(gameState, ModifierEffect.TWILIGHT_COST_MODIFIER, physicalCard)) {
|
||||
result += modifier.getTwilightCostModifier(gameState, this, physicalCard, ignoreRoamingPenalty);
|
||||
@@ -480,10 +480,10 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayOnTwilightCost(GameState gameState, PhysicalCard physicalCard, PhysicalCard target) {
|
||||
public int getPlayOnTwilightCost(GameState gameState, PhysicalCard physicalCard, PhysicalCard target, int twilightCostModifier) {
|
||||
LoggingThreadLocal.logMethodStart(physicalCard, "getPlayOnTwilightCost");
|
||||
try {
|
||||
int result = getTwilightCost(gameState, physicalCard, false);
|
||||
int result = getTwilightCost(gameState, physicalCard, twilightCostModifier, false);
|
||||
for (Modifier modifier : getModifiersAffectingCard(gameState, ModifierEffect.TWILIGHT_COST_MODIFIER, physicalCard)) {
|
||||
result += modifier.getPlayOnTwilightCostModifier(gameState, this, physicalCard, target);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public interface ModifiersQuerying {
|
||||
public boolean addsTwilightForCompanionMove(GameState gameState, PhysicalCard companion);
|
||||
|
||||
// Twilight cost
|
||||
public int getTwilightCost(GameState gameState, PhysicalCard physicalCard, boolean ignoreRoamingPenalty);
|
||||
public int getTwilightCost(GameState gameState, PhysicalCard physicalCard, int twilightCostModifier, boolean ignoreRoamingPenalty);
|
||||
|
||||
public int getPlayOnTwilightCost(GameState gameState, PhysicalCard physicalCard, PhysicalCard target);
|
||||
public int getPlayOnTwilightCost(GameState gameState, PhysicalCard physicalCard, PhysicalCard target, int twilightCostModifier);
|
||||
|
||||
public int getRoamingPenalty(GameState gameState, PhysicalCard physicalCard);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PlayerPlaysStartingFellowshipGameProcess implements GameProcess {
|
||||
new Filter() {
|
||||
@Override
|
||||
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
|
||||
int twilightCost = modifiersQuerying.getTwilightCost(gameState, physicalCard, false);
|
||||
int twilightCost = modifiersQuerying.getTwilightCost(gameState, physicalCard, 0, false);
|
||||
return gameState.getTwilightPool() + twilightCost <= 4
|
||||
&& physicalCard.getBlueprint().checkPlayRequirements(playerId, game, physicalCard, 0, 0, false, false)
|
||||
&& modifiersQuerying.canPlayAction(gameState, playerId, physicalCard.getBlueprint().getPlayCardAction(playerId, game, physicalCard, 0, false));
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MovementGameProcess implements GameProcess {
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
GameState gameState = game.getGameState();
|
||||
|
||||
int siteTwilightCost = game.getModifiersQuerying().getTwilightCost(gameState, gameState.getCurrentSite(), false);
|
||||
int siteTwilightCost = game.getModifiersQuerying().getTwilightCost(gameState, gameState.getCurrentSite(), 0, false);
|
||||
if (!game.getFormat().isOrderedSites()) {
|
||||
final int siteNumber = gameState.getCurrentSiteNumber();
|
||||
if (siteNumber > 3 && siteNumber <= 6)
|
||||
|
||||
@@ -182,7 +182,7 @@ public class LotroGameMediator {
|
||||
|
||||
sb.append("<br><br><b>Effective stats:</b>");
|
||||
try {
|
||||
int twilightCost = _lotroGame.getModifiersQuerying().getTwilightCost(_lotroGame.getGameState(), card, false);
|
||||
int twilightCost = _lotroGame.getModifiersQuerying().getTwilightCost(_lotroGame.getGameState(), card, 0, false);
|
||||
sb.append("<br><b>Twilight cost:</b> " + twilightCost);
|
||||
} catch (UnsupportedOperationException exp) {
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ public class IndividualCardAtTest extends AbstractAtTest {
|
||||
// End fellowship
|
||||
playerDecided(P2, "");
|
||||
|
||||
assertEquals(8, _game.getModifiersQuerying().getTwilightCost(_game.getGameState(), attea, false));
|
||||
assertEquals(8, _game.getModifiersQuerying().getTwilightCost(_game.getGameState(), attea, 0, false));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -6,13 +6,14 @@ import com.gempukku.lotro.game.PhysicalCardImpl;
|
||||
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
|
||||
import com.gempukku.lotro.logic.decisions.AwaitingDecisionType;
|
||||
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
||||
public class ToilAtTest extends AbstractAtTest {
|
||||
@Test
|
||||
public void cantPlayIfNotEnoughAndCantExertAnything() throws DecisionResultInvalidException {
|
||||
@@ -327,6 +328,7 @@ public class ToilAtTest extends AbstractAtTest {
|
||||
assertEquals(1, _game.getGameState().getWounds(corpsOfHarad3));
|
||||
assertEquals(1, _game.getGameState().getWounds(corpsOfHarad4));
|
||||
assertEquals(1, _game.getGameState().getWounds(corpsOfHarad5));
|
||||
assertEquals(8, _game.getGameState().getTwilightPool());
|
||||
// It's 6 not 8, because of roaming penalty
|
||||
assertEquals(6, _game.getGameState().getTwilightPool());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user