"Event played" effect added.
This commit is contained in:
@@ -43,4 +43,6 @@ public interface GameStateListener {
|
||||
public void setZoneSize(String playerId, Zone zone, int size);
|
||||
|
||||
public void cardAffectedByCard(PhysicalCard card, PhysicalCard affectedCard);
|
||||
|
||||
public void eventPlayed(PhysicalCard card);
|
||||
}
|
||||
|
||||
@@ -224,6 +224,11 @@ public class GameState {
|
||||
listener.cardAffectedByCard(card, affectedCard);
|
||||
}
|
||||
|
||||
public void eventPlayed(PhysicalCard card) {
|
||||
for (GameStateListener listener : getAllGameStateListeners())
|
||||
listener.eventPlayed(card);
|
||||
}
|
||||
|
||||
public void stackCard(PhysicalCard card, PhysicalCard stackOn) {
|
||||
((PhysicalCardImpl) card).stackOn((PhysicalCardImpl) stackOn);
|
||||
addCardToZone(card, Zone.STACKED);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.gempukku.lotro.logic.effects;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
@@ -44,6 +45,8 @@ public class PlayCardEffect extends AbstractEffect {
|
||||
|
||||
@Override
|
||||
public EffectResult[] playEffect(LotroGame game) {
|
||||
if (_cardPlayed.getBlueprint().getCardType() == CardType.EVENT)
|
||||
game.getGameState().eventPlayed(_cardPlayed);
|
||||
return new EffectResult[]{new PlayCardResult(_cardPlayed, _attachedToCard)};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class GameEvent {
|
||||
ADD_TOKENS, REMOVE_TOKENS,
|
||||
MESSAGE, WARNING,
|
||||
ZONE_SIZE,
|
||||
CARD_AFFECTS_CARD
|
||||
CARD_AFFECTS_CARD, EVENT_PLAYED
|
||||
}
|
||||
|
||||
private String _message;
|
||||
|
||||
@@ -4,13 +4,12 @@ import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.common.Token;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.communication.GameStateListener;
|
||||
import static com.gempukku.lotro.game.GameEvent.Type.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.gempukku.lotro.game.GameEvent.Type.*;
|
||||
|
||||
public class GatheringParticipantCommunicationChannel implements GameStateListener {
|
||||
private List<GameEvent> _events = new LinkedList<GameEvent>();
|
||||
private String _self;
|
||||
@@ -120,6 +119,10 @@ public class GatheringParticipantCommunicationChannel implements GameStateListen
|
||||
_events.add(new GameEvent(CARD_AFFECTS_CARD).card(card).targetCardId(affectedCard.getCardId()));
|
||||
}
|
||||
|
||||
public void eventPlayed(PhysicalCard card) {
|
||||
_events.add(new GameEvent(EVENT_PLAYED).card(card));
|
||||
}
|
||||
|
||||
public List<GameEvent> consumeGameEvents() {
|
||||
List<GameEvent> result = _events;
|
||||
_events = new LinkedList<GameEvent>();
|
||||
|
||||
@@ -1,40 +1,96 @@
|
||||
var GameAnimations = Class.extend({
|
||||
game: null,
|
||||
animationEffectDiv: null,
|
||||
|
||||
playEventDuration: 500,
|
||||
cardAffectsCardDuration: 500,
|
||||
|
||||
init: function(gameUI) {
|
||||
this.game = gameUI;
|
||||
},
|
||||
|
||||
this.animationEffectDiv = $("<div id='animation'></div>");
|
||||
this.animationEffectDiv.hide();
|
||||
$("#main").append(this.animationEffectDiv);
|
||||
eventPlayed: function(element) {
|
||||
var that = this;
|
||||
|
||||
var participantId = element.getAttribute("participantId");
|
||||
var blueprintId = element.getAttribute("blueprintId");
|
||||
|
||||
var card = new Card(blueprintId, "ANIMATION", "anim", participantId);
|
||||
var cardDiv = createSimpleCardDiv(card.imageUrl);
|
||||
|
||||
$("#main").queue(
|
||||
function(next) {
|
||||
cardDiv.data("card", card);
|
||||
$("#main").append(cardDiv);
|
||||
|
||||
var gameWidth = $("#main").width();
|
||||
var gameHeight = $("#main").height();
|
||||
|
||||
var cardWidth = card.getWidthForHeight(gameHeight / 2);
|
||||
|
||||
$(cardDiv).css(
|
||||
{
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
top: gameHeight / 4,
|
||||
width: cardWidth,
|
||||
height: gameHeight / 2,
|
||||
"z-index": 100,
|
||||
opacity: 0});
|
||||
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
left: "+=" + (gameWidth - cardWidth)},
|
||||
{
|
||||
duration: that.playEventDuration,
|
||||
easing: "linear",
|
||||
queue: false,
|
||||
complete: next});
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 1},
|
||||
{
|
||||
duration: that.playEventDuration / 2,
|
||||
easing: "easeOutQuart",
|
||||
queue: false,
|
||||
complete: function() {
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 0},
|
||||
{
|
||||
duration: that.playEventDuration / 2,
|
||||
easing: "easeInQuart",
|
||||
queue: false
|
||||
});
|
||||
}});
|
||||
}).queue(
|
||||
function(next) {
|
||||
$(cardDiv).remove();
|
||||
next();
|
||||
});
|
||||
},
|
||||
|
||||
cardAffectsCard: function(element) {
|
||||
var that = this;
|
||||
|
||||
var participantId = element.getAttribute("participantId");
|
||||
var blueprintId = element.getAttribute("blueprintId");
|
||||
var targetCardId = element.getAttribute("targetCardId");
|
||||
|
||||
this.animationEffectDiv.queue("anim",
|
||||
var card = new Card(blueprintId, "ANIMATION", "anim", participantId);
|
||||
var cardDiv = createSimpleCardDiv(card.imageUrl);
|
||||
|
||||
$("#main").queue(
|
||||
function(next) {
|
||||
var targetCard = $(".card:cardId(" + targetCardId + ")");
|
||||
if (targetCard.length > 0) {
|
||||
var card = new Card(blueprintId, "ANIMATION", "anim", participantId);
|
||||
var cardDiv = createCardDiv(card.imageUrl);
|
||||
cardDiv.data("card", card);
|
||||
$("#main").append(cardDiv);
|
||||
|
||||
targetCard = targetCard[0];
|
||||
$("#animation").html(cardDiv);
|
||||
$("#animation").show();
|
||||
var targetCardWidth = $(targetCard).width();
|
||||
var targetCardHeight = $(targetCard).height();
|
||||
|
||||
var maxDimension = Math.max(targetCardWidth, targetCardHeight);
|
||||
|
||||
var borderWidth = Math.floor(maxDimension / 30);
|
||||
var endBorderWidth = Math.floor(maxDimension * 2 / 30);
|
||||
$("#animation").css({
|
||||
$(cardDiv).css(
|
||||
{
|
||||
position: "absolute",
|
||||
left: $(targetCard).position().left,
|
||||
top: $(targetCard).position().top,
|
||||
@@ -42,7 +98,7 @@ var GameAnimations = Class.extend({
|
||||
height: targetCardHeight,
|
||||
"z-index": 100,
|
||||
opacity: 1});
|
||||
$("#animation").animate(
|
||||
$(cardDiv).animate(
|
||||
{
|
||||
opacity: 0,
|
||||
left: "-=" + (targetCardWidth / 2),
|
||||
@@ -50,16 +106,17 @@ var GameAnimations = Class.extend({
|
||||
width: "+=" + targetCardWidth,
|
||||
height: "+=" + targetCardHeight},
|
||||
{
|
||||
duration: 800,
|
||||
easing: "easeInCubic",
|
||||
duration: that.cardAffectsCardDuration,
|
||||
easing: "easeInQuart",
|
||||
queue: false,
|
||||
complete: next
|
||||
});
|
||||
complete: next});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}).queue("anim",
|
||||
}).queue(
|
||||
function(next) {
|
||||
$("#animation").hide();
|
||||
$(cardDiv).remove();
|
||||
next();
|
||||
}).dequeue("anim");
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -85,10 +85,10 @@ var GempLotrGameUI = Class.extend({
|
||||
|
||||
this.skirmishShadowGroup = new NormalCardGroup($("#main"), function (card) {
|
||||
return card.zone == "SHADOW_CHARACTERS" && card.skirmish == true;
|
||||
});
|
||||
}, false);
|
||||
this.skirmishFellowshipGroup = new NormalCardGroup($("#main"), function (card) {
|
||||
return (card.zone == "FREE_SUPPORT" || card.zone == "FREE_CHARACTERS") && card.skirmish == true;
|
||||
});
|
||||
}, false);
|
||||
|
||||
this.initializeDialogs();
|
||||
|
||||
@@ -518,10 +518,12 @@ var GempLotrGameUI = Class.extend({
|
||||
var eventType = gameEvent.getAttribute("type");
|
||||
if (eventType == "CARD_AFFECTS_CARD") {
|
||||
this.animations.cardAffectsCard(gameEvent);
|
||||
} else if (eventType == "EVENT_PLAYED") {
|
||||
this.animations.eventPlayed(gameEvent);
|
||||
}
|
||||
}
|
||||
|
||||
var skirmish = element.getElementsByTagName("skirmish")
|
||||
var skirmish = element.getElementsByTagName("skirmish");
|
||||
if (skirmish.length > 0) {
|
||||
this.fpStrengthDiv.text(skirmish[0].getAttribute("fpStrength"));
|
||||
this.shadowStrengthDiv.text(skirmish[0].getAttribute("shadowStrength"));
|
||||
@@ -1407,8 +1409,8 @@ var GempLotrGameUI = Class.extend({
|
||||
delete this.shadowAssignGroups[previousCharacterId];
|
||||
delete this.freePeopleAssignGroups[previousCharacterId];
|
||||
|
||||
this.assignGroupDivs[this.assignGroupDivs.length - 1].remove();
|
||||
this.assignGroupDivs.splice(this.assignGroupDivs.length - 1, 1);
|
||||
this.assignGroupDivs[0].remove();
|
||||
this.assignGroupDivs.splice(0, 1);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -87,5 +87,11 @@ function createCardDiv(image, text) {
|
||||
var borderDiv = $("<div class='borderOverlay'><img class='actionArea' src='/gemp-lotr/images/pixel.png' width='100%' height='100%'></div>");
|
||||
cardDiv.append(borderDiv);
|
||||
|
||||
return cardDiv;
|
||||
}
|
||||
|
||||
function createSimpleCardDiv(image) {
|
||||
var cardDiv = $("<div class='card'><img src='" + image + "' width='100%' height='100%'></div>");
|
||||
|
||||
return cardDiv;
|
||||
}
|
||||
Reference in New Issue
Block a user