"Knife of the Galadhrim"

This commit is contained in:
marcins78@gmail.com
2011-11-20 00:54:28 +00:00
parent cec65ba56a
commit d555b6fc6b
6 changed files with 62 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
return _possessionClass;
}
public boolean isExtraPossessionClass() {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return false;
}
@@ -43,13 +43,13 @@ public abstract class AbstractAttachable extends AbstractLotroCardBlueprint {
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
PossessionClass possessionClass = getPossessionClass();
if (possessionClass != null) {
boolean extraPossessionClass = isExtraPossessionClass();
boolean extraPossessionClass = isExtraPossessionClass(game, self);
List<PhysicalCard> attachedCards = game.getGameState().getAttachedCards(physicalCard);
Collection<PhysicalCard> matchingClassPossessions = Filters.filter(attachedCards, gameState, modifiersQuerying, Filters.or(CardType.POSSESSION, CardType.ARTIFACT), possessionClass);
if (matchingClassPossessions.size() > 1)
return false;
if (!extraPossessionClass && matchingClassPossessions.size() == 1 &&
!((AbstractAttachable) matchingClassPossessions.iterator().next().getBlueprint()).isExtraPossessionClass())
!((AbstractAttachable) matchingClassPossessions.iterator().next().getBlueprint()).isExtraPossessionClass(game, self))
return false;
}
return true;

View File

@@ -48,7 +48,7 @@ public class Card1_216 extends AbstractAttachable {
}
@Override
public boolean isExtraPossessionClass() {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return true;
}

View File

@@ -30,7 +30,7 @@ public class Card2_010 extends AbstractAttachableFPPossession {
}
@Override
public boolean isExtraPossessionClass() {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return true;
}

View File

@@ -32,7 +32,7 @@ public class Card2_032 extends AbstractAttachableFPPossession {
}
@Override
public boolean isExtraPossessionClass() {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return true;
}

View File

@@ -33,7 +33,7 @@ public class Card2_050 extends AbstractAttachable {
}
@Override
public boolean isExtraPossessionClass() {
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return true;
}

View File

@@ -0,0 +1,55 @@
package com.gempukku.lotro.cards.set9.elven;
import com.gempukku.lotro.cards.AbstractAttachableFPPossession;
import com.gempukku.lotro.cards.PlayConditions;
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.effects.ChooseAndWoundCharactersEffect;
import com.gempukku.lotro.logic.effects.DiscardCardsFromPlayEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.List;
/**
* Set: Reflections
* Side: Free
* Culture: Elven
* Twilight Cost: 1
* Type: Possession • Hand Weapon
* Strength: +1
* Game Text: Bearer must be a [GONDOR] Man. If bearer is Aragorn, he may bear this hand weapon in addition to 1 other
* hand weapon. Skirmish: Discard this weapon to wound a minion bearer is skirmishing.
*/
public class Card9_017 extends AbstractAttachableFPPossession {
public Card9_017() {
super(1, 1, 0, Culture.ELVEN, PossessionClass.HAND_WEAPON, "Knife of the Galadhrim", true);
}
@Override
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
return Filters.and(Culture.GONDOR, Race.MAN);
}
@Override
public boolean isExtraPossessionClass(LotroGame game, PhysicalCard self) {
return self.getAttachedTo().getBlueprint().getName().equals("Aragorn");
}
@Override
protected List<? extends Action> getExtraInPlayPhaseActions(String playerId, LotroGame game, PhysicalCard self) {
if (PlayConditions.canUseFPCardDuringPhase(game, Phase.SKIRMISH, self)
&& PlayConditions.canSelfDiscard(self, game)) {
ActivateCardAction action = new ActivateCardAction(self);
action.appendCost(
new DiscardCardsFromPlayEffect(self, self));
action.appendEffect(
new ChooseAndWoundCharactersEffect(action, playerId, 1, 1, CardType.MINION, Filters.inSkirmishAgainst(self.getAttachedTo())));
return Collections.singletonList(action);
}
return null;
}
}