- If FP player liberates a site, it should not liberate his own anymore.
This commit is contained in:
@@ -15,20 +15,18 @@ import java.util.Set;
|
||||
|
||||
public class LiberateASiteEffect extends AbstractEffect {
|
||||
private PhysicalCard _source;
|
||||
private String _playerId;
|
||||
private String _liberatingPlayer;
|
||||
private String _liberatedSiteController;
|
||||
|
||||
public LiberateASiteEffect(PhysicalCard source) {
|
||||
this(source, source.getOwner());
|
||||
}
|
||||
|
||||
public LiberateASiteEffect(PhysicalCard source, String playerId) {
|
||||
public LiberateASiteEffect(PhysicalCard source, String liberatingPlayer, String liberatedSiteController) {
|
||||
_source = source;
|
||||
_playerId = playerId;
|
||||
_liberatingPlayer = liberatingPlayer;
|
||||
_liberatedSiteController = liberatedSiteController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return PlayConditions.canLiberateASite(game, _source.getOwner(), _source, _playerId);
|
||||
return PlayConditions.canLiberateASite(game, _source.getOwner(), _source, _liberatingPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,12 +46,12 @@ public class LiberateASiteEffect extends AbstractEffect {
|
||||
|
||||
for (int i = maxUnoccupiedSite; i >= 1; i--) {
|
||||
PhysicalCard site = game.getGameState().getSite(i);
|
||||
if (_playerId == null) {
|
||||
if (_liberatedSiteController == null) {
|
||||
if (site != null && site.getCardController() != null
|
||||
&& !site.getCardController().equals(game.getGameState().getCurrentPlayerId()))
|
||||
return site;
|
||||
} else {
|
||||
if (site != null && site.getCardController() != null && site.getCardController().equals(_playerId))
|
||||
if (site != null && site.getCardController() != null && site.getCardController().equals(_liberatedSiteController))
|
||||
return site;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +83,7 @@ public class LiberateASiteEffect extends AbstractEffect {
|
||||
for (PhysicalCard discardedCard : discardedCards)
|
||||
game.getActionsEnvironment().emitEffectResult(new DiscardCardsFromPlayResult(null, discardedCard));
|
||||
|
||||
game.getGameState().sendMessage(_playerId + " liberated a " + GameUtils.getCardLink(siteToLiberate) + " using " + GameUtils.getCardLink(_source));
|
||||
game.getGameState().sendMessage(_liberatingPlayer + " liberated a " + GameUtils.getCardLink(siteToLiberate) + " using " + GameUtils.getCardLink(_source));
|
||||
|
||||
liberatedSiteCallback(siteToLiberate);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Card10_073 extends AbstractPermanent {
|
||||
if (TriggerConditions.losesInitiative(effectResult, Side.FREE_PEOPLE)) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Card10_074 extends AbstractResponseEvent {
|
||||
}
|
||||
});
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
action.appendEffect(
|
||||
new ChoiceEffect(action, playerId, possibleEffects));
|
||||
return Collections.singletonList(action);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Card15_090 extends AbstractMinion {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new PreventableEffect(action,
|
||||
new LiberateASiteEffect(self), self.getOwner(),
|
||||
new LiberateASiteEffect(self, game.getGameState().getCurrentPlayerId(), null), self.getOwner(),
|
||||
new PreventableEffect.PreventionCost() {
|
||||
@Override
|
||||
public Effect createPreventionCostForPlayer(SubAction subAction, String playerId) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class Card15_135 extends AbstractFollower {
|
||||
if (TriggerConditions.winsSkirmish(game, effectResult, Filters.hasAttached(self))) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -51,10 +51,10 @@ public class Card15_141 extends AbstractAttachableFPPossession {
|
||||
action.appendCost(
|
||||
new SelfDiscardEffect(self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
if (Filters.mounted.accepts(game.getGameState(), game.getModifiersQuerying(), self.getAttachedTo()))
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Card17_027 extends AbstractAttachableFPPossession {
|
||||
new ExertCharactersEffect(action, self, self.getAttachedTo()));
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
possibleEffects.add(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, CardType.CONDITION, Filters.attachedTo(CardType.COMPANION)) {
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class Card17_102 extends AbstractCompanion {
|
||||
action.appendCost(
|
||||
new SelfExertEffect(action, self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class Card17_104 extends AbstractCompanion {
|
||||
AttachPermanentAction attachPermanentAction = ((AbstractAttachable) selectedCard.getBlueprint()).getPlayCardAction(playerId, game, selectedCard, Filters.and(self), 0);
|
||||
game.getActionsEnvironment().addActionToStack(attachPermanentAction);
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Card17_114 extends AbstractEvent {
|
||||
|
||||
SubCostToEffectAction subAction = new SubCostToEffectAction(action);
|
||||
subAction.appendCost(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
subAction.appendEffect(
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, urukHai, 2)));
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Card17_125 extends AbstractMinion {
|
||||
&& PlayConditions.canLiberateASite(game, playerId, self)) {
|
||||
final OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendCost(
|
||||
new LiberateASiteEffect(self) {
|
||||
new LiberateASiteEffect(self, playerId, null) {
|
||||
@Override
|
||||
public void liberatedSiteCallback(PhysicalCard liberatedSite) {
|
||||
action.appendEffect(
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Card17_138 extends AbstractPermanent {
|
||||
&& PlayConditions.canLiberateASite(game, playerId, self)) {
|
||||
final ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose an URUK-HAI minion", Culture.URUK_HAI, CardType.MINION) {
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Card18_075 extends AbstractMinion {
|
||||
&& PlayConditions.canLiberateASite(game, playerId, self, playerId)) {
|
||||
ActivateCardAction action = new ActivateCardAction(self);
|
||||
action.appendCost(
|
||||
new LiberateASiteEffect(self, playerId));
|
||||
new LiberateASiteEffect(self, playerId, playerId));
|
||||
action.appendEffect(
|
||||
new AddUntilStartOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.and(Culture.MEN, CardType.MINION), 2), Phase.REGROUP));
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Card20_343 extends AbstractAttachableFPPossession {
|
||||
if (TriggerConditions.winsSkirmish(game, effectResult, Filters.hasAttached(self), Filters.name(Names.theoden))) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Card4_071 extends AbstractCompanion {
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.not(self), Race.ELF));
|
||||
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class Card4_079 extends AbstractResponseOldEvent {
|
||||
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
possibleEffects.add(
|
||||
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, CardType.MINION) {
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class Card4_084 extends AbstractOldEvent {
|
||||
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
possibleEffects.add(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, CardType.MINION) {
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Card4_121 extends AbstractPermanent {
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Race.MAN, Keyword.RING_BOUND));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Card4_279 extends AbstractOldEvent {
|
||||
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
possibleEffects.add(
|
||||
new DrawCardsEffect(action, playerId, 3));
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Card4_292 extends AbstractCompanion {
|
||||
action.appendCost(
|
||||
new SelfExertEffect(action, self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class Card5_014 extends AbstractEvent {
|
||||
}
|
||||
});
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class Card5_085 extends AbstractEvent {
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 0, 2, CardType.CONDITION));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Card6_014 extends AbstractAttachableFPPossession {
|
||||
action.appendCost(
|
||||
new SelfDiscardEffect(self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class Card6_025 extends AbstractEvent {
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 2, 2, Race.ENT));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
action.appendEffect(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Side.SHADOW, CardType.CONDITION));
|
||||
return action;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Card6_051 extends AbstractAttachableFPPossession {
|
||||
action.appendCost(
|
||||
new SelfDiscardEffect(self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Card6_090 extends AbstractAttachableFPPossession {
|
||||
action.appendCost(
|
||||
new SelfDiscardEffect(self));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class Card7_117 extends AbstractEvent {
|
||||
|
||||
List<Effect> possibleEffects = new LinkedList<Effect>();
|
||||
possibleEffects.add(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
possibleEffects.add(
|
||||
new ChooseAndDiscardCardsFromHandEffect(action, playerId, false, 0, Integer.MAX_VALUE, Filters.any) {
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class Card7_127 extends AbstractCompanion {
|
||||
action.appendCost(
|
||||
new ChoiceEffect(action, playerId, possibleCosts));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -65,7 +65,7 @@ public class Card7_250 extends AbstractAttachableFPPossession {
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.name(Names.theoden)));
|
||||
action.appendEffect(
|
||||
new PreventableEffect(action,
|
||||
new LiberateASiteEffect(self),
|
||||
new LiberateASiteEffect(self, playerId, null),
|
||||
GameUtils.getOpponents(game, playerId),
|
||||
new PreventableEffect.PreventionCost() {
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Card9_002 extends AbstractMinion {
|
||||
public OptionalTriggerAction getKilledOptionalTrigger(String playerId, LotroGame game, PhysicalCard self) {
|
||||
if (playerId.equals(game.getGameState().getCurrentPlayerId())) {
|
||||
OptionalTriggerAction action = new OptionalTriggerAction(self);
|
||||
action.appendEffect(new LiberateASiteEffect(self));
|
||||
action.appendEffect(new LiberateASiteEffect(self, playerId, null));
|
||||
return action;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Card9_032 extends AbstractCompanion {
|
||||
action.appendCost(
|
||||
new ChooseAndDiscardCardsFromPlayEffect(action, playerId, 1, 1, Culture.GONDOR, CardType.ARTIFACT));
|
||||
action.appendEffect(
|
||||
new LiberateASiteEffect(self));
|
||||
new LiberateASiteEffect(self, playerId, null));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user