- "Sauron's Hatred" and other cards that play card without paying roaming penalty are now working correctly.

This commit is contained in:
marcins78@gmail.com
2012-05-22 10:57:22 +00:00
parent e417371516
commit 912b05a9d2
4 changed files with 52 additions and 14 deletions

View File

@@ -46,7 +46,7 @@ public class AbstractPermanent extends AbstractLotroCardBlueprint {
@Override
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, int twilightModifier, boolean ignoreRoamingPenalty, boolean ignoreCheckingDeadPile) {
twilightModifier -= getPotentialExtraPaymentDiscount(playerId, game, self);
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, false, false)
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, twilightModifier, ignoreRoamingPenalty, ignoreCheckingDeadPile)
&& PlayConditions.checkUniqueness(game.getGameState(), game.getModifiersQuerying(), self, ignoreCheckingDeadPile);
}

View File

@@ -66,26 +66,32 @@ public class ChooseAndPlayCardFromHandEffect implements Effect {
@Override
public void playEffect(final LotroGame game) {
Collection<PhysicalCard> playableInHand = getPlayableInHandCards(game);
if (playableInHand.size() > 0) {
if (playableInHand.size() == 1)
playCard(game, playableInHand.iterator().next());
else if (playableInHand.size() > 1) {
game.getUserFeedback().sendAwaitingDecision(_playerId,
new CardsSelectionDecision(1, "Choose a card to play", playableInHand, 1, 1) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
final PhysicalCard selectedCard = getSelectedCardsByResponse(result).iterator().next();
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier, _ignoreRoamingPenalty);
_playCardAction.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
afterCardPlayed(selectedCard);
}
});
game.getActionsEnvironment().addActionToStack(_playCardAction);
playCard(game, selectedCard);
}
});
}
}
private void playCard(LotroGame game, final PhysicalCard selectedCard) {
_playCardAction = selectedCard.getBlueprint().getPlayCardAction(_playerId, game, selectedCard, _twilightModifier, _ignoreRoamingPenalty);
_playCardAction.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
afterCardPlayed(selectedCard);
}
});
game.getActionsEnvironment().addActionToStack(_playCardAction);
}
protected void afterCardPlayed(PhysicalCard cardPlayed) {
}

View File

@@ -10,15 +10,16 @@ import com.gempukku.lotro.logic.decisions.AwaitingDecision;
import com.gempukku.lotro.logic.decisions.AwaitingDecisionType;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.modifiers.RemoveKeywordModifier;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class RoamingAtTest extends AbstractAtTest {
@Test
public void cantPlayRoamingMinionIfNotEnoughTwilight() throws DecisionResultInvalidException {
@@ -196,4 +197,34 @@ public class RoamingAtTest extends AbstractAtTest {
assertEquals(0, _game.getGameState().getTwilightPool());
assertTrue(_game.getModifiersQuerying().hasKeyword(_game.getGameState(), orcChieftain, Keyword.ROAMING));
}
@Test
public void payingForRoamingMinionWithoutRoamingPenalty() throws DecisionResultInvalidException {
Map<String, Collection<String>> extraCards = new HashMap<String, Collection<String>>();
initializeSimplestGame(extraCards);
PhysicalCardImpl orcChieftain = new PhysicalCardImpl(100, "1_266", P2, _library.getLotroCardBlueprint("1_266"));
PhysicalCardImpl sauronsHatred = new PhysicalCardImpl(100, "7_310", P2, _library.getLotroCardBlueprint("7_310"));
skipMulligans();
_game.getGameState().addCardToZone(_game, sauronsHatred, Zone.SUPPORT);
_game.getGameState().addCardToZone(_game, orcChieftain, Zone.HAND);
_game.getGameState().addThreats(P1, 1);
// End fellowship phase
playerDecided(P1, "");
assertEquals(2, _game.getGameState().getTwilightPool());
// Can't play the Orc Chieftain but can use the Sauron's Hatred
AwaitingDecision shadowPhaseDecision = _userFeedback.getAwaitingDecision(P2);
assertEquals(AwaitingDecisionType.CARD_ACTION_CHOICE, shadowPhaseDecision.getDecisionType());
validateContents(new String[]{"" + sauronsHatred.getCardId()}, (String[]) shadowPhaseDecision.getDecisionParameters().get("cardId"));
playerDecided(P2, "0");
// Orc Chieftain in play
assertEquals(Zone.SHADOW_CHARACTERS, orcChieftain.getZone());
assertEquals(0, _game.getGameState().getTwilightPool());
assertTrue(_game.getModifiersQuerying().hasKeyword(_game.getGameState(), orcChieftain, Keyword.ROAMING));
}
}

View File

@@ -1,6 +1,7 @@
<pre style="font-size:80%">
<b>22 May 2012</b>
- "A Dragon's Tale" now makes shadow player exert one of his/her minions.
- "Sauron's Hatred" and other cards that play card without paying roaming penalty are now working correctly.
<b>16 May 2012</b>
- "Glamdring, Elven Blade" now lets the shadow player to choose a minion to exert.