- Added animations for activating a card and removing a card form play.

This commit is contained in:
marcins78@gmail.com
2011-10-25 00:20:10 +00:00
parent 3cdacff6bb
commit e019611368
15 changed files with 116 additions and 13 deletions

View File

@@ -104,7 +104,11 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
_lotroGame.getGameState().iterateActiveTextCards(playerId, gatherActions);
return gatherActions.getActions();
List<Action> actionList = gatherActions.getActions();
for (Action action : actionList)
action.setPerformingPlayer(playerId);
return actionList;
}
@Override
@@ -116,6 +120,7 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
List<Action> result = new LinkedList<Action>();
for (Action action : gatherActions.getActions()) {
action.setPerformingPlayer(playerId);
if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action))
result.add(action);
}
@@ -158,6 +163,9 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
}
}
for (Action gatheredAction : gatheredActions)
gatheredAction.setPerformingPlayer(playerId);
return gatheredActions;
}
@@ -170,6 +178,7 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
List<Action> result = new LinkedList<Action>();
for (Action action : gatherAfterActions.getActions()) {
action.setPerformingPlayer(playerId);
if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action))
result.add(action);
}
@@ -189,12 +198,14 @@ public class DefaultActionsEnvironment implements ActionsEnvironment {
for (Action action : visitor.getActions()) {
action.setActionTimeword(_lotroGame.getGameState().getCurrentPhase());
action.setPerformingPlayer(playerId);
if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action))
playableActions.add(action);
}
for (Action action : stackedVisitor.getActions()) {
action.setActionTimeword(_lotroGame.getGameState().getCurrentPhase());
action.setPerformingPlayer(playerId);
if (_lotroGame.getModifiersQuerying().canPlayAction(_lotroGame.getGameState(), playerId, action))
playableActions.add(action);
}

View File

