"Controlled by the Ring"
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.gempukku.lotro.cards.set15.gollum;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Hunters
|
||||
* Side: Shadow
|
||||
* Culture: Gollum
|
||||
* Twilight Cost: 1
|
||||
* Type: Condition
|
||||
* Game Text: Bearer must be Gollum. Skirmish: If Gollum is not assigned to a skirmish, discard this condition to have
|
||||
* him replace a minion skirmishing a companion.
|
||||
*/
|
||||
public class Card15_041 extends AbstractAttachable {
|
||||
public Card15_041() {
|
||||
super(Side.SHADOW, CardType.CONDITION, 1, Culture.GOLLUM, null, "Controlled by the Ring");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Filters.gollum;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraPhaseActions(String playerId, LotroGame game, final PhysicalCard self) {
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game, Phase.SKIRMISH, self, 0)
|
||||
&& PlayConditions.canSpot(game, Filters.hasAttached(self), Filters.notAssignedToSkirmish)
|
||||
&& PlayConditions.canSelfDiscard(self, game)) {
|
||||
|
||||
final PhysicalCard gollum = self.getAttachedTo();
|
||||
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new SelfDiscardEffect(self));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose minion to replace", CardType.MINION, Filters.inSkirmishAgainst(CardType.COMPANION)) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, final PhysicalCard minion) {
|
||||
action.appendEffect(
|
||||
new UnrespondableEffect() {
|
||||
@Override
|
||||
protected void doPlayEffect(LotroGame game) {
|
||||
game.getGameState().replaceInSkirmishMinion(gollum, minion);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,8 @@ public interface GameStateListener {
|
||||
|
||||
public void startSkirmish(PhysicalCard fp, Set<PhysicalCard> minions);
|
||||
|
||||
public void addToSkirmish(PhysicalCard card);
|
||||
|
||||
public void removeFromSkirmish(PhysicalCard card);
|
||||
|
||||
public void finishSkirmish();
|
||||
|
||||
@@ -15,7 +15,7 @@ public class GameEvent {
|
||||
P, GPC, TC, PP, TP,
|
||||
PCIP, MCIP, RCFP,
|
||||
AA, RA,
|
||||
SS, RFS, ES,
|
||||
SS, RFS, ATS, ES,
|
||||
AT, RT,
|
||||
M, W,
|
||||
GS,
|
||||
|
||||
@@ -326,6 +326,13 @@ public class GameState {
|
||||
}
|
||||
}
|
||||
|
||||
public void replaceInSkirmishMinion(PhysicalCard card, PhysicalCard removeMinion) {
|
||||
removeFromSkirmish(removeMinion);
|
||||
_skirmish.getShadowCharacters().add(card);
|
||||
for (GameStateListener listener : getAllGameStateListeners())
|
||||
listener.addToSkirmish(card);
|
||||
}
|
||||
|
||||
private void removeFromSkirmish(PhysicalCard card, boolean notify) {
|
||||
if (_skirmish.getFellowshipCharacter() == card) {
|
||||
_skirmish.setFellowshipCharacter(null);
|
||||
|
||||
@@ -4,12 +4,13 @@ import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Token;
|
||||
import com.gempukku.lotro.communication.GameStateListener;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
|
||||
import com.gempukku.lotro.logic.decisions.AwaitingDecision;
|
||||
import com.gempukku.lotro.logic.timing.GameStats;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
|
||||
|
||||
public class GatheringParticipantCommunicationChannel implements GameStateListener {
|
||||
private List<GameEvent> _events = new LinkedList<GameEvent>();
|
||||
private String _self;
|
||||
@@ -55,6 +56,11 @@ public class GatheringParticipantCommunicationChannel implements GameStateListen
|
||||
_events.add(gameEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToSkirmish(PhysicalCard card) {
|
||||
_events.add(new GameEvent(ATS).card(card));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromSkirmish(PhysicalCard card) {
|
||||
_events.add(new GameEvent(RFS).card(card));
|
||||
|
||||
@@ -70,40 +70,40 @@ var GameAnimations = Class.extend({
|
||||
var cardWidth = card.getWidthForHeight(cardHeight);
|
||||
|
||||
$(cardDiv).css(
|
||||
{
|
||||
position: "absolute",
|
||||
left: (gameWidth / 2 - cardWidth / 4),
|
||||
top: gameHeight * (3 / 8),
|
||||
width: cardWidth / 2,
|
||||
height: cardHeight / 2,
|
||||
"z-index": 100,
|
||||
opacity: 0});
|
||||
{
|
||||
position: "absolute",
|
||||
left: (gameWidth / 2 - cardWidth / 4),
|
||||
top: gameHeight * (3 / 8),
|
||||
width: cardWidth / 2,
|
||||
height: cardHeight / 2,
|
||||
"z-index": 100,
|
||||
opacity: 0});
|
||||
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
left: "-=" + cardWidth / 4,
|
||||
top: "-=" + (gameHeight / 8),
|
||||
width: "+=" + (cardWidth / 2),
|
||||
height: "+=" + (cardHeight / 2),
|
||||
opacity: 1},
|
||||
{
|
||||
duration: that.getAnimationLength(that.playEventDuration / 8),
|
||||
easing: "linear",
|
||||
queue: false,
|
||||
complete: next});
|
||||
{
|
||||
left: "-=" + cardWidth / 4,
|
||||
top: "-=" + (gameHeight / 8),
|
||||
width: "+=" + (cardWidth / 2),
|
||||
height: "+=" + (cardHeight / 2),
|
||||
opacity: 1},
|
||||
{
|
||||
duration: that.getAnimationLength(that.playEventDuration / 8),
|
||||
easing: "linear",
|
||||
queue: false,
|
||||
complete: next});
|
||||
}).queue(
|
||||
function(next) {
|
||||
setTimeout(next, that.getAnimationLength(that.playEventDuration * (5 / 8)));
|
||||
}).queue(
|
||||
function(next) {
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 0},
|
||||
{
|
||||
duration: that.getAnimationLength(that.playEventDuration / 4),
|
||||
easing: "easeOutQuart",
|
||||
queue: false,
|
||||
complete: next});
|
||||
{
|
||||
opacity: 0},
|
||||
{
|
||||
duration: that.getAnimationLength(that.playEventDuration / 4),
|
||||
easing: "easeOutQuart",
|
||||
queue: false,
|
||||
complete: next});
|
||||
}).queue(
|
||||
function(next) {
|
||||
$(cardDiv).remove();
|
||||
@@ -157,26 +157,26 @@ var GameAnimations = Class.extend({
|
||||
}
|
||||
|
||||
$(cardDiv).css(
|
||||
{
|
||||
position: "absolute",
|
||||
left: shadowStartPosX,
|
||||
top: shadowStartPosY,
|
||||
width: shadowWidth,
|
||||
height: shadowHeight,
|
||||
"z-index": 100,
|
||||
opacity: 1});
|
||||
{
|
||||
position: "absolute",
|
||||
left: shadowStartPosX,
|
||||
top: shadowStartPosY,
|
||||
width: shadowWidth,
|
||||
height: shadowHeight,
|
||||
"z-index": 100,
|
||||
opacity: 1});
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 0,
|
||||
left: "-=" + (shadowWidth / 2),
|
||||
top: "-=" + (shadowHeight / 2),
|
||||
width: "+=" + shadowWidth,
|
||||
height: "+=" + shadowHeight},
|
||||
{
|
||||
duration: that.getAnimationLength(that.cardAffectsCardDuration),
|
||||
easing: "easeInQuart",
|
||||
queue: false,
|
||||
complete: null});
|
||||
{
|
||||
opacity: 0,
|
||||
left: "-=" + (shadowWidth / 2),
|
||||
top: "-=" + (shadowHeight / 2),
|
||||
width: "+=" + shadowWidth,
|
||||
height: "+=" + shadowHeight},
|
||||
{
|
||||
duration: that.getAnimationLength(that.cardAffectsCardDuration),
|
||||
easing: "easeInQuart",
|
||||
queue: false,
|
||||
complete: null});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ var GameAnimations = Class.extend({
|
||||
$(this).remove();
|
||||
}
|
||||
}
|
||||
);
|
||||
);
|
||||
next();
|
||||
});
|
||||
}
|
||||
@@ -266,29 +266,29 @@ var GameAnimations = Class.extend({
|
||||
var cardWidth = card.getWidthForHeight(cardHeight);
|
||||
|
||||
$(cardDiv).css(
|
||||
{
|
||||
position: "absolute",
|
||||
left: (gameWidth / 2 - cardWidth / 4),
|
||||
top: gameHeight * (3 / 8),
|
||||
width: cardWidth / 2,
|
||||
height: cardHeight / 2,
|
||||
"z-index": 100,
|
||||
opacity: 0});
|
||||
{
|
||||
position: "absolute",
|
||||
left: (gameWidth / 2 - cardWidth / 4),
|
||||
top: gameHeight * (3 / 8),
|
||||
width: cardWidth / 2,
|
||||
height: cardHeight / 2,
|
||||
"z-index": 100,
|
||||
opacity: 0});
|
||||
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 1},
|
||||
{
|
||||
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 8),
|
||||
easing: "linear",
|
||||
step: function(now, fx) {
|
||||
layoutCardElem(cardDiv,
|
||||
(gameWidth / 2 - cardWidth / 4) - now * (cardWidth / 4),
|
||||
gameHeight * (3 / 8) - now * (gameHeight / 8),
|
||||
cardWidth / 2 + now * (cardWidth / 2),
|
||||
cardHeight / 2 + now * (cardHeight / 2), 100);
|
||||
},
|
||||
complete: next});
|
||||
{
|
||||
opacity: 1},
|
||||
{
|
||||
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 8),
|
||||
easing: "linear",
|
||||
step: function(now, fx) {
|
||||
layoutCardElem(cardDiv,
|
||||
(gameWidth / 2 - cardWidth / 4) - now * (cardWidth / 4),
|
||||
gameHeight * (3 / 8) - now * (gameHeight / 8),
|
||||
cardWidth / 2 + now * (cardWidth / 2),
|
||||
cardHeight / 2 + now * (cardHeight / 2), 100);
|
||||
},
|
||||
complete: next});
|
||||
}).queue(
|
||||
function(next) {
|
||||
setTimeout(next, that.getAnimationLength(that.putCardIntoPlayDuration * (5 / 8)));
|
||||
@@ -303,20 +303,20 @@ var GameAnimations = Class.extend({
|
||||
var startHeight = cardDiv.height();
|
||||
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
left: oldValues["left"]},
|
||||
{
|
||||
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 4),
|
||||
easing: "linear",
|
||||
step: function(now, fx) {
|
||||
var state = fx.state;
|
||||
layoutCardElem(cardDiv,
|
||||
startLeft + (oldValues["left"] - startLeft) * state,
|
||||
startTop + (oldValues["top"] - startTop) * state,
|
||||
startWidth + (oldValues["width"] - startWidth) * state,
|
||||
startHeight + (oldValues["height"] - startHeight) * state, 100);
|
||||
},
|
||||
complete: next});
|
||||
{
|
||||
left: oldValues["left"]},
|
||||
{
|
||||
duration: that.getAnimationLength(that.putCardIntoPlayDuration / 4),
|
||||
easing: "linear",
|
||||
step: function(now, fx) {
|
||||
var state = fx.state;
|
||||
layoutCardElem(cardDiv,
|
||||
startLeft + (oldValues["left"] - startLeft) * state,
|
||||
startTop + (oldValues["top"] - startTop) * state,
|
||||
startWidth + (oldValues["width"] - startWidth) * state,
|
||||
startHeight + (oldValues["height"] - startHeight) * state, 100);
|
||||
},
|
||||
complete: next});
|
||||
}).queue(
|
||||
function(next) {
|
||||
var cardDiv = $(".card:cardId(" + cardId + ")");
|
||||
@@ -352,7 +352,7 @@ var GameAnimations = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
var card = $(".card:cardId(" + cardId + ")");
|
||||
var cardData = card.data("card");
|
||||
@@ -388,12 +388,12 @@ var GameAnimations = Class.extend({
|
||||
function(next) {
|
||||
$(".card:cardId(" + cardRemovedIds + ")")
|
||||
.animate(
|
||||
{
|
||||
opacity: 0},
|
||||
{
|
||||
duration: that.getAnimationLength(that.removeCardFromPlayDuration),
|
||||
easing: "easeOutQuart",
|
||||
queue: false});
|
||||
{
|
||||
opacity: 0},
|
||||
{
|
||||
duration: that.getAnimationLength(that.removeCardFromPlayDuration),
|
||||
easing: "easeOutQuart",
|
||||
queue: false});
|
||||
setTimeout(next, that.getAnimationLength(that.removeCardFromPlayDuration));
|
||||
});
|
||||
}
|
||||
@@ -418,7 +418,7 @@ var GameAnimations = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
card.remove();
|
||||
@@ -576,6 +576,27 @@ var GameAnimations = Class.extend({
|
||||
}
|
||||
},
|
||||
|
||||
addToSkirmish: function(element, animate) {
|
||||
var that = this;
|
||||
$("#main").queue(
|
||||
function(next) {
|
||||
var cardId = element.getAttribute("cardId");
|
||||
|
||||
$(".card:cardId(" + cardId + ")").each(function() {
|
||||
$(this).data("card").skirmish = true;
|
||||
});
|
||||
|
||||
next();
|
||||
});
|
||||
if (animate) {
|
||||
$("#main").queue(
|
||||
function(next) {
|
||||
that.game.layoutUI(false);
|
||||
next();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
removeFromSkirmish: function(element, animate) {
|
||||
var that = this;
|
||||
$("#main").queue(
|
||||
|
||||
@@ -943,6 +943,8 @@ var GempLotrGameUI = Class.extend({
|
||||
this.animations.removeAssignment(gameEvent, animate);
|
||||
} else if (eventType == "SS") {
|
||||
this.animations.startSkirmish(gameEvent, animate);
|
||||
} else if (eventType == "ATS") {
|
||||
this.animations.addToSkirmish(gameEvent, animate);
|
||||
} else if (eventType == "RFS") {
|
||||
this.animations.removeFromSkirmish(gameEvent, animate);
|
||||
} else if (eventType == "ES") {
|
||||
|
||||
Reference in New Issue
Block a user