Work on a plane.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -11,16 +12,18 @@ import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import java.util.List;
|
||||
|
||||
public class PreventMinionBeingAssignedToCharacterModifier extends AbstractModifier {
|
||||
private Side _side;
|
||||
private Filter _minionFilter;
|
||||
|
||||
public PreventMinionBeingAssignedToCharacterModifier(PhysicalCard source, Filter characterFilter, Filter minionFilter) {
|
||||
public PreventMinionBeingAssignedToCharacterModifier(PhysicalCard source, Side side, Filter characterFilter, Filter minionFilter) {
|
||||
super(source, "Is affected by assignment restriction", characterFilter, new ModifierEffect[]{ModifierEffect.ASSIGNMENT_MODIFIER});
|
||||
_side = side;
|
||||
_minionFilter = minionFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||
if (Filters.filter(minions, gameState, modifiersQuerying, _minionFilter).size() > 0)
|
||||
public boolean isValidAssignments(GameState gameState, Side side, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||
if (side == _side && Filters.filter(minions, gameState, modifiersQuerying, _minionFilter).size() > 0)
|
||||
return false;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Card1_147 extends AbstractMinion {
|
||||
action.appendEffect(new CardAffectsCardEffect(self, companion));
|
||||
action.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new PreventMinionBeingAssignedToCharacterModifier(self, Filters.sameCard(companion), Filters.sameCard(self))
|
||||
new PreventMinionBeingAssignedToCharacterModifier(self, Side.FREE_PEOPLE, Filters.sameCard(companion), Filters.sameCard(self))
|
||||
, Phase.ASSIGNMENT));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,10 +2,7 @@ package com.gempukku.lotro.cards.set2.wraith;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.modifiers.PreventMinionBeingAssignedToCharacterModifier;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Race;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
@@ -41,7 +38,7 @@ public class Card2_075 extends AbstractMinion {
|
||||
List<Modifier> modifiers = new LinkedList<Modifier>();
|
||||
modifiers.add(new RemoveKeywordModifier(self, Filters.race(Race.NAZGUL), Keyword.ROAMING));
|
||||
modifiers.add(
|
||||
new PreventMinionBeingAssignedToCharacterModifier(self, Filters.or(Filters.type(CardType.COMPANION), Filters.type(CardType.ALLY)), Filters.sameCard(self)));
|
||||
new PreventMinionBeingAssignedToCharacterModifier(self, Side.FREE_PEOPLE, Filters.or(Filters.type(CardType.COMPANION), Filters.type(CardType.ALLY)), Filters.sameCard(self)));
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.gempukku.lotro.cards.set3.elven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractCompanion;
|
||||
import com.gempukku.lotro.cards.modifiers.ArcheryTotalModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.logic.modifiers.Condition;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Side: Free
|
||||
* Culture: Elven
|
||||
* Twilight Cost: 2
|
||||
* Type: Companion • Elf
|
||||
* Strength: 6
|
||||
* Vitality: 3
|
||||
* Resistance: 6
|
||||
* Signet: Aragorn
|
||||
* Game Text: Archer. While Legolas is at a river or forest, add 1 to the fellowship archery total.
|
||||
*/
|
||||
public class Card3_121 extends AbstractCompanion {
|
||||
public Card3_121() {
|
||||
super(2, 6, 3, Culture.ELVEN, Race.ELF, Signet.ARAGORN, "Legolas", true);
|
||||
addKeyword(Keyword.ARCHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new ArcheryTotalModifier(self, Side.FREE_PEOPLE,
|
||||
new Condition() {
|
||||
@Override
|
||||
public boolean isFullfilled(GameState gameState, ModifiersQuerying modifiersQuerying) {
|
||||
PhysicalCard currentSite = gameState.getCurrentSite();
|
||||
return modifiersQuerying.hasKeyword(gameState, currentSite, Keyword.RIVER)
|
||||
|| modifiersQuerying.hasKeyword(gameState, currentSite, Keyword.FOREST);
|
||||
}
|
||||
}, 1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.gempukku.lotro.cards.set3.gondor;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractCompanion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddTwilightEffect;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.actions.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.effects.HealCharacterEffect;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Side: Free
|
||||
* Culture: Gondor
|
||||
* Twilight Cost: 3
|
||||
* Type: Companion • Man
|
||||
* Strength: 7
|
||||
* Vitality: 3
|
||||
* Resistance: 6
|
||||
* Signet: Gandalf
|
||||
* Game Text: Ranger. Fellowship: Add (2) to heal Boromir.
|
||||
*/
|
||||
public class Card3_122 extends AbstractCompanion {
|
||||
public Card3_122() {
|
||||
super(3, 7, 3, Culture.GONDOR, Race.MAN, Signet.GANDALF, "Boromir", true);
|
||||
addKeyword(Keyword.RANGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseFPCardDuringPhase(game.getGameState(), Phase.FELLOWSHIP, self)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self, Keyword.FELLOWSHIP);
|
||||
action.appendCost(
|
||||
new AddTwilightEffect(self, 2));
|
||||
action.appendEffect(
|
||||
new HealCharacterEffect(playerId, self));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.game.state.Skirmish;
|
||||
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 3
|
||||
* Type: Site
|
||||
* Site: 6
|
||||
* Game Text: Forest. Sanctuary. While the fellowship is at Caras Galadhon, no more than one minion may be assigned
|
||||
* to each skirmish.
|
||||
*/
|
||||
public class Card3_115 extends AbstractSite {
|
||||
public Card3_115() {
|
||||
super("Caras Galadhon", 6, 3, Direction.LEFT);
|
||||
addKeyword(Keyword.FOREST);
|
||||
addKeyword(Keyword.SANCTUARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new AbstractModifier(self, "No more than one minion may be assigned to each skirmish", null, new ModifierEffect[]{ModifierEffect.ASSIGNMENT_MODIFIER}) {
|
||||
@Override
|
||||
public boolean isValidAssignments(GameState gameState, Side side, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result) {
|
||||
for (Map.Entry<PhysicalCard, List<PhysicalCard>> minionsAssignedToCharacter : assignments.entrySet()) {
|
||||
PhysicalCard fp = minionsAssignedToCharacter.getKey();
|
||||
List<PhysicalCard> minions = minionsAssignedToCharacter.getValue();
|
||||
List<Skirmish> skirmishes = gameState.getAssignments();
|
||||
if (countMinionsCurrentlyAssignedToFPChar(skirmishes, fp) + minions.size() > 1)
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int countMinionsCurrentlyAssignedToFPChar(List<Skirmish> skirmishes, PhysicalCard fp) {
|
||||
for (Skirmish skirmish : skirmishes) {
|
||||
if (skirmish.getFellowshipCharacter() == fp)
|
||||
return skirmish.getShadowCharacters().size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
|
||||
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 java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 2
|
||||
* Type: Site
|
||||
* Site: 4
|
||||
* Game Text: When the fellowship moves to Eregion Hills, add a burden.
|
||||
*/
|
||||
public class Card3_116 extends AbstractSite {
|
||||
public Card3_116() {
|
||||
super("Eregion Hills", 4, 2, Direction.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_TO
|
||||
&& game.getGameState().getCurrentSite() == this) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new AddBurdenEffect(self));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 8
|
||||
* Type: Site
|
||||
* Site: 8
|
||||
* Game Text: River. Maneuver events may not be played.
|
||||
*/
|
||||
public class Card3_117 extends AbstractSite {
|
||||
public Card3_117() {
|
||||
super("Gates of Argonath", 8, 8, Direction.RIGHT);
|
||||
addKeyword(Keyword.RIVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new AbstractModifier(self, "Maneuver events may not be played", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
|
||||
@Override
|
||||
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
|
||||
PhysicalCard source = action.getActionSource();
|
||||
if (source != null && source.getBlueprint().getCardType() == CardType.EVENT
|
||||
&& modifiersQuerying.hasKeyword(gameState, source, Keyword.MANEUVER))
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Zone;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.GameState;
|
||||
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
|
||||
import com.gempukku.lotro.logic.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 6
|
||||
* Type: Site
|
||||
* Site: 7
|
||||
* Game Text: River. While the fellowship is at The Great River, cards may not be played from draw decks or discard piles.
|
||||
*/
|
||||
public class Card3_118 extends AbstractSite {
|
||||
public Card3_118() {
|
||||
// TODO Check direction of the site
|
||||
super("The Great River", 7, 6, null);
|
||||
addKeyword(Keyword.RIVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(PhysicalCard self) {
|
||||
return Collections.singletonList(
|
||||
new AbstractModifier(self, "Cards may not be played from draw decks or discard piles", null, new ModifierEffect[]{ModifierEffect.ACTION_MODIFIER}) {
|
||||
@Override
|
||||
public boolean canPlayAction(GameState gameState, ModifiersQuerying modifiersQuerying, Action action, boolean result) {
|
||||
PhysicalCard source = action.getActionSource();
|
||||
if (source != null && (source.getZone() == Zone.DECK || source.getZone() == Zone.DISCARD))
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.effects.RemoveBurdenEffect;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
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.actions.OptionalTriggerAction;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 0
|
||||
* Type: Site
|
||||
* Site: 3
|
||||
* Game Text: Sanctuary. When the fellowship moves to House of Elrond, the Free Peoples player may spot 2 Elves
|
||||
* to remove a burden.
|
||||
*/
|
||||
public class Card3_119 extends AbstractSite {
|
||||
public Card3_119() {
|
||||
// TODO Check direction of the site
|
||||
super("House of Elrond", 3, 0, null);
|
||||
addKeyword(Keyword.SANCTUARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (effectResult.getType() == EffectResult.Type.WHEN_MOVE_TO
|
||||
&& game.getGameState().getCurrentSite() == self
|
||||
&& Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.ELF)) >= 2) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new RemoveBurdenEffect(self));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gempukku.lotro.cards.set3.site;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractSite;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.costs.ChooseAndExertCharactersCost;
|
||||
import com.gempukku.lotro.cards.effects.ChooseAndWoundCharactersEffect;
|
||||
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.actions.ActivateCardAction;
|
||||
import com.gempukku.lotro.logic.timing.Action;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: Realms of Elf-lords
|
||||
* Twilight Cost: 9
|
||||
* Type: Site
|
||||
* Site: 9
|
||||
* Game Text: Maneuver: Spot 4 companions and exert your [ISENGARD] Orc to make the Free Peoples player wound
|
||||
* a companion.
|
||||
*/
|
||||
public class Card3_120 extends AbstractSite {
|
||||
public Card3_120() {
|
||||
// TODO Check direction of the site
|
||||
super("Wastes of Emyn Muil", 9, 9, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (PlayConditions.canUseSiteDuringPhase(game.getGameState(), Phase.MANEUVER, self)
|
||||
&& Filters.countSpottable(game.getGameState(), game.getModifiersQuerying(), Filters.type(CardType.COMPANION)) >= 4
|
||||
&& PlayConditions.canExert(self, game.getGameState(), game.getModifiersQuerying(), Filters.owner(playerId), Filters.culture(Culture.ISENGARD), Filters.race(Race.ORC))) {
|
||||
ActivateCardAction action = new ActivateCardAction(self, Keyword.MANEUVER);
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersCost(action, playerId, 1, 1, Filters.owner(playerId), Filters.culture(Culture.ISENGARD), Filters.race(Race.ORC)));
|
||||
action.appendEffect(
|
||||
new ChooseAndWoundCharactersEffect(action, game.getGameState().getCurrentPlayerId(), 1, 1, Filters.type(CardType.COMPANION)));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -146,12 +146,12 @@ public abstract class AbstractModifier implements Modifier {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||
public boolean isValidAssignments(GameState gameState, Side side, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result) {
|
||||
public boolean isValidAssignments(GameState gameState, Side side, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ public interface Modifier {
|
||||
|
||||
public boolean shouldSkipPhase(GameState gameState, ModifiersQuerying modifiersQuerying, Phase phase, String playerId, boolean result);
|
||||
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result);
|
||||
public boolean isValidAssignments(GameState gameState, Side Side, ModifiersQuerying modifiersQuerying, PhysicalCard companion, List<PhysicalCard> minions, boolean result);
|
||||
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result);
|
||||
public boolean isValidAssignments(GameState gameState, Side Side, ModifiersQuerying modifiersQuerying, Map<PhysicalCard, List<PhysicalCard>> assignments, boolean result);
|
||||
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
|
||||
|
||||
|
||||
@@ -356,14 +356,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, Map<PhysicalCard, List<PhysicalCard>> assignments) {
|
||||
public boolean isValidAssignments(GameState gameState, Side side, Map<PhysicalCard, List<PhysicalCard>> assignments) {
|
||||
boolean result = true;
|
||||
|
||||
for (Modifier modifier : getModifiers(ModifierEffect.ASSIGNMENT_MODIFIER)) {
|
||||
result = modifier.isValidFreePlayerAssignments(gameState, this, assignments, result);
|
||||
result = modifier.isValidAssignments(gameState, side, this, assignments, result);
|
||||
for (Map.Entry<PhysicalCard, List<PhysicalCard>> assignment : assignments.entrySet()) {
|
||||
if (affectsCardWithSkipSet(gameState, assignment.getKey(), modifier))
|
||||
result = modifier.isValidFreePlayerAssignments(gameState, this, assignment.getKey(), assignment.getValue(), result);
|
||||
result = modifier.isValidAssignments(gameState, side, this, assignment.getKey(), assignment.getValue(), result);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -49,7 +49,7 @@ public interface ModifiersQuerying {
|
||||
|
||||
public boolean shouldSkipPhase(GameState gameState, Phase phase, String playerId);
|
||||
|
||||
public boolean isValidFreePlayerAssignments(GameState gameState, Map<PhysicalCard, List<PhysicalCard>> assignments);
|
||||
public boolean isValidAssignments(GameState gameState, Side side, Map<PhysicalCard, List<PhysicalCard>> assignments);
|
||||
|
||||
public boolean canBeAssignedToSkirmish(GameState gameState, PhysicalCard card);
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.gempukku.lotro.logic.timing;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
|
||||
public abstract class AbstractNewEffect implements NewEffect {
|
||||
private Boolean _carriedOut;
|
||||
private Boolean _successful;
|
||||
|
||||
protected abstract FullEffectResult playEffectReturningResult(LotroGame game);
|
||||
|
||||
@Override
|
||||
public final EffectResult[] playEffect(LotroGame game) {
|
||||
FullEffectResult fullEffectResult = playEffectReturningResult(game);
|
||||
_carriedOut = fullEffectResult._carriedOut;
|
||||
_successful = fullEffectResult._successful;
|
||||
return fullEffectResult._results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean wasCarriedOut() {
|
||||
if (_carriedOut == null)
|
||||
throw new IllegalStateException("Effect has to be played first");
|
||||
return _carriedOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean wasSuccessful() {
|
||||
if (_successful == null)
|
||||
throw new IllegalStateException("Effect has to be played first");
|
||||
return _successful;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
_carriedOut = null;
|
||||
_successful = null;
|
||||
}
|
||||
|
||||
protected static class FullEffectResult {
|
||||
private EffectResult[] _results;
|
||||
private boolean _successful;
|
||||
private boolean _carriedOut;
|
||||
|
||||
public FullEffectResult(EffectResult[] results, boolean successful, boolean carriedOut) {
|
||||
_results = results;
|
||||
_successful = successful;
|
||||
_carriedOut = carriedOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.gempukku.lotro.logic.timing;
|
||||
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
|
||||
public interface NewEffect {
|
||||
/**
|
||||
* Returns the text tha represents this effect. This text might be displayed
|
||||
* to the user.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
public String getText(LotroGame game);
|
||||
|
||||
/**
|
||||
* Returns the type of the effect. This should list the type of effect it represents
|
||||
* if the effect is a recognizable by the game.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public EffectResult.Type getType();
|
||||
|
||||
/**
|
||||
* Checks wheather this effect can be played in full. This is required to check
|
||||
* for example for cards that give a choice of effects to carry out and one
|
||||
* that can be played in full has to be chosen.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
public boolean isPlayableInFull(LotroGame game);
|
||||
|
||||
/**
|
||||
* Plays the effect and returns it's result.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
public EffectResult[] playEffect(LotroGame game);
|
||||
|
||||
/**
|
||||
* Returns if the effect playing called earlier was successful or not. This is
|
||||
* required for checking if cost was paid and effects can be carried out.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean wasSuccessful();
|
||||
|
||||
/**
|
||||
* Returns if the effect was carried out (not prevented) in full. This is required
|
||||
* for checking if effect that player can prevent by paying some cost should be
|
||||
* played anyway. If it was prevented, the original event has to be played.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean wasCarriedOut();
|
||||
|
||||
/**
|
||||
* Resets the history and any state this effect might have, to be able to be
|
||||
* played again (for example multiple players trying to prevent the same effect.
|
||||
*/
|
||||
public void reset();
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.logic.timing.processes.turn.assign;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -66,7 +67,7 @@ public class FreePeoplePlayerAssignsMinionsGameProcess implements GameProcess {
|
||||
unassignedMinions.removeAll(minionsAssigned);
|
||||
}
|
||||
|
||||
if (!_game.getModifiersQuerying().isValidFreePlayerAssignments(_game.getGameState(), assignments))
|
||||
if (!_game.getModifiersQuerying().isValidAssignments(_game.getGameState(), Side.FREE_PEOPLE, assignments))
|
||||
throw new DecisionResultInvalidException("Assignments are not valid for the effects affecting the cards");
|
||||
|
||||
ActivateCardAction action = new ActivateCardAction(null, null);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gempukku.lotro.logic.timing.processes.turn.assign;
|
||||
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
@@ -64,6 +65,9 @@ public class ShadowPlayerAssignsHisMinionsGameProcess implements GameProcess {
|
||||
action.appendEffect(
|
||||
new AssignmentEffect(_playerId, assignments, "Shadow player assignments"));
|
||||
|
||||
if (!_game.getModifiersQuerying().isValidAssignments(_game.getGameState(), Side.SHADOW, assignments))
|
||||
throw new DecisionResultInvalidException("Assignments are not valid for the effects affecting the cards");
|
||||
|
||||
_game.getActionsEnvironment().addActionToStack(action);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user