@@ -13,6 +13,7 @@ public abstract class AbstractCostToEffectAction implements CostToEffectAction {
private LinkedList<Effect> _effects = new LinkedList<Effect>();
private Phase _actionTimeword;
private String _performingPlayer;
@Override
public Phase getActionTimeword() {
@@ -24,6 +25,16 @@ public abstract class AbstractCostToEffectAction implements CostToEffectAction {
_actionTimeword = phase;
}
@Override
public void setPerformingPlayer(String playerId) {
_performingPlayer = playerId;
}
@Override
public String getPerformingPlayer() {
return _performingPlayer;
}
@Override
public final void appendCost(Effect cost) {
_costs.add(cost);

View File

@@ -45,7 +45,7 @@ public class ActivateCardAction extends AbstractCostToEffectAction {
public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) {
_sentMessage = true;
game.getGameState().activatedCard(_physicalCard.getOwner(), _physicalCard);
game.getGameState().activatedCard(getPerformingPlayer(), _physicalCard);
return new SendMessageEffect(getMessage());
}

View File

@@ -47,7 +47,7 @@ public class OptionalTriggerAction extends AbstractCostToEffectAction {
public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) {
_sentMessage = true;
game.getGameState().activatedCard(_physicalCard.getOwner(), _physicalCard);
game.getGameState().activatedCard(getPerformingPlayer(), _physicalCard);
return new SendMessageEffect(getMessage());
}

View File

@@ -50,6 +50,16 @@ public class PreventSubAction implements Action {
_action.setActionTimeword(phase);
}
@Override
public String getPerformingPlayer() {
return _action.getPerformingPlayer();
}
@Override
public void setPerformingPlayer(String playerId) {
_action.setPerformingPlayer(playerId);
}
@Override
public String getText(LotroGame game) {
return null;

View File

@@ -42,7 +42,7 @@ public class RequiredTriggerAction extends AbstractCostToEffectAction {
public Effect nextEffect(LotroGame game) {
if (!_sentMessage && _physicalCard != null) {
_sentMessage = true;
game.getGameState().activatedCard(null, _physicalCard);
game.getGameState().activatedCard(getPerformingPlayer(), _physicalCard);
return new SendMessageEffect(getMessage());
}

View File

@@ -40,6 +40,16 @@ public class SubAction implements Action {
_action.setActionTimeword(phase);
}
@Override
public String getPerformingPlayer() {
return _action.getPerformingPlayer();
}
@Override
public void setPerformingPlayer(String playerId) {
_action.setPerformingPlayer(playerId);
}
@Override
public String getText(LotroGame game) {
return null;

View File

@@ -7,9 +7,13 @@ import com.gempukku.lotro.game.state.LotroGame;
public interface Action {
public PhysicalCard getActionSource();
public void setActionTimeword(Phase phase);
public PhysicalCard getActionAttachedToCard();
public void setActionTimeword(Phase phase);
public void setPerformingPlayer(String playerId);
public String getPerformingPlayer();
public Phase getActionTimeword();

View File

@@ -37,6 +37,15 @@ public class PlayerReconcilesAction implements Action {
public void setActionTimeword(Phase phase) {
}
@Override
public String getPerformingPlayer() {
return null;
}
@Override
public void setPerformingPlayer(String playerId) {
}
@Override
public PhysicalCard getActionSource() {
return null;

View File

@@ -37,6 +37,15 @@ public class ResolveSkirmishAction implements Action {
public void setActionTimeword(Phase phase) {
}
@Override
public String getPerformingPlayer() {
return null;
}
@Override
public void setPerformingPlayer(String playerId) {
}
@Override
public PhysicalCard getActionSource() {
return null;

View File

@@ -24,6 +24,15 @@ public class SimpleEffectAction implements Action {
public void setActionTimeword(Phase phase) {
}
@Override
public String getPerformingPlayer() {
return null;
}
@Override
public void setPerformingPlayer(String playerId) {
}
@Override
public PhysicalCard getActionSource() {
return null;

View File

@@ -25,6 +25,15 @@ public abstract class SystemAction implements Action {
public void setActionTimeword(Phase phase) {
}
@Override
public void setPerformingPlayer(String playerId) {
}
@Override
public String getPerformingPlayer() {
return null;
}
@Override
public String getText(LotroGame game) {
throw new UnsupportedOperationException("System action has no text");

View File

@@ -15,6 +15,10 @@
border: solid #000000;
}
.highlightBorderOverlay {
border: solid #ffffff;
}
.foilOverlay {
opacity: 0.2;
}

View File

@@ -10,6 +10,7 @@ a site.
- Added multi-deck support (ugly but hopefully working).
- "We Are the Fighting Uruk-hai" correctly adds bonuses to the Uruk-hai.
- Liberating a site should no longer freeze the game.
- Added animations for activating a card and removing a card form play.
<b>23 Oct. 2011</b>
- "Hornburg Causeway" now adds +2 to archery for each unbound companion over 3, instead of +1.

View File

@@ -4,6 +4,7 @@ var GameAnimations = Class.extend({
putCardIntoPlayDuration: 1500,
cardAffectsCardDuration: 1200,
cardActivatedDuration: 1200,
removeCardFromPlayDuration: 600,
init: function(gameUI) {
this.game = gameUI;
@@ -23,12 +24,12 @@ var GameAnimations = Class.extend({
$("#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);
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6)
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6)
.switchClass("borderOverlay", "highlightBorderOverlay", that.cardActivatedDuration / 6)
.switchClass("highlightBorderOverlay", "borderOverlay", that.cardActivatedDuration / 6);
setTimeout(next, that.cardActivatedDuration);
});
}
@@ -205,6 +206,8 @@ var GameAnimations = Class.extend({
targetCardData.attachedCards.push(cardDiv);
}
that.game.layoutUI(false);
next();
});
@@ -214,8 +217,6 @@ var GameAnimations = Class.extend({
$("#main").queue(
function(next) {
that.game.layoutUI(false);
var cardDiv = $(".card:cardId(" + cardId + ")");
var card = cardDiv.data("card");
var pos = cardDiv.position();
@@ -340,6 +341,21 @@ var GameAnimations = Class.extend({
removeCardFromPlay: function(element, animate) {
var that = this;
if (animate) {
$("#main").queue(
function(next) {
var cardRemovedIds = element.getAttribute("otherCardIds").split(",");
$(".card:cardId(" + cardRemovedIds + ")")
.animate(
{
opacity: 0},
{
duration: that.removeCardFromPlayDuration,
easing: "easeOutQuart",
queue: false});
setTimeout(next, that.removeCardFromPlayDuration);
});
}
$("#main").queue(
function(next) {
var cardRemovedIds = element.getAttribute("otherCardIds").split(",");