"I Will Help You Bear This Burden"
This commit is contained in:
@@ -234,6 +234,10 @@ public class PlayConditions {
|
||||
return game.getGameState().getThreats() >= count && game.getModifiersQuerying().canRemoveThreat(game.getGameState(), card);
|
||||
}
|
||||
|
||||
public static boolean canAddBurdens(LotroGame game, String performingPlayer, PhysicalCard card) {
|
||||
return game.getModifiersQuerying().canAddBurden(game.getGameState(), performingPlayer, card);
|
||||
}
|
||||
|
||||
public static boolean canRemoveBurdens(LotroGame game, PhysicalCard card, int count) {
|
||||
return game.getGameState().getBurdens() >= count && game.getModifiersQuerying().canRemoveBurden(game.getGameState(), card);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class AddBurdenEffect extends AbstractEffect implements Preventable {
|
||||
|
||||
@Override
|
||||
public boolean isPlayableInFull(LotroGame game) {
|
||||
return true;
|
||||
return game.getModifiersQuerying().canAddBurden(game.getGameState(), _performingPlayer, _source);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,7 +55,7 @@ public class AddBurdenEffect extends AbstractEffect implements Preventable {
|
||||
|
||||
@Override
|
||||
protected FullEffectResult playEffectReturningResult(LotroGame game) {
|
||||
if (_prevented < _count) {
|
||||
if (isPlayableInFull(game) && _prevented < _count) {
|
||||
int toAdd = _count - _prevented;
|
||||
game.getGameState().sendMessage(GameUtils.getCardLink(_source) + " adds " + GameUtils.formatNumber(toAdd, _count) + " burden" + ((toAdd > 1) ? "s" : ""));
|
||||
game.getGameState().addBurdens(toAdd);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.gempukku.lotro.cards.modifiers;
|
||||
|
||||
import com.gempukku.lotro.common.Filterable;
|
||||
import com.gempukku.lotro.filters.Filters;
|
||||
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.Condition;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifierEffect;
|
||||
import com.gempukku.lotro.logic.modifiers.ModifiersQuerying;
|
||||
|
||||
public class CantAddBurdensModifier extends AbstractModifier {
|
||||
private Filterable[] _sourceFilters;
|
||||
|
||||
public CantAddBurdensModifier(PhysicalCard source, Condition condition, Filterable... sourceFilters) {
|
||||
super(source, "Can't add burdens", null, condition, ModifierEffect.BURDEN_MODIFIER);
|
||||
_sourceFilters = sourceFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddBurden(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, PhysicalCard source) {
|
||||
if (Filters.and(_sourceFilters).accepts(gameState, modifiersQuerying, source))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.gempukku.lotro.cards.set20.gandalf;
|
||||
|
||||
import com.gempukku.lotro.cards.AbstractAttachable;
|
||||
import com.gempukku.lotro.cards.PlayConditions;
|
||||
import com.gempukku.lotro.cards.TriggerConditions;
|
||||
import com.gempukku.lotro.cards.actions.AttachPermanentAction;
|
||||
import com.gempukku.lotro.cards.effects.SelfDiscardEffect;
|
||||
import com.gempukku.lotro.cards.effects.choose.ChooseAndExertCharactersEffect;
|
||||
import com.gempukku.lotro.cards.modifiers.CantAddBurdensModifier;
|
||||
import com.gempukku.lotro.common.*;
|
||||
import com.gempukku.lotro.filters.Filter;
|
||||
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.modifiers.Modifier;
|
||||
import com.gempukku.lotro.logic.modifiers.StrengthModifier;
|
||||
import com.gempukku.lotro.logic.timing.EffectResult;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 2
|
||||
* •I Will Help You Bear This Burden
|
||||
* Gandalf Condition • Companion
|
||||
* 2
|
||||
* Spell.
|
||||
* To play, exert Gandalf.
|
||||
* Bearer must be Frodo.
|
||||
* Burdens may not be added by shadow cards. Discard this condition at the end of the turn.
|
||||
*/
|
||||
public class Card20_163 extends AbstractAttachable {
|
||||
public Card20_163() {
|
||||
super(Side.FREE_PEOPLE, CardType.CONDITION, 2, Culture.GANDALF, null, "I Will Help You Bear This Burden", null, true);
|
||||
addKeyword(Keyword.SPELL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int withTwilightRemoved, Filter additionalAttachmentFilter, int twilightModifier) {
|
||||
return super.checkPlayRequirements(playerId, game, self, withTwilightRemoved, additionalAttachmentFilter, twilightModifier)
|
||||
&& PlayConditions.canExert(self, game, Filters.gandalf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filterable getValidTargetFilter(String playerId, LotroGame game, PhysicalCard self) {
|
||||
return Filters.frodo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, Filterable additionalAttachmentFilter, int twilightModifier) {
|
||||
AttachPermanentAction action = super.getPlayCardAction(playerId, game, self, additionalAttachmentFilter, twilightModifier);
|
||||
action.appendCost(
|
||||
new ChooseAndExertCharactersEffect(action, playerId, 1, 1, Filters.gandalf));
|
||||
return action;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Modifier> getAlwaysOnModifiers(LotroGame game, PhysicalCard self) {
|
||||
List<Modifier> modifiers = new LinkedList<Modifier>();
|
||||
modifiers.add(
|
||||
new StrengthModifier(self, Filters.hasAttached(self), 2));
|
||||
modifiers.add(
|
||||
new CantAddBurdensModifier(self, null, Side.SHADOW));
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RequiredTriggerAction> getRequiredAfterTriggers(LotroGame game, EffectResult effectResult, PhysicalCard self) {
|
||||
if (TriggerConditions.endOfTurn(game, effectResult)) {
|
||||
RequiredTriggerAction action = new RequiredTriggerAction(self);
|
||||
action.appendEffect(
|
||||
new SelfDiscardEffect(self));
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -272,6 +272,11 @@ public abstract class AbstractModifier implements Modifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddBurden(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, PhysicalCard source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRemoveBurden(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard source) {
|
||||
return true;
|
||||
|
||||
@@ -110,6 +110,8 @@ public interface Modifier {
|
||||
|
||||
public boolean canBeHealed(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard card);
|
||||
|
||||
public boolean canAddBurden(GameState gameState, ModifiersQuerying modifiersQuerying, String performingPlayer, PhysicalCard source);
|
||||
|
||||
public boolean canRemoveBurden(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard source);
|
||||
|
||||
public boolean canRemoveThreat(GameState gameState, ModifiersQuerying modifiersQuerying, PhysicalCard source);
|
||||
|
||||
@@ -817,6 +817,15 @@ public class ModifiersLogic implements ModifiersEnvironment, ModifiersQuerying {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddBurden(GameState gameState, String performingPlayer, PhysicalCard source) {
|
||||
for (Modifier modifier : getModifiers(gameState, ModifierEffect.BURDEN_MODIFIER)) {
|
||||
if (!modifier.canAddBurden(gameState, this, performingPlayer, source))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRemoveBurden(GameState gameState, PhysicalCard source) {
|
||||
for (Modifier modifier : getModifiers(gameState, ModifierEffect.BURDEN_MODIFIER)) {
|
||||
|
||||
@@ -73,6 +73,8 @@ public interface ModifiersQuerying {
|
||||
|
||||
public boolean canBeHealed(GameState gameState, PhysicalCard card);
|
||||
|
||||
public boolean canAddBurden(GameState gameState, String performingPlayer, PhysicalCard source);
|
||||
|
||||
public boolean canRemoveBurden(GameState gameState, PhysicalCard source);
|
||||
|
||||
public boolean canRemoveThreat(GameState gameState, PhysicalCard source);
|
||||
|
||||
Reference in New Issue
Block a user