Adding Haldir.

Simplifying StrengthModifier to generate text message.
This commit is contained in:
marcins78@gmail.com
2011-08-29 13:35:55 +00:00
parent 479a2bcb3e
commit a6f015d17a
16 changed files with 79 additions and 17 deletions

View File

@@ -9,8 +9,8 @@ import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
public class StrengthModifier extends AbstractModifier {
private int _modifier;
public StrengthModifier(PhysicalCard source, String text, Filter affectFilter, int modifier) {
super(source, text, affectFilter);
public StrengthModifier(PhysicalCard source, Filter affectFilter, int modifier) {
super(source, "Strength +" + modifier, affectFilter);
_modifier = modifier;
}

View File

@@ -44,7 +44,7 @@ public class Card1_003 extends AbstractLotroCardBlueprint {
int bonus = (attachedDwarvenHandWeapons.size() == 0) ? 2 : 3;
action.addEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, "+" + bonus + " Strength", Filters.sameCard(dwarf), bonus), Phase.SKIRMISH
new StrengthModifier(self, Filters.sameCard(dwarf), bonus), Phase.SKIRMISH
)
);
}

View File

@@ -51,7 +51,7 @@ public class Card1_009 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, "Strength +2", Filters.sameCard(self.getAttachedTo()), 2);
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 2);
}
@Override

View File

@@ -47,7 +47,7 @@ public class Card1_011 extends AbstractCompanion {
@Override
public Modifier getAlwaysOnEffect(final PhysicalCard self) {
return new StrengthModifier(self, "Strength +2",
return new StrengthModifier(self,
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {

View File

@@ -49,7 +49,7 @@ public class Card1_013 extends AbstractCompanion {
CostToEffectAction action = new CostToEffectAction(self, "Exert Gimli to make him strength +2");
action.addCost(new ExertCharacterEffect(self));
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, "Strength+2", Filters.sameCard(self), 2), Phase.SKIRMISH));
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, Filters.sameCard(self), 2), Phase.SKIRMISH));
result.add(action);
}

View File

@@ -47,7 +47,7 @@ public class Card1_024 extends AbstractLotroCardBlueprint {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, "While a Dwarf skirmishes a MORIA minion, that Dwarf is strength +1",
return new StrengthModifier(self,
Filters.and(
Filters.keyword(Keyword.DWARF),
new Filter() {

View File

@@ -45,7 +45,7 @@ public class Card1_026 extends AbstractLotroCardBlueprint {
GameState gameState = game.getGameState();
int bonus = (game.getModifiersQuerying().hasKeyword(gameState, gameState.getCurrentSite(), Keyword.UNDERGROUND)) ? 4 : 2;
game.getModifiersEnvironment().addUntilEndOfPhaseModifier(
new StrengthModifier(self, "Strength +" + bonus, Filters.sameCard(dwarf), bonus), Phase.SKIRMISH);
new StrengthModifier(self, Filters.sameCard(dwarf), bonus), Phase.SKIRMISH);
}
}
);

View File

@@ -48,7 +48,7 @@ public class Card1_029 extends AbstractLotroCardBlueprint {
new ChooseActiveCardEffect(playerId, "Choose an Elf", Filters.keyword(Keyword.ELF)) {
@Override
protected void cardSelected(LotroGame game, final PhysicalCard elf) {
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, "Strength +1", Filters.sameCard(elf), 1), Phase.SKIRMISH));
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, Filters.sameCard(elf), 1), Phase.SKIRMISH));
action.addEffect(new AddUntilEndOfPhaseActionProxyEffect(
new AbstractActionProxy() {
@Override

View File

@@ -34,7 +34,7 @@ public class Card1_030 extends AbstractCompanion {
@Override
public Modifier getAlwaysOnEffect(final PhysicalCard self) {
return new StrengthModifier(self, "Strength +3",
return new StrengthModifier(self,
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {

View File

@@ -51,7 +51,7 @@ public class Card1_032 extends AbstractLotroCardBlueprint {
bonus = 4;
}
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, "Strength +" + bonus, Filters.sameCard(elf), bonus), Phase.SKIRMISH));
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, Filters.sameCard(elf), bonus), Phase.SKIRMISH));
}
});
return Collections.singletonList(action);

