Fixing attachments.

This commit is contained in:
marcins78@gmail.com
2011-08-30 01:12:01 +00:00
parent 642da9c6b9
commit 778c0fc186
18 changed files with 34 additions and 22 deletions

View File

@@ -93,11 +93,6 @@ public abstract class AbstractLotroCardBlueprint implements LotroCardBlueprint {
return null;
}
@Override
public int getTwilightCost() {
throw new UnsupportedOperationException("This method should not be called on this card");
}
@Override
public int getStrength() {
throw new UnsupportedOperationException("This method should not be called on this card");

View File

@@ -1,7 +1,6 @@
package com.gempukku.lotro.cards.actions;
import com.gempukku.lotro.cards.effects.PayTwilightCostEffect;
import com.gempukku.lotro.cards.effects.RemoveCardFromHandEffect;
import com.gempukku.lotro.cards.effects.TransferPermanentEffect;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.game.PhysicalCard;
@@ -16,7 +15,6 @@ public class TransferPermanentAction extends CostToEffectAction {
addCost(new ChooseActiveCardEffect(card.getOwner(), "Choose target to attach to", filter) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard target) {
addCost(new RemoveCardFromHandEffect(card));
addCost(new PayTwilightCostEffect(card));
addCost(new TransferPermanentEffect(card, target));
}

View File

@@ -17,6 +17,6 @@ public class TransferPermanentEffect extends UnrespondableEffect {
@Override
public void playEffect(LotroGame game) {
GameState gameState = game.getGameState();
gameState.attachCard(_physicalCard, _targetCard);
gameState.transferCard(_physicalCard, _targetCard);
}
}

View File

@@ -47,7 +47,7 @@ public class Card1_001 extends AbstractLotroCardBlueprint {
modifiers.add(new KeywordModifier(null, null, Keyword.RING_BEARER));
modifiers.add(new KeywordModifier(null, null, Keyword.RING_BOUND));
return new CompositeModifier(self, Filters.sameCard(self.getAttachedTo()), modifiers);
return new CompositeModifier(self, Filters.attachedTo(self), modifiers);
}
@Override
@@ -84,4 +84,9 @@ public class Card1_001 extends AbstractLotroCardBlueprint {
return null;
}
}
@Override
public int getTwilightCost() {
throw new UnsupportedOperationException("This method should not be called on this card");
}
}

View File

@@ -45,7 +45,7 @@ public class Card1_002 extends AbstractLotroCardBlueprint {
modifiers.add(new KeywordModifier(null, null, Keyword.RING_BEARER));
modifiers.add(new KeywordModifier(null, null, Keyword.RING_BOUND));
return new CompositeModifier(self, Filters.sameCard(self.getAttachedTo()), modifiers);
return new CompositeModifier(self, Filters.attachedTo(self), modifiers);
}
@Override
@@ -82,4 +82,8 @@ public class Card1_002 extends AbstractLotroCardBlueprint {
}
}
@Override
public int getTwilightCost() {
throw new UnsupportedOperationException("This method should not be called on this card");
}
}

View File

@@ -42,6 +42,6 @@ public class Card1_008 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new OverwhelmedByMultiplierModifier(self, Filters.sameCard(self.getAttachedTo()), 3);
return new OverwhelmedByMultiplierModifier(self, Filters.attachedTo(self), 3);
}
}

View File

@@ -51,7 +51,7 @@ public class Card1_009 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 2);
return new StrengthModifier(self, Filters.attachedTo(self), 2);
}
@Override

View File

@@ -55,7 +55,7 @@ public class Card1_014 extends AbstractAttachableFPPossession {
List<Modifier> modifiers = new LinkedList<Modifier>();
modifiers.add(new StrengthModifier(null, null, 2));
modifiers.add(new KeywordModifier(null, null, Keyword.DAMAGE));
return new CompositeModifier(self, Filters.sameCard(self.getAttachedTo()), modifiers);
return new CompositeModifier(self, Filters.attachedTo(self), modifiers);
}
@Override

View File

