Splitting assignment resolve effect results into multiple for each character.
This commit is contained in:
@@ -14,9 +14,6 @@ import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class TriggerConditions {
|
||||
public static boolean losesInitiative(EffectResult effectResult, Side side) {
|
||||
if (effectResult.getType() == EffectResult.Type.INITIATIVE_CHANGE) {
|
||||
@@ -79,7 +76,7 @@ public class TriggerConditions {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean assigned(LotroGame game, EffectResult effectResult, Side side, Filterable againstFilter, Filterable... cardFilters) {
|
||||
public static boolean assignedAgainst(LotroGame game, EffectResult effectResult, Side side, Filterable againstFilter, Filterable... assignedFilters) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (side != null) {
|
||||
@@ -92,16 +89,8 @@ public class TriggerConditions {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<PhysicalCard, Set<PhysicalCard>> assignments = assignmentResult.getAssignments();
|
||||
for (PhysicalCard matchingFPCard : Filters.filter(assignments.keySet(), game.getGameState(), game.getModifiersQuerying(), cardFilters)) {
|
||||
if (Filters.filter(assignments.get(matchingFPCard), game.getGameState(), game.getModifiersQuerying(), againstFilter).size() > 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
for (PhysicalCard matchingAgainstCard : Filters.filter(assignments.keySet(), game.getGameState(), game.getModifiersQuerying(), againstFilter)) {
|
||||
if (Filters.filter(assignments.get(matchingAgainstCard), game.getGameState(), game.getModifiersQuerying(), cardFilters).size() > 0)
|
||||
return true;
|
||||
}
|
||||
return Filters.and(assignedFilters).accepts(game.getGameState(), game.getModifiersQuerying(), assignmentResult.getAssignedCard())
|
||||
&& Filters.filter(assignmentResult.getAgainst(), game.getGameState(), game.getModifiersQuerying(), againstFilter).size() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set1.sauron;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
import com.gempukku.lotro.cards.effects.ChoiceEffect;
|
||||
@@ -9,12 +10,12 @@ import com.gempukku.lotro.cards.effects.choose.ChooseAndDiscardCardsFromHandEffe
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
@@ -55,8 +56,7 @@ public class Card1_244 extends AbstractAttachable {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT
|
||||
&& ((AssignmentResult) effectResult).getAssignments().containsKey(self.getAttachedTo())) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Filters.any, Filters.hasAttached(self))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Card1_279 extends AbstractAttachable {
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getAssignments().containsKey(self.getAttachedTo()))
|
||||
if (assignmentResult.getAssignedCard() == self.getAttachedTo())
|
||||
self.storeData(true);
|
||||
else if (self.getData() == null)
|
||||
self.storeData(false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Card10_021 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Card10_049 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, null, Race.MAN, self)) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Race.MAN, self)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new WoundCharactersEffect(self, Filters.assignedAgainst(self)));
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.gempukku.lotro.cards.set4.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractPermanent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndPlayCardFromDiscardEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -11,9 +13,8 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,21 +33,12 @@ public class Card4_170 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())) {
|
||||
int count = Filters.filter(assignmentResult.getAssignments().keySet(), game.getGameState(), game.getModifiersQuerying(), CardType.ALLY).size();
|
||||
List<OptionalTriggerAction> optionalTriggers = new LinkedList<OptionalTriggerAction>();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndPlayCardFromDiscardEffect(playerId, game, -2, Filters.and(CardType.MINION, Culture.ISENGARD)));
|
||||
optionalTriggers.add(action);
|
||||
}
|
||||
|
||||
return optionalTriggers;
|
||||
}
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, CardType.ALLY)
|
||||
&& PlayConditions.canPlayFromDiscard(playerId, game, -2, Culture.ISENGARD, CardType.MINION)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ChooseAndPlayCardFromDiscardEffect(playerId, game, -2, Filters.and(CardType.MINION, Culture.ISENGARD)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set4.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -13,7 +14,6 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -45,15 +45,11 @@ public class Card4_172 extends AbstractAttachable {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())
|
||||
&& assignmentResult.getAssignments().keySet().contains(self.getAttachedTo())) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, CardType.ALLY));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, Filters.hasAttached(self))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, CardType.ALLY));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
package com.gempukku.lotro.cards.set4.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
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.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Set: The Two Towers
|
||||
@@ -35,21 +37,13 @@ public class Card4_178 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.and(Culture.ISENGARD, Race.MAN), Filters.or(CardType.COMPANION, CardType.ALLY))) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())) {
|
||||
List<RequiredTriggerAction> actions = new LinkedList<RequiredTriggerAction>();
|
||||
for (Map.Entry<PhysicalCard, Set<PhysicalCard>> physicalCardListEntry : assignmentResult.getAssignments().entrySet()) {
|
||||
if (Filters.filter(physicalCardListEntry.getValue(), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Race.MAN).size() > 0) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, physicalCardListEntry.getKey()));
|
||||
actions.add(action);
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.setText("Exert " + GameUtils.getCardLink(assignmentResult.getAssignedCard()));
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, assignmentResult.getAssignedCard()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gempukku.lotro.cards.set4.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -12,7 +13,6 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -39,18 +39,11 @@ public class Card4_212 extends AbstractAttachable {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())) {
|
||||
if (assignmentResult.getAssignments().keySet().contains(self.getAttachedTo())) {
|
||||
if (Filters.filter(assignmentResult.getAssignments().get(self.getAttachedTo()), game.getGameState(), game.getModifiersQuerying(), Culture.ISENGARD, Keyword.TRACKER).size() > 0) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, self.getAttachedTo()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.and(Culture.ISENGARD, Keyword.TRACKER), Filters.hasAttached(self))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, self.getAttachedTo()));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set4.raider;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
import com.gempukku.lotro.cards.effects.SelfExertEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -12,12 +13,9 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Set: The Two Towers
|
||||
@@ -38,19 +36,14 @@ public class Card4_226 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Filters.unboundCompanion, self)
|
||||
&& PlayConditions.canExert(self, game, Filters.sameCard(self))) {
|
||||
AssignmentResult result = (AssignmentResult) effectResult;
|
||||
for (Map.Entry<PhysicalCard, Set<PhysicalCard>> oneAssignment : result.getAssignments().entrySet()) {
|
||||
if (oneAssignment.getValue().contains(self) && Filters.unboundCompanion.accepts(game.getGameState(), game.getModifiersQuerying(), oneAssignment.getKey())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendCost(
|
||||
new SelfExertEffect(self));
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendCost(
|
||||
new SelfExertEffect(self));
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.cards.set4.raider;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
import com.gempukku.lotro.cards.effects.SelfExertEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
@@ -12,12 +13,9 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Set: The Two Towers
|
||||
@@ -38,19 +36,14 @@ public class Card4_228 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Filters.unboundCompanion, self)
|
||||
&& PlayConditions.canExert(self, game, Filters.sameCard(self))) {
|
||||
AssignmentResult result = (AssignmentResult) effectResult;
|
||||
for (Map.Entry<PhysicalCard, Set<PhysicalCard>> oneAssignment : result.getAssignments().entrySet()) {
|
||||
if (oneAssignment.getValue().contains(self) && Filters.unboundCompanion.accepts(game.getGameState(), game.getModifiersQuerying(), oneAssignment.getKey())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendCost(
|
||||
new SelfExertEffect(self));
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
}
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendCost(
|
||||
new SelfExertEffect(self));
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.gempukku.lotro.cards.set4.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.common.Block;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.RequiredTriggerAction;
|
||||
import com.gempukku.lotro.logic.effects.AddTwilightEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -28,15 +31,11 @@ public class Card4_336 extends AbstractSite {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())) {
|
||||
int assignedCount = assignmentResult.getAssignments().keySet().size();
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(self, assignedCount));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, Filters.or(CardType.COMPANION, CardType.ALLY))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(self, 1));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Card7_133 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
&& PlayConditions.hasInitiative(game, Side.SHADOW)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Card7_134 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
&& PlayConditions.hasInitiative(game, Side.SHADOW)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Card7_135 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)
|
||||
&& PlayConditions.hasInitiative(game, Side.SHADOW)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Card7_163 extends AbstractMinion {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, Side.FREE_PEOPLE, Filters.any, self)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfTurnModifierEffect(
|
||||
|
||||
@@ -70,7 +70,7 @@ public class Card8_028 extends AbstractPermanent {
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.assigned(game, effectResult, null, Filters.any, Filters.hasAttached(self))) {
|
||||
if (TriggerConditions.assignedAgainst(game, effectResult, null, Filters.any, Filters.hasAttached(self))) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new ExertCharactersEffect(self, Filters.hasAttached(self)));
|
||||
|
||||
@@ -10,8 +10,6 @@ import com.gempukku.lotro.logic.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class AssignmentEffect extends AbstractEffect {
|
||||
private String _playerId;
|
||||
@@ -55,8 +53,9 @@ public class AssignmentEffect extends AbstractEffect {
|
||||
game.getGameState().sendMessage(_playerId + " assigns " + GameUtils.getCardLink(_minion) + " to skirmish " + GameUtils.getCardLink(_fpChar));
|
||||
game.getGameState().assignToSkirmishes(_fpChar, Collections.singleton(_minion));
|
||||
|
||||
final Map<PhysicalCard, Set<PhysicalCard>> assignments = Collections.singletonMap(_fpChar, Collections.singleton(_minion));
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, assignments));
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, _fpChar, _minion));
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, _minion, _fpChar));
|
||||
|
||||
return new FullEffectResult(true, true);
|
||||
}
|
||||
return new FullEffectResult(false, false);
|
||||
|
||||
@@ -51,8 +51,11 @@ public class AssignmentPhaseEffect extends AbstractEffect {
|
||||
PhysicalCard fpChar = physicalCardListEntry.getKey();
|
||||
Set<PhysicalCard> minions = physicalCardListEntry.getValue();
|
||||
game.getGameState().assignToSkirmishes(fpChar, minions);
|
||||
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, fpChar, minions));
|
||||
for (PhysicalCard minion : minions)
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, minion, fpChar));
|
||||
}
|
||||
game.getActionsEnvironment().emitEffectResult(new AssignmentResult(_playerId, _assignments));
|
||||
return new FullEffectResult(true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,24 +4,37 @@ import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class AssignmentResult extends EffectResult {
|
||||
private String _playerId;
|
||||
private Map<PhysicalCard, Set<PhysicalCard>> _assignments;
|
||||
private PhysicalCard _assignedCard;
|
||||
private Set<PhysicalCard> _against;
|
||||
|
||||
public AssignmentResult(String playerId, Map<PhysicalCard, Set<PhysicalCard>> assignments) {
|
||||
public AssignmentResult(String playerId, PhysicalCard assignedCard, PhysicalCard against) {
|
||||
super(EffectResult.Type.ASSIGNMENT);
|
||||
_playerId = playerId;
|
||||
_assignments = assignments;
|
||||
_assignedCard = assignedCard;
|
||||
_against = Collections.singleton(against);
|
||||
}
|
||||
|
||||
public AssignmentResult(String playerId, PhysicalCard assignedCard, Set<PhysicalCard> against) {
|
||||
super(EffectResult.Type.ASSIGNMENT);
|
||||
_playerId = playerId;
|
||||
_assignedCard = assignedCard;
|
||||
_against = against;
|
||||
}
|
||||
|
||||
public String getPlayerId() {
|
||||
return _playerId;
|
||||
}
|
||||
|
||||
public Map<PhysicalCard, Set<PhysicalCard>> getAssignments() {
|
||||
return Collections.unmodifiableMap(_assignments);
|
||||
public Set<PhysicalCard> getAgainst() {
|
||||
return _against;
|
||||
}
|
||||
|
||||
public PhysicalCard getAssignedCard() {
|
||||
return _assignedCard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.gempukku.lotro.logic.timing.rules;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.AbstractActionProxy;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
@@ -10,9 +12,8 @@ import com.gempukku.lotro.logic.effects.AddTwilightEffect;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
import com.gempukku.lotro.logic.timing.results.AssignmentResult;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AmbushRule {
|
||||
private DefaultActionsEnvironment _actionsEnvironment;
|
||||
@@ -29,20 +30,15 @@ public class AmbushRule {
|
||||
if (effectResult.getType() == EffectResult.Type.ASSIGNMENT) {
|
||||
AssignmentResult assignmentResult = (AssignmentResult) effectResult;
|
||||
if (assignmentResult.getPlayerId().equals(game.getGameState().getCurrentPlayerId())) {
|
||||
List<OptionalTriggerAction> actions = new LinkedList<OptionalTriggerAction>();
|
||||
for (Set<PhysicalCard> minions : assignmentResult.getAssignments().values()) {
|
||||
for (PhysicalCard minion : minions) {
|
||||
if (game.getModifiersQuerying().hasKeyword(game.getGameState(), minion, Keyword.AMBUSH) && minion.getOwner().equals(playerId)) {
|
||||
final int count = game.getModifiersQuerying().getKeywordCount(game.getGameState(), minion, Keyword.AMBUSH);
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(minion);
|
||||
action.setText("Ambush - add " + count);
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(minion, count));
|
||||
actions.add(action);
|
||||
}
|
||||
}
|
||||
PhysicalCard assignedCard = assignmentResult.getAssignedCard();
|
||||
if (Filters.and(CardType.MINION, Keyword.AMBUSH).accepts(game.getGameState(), game.getModifiersQuerying(), assignedCard)) {
|
||||
final int count = game.getModifiersQuerying().getKeywordCount(game.getGameState(), assignedCard, Keyword.AMBUSH);
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(assignedCard);
|
||||
action.setText("Ambush - add " + count);
|
||||
action.appendEffect(
|
||||
new AddTwilightEffect(assignedCard, count));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user