First card and mechanics fixes.

This commit is contained in:
marcins78@gmail.com
2011-08-30 00:48:33 +00:00
parent 9bd636361a
commit 642da9c6b9
13 changed files with 76 additions and 25 deletions

View File

@@ -34,7 +34,7 @@ public class AbstractAttachable extends AbstractLotroCardBlueprint {
GameState gameState = game.getGameState();
LotroCardBlueprint blueprint = self.getBlueprint();
if (gameState.getCurrentPhase() == ((getSide() == Side.FREE_PEOPLE) ? Phase.FELLOWSHIP : Phase.SHADOW)
&& self.getZone() == Zone.HAND
&& (self.getZone() == Zone.HAND || self.getZone() == Zone.DECK)
&& (!blueprint.isUnique() || !Filters.canSpot(gameState, game.getModifiersQuerying(), Filters.name(blueprint.getName())))
&& Filters.canSpot(gameState, game.getModifiersQuerying(), validTargetFilter)) {

View File

@@ -3,10 +3,7 @@ package com.gempukku.lotro.cards.set1.dwarven;
import com.gempukku.lotro.cards.AbstractAlly;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
import com.gempukku.lotro.common.Zone;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.LotroGame;
@@ -31,6 +28,7 @@ import java.util.List;
public class Card1_017 extends AbstractAlly {
public Card1_017() {
super(1, 3, 3, 3, Culture.DWARVEN, "Grimir", "1_17", true);
addKeyword(Keyword.DWARF);
}
@Override
@@ -53,6 +51,7 @@ public class Card1_017 extends AbstractAlly {
}
}
);
actions.add(action);
}
return actions;

View File

@@ -37,7 +37,7 @@ public class Card1_019 extends AbstractLotroCardBlueprint {
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (game.getGameState().getCurrentPhase() == Phase.MANEUVER
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.canExert(), Filters.keyword(Keyword.DWARF))) {
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.DWARF), Filters.canExert())) {
final PlayEventFromHandAction action = new PlayEventFromHandAction(self);
action.addCost(
new ChooseActiveCardEffect(playerId, "Choose Dwarf to exert", Filters.canExert(), Filters.keyword(Keyword.DWARF)) {

View File

@@ -1,6 +1,7 @@
package com.gempukku.lotro.cards.set1.dwarven;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.actions.PlayEventFromHandAction;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
@@ -41,8 +42,7 @@ public class Card1_022 extends AbstractLotroCardBlueprint {
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (game.getGameState().getCurrentPhase() == Phase.MANEUVER
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.DWARF), Filters.canExert())) {
final CostToEffectAction action = new CostToEffectAction(self, "Discard cards from the top of your draw deck until you choose to stop" +
" (limit 5). Add (1) for each card discarded in this way. Take the last card discarded into hand.");
final PlayEventFromHandAction action = new PlayEventFromHandAction(self);
action.addCost(
new ChooseActiveCardEffect(playerId, "Choose Dwarf to exert", Filters.keyword(Keyword.DWARF), Filters.canExert()) {
@Override

View File

@@ -29,6 +29,7 @@ public class Card1_030 extends AbstractCompanion {
public Card1_030() {
super(2, 6, 3, Culture.ELVEN, "Arwen", "1_30", true);
addKeyword(Keyword.RANGER);
addKeyword(Keyword.ELF);
setSignet(Signet.ARAGORN);
}

View File

@@ -3,15 +3,17 @@ package com.gempukku.lotro.cards.set1.elven;
import com.gempukku.lotro.cards.AbstractLotroCardBlueprint;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventFromHandAction;
import com.gempukku.lotro.cards.actions.PlayPermanentFromDeckAction;
import com.gempukku.lotro.cards.effects.SpotEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.decisions.ArbitraryCardsSelectionDecision;
import com.gempukku.lotro.logic.decisions.DecisionResultInvalidException;
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
@@ -37,19 +39,27 @@ public class Card1_035 extends AbstractLotroCardBlueprint {
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, final LotroGame game, PhysicalCard self) {
public List<? extends Action> getPlayablePhaseActions(final String playerId, final LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayFromHandDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)
&& Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.ELF))) {
final PlayEventFromHandAction action = new PlayEventFromHandAction(self);
action.addCost(new SpotEffect(Filters.keyword(Keyword.ELF)));
action.addEffect(
new PlayoutDecisionEffect(game.getUserFeedback(), playerId,
new ArbitraryCardsSelectionDecision(1, "Choose Tale to play from your deck", Filters.filter(game.getGameState().getDeck(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.TALE)), 0, 1) {
new ArbitraryCardsSelectionDecision(1, "Choose Tale to play from your deck", Filters.filter(game.getGameState().getDeck(playerId), game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.TALE),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
List<? extends Action> playableActions = physicalCard.getBlueprint().getPlayablePhaseActions(playerId, game, physicalCard);
return (playableActions.size() > 0);
}
}), 0, 1) {
@Override
public void decisionMade(String result) throws DecisionResultInvalidException {
List<PhysicalCard> selectedCard = getSelectedCardsByResponse(result);
if (selectedCard.size() > 0) {
game.getActionsEnvironment().addActionToStack(new PlayPermanentFromDeckAction(selectedCard.get(0), Zone.FREE_SUPPORT));
List<PhysicalCard> selectedCards = getSelectedCardsByResponse(result);
if (selectedCards.size() > 0) {
PhysicalCard selectedCard = selectedCards.get(0);
game.getActionsEnvironment().addActionToStack(selectedCard.getBlueprint().getPlayablePhaseActions(playerId, game, selectedCard).get(0));
}
}
})

View File

@@ -14,7 +14,6 @@ import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -61,9 +60,9 @@ public class Card1_050 extends AbstractCompanion {
}
});
return Collections.singletonList(action);
actions.add(action);
}
return null;
return actions;
}
}