@@ -39,6 +39,7 @@ public class Card1_017 extends AbstractAlly {
appendHealAllyActions(actions, game, self);
if (game.getGameState().getCurrentPhase() == Phase.FELLOWSHIP
&& self.getZone() == Zone.FREE_SUPPORT
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
CostToEffectAction action = new CostToEffectAction(self, "Exert Grimir to shuffle a DWARVEN event from your discard pile into draw deck");
action.addCost(new ExertCharacterEffect(self));

View File

@@ -51,7 +51,7 @@ public class Card1_031 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new AbstractModifier(self, "Strength +2, if at Plains another +2", Filters.sameCard(self.getAttachedTo())) {
return new AbstractModifier(self, "Strength +2, if at Plains another +2", Filters.attachedTo(self)) {
@Override
public int getStrength(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
return modifiersQuerying.hasKeyword(gameState, gameState.getCurrentSite(), Keyword.PLAINS) ? 4 : 2;

View File

@@ -50,7 +50,7 @@ public class Card1_033 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 1);
return new StrengthModifier(self, Filters.attachedTo(self), 1);
}
@Override

View File

@@ -42,6 +42,6 @@ public class Card1_041 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new KeywordModifier(self, Filters.sameCard(self.getAttachedTo()), Keyword.ARCHER);
return new KeywordModifier(self, Filters.attachedTo(self), Keyword.ARCHER);
}
}

View File

@@ -93,6 +93,6 @@ public class Card1_047 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 2);
return new StrengthModifier(self, Filters.attachedTo(self), 2);
}
}

View File

@@ -46,7 +46,7 @@ public class Card1_049 extends AbstractAttachable {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new AbstractModifier(self, "Streng +1 for each Elf you can spot (limit +3)", Filters.sameCard(self.getAttachedTo())) {
return new AbstractModifier(self, "Streng +1 for each Elf you can spot (limit +3)", Filters.attachedTo(self)) {
@Override
public int getStrength(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard, int result) {
int count = Math.min(3, Filters.countActive(gameState, modifiersQuerying, Filters.keyword(Keyword.ELF)));

View File

@@ -34,6 +34,11 @@ public class Card1_059 extends AbstractLotroCardBlueprint {
super(Side.FREE_PEOPLE, CardType.CONDITION, Culture.ELVEN, "Shoulder to Shoulder", "1_59");
}
@Override
public int getTwilightCost() {
return 1;
}
@Override
public List<? extends Action> getPlayablePhaseActions(final String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canPlayFromHandDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {

View File

@@ -163,11 +163,11 @@ public class Filters {
};
}
public static Filter attachedTo(final int cardId) {
public static Filter attachedTo(final PhysicalCard attachment) {
return new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
return physicalCard.getZone() == Zone.ATTACHED && physicalCard.getAttachedTo().getCardId() == cardId;
return physicalCard == attachment.getAttachedTo();
}
};
}

View File

@@ -133,10 +133,13 @@ public class GameState {
return zone == Zone.DISCARD || zone == Zone.HAND;
}
public void transferCard(PhysicalCard card, PhysicalCard transferTo) {
((PhysicalCardImpl) card).attachTo((PhysicalCardImpl) transferTo);
}
public void attachCard(PhysicalCard card, PhysicalCard attachTo) {
((PhysicalCardImpl) card).attachTo((PhysicalCardImpl) attachTo);
if (card.getZone() != Zone.ATTACHED)
addCardToZone(card, Zone.ATTACHED);
addCardToZone(card, Zone.ATTACHED);
}
public void setRingBearer(PhysicalCard card) {

View File

@@ -30,6 +30,7 @@ public class PlayRingBearerRingAndAddBurdersGameProcess implements GameProcess {
gameState.setRingBearer(ringBearer);
PhysicalCard ring = Filters.filter(gameState.getDeck(playerId), gameState, _game.getModifiersQuerying(), Filters.type(CardType.THE_ONE_RING)).get(0);
gameState.removeCardFromZone(ring);
gameState.attachCard(ring, ringBearer);
gameState.addBurdens(playerId, _bids.get(playerId));