"Uruk Slayer"
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package com.gempukku.lotro.cards.effects;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
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.timing.Effect;
|
||||
import com.gempukku.lotro.logic.timing.UnrespondableEffect;
|
||||
|
||||
public class CheckLimitEffect extends UnrespondableEffect {
|
||||
private CostToEffectAction _action;
|
||||
private PhysicalCard _card;
|
||||
private int _limit;
|
||||
private Phase _phase;
|
||||
private boolean _cost;
|
||||
private Effect _limitedEffect;
|
||||
|
||||
public CheckLimitEffect(CostToEffectAction action, PhysicalCard card, int limit, Phase phase, boolean cost, Effect limitedEffect) {
|
||||
_card = card;
|
||||
_limit = limit;
|
||||
_phase = phase;
|
||||
_limitedEffect = limitedEffect;
|
||||
_action = action;
|
||||
_cost = cost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playEffect(LotroGame game) {
|
||||
int count = game.getModifiersEnvironment().getUntilEndOfPhaseLimitCounter(_card, _phase).incrementCounter();
|
||||
if (count <= _limit) {
|
||||
if (_cost)
|
||||
_action.addCost(_limitedEffect);
|
||||
else
|
||||
_action.addEffect(_limitedEffect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.gempukku.lotro.cards.set1.isengard;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractMinion;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.effects.AddUntilEndOfPhaseModifierEffect;
|
||||
import com.gempukku.lotro.cards.effects.CheckLimitEffect;
|
||||
import com.gempukku.lotro.cards.effects.RemoveTwilightEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
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.timing.Action;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Set: The Fellowship of the Ring
|
||||
* Side: Shadow
|
||||
* Culture: Isengard
|
||||
* Twilight Cost: 4
|
||||
* Type: Minion • Uruk-Hai
|
||||
* Strength: 9
|
||||
* Vitality: 2
|
||||
* Site: 5
|
||||
* Game Text: Damage +1. Skirmish: Remove (1) to make this minion strength +1 (limit +3).
|
||||
*/
|
||||
public class Card1_153 extends AbstractMinion {
|
||||
public Card1_153() {
|
||||
super(4, 9, 2, 5, Culture.ISENGARD, "Uruk Slayer", "1_153");
|
||||
addKeyword(Keyword.URUK_HAI);
|
||||
addKeyword(Keyword.DAMAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Action> getPlayablePhaseActions(String playerId, LotroGame game, PhysicalCard self) {
|
||||
List<Action> actions = new LinkedList<Action>();
|
||||
appendPlayMinionAction(actions, game, self);
|
||||
|
||||
if (PlayConditions.canUseShadowCardDuringPhase(game.getGameState(), Phase.SKIRMISH, self, 1)) {
|
||||
final CostToEffectAction action = new CostToEffectAction(self, "Remove (1) to make this minion strength +1 (limit +3).");
|
||||
action.addCost(new RemoveTwilightEffect(1));
|
||||
action.addEffect(
|
||||
new CheckLimitEffect(action, self, 3, Phase.SKIRMISH, false,
|
||||
new AddUntilEndOfPhaseModifierEffect(
|
||||
new StrengthModifier(self, Filters.sameCard(self), 1), Phase.SKIRMISH)));
|
||||
|
||||
actions.add(action);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.gempukku.lotro.logic.modifiers;
|
||||
|
||||
public class DefaultLimitCounter implements LimitCounter {
|
||||
private int _count;
|
||||
|
||||
@Override
|
||||
public int incrementCounter() {
|
||||
_count++;
|
||||
return _count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.gempukku.lotro.logic.modifiers;
|
||||
|
||||
public interface LimitCounter {
|
||||
public int incrementCounter();
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.gempukku.lotro.logic.modifiers;
|
||||
|
||||
import com.gempukku.lotro.common.Phase;
|
||||
import com.gempukku.lotro.game.PhysicalCard;
|
||||
|
||||
public interface ModifiersEnvironment {
|
||||
public LimitCounter getUntilEndOfPhaseLimitCounter(PhysicalCard card, Phase phase);
|
||||
|
||||
public ModifierHook addAlwaysOnModifier(Modifier modifier);
|
||||
|
||||
public void addUntilStartOfPhaseModifier(Modifier modifier, Phase phase);
|
||||
|
||||
@@ -17,6 +17,23 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
|
||||
private Set<Modifier> _skipSet = new HashSet<Modifier>();
|
||||
|
||||
private Map<Phase, Map<PhysicalCard, LimitCounter>> _counters = new HashMap<Phase, Map<PhysicalCard, LimitCounter>>();
|
||||
|
||||
@Override
|
||||
public LimitCounter getUntilEndOfPhaseLimitCounter(PhysicalCard card, Phase phase) {
|
||||
Map<PhysicalCard, LimitCounter> limitCounterMap = _counters.get(phase);
|
||||
if (limitCounterMap == null) {
|
||||
limitCounterMap = new HashMap<PhysicalCard, LimitCounter>();
|
||||
_counters.put(phase, limitCounterMap);
|
||||
}
|
||||
LimitCounter limitCounter = limitCounterMap.get(card);
|
||||
if (limitCounter == null) {
|
||||
limitCounter = new DefaultLimitCounter();
|
||||
limitCounterMap.put(card, limitCounter);
|
||||
}
|
||||
return limitCounter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModifierHook addAlwaysOnModifier(Modifier modifier) {
|
||||
_modifiers.add(modifier);
|
||||
@@ -29,6 +46,9 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
_modifiers.removeAll(list);
|
||||
list.clear();
|
||||
}
|
||||
Map<PhysicalCard, LimitCounter> counterMap = _counters.get(phase);
|
||||
if (counterMap != null)
|
||||
counterMap.clear();
|
||||
}
|
||||
|
||||
public void removeStartOfPhase(Phase phase) {
|
||||
|
||||
Reference in New Issue
Block a user