View File

@@ -29,6 +29,11 @@ public class Card1_054 extends AbstractLotroCardBlueprint {
super(Side.FREE_PEOPLE, CardType.CONDITION, Culture.ELVEN, "Mallorn-trees", "1_54");
}
@Override
public int getTwilightCost() {
return 1;
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {

View File

@@ -134,8 +134,8 @@ public class GameState {
}
public void attachCard(PhysicalCard card, PhysicalCard attachTo) {
removeCardFromZone(card);
((PhysicalCardImpl) card).attachTo((PhysicalCardImpl) attachTo);
if (card.getZone() != Zone.ATTACHED)
addCardToZone(card, Zone.ATTACHED);
}
@@ -160,6 +160,9 @@ public class GameState {
public void removeCardFromZone(PhysicalCard card) {
Zone zone = card.getZone();
removeAllTokens(card);
boolean b = getZoneCards(card.getOwner(), card.getBlueprint().getCardType(), zone).remove(card);
if (!b)
throw new RuntimeException("Card was not found in the expected zone");
@@ -182,6 +185,18 @@ public class GameState {
listener.cardCreated(card);
}
private void removeAllTokens(PhysicalCard card) {
Map<Token, Integer> map = _cardTokens.get(card);
if (map != null) {
for (Map.Entry<Token, Integer> tokenIntegerEntry : map.entrySet())
if (tokenIntegerEntry.getValue() > 0)
for (GameStateListener listener : getAllGameStateListeners())
listener.removeTokens(card, tokenIntegerEntry.getKey(), tokenIntegerEntry.getValue());
map.clear();
}
}
public void putCardOnBottomOfDeck(PhysicalCard card) {
addCardToZone(card, Zone.DECK);
}

View File

@@ -43,7 +43,8 @@ public class PlayerPlaysStartingFellowshipGameProcess implements GameProcess {
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return (physicalCard.getBlueprint().getPlayablePhaseActions(playerId, _game, physicalCard).size() > 0);
List<? extends Action> playableActions = physicalCard.getBlueprint().getPlayablePhaseActions(playerId, _game, physicalCard);
return (playableActions != null && playableActions.size() > 0);
}
});
}

View File

@@ -28,6 +28,12 @@ public class ArcheryFireGameProcess implements GameProcess {
GameState gameState = _game.getGameState();
_fellowshipArcheryTotal = Filters.countActive(gameState, _game.getModifiersQuerying(),
Filters.keyword(Keyword.ARCHER),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return modifiersQuerying.addsToArcheryTotal(gameState, physicalCard);
}
},
Filters.or(
Filters.type(CardType.COMPANION),
new Filter() {
@@ -40,7 +46,14 @@ public class ArcheryFireGameProcess implements GameProcess {
_fellowshipArcheryTotal = _game.getModifiersQuerying().getArcheryTotal(gameState, Side.FREE_PEOPLE, _fellowshipArcheryTotal);
_shadowArcheryTotal = Filters.countActive(gameState, _game.getModifiersQuerying(),
Filters.keyword(Keyword.ARCHER), Filters.type(CardType.MINION));
Filters.keyword(Keyword.ARCHER),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return modifiersQuerying.addsToArcheryTotal(gameState, physicalCard);
}
},
Filters.type(CardType.MINION));
_shadowArcheryTotal = _game.getModifiersQuerying().getArcheryTotal(gameState, Side.SHADOW, _shadowArcheryTotal);
}

View File

@@ -53,6 +53,10 @@ public class LotroServer {
lotroDeck.setRing(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_1"));
lotroDeck.setRingBearer(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_290"));
for (int i = 3; i < 58; i++)
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_" + i));
// Sites
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_326"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_331"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_337"));
@@ -63,10 +67,6 @@ public class LotroServer {
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_356"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_362"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_12"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_13"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_51"));
for (int i = 0; i < 4; i++) {
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_145"));
lotroDeck.addCard(_lotroCardBlueprintLibrary.getLotroCardBlueprint("1_146"));

View File

@@ -331,6 +331,7 @@ var GempLotrUI = Class.extend({
cardData.tokens[token] += count;
this.layoutZone(zone);
this.assignmentsChanged();
},
removeTokens: function(element) {
@@ -347,6 +348,7 @@ var GempLotrUI = Class.extend({
cardData.tokens[token] -= count;
this.layoutZone(zone);
this.assignmentsChanged();
},
startSkirmish: function(element) {
@@ -444,10 +446,16 @@ var GempLotrUI = Class.extend({
} else if (zone == "FREE_CHARACTERS") {
this.charactersPlayer.layoutCards();
this.charactersOpponent.layoutCards();
} else if (zone == "FREE_SUPPORT") {
this.supportPlayer.layoutCards();
this.supportOpponent.layoutCards();
} else if (zone == "HAND") {
this.hand.layoutCards();
} else if (zone == "SHADOW_CHARACTERS") {
this.shadow.layoutCards();
} else if (zone == "SHADOW_SUPPORT") {
this.shadowPlayer.layoutCards();
this.shadowOpponent.layoutCards();
}
},