"Arrow From the South"
This commit is contained in:
@@ -4,14 +4,11 @@ import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.decisions.MultipleChoiceAwaitingDecision;
|
||||
import com.gempukku.lotro.logic.effects.DrawCardEffect;
|
||||
import com.gempukku.lotro.logic.effects.PlayoutDecisionEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,29 +27,12 @@ public class Card1_362 extends AbstractSite {
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_TO
|
||||
&& game.getGameState().getCurrentSite() == self) {
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
|
||||
String fpPlayerId = game.getGameState().getCurrentPlayerId();
|
||||
final int burdens = game.getGameState().getBurdens();
|
||||
|
||||
String[] opponents = GameUtils.getOpponents(game, fpPlayerId);
|
||||
for (String opponent : opponents) {
|
||||
final String opp = opponent;
|
||||
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
if (!playerId.equals(game.getGameState().getCurrentPlayerId())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new PlayoutDecisionEffect(game.getUserFeedback(), opponent,
|
||||
new MultipleChoiceAwaitingDecision(1, "Do you want to draw a card for each burder?", new String[]{"Yes", "No"}) {
|
||||
@Override
|
||||
protected void validDecisionMade(int index, String result) {
|
||||
if (result.equals("Yes")) {
|
||||
action.appendEffect(new DrawCardEffect(opp, burdens));
|
||||
}
|
||||
}
|
||||
}));
|
||||
actions.add(action);
|
||||
new DrawCardEffect(playerId, game.getGameState().getBurdens()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.GameUtils;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.HealCharactersEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
@@ -34,8 +35,13 @@ public class Card2_014 extends AbstractPermanent {
|
||||
&& game.getModifiersQuerying().hasKeyword(game.getGameState(), game.getGameState().getCurrentSite(), Keyword.UNDERGROUND)) {
|
||||
Collection<PhysicalCard> dwarfCompanions = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.DWARF), Filters.type(CardType.COMPANION));
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
for (PhysicalCard dwarfCompanion : dwarfCompanions) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
for (final PhysicalCard dwarfCompanion : dwarfCompanions) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self) {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Heal " + GameUtils.getCardLink(dwarfCompanion);
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new HealCharactersEffect(playerId, dwarfCompanion));
|
||||
actions.add(action);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.HealCharactersEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
@@ -37,8 +38,13 @@ public class Card2_120 extends AbstractSite {
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
|
||||
Collection<PhysicalCard> hobbitCompanions = Filters.filterActive(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.HOBBIT), Filters.type(CardType.COMPANION));
|
||||
for (PhysicalCard hobbitCompanion : hobbitCompanions) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
for (final PhysicalCard hobbitCompanion : hobbitCompanions) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self) {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Heal " + GameUtils.getCardLink(hobbitCompanion);
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new HealCharactersEffect(playerId, hobbitCompanion));
|
||||
actions.add(action);
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.GameUtils;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.modifiers.KeywordModifier;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
@@ -42,7 +43,12 @@ public class Card4_027 extends AbstractPermanent {
|
||||
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
for (final PhysicalCard physicalCard : winningDunlandMan) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(physicalCard);
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self) {
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return "Make " + GameUtils.getCardLink(physicalCard) + " strength +2 and Fierce";
|
||||
}
|
||||
};
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.sameCard(physicalCard), 2), Phase.REGROUP));
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
public enum Zone {
|
||||
FREE_CHARACTERS("play"), SUPPORT("play"), SHADOW_CHARACTERS("play"),
|
||||
ADVENTURE_PATH("play"),
|
||||
HAND("hand"), DECK("deck"), ATTACHED("play"), STACKED("stacked"),
|
||||
DISCARD("discard"), DEAD("dead pile");
|
||||
FREE_CHARACTERS("play", true), SUPPORT("play", true), SHADOW_CHARACTERS("play", true),
|
||||
ADVENTURE_PATH("play", true),
|
||||
HAND("hand", false), DECK("deck", false), ATTACHED("play", true), STACKED("stacked", false),
|
||||
DISCARD("discard", false), DEAD("dead pile", false);
|
||||
|
||||
private String _humanReadable;
|
||||
private boolean _inPlay;
|
||||
|
||||
private Zone(String humanReadable) {
|
||||
private Zone(String humanReadable, boolean inPlay) {
|
||||
_humanReadable = humanReadable;
|
||||
_inPlay = inPlay;
|
||||
}
|
||||
|
||||
public String getHumanReadable() {
|
||||
return _humanReadable;
|
||||
}
|
||||
|
||||
public boolean isInPlay() {
|
||||
return _inPlay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +108,16 @@ public class TurnProcedure {
|
||||
if (!_checkedOptionalWhenResponses) {
|
||||
_checkedOptionalWhenResponses = true;
|
||||
ActivateCardAction action = new ActivateCardAction(null, null);
|
||||
|
||||
Map<String, List<Action>> optionalAfterTriggers = new HashMap<String, List<Action>>();
|
||||
for (String playerId : _game.getGameState().getPlayerOrder().getAllPlayers()) {
|
||||
List<Action> actions = new LinkedList<Action>();
|
||||
actions.addAll(_game.getActionsEnvironment().getOptionalAfterTriggers(playerId, _effectResults));
|
||||
optionalAfterTriggers.put(playerId, actions);
|
||||
}
|
||||
|
||||
action.appendEffect(
|
||||
new PlayoutOptionalAfterResponsesEffect(action, new HashSet<PhysicalCard>(), _game.getGameState().getPlayerOrder().getCounterClockwisePlayOrder(_game.getGameState().getCurrentPlayerId(), true), 0, _effect, _effectResults));
|
||||
new PlayoutOptionalAfterResponsesEffect(action, optionalAfterTriggers, _game.getGameState().getPlayerOrder().getCounterClockwisePlayOrder(_game.getGameState().getCurrentPlayerId(), true), 0, _effect, _effectResults));
|
||||
return new StackActionEffect(action);
|
||||
}
|
||||
}
|
||||
@@ -177,15 +185,15 @@ public class TurnProcedure {
|
||||
|
||||
private class PlayoutOptionalAfterResponsesEffect extends UnrespondableEffect {
|
||||
private ActivateCardAction _action;
|
||||
private Set<PhysicalCard> _cardTriggersUsed;
|
||||
private Map<String, List<Action>> _unplayedAfterTriggers;
|
||||
private PlayOrder _playOrder;
|
||||
private int _passCount;
|
||||
private Effect _effect;
|
||||
private EffectResult[] _effectResults;
|
||||
|
||||
private PlayoutOptionalAfterResponsesEffect(ActivateCardAction action, Set<PhysicalCard> cardTriggersUsed, PlayOrder playOrder, int passCount, Effect effect, EffectResult[] effectResults) {
|
||||
private PlayoutOptionalAfterResponsesEffect(ActivateCardAction action, Map<String, List<Action>> unplayedAfterTriggers, PlayOrder playOrder, int passCount, Effect effect, EffectResult[] effectResults) {
|
||||
_action = action;
|
||||
_cardTriggersUsed = cardTriggersUsed;
|
||||
_unplayedAfterTriggers = unplayedAfterTriggers;
|
||||
_playOrder = playOrder;
|
||||
_passCount = passCount;
|
||||
_effect = effect;
|
||||
@@ -196,12 +204,15 @@ public class TurnProcedure {
|
||||
public void doPlayEffect(LotroGame game) {
|
||||
final String activePlayer = _playOrder.getNextPlayer();
|
||||
|
||||
final List<Action> optionalAfterTriggers = game.getActionsEnvironment().getOptionalAfterTriggers(activePlayer, _effectResults);
|
||||
// Remove triggers already resolved
|
||||
final List<Action> optionalAfterTriggers = _unplayedAfterTriggers.get(activePlayer);
|
||||
|
||||
// Remove triggers for cards no longer in play
|
||||
final Iterator<Action> triggersIterator = optionalAfterTriggers.iterator();
|
||||
while (triggersIterator.hasNext())
|
||||
if (_cardTriggersUsed.contains(triggersIterator.next().getActionSource()))
|
||||
while (triggersIterator.hasNext()) {
|
||||
final PhysicalCard actionSource = triggersIterator.next().getActionSource();
|
||||
if (!actionSource.getZone().isInPlay())
|
||||
triggersIterator.remove();
|
||||
}
|
||||
|
||||
final List<Action> optionalAfterActions = _game.getActionsEnvironment().getOptionalAfterActions(activePlayer, _effectResults);
|
||||
|
||||
@@ -217,18 +228,18 @@ public class TurnProcedure {
|
||||
if (action != null) {
|
||||
_game.getActionsEnvironment().addActionToStack(action);
|
||||
if (optionalAfterTriggers.contains(action))
|
||||
_cardTriggersUsed.add(action.getActionSource());
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _cardTriggersUsed, _playOrder, 0, _effect, _effectResults));
|
||||
optionalAfterActions.remove(action);
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _unplayedAfterTriggers, _playOrder, 0, _effect, _effectResults));
|
||||
} else {
|
||||
if ((_passCount + 1) < _playOrder.getPlayerCount()) {
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _cardTriggersUsed, _playOrder, _passCount + 1, _effect, _effectResults));
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _unplayedAfterTriggers, _playOrder, _passCount + 1, _effect, _effectResults));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if ((_passCount + 1) < _playOrder.getPlayerCount()) {
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _cardTriggersUsed, _playOrder, _passCount + 1, _effect, _effectResults));
|
||||
_action.appendEffect(new PlayoutOptionalAfterResponsesEffect(_action, _unplayedAfterTriggers, _playOrder, _passCount + 1, _effect, _effectResults));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,21 +273,21 @@ var GempLotrGameUI = Class.extend({
|
||||
initializeDialogs: function() {
|
||||
this.smallDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
resizable: false,
|
||||
width: 400,
|
||||
height: 200
|
||||
});
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
resizable: false,
|
||||
width: 400,
|
||||
height: 200
|
||||
});
|
||||
|
||||
this.cardActionDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
resizable: true,
|
||||
width: 600,
|
||||
height: 300
|
||||
});
|
||||
autoOpen: false,
|
||||
closeOnEscape: false,
|
||||
resizable: true,
|
||||
width: 600,
|
||||
height: 300
|
||||
});
|
||||
|
||||
var that = this;
|
||||
|
||||
@@ -302,15 +302,15 @@ var GempLotrGameUI = Class.extend({
|
||||
|
||||
this.infoDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
title: "Card information",
|
||||
minHeight: 80,
|
||||
minWidth: 200,
|
||||
width: Math.max(600, width * 0.75),
|
||||
height: Math.max(300, height * 0.75)
|
||||
});
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
title: "Card information",
|
||||
minHeight: 80,
|
||||
minWidth: 200,
|
||||
width: Math.max(600, width * 0.75),
|
||||
height: Math.max(300, height * 0.75)
|
||||
});
|
||||
|
||||
var swipeOptions = {
|
||||
threshold: 20,
|
||||
@@ -603,9 +603,9 @@ var GempLotrGameUI = Class.extend({
|
||||
else if (zone == "DISCARD")
|
||||
$("#discard" + this.getPlayerIndex(playerId)).text("Discard: " + count);
|
||||
else if (zone == "DEAD")
|
||||
$("#deadPile" + this.getPlayerIndex(playerId)).text("Dead pile: " + count);
|
||||
else if (zone == "DECK")
|
||||
$("#deck" + this.getPlayerIndex(playerId)).text("Deck: " + count);
|
||||
$("#deadPile" + this.getPlayerIndex(playerId)).text("Dead pile: " + count);
|
||||
else if (zone == "DECK")
|
||||
$("#deck" + this.getPlayerIndex(playerId)).text("Deck: " + count);
|
||||
},
|
||||
|
||||
playerPosition: function(element) {
|
||||
@@ -773,7 +773,7 @@ var GempLotrGameUI = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
var card = $(".card:cardId(" + cardId + ")");
|
||||
var cardData = card.data("card");
|
||||
@@ -895,7 +895,7 @@ var GempLotrGameUI = Class.extend({
|
||||
if (index != -1)
|
||||
cardData.attachedCards.splice(index, 1);
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
card.remove();
|
||||
@@ -967,13 +967,13 @@ var GempLotrGameUI = Class.extend({
|
||||
this.smallDialog
|
||||
.html(text + "<br /><input id='integerDecision' type='text' value='0'>")
|
||||
.dialog("option", "buttons",
|
||||
{
|
||||
"OK": function() {
|
||||
$(this).dialog("close");
|
||||
that.decisionFunction(id, $("#integerDecision").val());
|
||||
}
|
||||
}
|
||||
);
|
||||
{
|
||||
"OK": function() {
|
||||
$(this).dialog("close");
|
||||
that.decisionFunction(id, $("#integerDecision").val());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$("#integerDecision").SpinnerControl({ type: 'range',
|
||||
typedata: {
|
||||
@@ -1005,13 +1005,13 @@ var GempLotrGameUI = Class.extend({
|
||||
this.smallDialog
|
||||
.html(html)
|
||||
.dialog("option", "buttons",
|
||||
{
|
||||
"OK": function() {
|
||||
$(this).dialog("close");
|
||||
that.decisionFunction(id, $("#multipleChoiceDecision").val());
|
||||
}
|
||||
}
|
||||
);
|
||||
{
|
||||
"OK": function() {
|
||||
$(this).dialog("close");
|
||||
that.decisionFunction(id, $("#multipleChoiceDecision").val());
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
this.smallDialog.dialog("open");
|
||||
},
|
||||
@@ -1156,7 +1156,7 @@ var GempLotrGameUI = Class.extend({
|
||||
|
||||
var selectedCardIds = new Array();
|
||||
|
||||
this.alertText.text(text);
|
||||
this.alertText.html(text);
|
||||
|
||||
var processButtons = function() {
|
||||
that.alertButtons.html("");
|
||||
@@ -1260,8 +1260,8 @@ var GempLotrGameUI = Class.extend({
|
||||
$(div).find('LI.hover').removeClass('hover');
|
||||
$(this).parent().addClass('hover');
|
||||
}).mouseout(function() {
|
||||
$(div).find('LI.hover').removeClass('hover');
|
||||
});
|
||||
$(div).find('LI.hover').removeClass('hover');
|
||||
});
|
||||
|
||||
var getRidOfContextMenu = function() {
|
||||
$(div).remove();
|
||||
@@ -1380,7 +1380,7 @@ var GempLotrGameUI = Class.extend({
|
||||
|
||||
var that = this;
|
||||
|
||||
this.alertText.text(text);
|
||||
this.alertText.html(text);
|
||||
|
||||
var selectedCardIds = new Array();
|
||||
|
||||
@@ -1448,7 +1448,7 @@ var GempLotrGameUI = Class.extend({
|
||||
|
||||
var that = this;
|
||||
|
||||
this.alertText.text(text);
|
||||
this.alertText.html(text);
|
||||
this.alertButtons.html("<button id='Done'>Done</button>");
|
||||
$("#Done").button().click(function() {
|
||||
that.alertText.html("");
|
||||
|
||||
Reference in New Issue
Block a user