This commit is contained in:
marcins78@gmail.com
2011-10-13 16:32:24 +00:00
parent bac009995a
commit ed12534517
26 changed files with 163 additions and 44 deletions

View File

@@ -5,11 +5,11 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
public class PreventEffect extends UnrespondableEffect {
public class PreventCardEffect extends UnrespondableEffect {
private AbstractPreventableCardEffect _effect;
private PhysicalCard _card;
public PreventEffect(AbstractPreventableCardEffect effect, PhysicalCard card) {
public PreventCardEffect(AbstractPreventableCardEffect effect, PhysicalCard card) {
_effect = effect;
_card = card;
}

View File

@@ -6,11 +6,14 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.GameUtils;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.Preventable;
public class TakeControlOfASiteEffect extends AbstractEffect {
public class TakeControlOfASiteEffect extends AbstractEffect implements Preventable {
private PhysicalCard _source;
private String _playerId;
private boolean _prevented;
public TakeControlOfASiteEffect(PhysicalCard source, String playerId) {
_source = source;
_playerId = playerId;
@@ -42,15 +45,26 @@ public class TakeControlOfASiteEffect extends AbstractEffect {
@Override
public EffectResult.Type getType() {
return null;
return EffectResult.Type.TAKE_CONTROL_OF_A_SITE;
}
@Override
public void prevent() {
_prevented = true;
}
@Override
public boolean isPrevented() {
return _prevented;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
PhysicalCard site = getFirstControllableSite(game);
if (site != null) {
if (site != null && !_prevented) {
game.getGameState().takeControlOfCard(_playerId, site, Zone.SUPPORT);
game.getGameState().sendMessage(_playerId + " took control of " + GameUtils.getCardLink(site));
return new FullEffectResult(null, true, true);
}
return new FullEffectResult(null, false, false);
}

View File

@@ -65,7 +65,7 @@ public class Card1_001 extends AbstractAttachable {
List<Action> actions = new LinkedList<Action>();
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new PreventEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 2));
action.appendEffect(new PutOnTheOneRingEffect());
action.appendEffect(new AddUntilStartOfPhaseActionProxyEffect(
@@ -98,7 +98,7 @@ public class Card1_001 extends AbstractAttachable {
WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
if (woundEffect.getAffectedCardsMinusPrevented(game).contains(self.getAttachedTo())) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new PreventEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 2));
return Collections.singletonList(action);
}

View File

@@ -64,7 +64,7 @@ public class Card1_002 extends AbstractAttachable {
List<Action> actions = new LinkedList<Action>();
ActivateCardAction action = new ActivateCardAction(self);
action.appendEffect(new PreventEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 1));
action.appendEffect(new PutOnTheOneRingEffect());
action.appendEffect(new AddUntilStartOfPhaseActionProxyEffect(
@@ -98,7 +98,7 @@ public class Card1_002 extends AbstractAttachable {
if (woundEffect.getAffectedCardsMinusPrevented(game).contains(self.getAttachedTo())) {
List<RequiredTriggerAction> actions = new LinkedList<RequiredTriggerAction>();
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new PreventEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 1));
return actions;
}

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set1.gandalf;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
@@ -58,7 +58,7 @@ public class Card1_076 extends AbstractResponseEvent {
@Override
protected void cardSelected(PhysicalCard companion) {
action.appendEffect(
new PreventEffect(woundEffect, companion));
new PreventCardEffect(woundEffect, companion));
}
});
return Collections.singletonList(action);

View File

@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set1.gandalf;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
@@ -51,7 +51,7 @@ public class Card1_085 extends AbstractResponseEvent {
@Override
protected void cardSelected(PhysicalCard card) {
action.appendEffect(
new PreventEffect(exertEffect, card));
new PreventCardEffect(exertEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set1.moria;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -59,7 +59,7 @@ public class Card1_173 extends AbstractPermanent {
@Override
protected void cardSelected(PhysicalCard moriaOrc) {
action.appendEffect(
new PreventEffect(woundEffect, moriaOrc));
new PreventCardEffect(woundEffect, moriaOrc));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set1.shire;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.RemoveBurdenEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
@@ -42,7 +42,7 @@ public class Card1_287 extends AbstractResponseEvent {
if (Filters.filter(healEffect.getAffectedCardsMinusPrevented(game), game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER)).size() > 0) {
final PlayEventAction action = new PlayEventAction(self);
action.appendCost(
new PreventEffect(healEffect, Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER))));
new PreventCardEffect(healEffect, Filters.findFirstActive(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.RING_BEARER))));
action.appendEffect(
new RemoveBurdenEffect(self));
return Collections.singletonList(action);

View File

@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set1.wraith;
import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Race;
import com.gempukku.lotro.common.Side;
@@ -48,7 +48,7 @@ public class Card1_203 extends AbstractResponseEvent {
@Override
protected void cardSelected(PhysicalCard nazgul) {
action.appendEffect(
new PreventEffect(woundEffect, nazgul));
new PreventCardEffect(woundEffect, nazgul));
}
}
);

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.cards.set2.dwarven;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Race;
@@ -47,7 +47,7 @@ public class Card2_003 extends AbstractAttachableFPPossession {
action.appendCost(
new DiscardCardsFromPlayEffect(self));
action.appendEffect(
new PreventEffect((WoundCharactersEffect) effect, self.getAttachedTo()));
new PreventCardEffect((WoundCharactersEffect) effect, self.getAttachedTo()));
return Collections.singletonList(action);
}
return null;

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.cards.set2.elven;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -61,7 +61,7 @@ public class Card2_018 extends AbstractPermanent {
@Override
protected void cardSelected(PhysicalCard elf) {
action.appendEffect(
new PreventEffect(woundEffect, elf));
new PreventCardEffect(woundEffect, elf));
}
});
return Collections.singletonList(action);

View File

@@ -4,7 +4,7 @@ import com.gempukku.lotro.cards.AbstractResponseEvent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.actions.PlayEventAction;
import com.gempukku.lotro.cards.effects.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Side;
@@ -54,7 +54,7 @@ public class Card2_034 extends AbstractResponseEvent {
@Override
protected void cardSelected(PhysicalCard card) {
action.appendEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.cards.set2.shire;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
@@ -46,7 +46,7 @@ public class Card2_106 extends AbstractPermanent {
new ChooseActiveCardEffect(self, playerId, "Choose Hobbit", Filters.in(woundedCharacters), Filters.race(Race.HOBBIT)) {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(new PreventEffect(woundEffect, card));
action.insertEffect(new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set2.wraith;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
@@ -47,7 +47,7 @@ public class Card2_077 extends AbstractPermanent {
new ChooseActiveCardEffect(self, playerId, "Choose twilight Nazgul", Filters.in(woundedCards), Filters.race(Race.NAZGUL), Filters.keyword(Keyword.TWILIGHT)) {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(new PreventEffect(woundEffect, card));
action.insertEffect(new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set3.elven;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.effects.ChooseAndDiscardCardsFromHandEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.common.Race;
@@ -55,7 +55,7 @@ public class Card3_007 extends AbstractCompanion {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set3.elven;
import com.gempukku.lotro.cards.AbstractAlly;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.Block;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
@@ -60,7 +60,7 @@ public class Card3_014 extends AbstractAlly {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set3.gandalf;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Side;
@@ -52,7 +52,7 @@ public class Card3_036 extends AbstractPermanent {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -2,7 +2,7 @@ package com.gempukku.lotro.cards.set3.isengard;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Race;
@@ -47,7 +47,7 @@ public class Card3_059 extends AbstractMinion {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set3.isengard;
import com.gempukku.lotro.cards.AbstractMinion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.modifiers.CantBeAssignedToSkirmishModifier;
import com.gempukku.lotro.cards.modifiers.CantTakeWoundsModifier;
import com.gempukku.lotro.common.Culture;
@@ -90,7 +90,7 @@ public class Card3_068 extends AbstractMinion {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -100,7 +100,7 @@ public class Card4_001 extends AbstractAttachable {
WoundCharactersEffect woundEffect = (WoundCharactersEffect) effect;
if (woundEffect.getAffectedCardsMinusPrevented(game).contains(self.getAttachedTo())) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(new PreventEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new PreventCardEffect(woundEffect, self.getAttachedTo()));
action.appendEffect(new AddBurdenEffect(self, 1));
return Collections.singletonList(action);
}

View File

@@ -3,7 +3,7 @@ package com.gempukku.lotro.cards.set4.dunland;
import com.gempukku.lotro.cards.AbstractPermanent;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChoiceEffect;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filters;
@@ -70,7 +70,7 @@ public class Card4_019 extends AbstractPermanent {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(woundEffect, card));
new PreventCardEffect(woundEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -1,7 +1,7 @@
package com.gempukku.lotro.cards.set4.elven;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.effects.PreventEffect;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.*;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
@@ -63,7 +63,7 @@ public class Card4_063 extends AbstractAttachableFPPossession {
@Override
protected void cardSelected(PhysicalCard card) {
action.insertEffect(
new PreventEffect(discardEffect, card));
new PreventCardEffect(discardEffect, card));
}
});
return Collections.singletonList(action);

View File

@@ -0,0 +1,58 @@
package com.gempukku.lotro.cards.set4.rohan;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.ChooseAndExertCharactersEffect;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.TakeControlOfASiteEffect;
import com.gempukku.lotro.common.Culture;
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.ActivateCardAction;
import com.gempukku.lotro.logic.effects.PreventEffect;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Rohan
* Twilight Cost: 2
* Type: Companion • Man
* Strength: 6
* Vitality: 3
* Resistance: 6
* Game Text: Response: If your opponent is about to take control of a site, exert Ceorl and a villager to prevent this.
*/
public class Card4_264 extends AbstractCompanion {
public Card4_264() {
super(2, 6, 3, Culture.ROHAN, Race.MAN, null, "Ceorl", true);
}
@Override
public List<? extends Action> getOptionalBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (effect.getType() == EffectResult.Type.TAKE_CONTROL_OF_A_SITE) {
TakeControlOfASiteEffect takeControlEffect = (TakeControlOfASiteEffect) effect;
if (!takeControlEffect.isPrevented()
&& PlayConditions.canExert(self, game, Filters.sameCard(self))
&& PlayConditions.canExert(self, game, Filters.keyword(Keyword.VILLAGER))) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendCost(
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.keyword(Keyword.VILLAGER)));
action.appendEffect(
new PreventEffect(takeControlEffect));
return Collections.singletonList(action);
}
}
return null;
}
}

View File

@@ -0,0 +1,38 @@
package com.gempukku.lotro.logic.effects;
import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.timing.AbstractEffect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.Preventable;
public class PreventEffect extends AbstractEffect {
private Preventable _preventable;
public PreventEffect(Preventable preventable) {
_preventable = preventable;
}
@Override
protected FullEffectResult playEffectReturningResult(LotroGame game) {
if (isPlayableInFull(game)) {
_preventable.prevent();
return new FullEffectResult(null, true, true);
}
return new FullEffectResult(null, false, false);
}
@Override
public String getText(LotroGame game) {
return null;
}
@Override
public EffectResult.Type getType() {
return null;
}
@Override
public boolean isPlayableInFull(LotroGame game) {
return !_preventable.isPrevented();
}
}

View File

@@ -14,6 +14,8 @@ public abstract class EffectResult {
START_OF_TURN,
END_OF_TURN,
TAKE_CONTROL_OF_A_SITE,
PLAY, ACTIVATE, DRAW_CARD_OR_PUT_INTO_HAND,
PUT_ON_THE_ONE_RING, REMOVE_BURDEN, ADD_BURDEN,

View File

@@ -0,0 +1,7 @@
package com.gempukku.lotro.logic.timing;
public interface Preventable {
public void prevent();
public boolean isPrevented();
}