"Counts But One"
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
import com.gempukku.lotro.game.state.LotroGame;
|
||||
import com.gempukku.lotro.logic.timing.AbstractEffect;
|
||||
|
||||
public class ReplaceInSkirmishEffect extends AbstractEffect {
|
||||
private PhysicalCard _replacedBy;
|
||||
private Filterable[] _replacingFilter;
|
||||
|
||||
public ReplaceInSkirmishEffect(PhysicalCard replacedBy, Filterable... replacingFilter) {
|
||||
_replacedBy = replacedBy;
|
||||
_replacingFilter = replacingFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(LotroGame game) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.and(_replacingFilter, Filters.inSkirmish));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (isPlayableInFull(game)) {
|
||||
game.getGameState().replaceInSkirmish(_replacedBy);
|
||||
return new FullEffectResult(null, true, true);
|
||||
}
|
||||
return new FullEffectResult(null, false, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gempukku.lotro.cards.set8.dwarven;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractEvent;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.actions.PlayEventAction;
|
||||
import com.gempukku.lotro.cards.effects.ReplaceInSkirmishEffect;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
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.effects.AddThreatsEffect;
|
||||
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
|
||||
|
||||
/**
|
||||
* Set: Siege of Gondor
|
||||
* Side: Free
|
||||
* Culture: Dwarven
|
||||
* Twilight Cost: 2
|
||||
* Type: Event • Skirmish
|
||||
* Game Text: If Gimli is not assigned to a skirmish, add a threat to have him replace an unbound companion in
|
||||
* a skirmish.
|
||||
*/
|
||||
public class Card8_004 extends AbstractEvent {
|
||||
public Card8_004() {
|
||||
super(Side.FREE_PEOPLE, 2, Culture.DWARVEN, "Counts But One", Phase.SKIRMISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
return super.checkPlayRequirements(playerId, game, self, twilightModifier, ignoreRoamingPenalty)
|
||||
&& PlayConditions.canSpot(game, Filters.gimli, Filters.notAssignedToSkirmish)
|
||||
&& PlayConditions.canAddThreat(game, self, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayEventAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier, boolean ignoreRoamingPenalty) {
|
||||
final PlayEventAction action = new PlayEventAction(self);
|
||||
action.appendCost(
|
||||
new AddThreatsEffect(playerId, self, 1));
|
||||
action.appendEffect(
|
||||
new ChooseActiveCardEffect(self, playerId, "Choose Gimli", Filters.gimli) {
|
||||
@Override
|
||||
protected void cardSelected(LotroGame game, PhysicalCard card) {
|
||||
action.insertEffect(
|
||||
new ReplaceInSkirmishEffect(card, Filters.unboundCompanion));
|
||||
}
|
||||
});
|
||||
return action;
|
||||
}
|
||||
}
|
||||
@@ -287,6 +287,14 @@ public class GameState {
|
||||
removeFromSkirmish(card, true);
|
||||
}
|
||||
|
||||
public void replaceInSkirmish(PhysicalCard card) {
|
||||
_skirmish.setFellowshipCharacter(card);
|
||||
for (GameStateListener gameStateListener : getAllGameStateListeners()) {
|
||||
gameStateListener.finishSkirmish();
|
||||
gameStateListener.startSkirmish(_skirmish.getFellowshipCharacter(), _skirmish.getShadowCharacters());
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromSkirmish(PhysicalCard card, boolean notify) {
|
||||
if (_skirmish.getFellowshipCharacter() == card) {
|
||||
_skirmish.setFellowshipCharacter(null);
|
||||
|
||||
Reference in New Issue
Block a user