This commit is contained in:
marcins78@gmail.com
2011-12-29 06:29:25 +00:00
parent 4db32b2d0d
commit 5d1100f1ab
5 changed files with 109 additions and 1 deletions

View File

@@ -284,4 +284,14 @@ public class TriggerConditions {
public static boolean moves(LotroGame game, EffectResult effectResult) {
return effectResult.getType() == EffectResult.Type.WHEN_FELLOWSHIP_MOVES;
}
public static boolean transferredCard(LotroGame game, EffectResult effectResult, Filterable transferredCard, Filterable transferredFrom, Filterable transferredTo) {
if (effectResult.getType() == EffectResult.Type.CARD_TRANSFERRED) {
CardTransferredResult transferResult = (CardTransferredResult) effectResult;
return (Filters.and(transferredCard).accepts(game.getGameState(), game.getModifiersQuerying(), transferResult.getTransferredCard())
&& (transferredFrom == null || (transferResult.getTransferredFrom() != null && Filters.and(transferredFrom).accepts(game.getGameState(), game.getModifiersQuerying(), transferResult.getTransferredFrom())))
&& (transferredTo == null || (transferResult.getTransferredTo() != null && Filters.and(transferredTo).accepts(game.getGameState(), game.getModifiersQuerying(), transferResult.getTransferredTo()))));
}
return false;
}
}

View File

@@ -6,6 +6,7 @@ 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.Effect;
import com.gempukku.lotro.logic.timing.results.CardTransferredResult;
public class TransferPermanentEffect extends AbstractEffect {
private PhysicalCard _physicalCard;
@@ -38,8 +39,12 @@ public class TransferPermanentEffect extends AbstractEffect {
if (isPlayableInFull(game)) {
GameState gameState = game.getGameState();
gameState.sendMessage(_physicalCard.getOwner() + " transfers " + GameUtils.getCardLink(_physicalCard) + " to " + GameUtils.getCardLink(_targetCard));
PhysicalCard transferredFrom = _physicalCard.getAttachedTo();
gameState.transferCard(_physicalCard, _targetCard);
game.getActionsEnvironment().emitEffectResult(
new CardTransferredResult(_physicalCard, transferredFrom, _targetCard));
return new FullEffectResult(true, true);
}
return new FullEffectResult(false, false);

View File

@@ -0,0 +1,64 @@
package com.gempukku.lotro.cards.set13.gandalf;
import com.gempukku.lotro.cards.AbstractFollower;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.ReinforceTokenEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Side;
import com.gempukku.lotro.common.Token;
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.effects.AddTwilightEffect;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.SpotCondition;
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.Collections;
import java.util.List;
/**
* Set: Bloodlines
* Side: Free
* Culture: Gandalf
* Twilight Cost: 2
* Type: Follower
* Game Text: Aid - (2). (At the start of the maneuver phase, you may add (2) to transfer this to a companion.) Each
* time you transfer this to a companion, you may reinforce a [GANDALF] token. While you can spot a [GANDALF] companion,
* each minion skirmishing bearer is strength -1.
*/
public class Card13_028 extends AbstractFollower {
public Card13_028() {
super(Side.FREE_PEOPLE, 2, Culture.GANDALF, "Alatar", true);
}
@Override
protected boolean canPayAidCost(LotroGame game, PhysicalCard self) {
return true;
}
@Override
protected Effect getAidCost(LotroGame game, PhysicalCard self) {
return new AddTwilightEffect(self, 2);
}
@Override
protected List<OptionalTriggerAction> getExtraOptionalAfterTriggers(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
if (TriggerConditions.transferredCard(game, effectResult, self, null, CardType.COMPANION)) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(
new ReinforceTokenEffect(self, playerId, Token.GANDALF));
return Collections.singletonList(action);
}
return null;
}
@Override
public Modifier getAlwaysOnModifier(PhysicalCard self) {
return new StrengthModifier(self, Filters.and(CardType.MINION, Filters.inSkirmishAgainst(Filters.hasAttached(self))), new SpotCondition(Culture.GANDALF, CardType.COMPANION), -1);
}
}

View File

@@ -49,7 +49,7 @@ public abstract class EffectResult {
CHARACTER_WON_SKIRMISH, CHARACTER_LOST_SKIRMISH,
CHARACTER_ASSIGNED
CHARACTER_ASSIGNED, CARD_TRANSFERRED
}
private Type _type;

View File

@@ -0,0 +1,29 @@
package com.gempukku.lotro.logic.timing.results;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.logic.timing.EffectResult;
public class CardTransferredResult extends EffectResult {
private PhysicalCard _transferredCard;
private PhysicalCard _transferredFrom;
private PhysicalCard _transferredTo;
public CardTransferredResult(PhysicalCard transferredCard, PhysicalCard transferredFrom, PhysicalCard transferredTo) {
super(EffectResult.Type.CARD_TRANSFERRED);
_transferredCard = transferredCard;
_transferredFrom = transferredFrom;
_transferredTo = transferredTo;
}
public PhysicalCard getTransferredCard() {
return _transferredCard;
}
public PhysicalCard getTransferredFrom() {
return _transferredFrom;
}
public PhysicalCard getTransferredTo() {
return _transferredTo;
}
}