This commit is contained in:
marcins78@gmail.com
2011-10-16 19:41:47 +00:00
parent e6bc21fd06
commit d5a928f6d8
2 changed files with 85 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ public class AddBurdenEffect extends AbstractEffect implements Preventable {
_prevented++;
}
public void preventAll() {
_prevented = _count;
}
@Override
public String getText(LotroGame game) {
return "Add " + (_count - _prevented) + "burden(s)";

View File

@@ -0,0 +1,81 @@
package com.gempukku.lotro.cards.set4.shire;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddBurdenEffect;
import com.gempukku.lotro.cards.effects.ExertCharactersEffect;
import com.gempukku.lotro.cards.effects.MakeRingBearerEffect;
import com.gempukku.lotro.common.*;
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.actions.OptionalTriggerAction;
import com.gempukku.lotro.logic.effects.KillEffect;
import com.gempukku.lotro.logic.timing.Effect;
import com.gempukku.lotro.logic.timing.EffectResult;
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
import java.util.Collections;
import java.util.List;
/**
* Set: The Two Towers
* Side: Free
* Culture: Shire
* Twilight Cost: 2
* Type: Companion • Hobbit
* Strength: 3
* Vitality: 4
* Resistance: 6
* Signet: Gandalf
* Game Text: Ring-bound. Response: If a Shadow card is about to add any number of burdens, spot Frodo and exert Sam
* to prevent this. Response: If Frodo is killed, make Sam the Ring-bearer (resistance 5).
*/
public class Card4_316 extends AbstractCompanion {
public Card4_316() {
super(2, 3, 4, Culture.SHIRE, Race.HOBBIT, Signet.GANDALF, "Sam", true);
addKeyword(Keyword.RING_BOUND);
}
@Override
public int getResistance() {
return 5;
}
@Override
public List<? extends ActivateCardAction> getOptionalInPlayBeforeActions(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (effect.getType() == EffectResult.Type.ADD_BURDEN
&& PlayConditions.canSpot(game, Filters.name("Frodo"))
&& PlayConditions.canSelfExert(self, game)) {
final AddBurdenEffect addBurdenEffect = (AddBurdenEffect) effect;
if (addBurdenEffect.getSource().getBlueprint().getSide() == Side.SHADOW
&& !addBurdenEffect.isPrevented()) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new ExertCharactersEffect(self, self));
action.appendEffect(
new UnrespondableEffect() {
@Override
protected void doPlayEffect(LotroGame game) {
addBurdenEffect.preventAll();
}
});
return Collections.singletonList(action);
}
}
return null;
}
@Override
public List<OptionalTriggerAction> getOptionalBeforeTriggers(String playerId, LotroGame game, Effect effect, PhysicalCard self) {
if (effect.getType() == EffectResult.Type.KILL) {
if (Filters.filter(((KillEffect) effect).getCharactersToBeKilled(), game.getGameState(), game.getModifiersQuerying(), Filters.name("Frodo")).size() > 0) {
OptionalTriggerAction action = new OptionalTriggerAction(self);
action.appendEffect(new MakeRingBearerEffect(self));
return Collections.singletonList(action);
}
}
return null;
}
}