diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_092.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_092.java index 4087e1ed5..5ef04a26d 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_092.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/gondor/Card1_092.java @@ -39,7 +39,8 @@ public class Card1_092 extends AbstractAttachableFPPossession { @Override public List getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) { - if (PlayConditions.isWounded(effectResult, self.getAttachedTo())) { + if (PlayConditions.isWounded(effectResult, self.getAttachedTo()) + && game.getGameState().getCurrentPhase() == Phase.SKIRMISH) { RequiredTriggerAction action = new RequiredTriggerAction(self, null, "Apply damage prevention"); action.addEffect(new CardAffectsCardEffect(self, self.getAttachedTo())); action.addEffect( diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java index d6abe1120..6574b10f5 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroGameMediator.java @@ -167,7 +167,7 @@ public class LotroGameMediator { public void concede(String playerId) { _writeLock.lock(); try { - if (_lotroGame.getWinnerPlayerId() == null) + if (_lotroGame.getWinnerPlayerId() == null && _playersPlaying.contains(playerId)) _lotroGame.playerLost(playerId, "Concession"); } finally { _writeLock.unlock(); diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html index 3cd20044b..d26008fcb 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/game.html @@ -128,6 +128,7 @@ + diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js new file mode 100644 index 000000000..99e6102dc --- /dev/null +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameAnimations.js @@ -0,0 +1,65 @@ +var GameAnimations = Class.extend({ + game: null, + animationEffectDiv: null, + + + init: function(gameUI) { + this.game = gameUI; + + this.animationEffectDiv = $("
"); + this.animationEffectDiv.hide(); + $("#main").append(this.animationEffectDiv); + }, + + cardAffectsCard: function(element) { + var participantId = element.getAttribute("participantId"); + var blueprintId = element.getAttribute("blueprintId"); + var targetCardId = element.getAttribute("targetCardId"); + + this.animationEffectDiv.queue("anim", + 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); + + 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({ + position: "absolute", + left: $(targetCard).position().left, + top: $(targetCard).position().top, + width: targetCardWidth, + height: targetCardHeight, + "z-index": 100, + opacity: 1}); + $("#animation").animate( + { + opacity: 0, + left: "-=" + (targetCardWidth / 2), + top: "-=" + (targetCardHeight / 2), + width: "+=" + targetCardWidth, + height: "+=" + targetCardHeight}, + { + duration: 800, + easing: "easeInCubic", + queue: false, + complete: next + }); + } + }).queue("anim", + function(next) { + $("#animation").hide(); + next(); + }).dequeue("anim"); + } +}); \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js index d941f5b37..6483f1fb7 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js @@ -54,11 +54,14 @@ var GempLotrGameUI = Class.extend({ tabPane: null, - animationEffectDiv: null, + animations: null, init: function(url) { log("ui initialized"); var that = this; + + this.animations = new GameAnimations(this); + this.communication = new GempLotrCommunication("/gemp-lotr/server", function() { that.chatBox.appendMessage("There was a problem communicating with the server, if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage"); @@ -182,9 +185,6 @@ var GempLotrGameUI = Class.extend({ that.clickCardFunction(event); }); - this.animationEffectDiv = $("
"); - this.animationEffectDiv.hide(); - $("#main").append(this.animationEffectDiv); }, addBottomLeftTabPane: function() { @@ -517,7 +517,7 @@ var GempLotrGameUI = Class.extend({ var gameEvent = gameEvents[i]; var eventType = gameEvent.getAttribute("type"); if (eventType == "CARD_AFFECTS_CARD") { - this.cardAffectsCard(gameEvent); + this.animations.cardAffectsCard(gameEvent); } } @@ -648,58 +648,6 @@ var GempLotrGameUI = Class.extend({ this.chatBox.appendMessage(message, "warningMessage"); }, - cardAffectsCard: function(element) { - var participantId = element.getAttribute("participantId"); - var blueprintId = element.getAttribute("blueprintId"); - var targetCardId = element.getAttribute("targetCardId"); - - var card = new Card(blueprintId, "ANIMATION", "anim", participantId); - var cardDiv = createCardDiv(card.imageUrl); - cardDiv.data("card", card); - - this.animationEffectDiv.queue("anim", - function(next) { - var targetCard = $(".card:cardId(" + targetCardId + ")"); - if (targetCard.length > 0) { - 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({ - position: "absolute", - left: $(targetCard).position().left, - top: $(targetCard).position().top, - width: targetCardWidth, - height: targetCardHeight, - "z-index": 100, - opacity: 1}); - $("#animation").animate( - { - opacity: 0, - left: "-=" + (targetCardWidth / 2), - top: "-=" + (targetCardHeight / 2), - width: "+=" + targetCardWidth, - height: "+=" + targetCardHeight}, - { - duration: 500, - easing: "easeInCubic", - queue: false, - complete: next - }); - } - }).queue("anim", - function(next) { - $("#animation").hide(); - next(); - }).dequeue("anim"); - }, - startSkirmish: function(element) { var cardId = element.getAttribute("cardId"); var opposingCardIds = element.getAttribute("opposingCardIds").split(",");