"Legolas, Greenleaf"

This commit is contained in:
marcins78@gmail.com
2011-08-29 14:14:53 +00:00
parent 0448572e18
commit e68127044b
7 changed files with 107 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
package com.gempukku.lotro.cards.modifiers;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
import com.gempukku.lotro.logic.modifiers.AbstractModifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
public class DoesNotAddToArcheryTotalModifier extends AbstractModifier {
public DoesNotAddToArcheryTotalModifier(PhysicalCard source, Filter affectFilter) {
super(source, "Does not add to archery total", affectFilter);
}
@Override
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
return false;
}
}

View File

@@ -12,7 +12,6 @@ import com.gempukku.lotro.game.state.LotroGame;
import com.gempukku.lotro.logic.modifiers.Modifier;
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
import com.gempukku.lotro.logic.timing.Action;
import com.gempukku.lotro.logic.timing.EffectResult;
import java.util.LinkedList;
import java.util.List;
@@ -35,7 +34,7 @@ public class Card1_048 extends AbstractCompanion {
}
@Override
public List<? extends Action> getPlayableWhenActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.ELF)))

View File

@@ -0,0 +1,69 @@
package com.gempukku.lotro.cards.set1.elven;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.PlayConditions;
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
import com.gempukku.lotro.cards.effects.ExertCharacterEffect;
import com.gempukku.lotro.cards.modifiers.DoesNotAddToArcheryTotalModifier;
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.CostToEffectAction;
import com.gempukku.lotro.logic.effects.ChooseActiveCardEffect;
import com.gempukku.lotro.logic.effects.WoundEffect;
import com.gempukku.lotro.logic.timing.Action;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Companion • Elf
* Strength: 6
* Vitality: 3
* Resistance: 6
* Signet: Frodo
* Game Text: Archer. Archery: Exert Legolas to wound a minion; Legolas does not add to the fellowship archery total.
*/
public class Card1_050 extends AbstractCompanion {
public Card1_050() {
super(2, 6, 3, Culture.ELVEN, "Legolas", "1_50", true);
addKeyword(Keyword.ELF);
addKeyword(Keyword.ARCHER);
setSignet(Signet.FRODO);
}
@Override
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
appendPlayCompanionActions(actions, game, self);
appendHealCompanionActions(actions, game, self);
if (game.getGameState().getCurrentPhase() == Phase.ARCHERY
&& self.getZone() == Zone.FREE_CHARACTERS
&& PlayConditions.canExert(game.getGameState(), game.getModifiersQuerying(), self)) {
final CostToEffectAction action = new CostToEffectAction(self, "Exert Legolas to wound a minion");
action.addCost(new ExertCharacterEffect(self));
action.addCost(
new AddUntilEndOfPhaseModifierEffect(
new DoesNotAddToArcheryTotalModifier(self, Filters.sameCard(self)), Phase.ARCHERY));
action.addEffect(
new ChooseActiveCardEffect(playerId, "Choose a minion", Filters.type(CardType.MINION)) {
@Override
protected void cardSelected(LotroGame game, PhysicalCard minion) {
action.addEffect(new WoundEffect(minion));
}
});
return Collections.singletonList(action);
}
return null;
}
}

View File

@@ -84,4 +84,9 @@ public abstract class AbstractModifier implements Modifier {
public int getMoveLimit(GameState gameState, ModifiersQuerying modifiersQuerying, int result) {
return result;
}
@Override
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result) {
return result;
}
}

View File

@@ -33,4 +33,6 @@ public interface Modifier {
public int getArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, Side side, int result);
public int getMoveLimit(GameState gameState, ModifiersQuerying modifiersQuerying, int result);
public boolean addsToArcheryTotal(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card, boolean result);
}

View File

@@ -201,6 +201,16 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
return allyOnCurrentSite;
}
@Override
public boolean addsToArcheryTotal(GameState gameState, PhysicalCard card) {
boolean result = true;
for (Modifier modifier : _modifiers)
if (affectsCardWithSkipSet(gameState, card, modifier))
result = modifier.addsToArcheryTotal(gameState, this, card, result);
return result;
}
private class ModifierHookImpl implements ModifierHook {
private Modifier _modifier;

View File

@@ -31,4 +31,6 @@ public interface ModifiersQuerying {
public boolean canTakeWound(GameState gameState, PhysicalCard card);
public boolean isAllyOnCurrentSite(GameState gameState, PhysicalCard card);
public boolean addsToArcheryTotal(GameState gameState, PhysicalCard card);
}