Added follower card type.

This commit is contained in:
marcins78@gmail.com
2011-12-29 06:19:24 +00:00
parent c3a0e4ddb6
commit 4db32b2d0d
2 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
package com.gempukku.lotro.cards;
import com.gempukku.lotro.cards.effects.TransferPermanentEffect;
import com.gempukku.lotro.common.*;
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.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
public abstract class AbstractFollower extends AbstractPermanent {
public AbstractFollower(Side side, int twilightCost, Culture culture, String name) {
this(side, twilightCost, culture, name, false);
}
public AbstractFollower(Side side, int twilightCost, Culture culture, String name, boolean unique) {
super(side, twilightCost, CardType.FOLLOWER, culture, Zone.SUPPORT, name, unique);
}
protected abstract boolean canPayAidCost(LotroGame game, PhysicalCard self);
protected abstract Effect getAidCost(LotroGame game, PhysicalCard self);
protected Filterable getFollowerTarget(LotroGame game, PhysicalCard self) {
return CardType.COMPANION;
}
@Override
public final List<OptionalTriggerAction> getOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
if (TriggerConditions.startOfPhase(game, effectResult, Phase.MANEUVER)
&& self.getZone() == Zone.SUPPORT
&& canPayAidCost(game, self)
&& PlayConditions.canSpot(game, getFollowerTarget(game, self))) {
final OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendCost(
getAidCost(game, self));
action.appendCost(
new ChooseActiveCardEffect(self, playerId, "Choose character to transfer follower to", getFollowerTarget(game, self)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard card) {
action.appendEffect(
new TransferPermanentEffect(self, card));
}
});
return Collections.singletonList(action);
}
return getExtraOptionalAfterTriggers(playerId, game, effectResult, self);
}
protected List<OptionalTriggerAction> getExtraOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, final PhysicalCard self) {
return null;
}
}

View File

@@ -1,5 +1,5 @@
package com.gempukku.lotro.common;
public enum CardType implements Filterable {
THE_ONE_RING, SITE, COMPANION, ALLY, MINION, POSSESSION, ARTIFACT, EVENT, CONDITION
THE_ONE_RING, SITE, COMPANION, ALLY, MINION, POSSESSION, ARTIFACT, EVENT, CONDITION, FOLLOWER
}