The played cards from ChooseAndPlayCard... effects now gets notified of the fact AFTER it hits play.

This commit is contained in:
marcins78@gmail.com
2011-11-09 11:16:02 +00:00
parent 744c9466d6
commit c05cb17c20
9 changed files with 13 additions and 13 deletions

View File

@@ -53,9 +53,6 @@ public class ChooseAndPlayCardFromHandEffect implements Effect {
return null; return null;
} }
protected void cardPlayed(PhysicalCard cardPlayed) {
}
@Override @Override
public Collection<? extends EffectResult> playEffect(final LotroGame game) { public Collection<? extends EffectResult> playEffect(final LotroGame game) {
Collection<PhysicalCard> playableInHand = getPlayableInHandCards(game); Collection<PhysicalCard> playableInHand = getPlayableInHandCards(game);
@@ -70,7 +67,7 @@ public class ChooseAndPlayCardFromHandEffect implements Effect {
new UnrespondableEffect() { new UnrespondableEffect() {
@Override @Override
protected void doPlayEffect(LotroGame game) { protected void doPlayEffect(LotroGame game) {
cardPlayed(selectedCard); afterCardPlayed(selectedCard);
} }
}); });
game.getActionsEnvironment().addActionToStack(_playCardAction); game.getActionsEnvironment().addActionToStack(_playCardAction);
@@ -80,6 +77,9 @@ public class ChooseAndPlayCardFromHandEffect implements Effect {
return null; return null;
} }
protected void afterCardPlayed(PhysicalCard cardPlayed) {
}
@Override @Override
public boolean wasSuccessful() { public boolean wasSuccessful() {
if (_playCardAction == null) if (_playCardAction == null)

View File

@@ -72,7 +72,7 @@ public class ChooseAndPlayCardFromStackedEffect implements Effect {
new UnrespondableEffect() { new UnrespondableEffect() {
@Override @Override
protected void doPlayEffect(LotroGame game) { protected void doPlayEffect(LotroGame game) {
cardPlayed(selectedCard); afterCardPlayed(selectedCard);
} }
}); });
game.getActionsEnvironment().addActionToStack(_playCardAction); game.getActionsEnvironment().addActionToStack(_playCardAction);
@@ -83,7 +83,7 @@ public class ChooseAndPlayCardFromStackedEffect implements Effect {
return null; return null;
} }
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
} }
@Override @Override

View File

@@ -43,7 +43,7 @@ public class Card4_009 extends AbstractMinion {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new AddUntilStartOfPhaseModifierEffect( new AddUntilStartOfPhaseModifierEffect(
new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP)); new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP));

View File

@@ -43,7 +43,7 @@ public class Card4_023 extends AbstractMinion {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new AddUntilStartOfPhaseModifierEffect( new AddUntilStartOfPhaseModifierEffect(
new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP)); new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP));

View File

@@ -43,7 +43,7 @@ public class Card4_038 extends AbstractMinion {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -2, Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new AddUntilStartOfPhaseModifierEffect( new AddUntilStartOfPhaseModifierEffect(
new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP)); new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP));

View File

@@ -43,7 +43,7 @@ public class Card6_006 extends AbstractMinion {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), Filters.and(Filters.culture(Culture.DUNLAND), Filters.race(Race.MAN))) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new AddUntilStartOfPhaseModifierEffect( new AddUntilStartOfPhaseModifierEffect(
new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP)); new KeywordModifier(self, Filters.sameCard(cardPlayed), Keyword.FIERCE), Phase.REGROUP));

View File

@@ -40,7 +40,7 @@ public class Card6_105 extends AbstractPermanent {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -4, CardType.MINION, Filters.or(Race.NAZGUL, Culture.SAURON)) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -4, CardType.MINION, Filters.or(Race.NAZGUL, Culture.SAURON)) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new ExhaustCharacterEffect(self, action, cardPlayed)); new ExhaustCharacterEffect(self, action, cardPlayed));
} }

View File

@@ -40,7 +40,7 @@ public class Card6_084 extends AbstractPermanent {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -8, CardType.MINION, Filters.or(Culture.WRAITH, Culture.SAURON)) { new ChooseAndPlayCardFromHandEffect(playerId, game.getGameState().getHand(playerId), -8, CardType.MINION, Filters.or(Culture.WRAITH, Culture.SAURON)) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new ExhaustCharacterEffect(self, action, cardPlayed)); new ExhaustCharacterEffect(self, action, cardPlayed));
} }

View File

@@ -49,7 +49,7 @@ public class Card7_274 extends AbstractMinion {
action.appendEffect( action.appendEffect(
new ChooseAndPlayCardFromStackedEffect(playerId, Filters.siteControlled(playerId), Culture.SAURON, Race.ORC) { new ChooseAndPlayCardFromStackedEffect(playerId, Filters.siteControlled(playerId), Culture.SAURON, Race.ORC) {
@Override @Override
protected void cardPlayed(PhysicalCard cardPlayed) { protected void afterCardPlayed(PhysicalCard cardPlayed) {
action.appendEffect( action.appendEffect(
new AddUntilStartOfPhaseModifierEffect( new AddUntilStartOfPhaseModifierEffect(
new StrengthModifier(self, cardPlayed, 6), Phase.REGROUP)); new StrengthModifier(self, cardPlayed, 6), Phase.REGROUP));