"Lorien Protector"

This commit is contained in:
marcins78@gmail.com
2011-12-20 01:37:28 +00:00
parent 1ff0e0fbda
commit b0d45d098c
3 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package com.gempukku.lotro.cards.set13.elven;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.TriggerConditions;
import com.gempukku.lotro.cards.effects.PreventCardEffect;
import com.gempukku.lotro.common.CardType;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Phase;
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.RequiredTriggerAction;
import com.gempukku.lotro.logic.effects.AbstractPreventableCardEffect;
import com.gempukku.lotro.logic.timing.Effect;
import java.util.Collections;
import java.util.List;
/**
* Set: Bloodlines
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Companion • Elf
* Strength: 6
* Vitality: 3
* Resistance: 6
* Game Text: While another companion is assigned to a skirmish, during each skirmish, prevent all wounds to this
* companion after the first wound.
*/
public class Card13_020 extends AbstractCompanion {
public Card13_020() {
super(2, 6, 3, 6, Culture.ELVEN, Race.ELF, null, "Lorien Protector");
}
@Override
public List<RequiredTriggerAction> getRequiredBeforeTriggers(LotroGame game, Effect effect, PhysicalCard self) {
if (TriggerConditions.isGettingWounded(effect, game, self)
&& PlayConditions.canSpot(game, Filters.not(self), CardType.COMPANION, Filters.assignedToSkirmish)
&& PlayConditions.isPhase(game, Phase.SKIRMISH)
&& game.getModifiersEnvironment().getWoundsTakenInCurrentPhase(self) >= 1) {
RequiredTriggerAction action = new RequiredTriggerAction(self);
action.appendEffect(
new PreventCardEffect((AbstractPreventableCardEffect) effect, self));
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -15,4 +15,6 @@ public interface ModifiersEnvironment {
public void addUntilEndOfTurnModifier(Modifier modifier);
public void addedWound(PhysicalCard card);
public int getWoundsTakenInCurrentPhase(PhysicalCard card);
}

View File

@@ -440,6 +440,14 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
}
}
@Override
public int getWoundsTakenInCurrentPhase(PhysicalCard card) {
Integer wounds = _woundsPerPhaseMap.get(card.getCardId());
if (wounds == null)
return 0;
return wounds;
}
@Override
public boolean canTakeWound(GameState gameState, PhysicalCard card) {
LoggingThreadLocal.logMethodStart(card, "canTakeWound");