Adding text to wound effects (from rules - archery fire and threats).
This commit is contained in:
@@ -14,6 +14,8 @@ public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
|
||||
private Action _action;
|
||||
private int _count;
|
||||
|
||||
private String _sourceText;
|
||||
|
||||
public ChooseAndWoundCharactersEffect(Action action, String playerId, int minimum, int maximum, Filterable... filters) {
|
||||
this(action, playerId, minimum, maximum, 1, filters);
|
||||
}
|
||||
@@ -24,6 +26,10 @@ public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
|
||||
_count = count;
|
||||
}
|
||||
|
||||
public void setSourceText(String sourceText) {
|
||||
_sourceText = sourceText;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Filter getExtraFilter(LotroGame game) {
|
||||
return Filters.canTakeWound;
|
||||
@@ -32,8 +38,12 @@ public class ChooseAndWoundCharactersEffect extends ChooseActiveCardsEffect {
|
||||
@Override
|
||||
protected void cardsSelected(LotroGame game, Collection<PhysicalCard> cards) {
|
||||
SubAction subAction = new SubAction(_action);
|
||||
for (int i = 0; i < _count; i++)
|
||||
subAction.appendEffect(new WoundCharactersEffect(_action.getActionSource(), Filters.in(cards)));
|
||||
for (int i = 0; i < _count; i++) {
|
||||
WoundCharactersEffect woundEffect = new WoundCharactersEffect(_action.getActionSource(), Filters.in(cards));
|
||||
if (_sourceText != null)
|
||||
woundEffect.setSourceText(_sourceText);
|
||||
subAction.appendEffect(woundEffect);
|
||||
}
|
||||
game.getActionsEnvironment().addActionToStack(subAction);
|
||||
woundedCardsCallback(cards);
|
||||
}
|
||||
|
||||
@@ -17,22 +17,33 @@ import java.util.Collections;
|
||||
|
||||
public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
private Collection<PhysicalCard> _sources;
|
||||
private String _sourceText;
|
||||
|
||||
public WoundCharactersEffect(Collection<PhysicalCard> sources, Filterable... filter) {
|
||||
super(filter);
|
||||
_sources = sources;
|
||||
if (sources != null)
|
||||
_sourceText = GameUtils.getAppendedNames(sources);
|
||||
}
|
||||
|
||||
public WoundCharactersEffect(PhysicalCard source, PhysicalCard... cards) {
|
||||
super(cards);
|
||||
if (source != null)
|
||||
if (source != null) {
|
||||
_sources = Collections.singleton(source);
|
||||
_sourceText = GameUtils.getCardLink(source);
|
||||
}
|
||||
}
|
||||
|
||||
public WoundCharactersEffect(PhysicalCard source, Filterable... filter) {
|
||||
super(filter);
|
||||
if (source != null)
|
||||
if (source != null) {
|
||||
_sources = Collections.singleton(source);
|
||||
_sourceText = GameUtils.getCardLink(source);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSourceText(String sourceText) {
|
||||
_sourceText = sourceText;
|
||||
}
|
||||
|
||||
public Collection<PhysicalCard> getSources() {
|
||||
@@ -63,10 +74,7 @@ public class WoundCharactersEffect extends AbstractPreventableCardEffect {
|
||||
@Override
|
||||
protected Collection<? extends EffectResult> playoutEffectOn(LotroGame game, Collection<PhysicalCard> cards) {
|
||||
if (cards.size() > 0)
|
||||
if (_sources != null)
|
||||
game.getGameState().sendMessage(getAppendedNames(cards) + " " + GameUtils.be(cards) + " wounded by - " + getAppendedNames(_sources));
|
||||
else
|
||||
game.getGameState().sendMessage(getAppendedNames(cards) + " " + GameUtils.be(cards) + " wounded");
|
||||
game.getGameState().sendMessage(getAppendedNames(cards) + " " + GameUtils.be(cards) + " wounded by " + _sourceText);
|
||||
|
||||
for (PhysicalCard woundedCard : cards) {
|
||||
game.getGameState().addWound(woundedCard);
|
||||
|
||||
@@ -63,6 +63,7 @@ public class FellowshipPlayerAssignsArcheryDamageGameProcess implements GameProc
|
||||
for (int i = 0; i < _woundsToAssign; i++) {
|
||||
final int woundsLeft = _woundsToAssign - i;
|
||||
ChooseAndWoundCharactersEffect woundCharacter = new ChooseAndWoundCharactersEffect(action, _game.getGameState().getCurrentPlayerId(), 1, 1, filter);
|
||||
woundCharacter.setSourceText("Archery Fire");
|
||||
woundCharacter.setChoiceText("Choose character to assign archery wound to - remaining wounds: " + woundsLeft);
|
||||
action.appendEffect(woundCharacter);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class ShadowPlayerAssignsArcheryDamageGameProcess implements GameProcess
|
||||
for (int i = 0; i < _woundsToAssign; i++) {
|
||||
final int woundsLeft = _woundsToAssign - i;
|
||||
ChooseAndWoundCharactersEffect woundCharacter = new ChooseAndWoundCharactersEffect(action, _playerId, 1, 1, filter);
|
||||
woundCharacter.setSourceText("Archery Fire");
|
||||
woundCharacter.setChoiceText("Choose minion to assign archery wound to - remaining wounds: " + woundsLeft);
|
||||
action.appendEffect(woundCharacter);
|
||||
}
|
||||
|
||||
@@ -55,8 +55,9 @@ public class ThreatRule {
|
||||
if (game.getModifiersQuerying().hasFlagActive(game.getGameState(), ModifierFlag.RING_BEARER_CANT_TAKE_THREAT_WOUNDS))
|
||||
filter = Filters.and(filter, Filters.not(Keyword.RING_BEARER));
|
||||
|
||||
action.appendEffect(
|
||||
new ChooseAndWoundCharactersEffect(action, game.getGameState().getCurrentPlayerId(), 1, 1, filter));
|
||||
ChooseAndWoundCharactersEffect woundCharacter = new ChooseAndWoundCharactersEffect(action, game.getGameState().getCurrentPlayerId(), 1, 1, filter);
|
||||
woundCharacter.setSourceText("Threat Rule");
|
||||
action.appendEffect(woundCharacter);
|
||||
}
|
||||
return Collections.singletonList(action);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user