View File

@@ -50,7 +50,7 @@ public class Card1_033 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, "Strength +1", Filters.sameCard(self.getAttachedTo()), 1);
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 1);
}
@Override

View File

@@ -51,7 +51,7 @@ public class Card1_037 extends AbstractLotroCardBlueprint {
bonus = 4;
}
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, "Strength +" + bonus, Filters.sameCard(elf), bonus), Phase.SKIRMISH));
action.addEffect(new AddUntilEndOfPhaseModifierEffect(new StrengthModifier(self, Filters.sameCard(elf), bonus), Phase.SKIRMISH));
}
});

View File

@@ -84,7 +84,7 @@ public class Card1_047 extends AbstractAttachableFPPossession {
new ChoiceEffect(action, playerId, possibleCosts, true));
action.addEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, "Strength +1", Filters.sameCard(self.getAttachedTo()), 1),
new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 1),
Phase.SKIRMISH));
}
@@ -93,6 +93,6 @@ public class Card1_047 extends AbstractAttachableFPPossession {
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self, "Strength +2", Filters.sameCard(self.getAttachedTo()), 2);
return new StrengthModifier(self, Filters.sameCard(self.getAttachedTo()), 2);
}
}

View File

@@ -0,0 +1,62 @@
package com.gempukku.lotro.cards.set1.elven;
import com.gempukku.lotro.cards.AbstractCompanion;
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
import com.gempukku.lotro.common.Culture;
import com.gempukku.lotro.common.Keyword;
import com.gempukku.lotro.filters.Filter;
import com.gempukku.lotro.filters.Filters;
import com.gempukku.lotro.game.PhysicalCard;
import com.gempukku.lotro.game.state.GameState;
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;
/**
* Set: The Fellowship of the Ring
* Side: Free
* Culture: Elven
* Twilight Cost: 2
* Type: Companion • Elf
* Strength: 5
* Vitality: 3
* Resistance: 6
* Game Text: To play, spot an Elf. While Haldir is at site 6, 7, or 8, he is strength +2.
*/
public class Card1_048 extends AbstractCompanion {
public Card1_048() {
super(2, 5, 3, Culture.ELVEN, "Haldir", "1_48", true);
addKeyword(Keyword.ELF);
}
@Override
public List<? extends Action> getPlayableWhenActions(String playerId, LotroGame game, EffectResult effectResult, PhysicalCard self) {
List<Action> actions = new LinkedList<Action>();
if (Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.keyword(Keyword.ELF)))
appendPlayCompanionActions(actions, game, self);
appendHealCompanionActions(actions, game, self);
return actions;
}
@Override
public Modifier getAlwaysOnEffect(PhysicalCard self) {
return new StrengthModifier(self,
Filters.and(
Filters.sameCard(self),
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {
int currentSiteNumber = gameState.getCurrentSiteNumber();
return (currentSiteNumber == 6 || currentSiteNumber == 7 || currentSiteNumber == 8);
}
}), 2);
}
}

View File

@@ -35,7 +35,7 @@ public class Card1_051 extends AbstractCompanion {
@Override
public Modifier getAlwaysOnEffect(final PhysicalCard self) {
return new StrengthModifier(self, "Strength +3",
return new StrengthModifier(self,
new Filter() {
@Override
public boolean accepts(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard physicalCard) {

View File

@@ -56,7 +56,7 @@ public class Card1_145 extends AbstractMinion {
int spotCount = getValidatedResult(result);
action.addEffect(
new AddUntilEndOfPhaseModifierEffect(
new StrengthModifier(self, "Strength+" + spotCount, Filters.sameCard(self), spotCount)
new StrengthModifier(self, Filters.sameCard(self), spotCount)
, Phase.SKIRMISH));
}
}