Card activation now has an animation.
This commit is contained in:
@@ -43,9 +43,11 @@ public interface GameStateListener {
|
|||||||
|
|
||||||
public void setSite(PhysicalCard card);
|
public void setSite(PhysicalCard card);
|
||||||
|
|
||||||
|
public void sendGameStats(GameStats gameStats);
|
||||||
|
|
||||||
public void cardAffectedByCard(String playerPerforming, PhysicalCard card, Collection<PhysicalCard> affectedCard);
|
public void cardAffectedByCard(String playerPerforming, PhysicalCard card, Collection<PhysicalCard> affectedCard);
|
||||||
|
|
||||||
public void eventPlayed(PhysicalCard card);
|
public void eventPlayed(PhysicalCard card);
|
||||||
|
|
||||||
public void sendGameStats(GameStats gameStats);
|
public void cardActivated(String playerPerforming, PhysicalCard card);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class GameEvent {
|
|||||||
AT, RT,
|
AT, RT,
|
||||||
M, W,
|
M, W,
|
||||||
GS,
|
GS,
|
||||||
CAC, EP
|
CAC, EP, CA
|
||||||
}
|
}
|
||||||
|
|
||||||
private String _message;
|
private String _message;
|
||||||
|
|||||||
@@ -319,6 +319,11 @@ public class GameState {
|
|||||||
listener.eventPlayed(card);
|
listener.eventPlayed(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void activatedCard(String playerPerforming, PhysicalCard card) {
|
||||||
|
for (GameStateListener listener : getAllGameStateListeners())
|
||||||
|
listener.cardActivated(playerPerforming, card);
|
||||||
|
}
|
||||||
|
|
||||||
public void setRingBearer(PhysicalCard card) {
|
public void setRingBearer(PhysicalCard card) {
|
||||||
_ringBearers.put(card.getOwner(), card);
|
_ringBearers.put(card.getOwner(), card);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.gempukku.lotro.common.Phase;
|
|||||||
import com.gempukku.lotro.common.Token;
|
import com.gempukku.lotro.common.Token;
|
||||||
import com.gempukku.lotro.communication.GameStateListener;
|
import com.gempukku.lotro.communication.GameStateListener;
|
||||||
import com.gempukku.lotro.game.PhysicalCard;
|
import com.gempukku.lotro.game.PhysicalCard;
|
||||||
|
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
|
||||||
import com.gempukku.lotro.logic.timing.GameStats;
|
import com.gempukku.lotro.logic.timing.GameStats;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -11,8 +12,6 @@ import java.util.Date;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.gempukku.lotro.game.state.GameEvent.Type.*;
|
|
||||||
|
|
||||||
public class GatheringParticipantCommunicationChannel implements GameStateListener {
|
public class GatheringParticipantCommunicationChannel implements GameStateListener {
|
||||||
private List<GameEvent> _events = new LinkedList<GameEvent>();
|
private List<GameEvent> _events = new LinkedList<GameEvent>();
|
||||||
private String _self;
|
private String _self;
|
||||||
@@ -123,9 +122,14 @@ public class GatheringParticipantCommunicationChannel implements GameStateListen
|
|||||||
_events.add(new GameEvent(PCIP).card(card).index(card.getBlueprint().getSiteNumber()));
|
_events.add(new GameEvent(PCIP).card(card).index(card.getBlueprint().getSiteNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendGameStats(GameStats gameStats) {
|
||||||
|
_events.add(new GameEvent(GS).gameStats(gameStats.makeACopy()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cardAffectedByCard(String playerPerforming, PhysicalCard card, Collection<PhysicalCard> affectedCards) {
|
public void cardAffectedByCard(String playerPerforming, PhysicalCard card, Collection<PhysicalCard> affectedCards) {
|
||||||
_events.add(new GameEvent(CAC).participantId(playerPerforming).card(card).otherCardIds(getCardIds(affectedCards)));
|
_events.add(new GameEvent(CAC).card(card).participantId(playerPerforming).otherCardIds(getCardIds(affectedCards)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,8 +138,8 @@ public class GatheringParticipantCommunicationChannel implements GameStateListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendGameStats(GameStats gameStats) {
|
public void cardActivated(String playerPerforming, PhysicalCard card) {
|
||||||
_events.add(new GameEvent(GS).gameStats(gameStats.makeACopy()));
|
_events.add(new GameEvent(CA).card(card).participantId(playerPerforming));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GameEvent> consumeGameEvents() {
|
public List<GameEvent> consumeGameEvents() {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
|
|||||||
public Effect nextEffect(LotroGame game) {
|
public Effect nextEffect(LotroGame game) {
|
||||||
if (!_sentMessage && _physicalCard != null) {
|
if (!_sentMessage && _physicalCard != null) {
|
||||||
_sentMessage = true;
|
_sentMessage = true;
|
||||||
|
game.getGameState().activatedCard(_physicalCard.getOwner(), _physicalCard);
|
||||||
return new SendMessageEffect(getMessage());
|
return new SendMessageEffect(getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
|
|||||||
public Effect nextEffect(LotroGame game) {
|
public Effect nextEffect(LotroGame game) {
|
||||||
if (!_sentMessage && _physicalCard != null) {
|
if (!_sentMessage && _physicalCard != null) {
|
||||||
_sentMessage = true;
|
_sentMessage = true;
|
||||||
|
game.getGameState().activatedCard(_physicalCard.getOwner(), _physicalCard);
|
||||||
return new SendMessageEffect(getMessage());
|
return new SendMessageEffect(getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
|
|||||||
public Effect nextEffect(LotroGame game) {
|
public Effect nextEffect(LotroGame game) {
|
||||||
if (!_sentMessage && _physicalCard != null) {
|
if (!_sentMessage && _physicalCard != null) {
|
||||||
_sentMessage = true;
|
_sentMessage = true;
|
||||||
|
game.getGameState().activatedCard(null, _physicalCard);
|
||||||
return new SendMessageEffect(getMessage());
|
return new SendMessageEffect(getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
package com.gempukku.lotro.logic.effects;
|
|
||||||
|
|
||||||
import com.gempukku.lotro.game.PhysicalCard;
|
|
||||||
import com.gempukku.lotro.game.state.LotroGame;
|
|
||||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class CardAffectsCardEffect extends UnrespondableEffect {
|
|
||||||
private String _playerPerforming;
|
|
||||||
private PhysicalCard _card;
|
|
||||||
private Collection<PhysicalCard> _affectedCards;
|
|
||||||
|
|
||||||
public CardAffectsCardEffect(String playerPerforming, PhysicalCard card, PhysicalCard affectedCard) {
|
|
||||||
this(playerPerforming, card, Collections.singleton(affectedCard));
|
|
||||||
}
|
|
||||||
|
|
||||||
public CardAffectsCardEffect(String playerPerforming, PhysicalCard card, Collection<PhysicalCard> affectedCards) {
|
|
||||||
_playerPerforming = playerPerforming;
|
|
||||||
_card = card;
|
|
||||||
_affectedCards = affectedCards;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doPlayEffect(LotroGame game) {
|
|
||||||
game.getGameState().cardAffectsCard(_playerPerforming, _card, _affectedCards);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,11 +3,39 @@ var GameAnimations = Class.extend({
|
|||||||
playEventDuration: 1500,
|
playEventDuration: 1500,
|
||||||
putCardIntoPlayDuration: 1500,
|
putCardIntoPlayDuration: 1500,
|
||||||
cardAffectsCardDuration: 1200,
|
cardAffectsCardDuration: 1200,
|
||||||
|
cardActivatedDuration: 1200,
|
||||||
|
|
||||||
init: function(gameUI) {
|
init: function(gameUI) {
|
||||||
this.game = gameUI;
|
this.game = gameUI;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cardActivated: function(element, animate) {
|
||||||
|
if (animate) {
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
var participantId = element.getAttribute("participantId");
|
||||||
|
var cardId = element.getAttribute("cardId");
|
||||||
|
|
||||||
|
// Play-out game event animation only if it's not the player who initiated it
|
||||||
|
if (this.game.spectatorMode || (participantId != this.game.bottomPlayerId)) {
|
||||||
|
var cardDiv = $(".card:cardId(" + cardId + ")");
|
||||||
|
if (cardDiv != null) {
|
||||||
|
$("#main").queue(
|
||||||
|
function(next) {
|
||||||
|
$(".borderOverlay", cardDiv)
|
||||||
|
.animate({borderColor: "#ffffff"}, that.cardActivatedDuration / 6)
|
||||||
|
.animate({borderColor: "#000000"}, that.cardActivatedDuration / 6)
|
||||||
|
.animate({borderColor: "#ffffff"}, that.cardActivatedDuration / 6)
|
||||||
|
.animate({borderColor: "#000000"}, that.cardActivatedDuration / 6)
|
||||||
|
.animate({borderColor: "#ffffff"}, that.cardActivatedDuration / 6)
|
||||||
|
.animate({borderColor: "#000000"}, that.cardActivatedDuration / 6);
|
||||||
|
setTimeout(next, that.cardActivatedDuration);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
eventPlayed: function(element, animate) {
|
eventPlayed: function(element, animate) {
|
||||||
if (animate) {
|
if (animate) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|||||||
@@ -540,6 +540,8 @@ var GempLotrGameUI = Class.extend({
|
|||||||
this.animations.cardAffectsCard(gameEvent, animate);
|
this.animations.cardAffectsCard(gameEvent, animate);
|
||||||
} else if (eventType == "EP") {
|
} else if (eventType == "EP") {
|
||||||
this.animations.eventPlayed(gameEvent, animate);
|
this.animations.eventPlayed(gameEvent, animate);
|
||||||
|
} else if (eventType == "CA") {
|
||||||
|
this.animations.cardActivated(gameEvent, animate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user