Stacking and attachment fixes.
This commit is contained in:
@@ -49,7 +49,7 @@ public class AttachPermanentAction implements CostToEffectAction {
|
||||
new ChooseActiveCardEffect(card.getOwner(), "Choose target to attach to", filter) {
|
||||
@Override
|
||||
protected void cardSelected(PhysicalCard target) {
|
||||
_putCardIntoPlayEffect = new AttachCardFromHandEffect(_source, target);
|
||||
_putCardIntoPlayEffect = new AttachCardEffect(_source, target);
|
||||
|
||||
int modifier = 0;
|
||||
for (Map.Entry<Filter, Integer> filterIntegerEntry : attachCostModifiers.entrySet())
|
||||
|
||||
@@ -5,11 +5,11 @@ import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
public class AttachCardFromHandEffect extends UnrespondableEffect {
|
||||
public class AttachCardEffect extends UnrespondableEffect {
|
||||
private PhysicalCard _physicalCard;
|
||||
private PhysicalCard _targetCard;
|
||||
|
||||
public AttachCardFromHandEffect(PhysicalCard physicalCard, PhysicalCard targetCard) {
|
||||
public AttachCardEffect(PhysicalCard physicalCard, PhysicalCard targetCard) {
|
||||
_physicalCard = physicalCard;
|
||||
_targetCard = targetCard;
|
||||
}
|
||||
@@ -55,6 +55,11 @@ public class Card1_073 extends AbstractPermanent {
|
||||
});
|
||||
possibleChoices.add(
|
||||
new ChooseArbitraryCardsEffect(playerId, "Choose artifact or possession to play", game.getGameState().getStackedCards(self), Filters.playable(game), 1, 1) {
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Play stacked artifact or possession";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cardsSelected(List<PhysicalCard> selectedCards) {
|
||||
PhysicalCard selectedCard = selectedCards.get(0);
|
||||
|
||||
@@ -58,6 +58,7 @@ public class GameState {
|
||||
_discards.put(stringListEntry.getKey(), new LinkedList<PhysicalCardImpl>());
|
||||
_deadPiles.put(stringListEntry.getKey(), new LinkedList<PhysicalCardImpl>());
|
||||
_inPlay.put(stringListEntry.getKey(), new LinkedList<PhysicalCardImpl>());
|
||||
_stacked.put(stringListEntry.getKey(), new LinkedList<PhysicalCardImpl>());
|
||||
|
||||
addPlayerCards(stringListEntry.getKey(), stringListEntry.getValue(), library);
|
||||
}
|
||||
@@ -209,6 +210,8 @@ public class GameState {
|
||||
return _deadPiles.get(playerId);
|
||||
else if (zone == Zone.HAND)
|
||||
return _hands.get(playerId);
|
||||
else if (zone == Zone.STACKED)
|
||||
return _stacked.get(playerId);
|
||||
else
|
||||
return _inPlay.get(playerId);
|
||||
}
|
||||
@@ -241,6 +244,12 @@ public class GameState {
|
||||
else if (isZonePrivate(zone))
|
||||
for (GameStateListener listener : getPrivateGameStateListeners(card))
|
||||
listener.cardRemoved(card);
|
||||
|
||||
if (zone == Zone.ATTACHED)
|
||||
((PhysicalCardImpl) card).attachTo(null);
|
||||
|
||||
if (zone == Zone.STACKED)
|
||||
((PhysicalCardImpl) card).stackOn(null);
|
||||
}
|
||||
|
||||
public void addCardToZone(PhysicalCard card, Zone zone) {
|
||||
|
||||
@@ -483,8 +483,24 @@ var GempLotrGameUI = Class.extend({
|
||||
removeCardFromPlay: function(element) {
|
||||
var cardId = element.getAttribute("cardId");
|
||||
var zone = element.getAttribute("zone");
|
||||
var targetCardId = element.getAttribute("targetCardId");
|
||||
|
||||
$(".card:cardId(" + cardId + ")").remove();
|
||||
var card = $(".card:cardId(" + cardId + ")")
|
||||
|
||||
if (targetCardId != null) {
|
||||
var targetCardData = $(".card:cardId(" + targetCardId + ")").data("card");
|
||||
var index = -1;
|
||||
for (var i = 0; i < targetCardData.attachedCards.length; i++) {
|
||||
if (targetCardData.attachedCards[i].data("card").cardId == cardId) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index != -1)
|
||||
targetCardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
|
||||
card.remove();
|
||||
|
||||
this.layoutZone(zone);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user